@floe-ai/sdk 0.1.0-dev.20 → 0.1.0-dev.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/floe-sdk.es.js +2018 -1885
- package/dist-sdk/floe-sdk.es.js.map +1 -1
- package/dist-sdk/floe-sdk.iife.js +53 -58
- package/dist-sdk/floe-sdk.iife.js.map +1 -1
- package/dist-sdk/floe-sdk.umd.js +53 -58
- package/dist-sdk/floe-sdk.umd.js.map +1 -1
- package/dist-sdk/index.d.ts +26 -0
- package/package.json +1 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
var FloeSDK=function(ln){"use strict";var zx=Object.defineProperty;var Hx=(ln,Gt,En)=>Gt in ln?zx(ln,Gt,{enumerable:!0,configurable:!0,writable:!0,value:En}):ln[Gt]=En;var D=(ln,Gt,En)=>Hx(ln,typeof Gt!="symbol"?Gt+"":Gt,En);function Gt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var En={exports:{}},Br=typeof Reflect=="object"?Reflect:null,vd=Br&&typeof Br.apply=="function"?Br.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},jo;Br&&typeof Br.ownKeys=="function"?jo=Br.ownKeys:Object.getOwnPropertySymbols?jo=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:jo=function(e){return Object.getOwnPropertyNames(e)};function my(t){console&&console.warn&&console.warn(t)}var yd=Number.isNaN||function(e){return e!==e};function ye(){ye.init.call(this)}En.exports=ye,En.exports.once=wy,ye.EventEmitter=ye,ye.prototype._events=void 0,ye.prototype._eventsCount=0,ye.prototype._maxListeners=void 0;var bd=10;function Uo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ye,"defaultMaxListeners",{enumerable:!0,get:function(){return bd},set:function(t){if(typeof t!="number"||t<0||yd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");bd=t}}),ye.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ye.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||yd(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function wd(t){return t._maxListeners===void 0?ye.defaultMaxListeners:t._maxListeners}ye.prototype.getMaxListeners=function(){return wd(this)},ye.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(l===void 0)return!1;if(typeof l=="function")vd(l,this,n);else for(var c=l.length,d=Cd(l,c),r=0;r<c;++r)vd(d[r],this,n);return!0};function Sd(t,e,n,r){var i,o,s;if(Uo(n),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),s===void 0)s=o[e]=n,++t._eventsCount;else if(typeof s=="function"?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=wd(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,my(a)}return t}ye.prototype.addListener=function(e,n){return Sd(this,e,n,!1)},ye.prototype.on=ye.prototype.addListener,ye.prototype.prependListener=function(e,n){return Sd(this,e,n,!0)};function vy(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function kd(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=vy.bind(r);return i.listener=n,r.wrapFn=i,i}ye.prototype.once=function(e,n){return Uo(n),this.on(e,kd(this,e,n)),this},ye.prototype.prependOnceListener=function(e,n){return Uo(n),this.prependListener(e,kd(this,e,n)),this},ye.prototype.removeListener=function(e,n){var r,i,o,s,a;if(Uo(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;o===0?r.shift():yy(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this},ye.prototype.off=ye.prototype.removeListener,ye.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(i=n.length-1;i>=0;i--)this.removeListener(e,n[i]);return this};function xd(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?by(i):Cd(i,i.length)}ye.prototype.listeners=function(e){return xd(this,e,!0)},ye.prototype.rawListeners=function(e){return xd(this,e,!1)},ye.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):_d.call(t,e)},ye.prototype.listenerCount=_d;function _d(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}ye.prototype.eventNames=function(){return this._eventsCount>0?jo(this._events):[]};function Cd(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function yy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function by(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function wy(t,e){return new Promise(function(n,r){function i(s){t.removeListener(e,o),r(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),n([].slice.call(arguments))}Ed(t,e,o,{once:!0}),e!=="error"&&Sy(t,i,{once:!0})})}function Sy(t,e,n){typeof t.on=="function"&&Ed(t,"error",e,n)}function Ed(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){r.once&&t.removeEventListener(e,i),n(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var ky=En.exports;const xy=Gt(ky);for(var Ue=[],Ha=0;Ha<256;++Ha)Ue.push((Ha+256).toString(16).slice(1));function _y(t,e=0){return(Ue[t[e+0]]+Ue[t[e+1]]+Ue[t[e+2]]+Ue[t[e+3]]+"-"+Ue[t[e+4]]+Ue[t[e+5]]+"-"+Ue[t[e+6]]+Ue[t[e+7]]+"-"+Ue[t[e+8]]+Ue[t[e+9]]+"-"+Ue[t[e+10]]+Ue[t[e+11]]+Ue[t[e+12]]+Ue[t[e+13]]+Ue[t[e+14]]+Ue[t[e+15]]).toLowerCase()}var zo,Cy=new Uint8Array(16);function Ey(){if(!zo&&(zo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!zo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zo(Cy)}var Ty=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Td={randomUUID:Ty};function My(t,e,n){if(Td.randomUUID&&!e&&!t)return Td.randomUUID();t=t||{};var r=t.random||(t.rng||Ey)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return _y(r)}const Ay={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},Md={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},Q={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},Ke={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},Tn={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};class E{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const n=e.split(".").splice(0,2).map(o=>parseInt(o,10)||0);n.push(0);const r=n[0],i=n[1];if(r===10)switch(i){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(r){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}}static getAndroidVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=E.getVersionPrecision(e),o=E.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=E.map([e,n],c=>{const d=s-E.getVersionPrecision(c),f=c+new Array(d+1).join(".0");return E.map(f.split("."),h=>new Array(20-h.length).join("0")+h).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(l=>{r[l]=s[l]})}return e}static getBrowserAlias(e){return Ay[e]}static getBrowserTypeByAlias(e){return Md[e]||""}}const Y=/version\/(\d+(\.?_?\d+)+)/i,Oy=[{test:[/gptbot/i],describe(t){const e={name:"GPTBot"},n=E.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/chatgpt-user/i],describe(t){const e={name:"ChatGPT-User"},n=E.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/oai-searchbot/i],describe(t){const e={name:"OAI-SearchBot"},n=E.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(t){const e={name:"ClaudeBot"},n=E.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/omgilibot/i,/webzio-extended/i],describe(t){const e={name:"Omgilibot"},n=E.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/diffbot/i],describe(t){const e={name:"Diffbot"},n=E.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/perplexitybot/i],describe(t){const e={name:"PerplexityBot"},n=E.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/perplexity-user/i],describe(t){const e={name:"Perplexity-User"},n=E.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/youbot/i],describe(t){const e={name:"YouBot"},n=E.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-webindexer/i],describe(t){const e={name:"Meta-WebIndexer"},n=E.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-externalads/i],describe(t){const e={name:"Meta-ExternalAds"},n=E.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-externalagent/i],describe(t){const e={name:"Meta-ExternalAgent"},n=E.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-externalfetcher/i],describe(t){const e={name:"Meta-ExternalFetcher"},n=E.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=E.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/linespider/i],describe(t){const e={name:"Linespider"},n=E.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/amazonbot/i],describe(t){const e={name:"AmazonBot"},n=E.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/bingbot/i],describe(t){const e={name:"BingCrawler"},n=E.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/baiduspider/i],describe(t){const e={name:"BaiduSpider"},n=E.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/duckduckbot/i],describe(t){const e={name:"DuckDuckBot"},n=E.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/ia_archiver/i],describe(t){const e={name:"InternetArchiveCrawler"},n=E.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(t){const e={name:"SlackBot"},n=E.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/yahoo!?[\s/]*slurp/i],describe(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe(){return{name:"PingdomBot"}}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=E.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/PaleMoon/i],describe(t){const e={name:"Pale Moon"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=E.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=E.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=E.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=E.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=E.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=E.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=E.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=E.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=E.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=E.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=E.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=E.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=E.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=E.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=E.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=E.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=E.getFirstMatch(Y,t)||E.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=E.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=E.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=E.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/librewolf/i],describe(t){const e={name:"LibreWolf"},n=E.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=E.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=E.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(t){const e={name:"Sogou Browser"},n=E.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,t),r=E.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),i=E.getFirstMatch(/se ([\d.]+)x/i,t),o=n||r||i;return o&&(e.version=o),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=E.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.hasBrand("DuckDuckGo")?!0:t.test(/\sDdg\/[\d.]+$/i)},describe(t,e){const n={name:"DuckDuckGo"};if(e){const i=e.getBrandVersion("DuckDuckGo");if(i)return n.version=i,n}const r=E.getFirstMatch(/\sDdg\/([\d.]+)$/i,t);return r&&(n.version=r),n}},{test(t){return t.hasBrand("Brave")},describe(t,e){const n={name:"Brave"};if(e){const r=e.getBrandVersion("Brave");if(r)return n.version=r,n}return n}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=E.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=E.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=E.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=E.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=t.search("\\(")!==-1?n:e;return{name:E.getFirstMatch(i,t),version:E.getSecondMatch(i,t)}}}],Py=[{test:[/Roku\/DVP/],describe(t){const e=E.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Ke.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=E.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Ke.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=E.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=E.getWindowsVersionName(e);return{name:Ke.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Ke.iOS},n=E.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=E.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=E.getMacOSVersionName(e),r={name:Ke.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=E.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Ke.iOS,version:e}}},{test:[/OpenHarmony/i],describe(t){const e=E.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:Ke.HarmonyOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=E.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=E.getAndroidVersionName(e),r={name:Ke.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=E.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:Ke.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=E.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||E.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||E.getFirstMatch(/\bbb(\d+)/i,t);return{name:Ke.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=E.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Ke.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=E.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Ke.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Ke.Linux}}},{test:[/CrOS/],describe(){return{name:Ke.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=E.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Ke.PlayStation4,version:e}}}],Dy=[{test:[/googlebot/i],describe(){return{type:Q.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:Q.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:Q.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:Q.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:Q.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:Q.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:Q.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:Q.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:Q.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:Q.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:Q.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:Q.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:Q.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:Q.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:Q.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:Q.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:Q.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:Q.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:Q.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:Q.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(t){const e=E.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Q.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:Q.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:Q.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:Q.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:Q.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:Q.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:Q.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=E.getFirstMatch(/(ipod|iphone)/i,t);return{type:Q.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:Q.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=E.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:Q.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:Q.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:Q.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:Q.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:Q.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:Q.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:Q.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:Q.tv}}},{test:[/netcast/i],describe(){return{type:Q.tv}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:Q.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:Q.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:Q.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:Q.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:Q.tv}}}],Ly=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Tn.Blink};const n=E.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Tn.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:Tn.Trident},n=E.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:Tn.Presto},n=E.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:Tn.Gecko},n=E.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Tn.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:Tn.WebKit},n=E.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class Ad{constructor(e,n=!1,r=null){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e;let i=!1;typeof n=="boolean"?(i=n,this._hints=r):n!=null&&typeof n=="object"?this._hints=n:this._hints=null,this.parsedResult={},i!==!0&&this.parse()}getHints(){return this._hints}hasBrand(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;const n=e.toLowerCase();return this._hints.brands.some(r=>r.brand&&r.brand.toLowerCase()===n)}getBrandVersion(e){if(!this._hints||!Array.isArray(this._hints.brands))return;const n=e.toLowerCase(),r=this._hints.brands.find(i=>i.brand&&i.brand.toLowerCase()===n);return r?r.version:void 0}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=E.find(Oy,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA(),this)),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=E.find(Py,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=E.find(Dy,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=E.find(Ly,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return E.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(a=>{const l=e[a];typeof l=="string"?(i[a]=l,o+=1):typeof l=="object"&&(n[a]=l,r+=1)}),r>0){const a=Object.keys(n),l=E.find(a,d=>this.isOS(d));if(l){const d=this.satisfies(n[l]);if(d!==void 0)return d}const c=E.find(a,d=>this.isPlatform(d));if(c){const d=this.satisfies(n[c]);if(d!==void 0)return d}}if(o>0){const a=Object.keys(i),l=E.find(a,c=>this.isBrowser(c,!0));if(l!==void 0)return this.compareVersion(i[l])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=E.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(E.compareVersions(o,r,i))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}}/*!
|
|
1
|
+
var FloeSDK=function(ln){"use strict";var zx=Object.defineProperty;var Hx=(ln,Gt,Tn)=>Gt in ln?zx(ln,Gt,{enumerable:!0,configurable:!0,writable:!0,value:Tn}):ln[Gt]=Tn;var P=(ln,Gt,Tn)=>Hx(ln,typeof Gt!="symbol"?Gt+"":Gt,Tn);function Gt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Tn={exports:{}},Br=typeof Reflect=="object"?Reflect:null,yd=Br&&typeof Br.apply=="function"?Br.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},jo;Br&&typeof Br.ownKeys=="function"?jo=Br.ownKeys:Object.getOwnPropertySymbols?jo=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:jo=function(e){return Object.getOwnPropertyNames(e)};function vy(t){console&&console.warn&&console.warn(t)}var bd=Number.isNaN||function(e){return e!==e};function ye(){ye.init.call(this)}Tn.exports=ye,Tn.exports.once=Sy,ye.EventEmitter=ye,ye.prototype._events=void 0,ye.prototype._eventsCount=0,ye.prototype._maxListeners=void 0;var wd=10;function Uo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ye,"defaultMaxListeners",{enumerable:!0,get:function(){return wd},set:function(t){if(typeof t!="number"||t<0||bd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");wd=t}}),ye.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ye.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||bd(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Sd(t){return t._maxListeners===void 0?ye.defaultMaxListeners:t._maxListeners}ye.prototype.getMaxListeners=function(){return Sd(this)},ye.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(l===void 0)return!1;if(typeof l=="function")yd(l,this,n);else for(var c=l.length,d=Ed(l,c),r=0;r<c;++r)yd(d[r],this,n);return!0};function kd(t,e,n,r){var i,o,s;if(Uo(n),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),s===void 0)s=o[e]=n,++t._eventsCount;else if(typeof s=="function"?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=Sd(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,vy(a)}return t}ye.prototype.addListener=function(e,n){return kd(this,e,n,!1)},ye.prototype.on=ye.prototype.addListener,ye.prototype.prependListener=function(e,n){return kd(this,e,n,!0)};function yy(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function xd(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=yy.bind(r);return i.listener=n,r.wrapFn=i,i}ye.prototype.once=function(e,n){return Uo(n),this.on(e,xd(this,e,n)),this},ye.prototype.prependOnceListener=function(e,n){return Uo(n),this.prependListener(e,xd(this,e,n)),this},ye.prototype.removeListener=function(e,n){var r,i,o,s,a;if(Uo(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;o===0?r.shift():by(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this},ye.prototype.off=ye.prototype.removeListener,ye.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(i=n.length-1;i>=0;i--)this.removeListener(e,n[i]);return this};function _d(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?wy(i):Ed(i,i.length)}ye.prototype.listeners=function(e){return _d(this,e,!0)},ye.prototype.rawListeners=function(e){return _d(this,e,!1)},ye.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Cd.call(t,e)},ye.prototype.listenerCount=Cd;function Cd(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}ye.prototype.eventNames=function(){return this._eventsCount>0?jo(this._events):[]};function Ed(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function by(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function wy(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function Sy(t,e){return new Promise(function(n,r){function i(s){t.removeListener(e,o),r(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),n([].slice.call(arguments))}Td(t,e,o,{once:!0}),e!=="error"&&ky(t,i,{once:!0})})}function ky(t,e,n){typeof t.on=="function"&&Td(t,"error",e,n)}function Td(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){r.once&&t.removeEventListener(e,i),n(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var xy=Tn.exports;const _y=Gt(xy);for(var Ue=[],Va=0;Va<256;++Va)Ue.push((Va+256).toString(16).slice(1));function Cy(t,e=0){return(Ue[t[e+0]]+Ue[t[e+1]]+Ue[t[e+2]]+Ue[t[e+3]]+"-"+Ue[t[e+4]]+Ue[t[e+5]]+"-"+Ue[t[e+6]]+Ue[t[e+7]]+"-"+Ue[t[e+8]]+Ue[t[e+9]]+"-"+Ue[t[e+10]]+Ue[t[e+11]]+Ue[t[e+12]]+Ue[t[e+13]]+Ue[t[e+14]]+Ue[t[e+15]]).toLowerCase()}var zo,Ey=new Uint8Array(16);function Ty(){if(!zo&&(zo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!zo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zo(Ey)}var My=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Md={randomUUID:My};function Ay(t,e,n){if(Md.randomUUID&&!e&&!t)return Md.randomUUID();t=t||{};var r=t.random||(t.rng||Ty)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return Cy(r)}const Oy={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},Ad={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},Q={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},We={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},Mn={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};class T{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const n=e.split(".").splice(0,2).map(o=>parseInt(o,10)||0);n.push(0);const r=n[0],i=n[1];if(r===10)switch(i){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(r){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}}static getAndroidVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=T.getVersionPrecision(e),o=T.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=T.map([e,n],c=>{const d=s-T.getVersionPrecision(c),f=c+new Array(d+1).join(".0");return T.map(f.split("."),h=>new Array(20-h.length).join("0")+h).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(l=>{r[l]=s[l]})}return e}static getBrowserAlias(e){return Oy[e]}static getBrowserTypeByAlias(e){return Ad[e]||""}}const Y=/version\/(\d+(\.?_?\d+)+)/i,Dy=[{test:[/gptbot/i],describe(t){const e={name:"GPTBot"},n=T.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/chatgpt-user/i],describe(t){const e={name:"ChatGPT-User"},n=T.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/oai-searchbot/i],describe(t){const e={name:"OAI-SearchBot"},n=T.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(t){const e={name:"ClaudeBot"},n=T.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/omgilibot/i,/webzio-extended/i],describe(t){const e={name:"Omgilibot"},n=T.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/diffbot/i],describe(t){const e={name:"Diffbot"},n=T.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/perplexitybot/i],describe(t){const e={name:"PerplexityBot"},n=T.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/perplexity-user/i],describe(t){const e={name:"Perplexity-User"},n=T.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/youbot/i],describe(t){const e={name:"YouBot"},n=T.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-webindexer/i],describe(t){const e={name:"Meta-WebIndexer"},n=T.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-externalads/i],describe(t){const e={name:"Meta-ExternalAds"},n=T.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-externalagent/i],describe(t){const e={name:"Meta-ExternalAgent"},n=T.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/meta-externalfetcher/i],describe(t){const e={name:"Meta-ExternalFetcher"},n=T.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=T.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/linespider/i],describe(t){const e={name:"Linespider"},n=T.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/amazonbot/i],describe(t){const e={name:"AmazonBot"},n=T.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/bingbot/i],describe(t){const e={name:"BingCrawler"},n=T.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/baiduspider/i],describe(t){const e={name:"BaiduSpider"},n=T.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/duckduckbot/i],describe(t){const e={name:"DuckDuckBot"},n=T.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/ia_archiver/i],describe(t){const e={name:"InternetArchiveCrawler"},n=T.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(t){const e={name:"SlackBot"},n=T.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/yahoo!?[\s/]*slurp/i],describe(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe(){return{name:"PingdomBot"}}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=T.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/PaleMoon/i],describe(t){const e={name:"Pale Moon"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=T.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=T.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=T.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=T.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=T.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=T.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=T.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=T.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=T.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=T.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=T.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=T.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=T.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=T.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=T.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=T.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=T.getFirstMatch(Y,t)||T.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=T.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=T.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=T.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/librewolf/i],describe(t){const e={name:"LibreWolf"},n=T.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=T.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=T.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(t){const e={name:"Sogou Browser"},n=T.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,t),r=T.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),i=T.getFirstMatch(/se ([\d.]+)x/i,t),o=n||r||i;return o&&(e.version=o),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=T.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.hasBrand("DuckDuckGo")?!0:t.test(/\sDdg\/[\d.]+$/i)},describe(t,e){const n={name:"DuckDuckGo"};if(e){const i=e.getBrandVersion("DuckDuckGo");if(i)return n.version=i,n}const r=T.getFirstMatch(/\sDdg\/([\d.]+)$/i,t);return r&&(n.version=r),n}},{test(t){return t.hasBrand("Brave")},describe(t,e){const n={name:"Brave"};if(e){const r=e.getBrandVersion("Brave");if(r)return n.version=r,n}return n}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=T.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=T.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=T.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=T.getFirstMatch(Y,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=t.search("\\(")!==-1?n:e;return{name:T.getFirstMatch(i,t),version:T.getSecondMatch(i,t)}}}],Py=[{test:[/Roku\/DVP/],describe(t){const e=T.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:We.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=T.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:We.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=T.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=T.getWindowsVersionName(e);return{name:We.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:We.iOS},n=T.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=T.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=T.getMacOSVersionName(e),r={name:We.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=T.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:We.iOS,version:e}}},{test:[/OpenHarmony/i],describe(t){const e=T.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:We.HarmonyOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=T.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=T.getAndroidVersionName(e),r={name:We.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=T.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:We.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=T.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||T.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||T.getFirstMatch(/\bbb(\d+)/i,t);return{name:We.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=T.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:We.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=T.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:We.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:We.Linux}}},{test:[/CrOS/],describe(){return{name:We.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=T.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:We.PlayStation4,version:e}}}],Ly=[{test:[/googlebot/i],describe(){return{type:Q.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:Q.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:Q.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:Q.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:Q.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:Q.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:Q.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:Q.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:Q.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:Q.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:Q.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:Q.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:Q.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:Q.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:Q.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:Q.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:Q.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:Q.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:Q.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:Q.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:Q.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(t){const e=T.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Q.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:Q.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:Q.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:Q.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:Q.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:Q.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:Q.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=T.getFirstMatch(/(ipod|iphone)/i,t);return{type:Q.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:Q.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=T.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:Q.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:Q.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:Q.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:Q.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:Q.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:Q.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:Q.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:Q.tv}}},{test:[/netcast/i],describe(){return{type:Q.tv}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:Q.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:Q.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:Q.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:Q.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:Q.tv}}}],Iy=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Mn.Blink};const n=T.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Mn.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:Mn.Trident},n=T.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:Mn.Presto},n=T.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:Mn.Gecko},n=T.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Mn.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:Mn.WebKit},n=T.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class Od{constructor(e,n=!1,r=null){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e;let i=!1;typeof n=="boolean"?(i=n,this._hints=r):n!=null&&typeof n=="object"?this._hints=n:this._hints=null,this.parsedResult={},i!==!0&&this.parse()}getHints(){return this._hints}hasBrand(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;const n=e.toLowerCase();return this._hints.brands.some(r=>r.brand&&r.brand.toLowerCase()===n)}getBrandVersion(e){if(!this._hints||!Array.isArray(this._hints.brands))return;const n=e.toLowerCase(),r=this._hints.brands.find(i=>i.brand&&i.brand.toLowerCase()===n);return r?r.version:void 0}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=T.find(Dy,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA(),this)),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=T.find(Py,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=T.find(Ly,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=T.find(Iy,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return T.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(a=>{const l=e[a];typeof l=="string"?(i[a]=l,o+=1):typeof l=="object"&&(n[a]=l,r+=1)}),r>0){const a=Object.keys(n),l=T.find(a,d=>this.isOS(d));if(l){const d=this.satisfies(n[l]);if(d!==void 0)return d}const c=T.find(a,d=>this.isPlatform(d));if(c){const d=this.satisfies(n[c]);if(d!==void 0)return d}}if(o>0){const a=Object.keys(i),l=T.find(a,c=>this.isBrowser(c,!0));if(l!==void 0)return this.compareVersion(i[l])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=T.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(T.compareVersions(o,r,i))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}}/*!
|
|
2
2
|
* Bowser - a browser detector
|
|
3
3
|
* https://github.com/bowser-js/bowser
|
|
4
4
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
5
5
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
6
|
-
*/class Iy{static getParser(e,n=!1,r=null){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Ad(e,n,r)}static parse(e,n=null){return new Ad(e,n).getResult()}static get BROWSER_MAP(){return Md}static get ENGINE_MAP(){return Tn}static get OS_MAP(){return Ke}static get PLATFORMS_MAP(){return Q}}function Qt(t,e){return Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t}function Ry(t){return t&&t.__esModule?t.default:t}function ke(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var jr={},Od={};ke(Od,"PipecatClient",()=>Nt);var Ur={};Ur=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.5.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web.git"},"files":["dist","package.json","README.md"],"scripts":{"build":"jest --silent --passWithNoTests && parcel build --no-cache","dev":"parcel watch","lint":"eslint . --report-unused-disable-directives --max-warnings 0","test":"jest"},"jest":{"preset":"ts-jest","testEnvironment":"jsdom"},"devDependencies":{"@jest/globals":"^29.7.0","@types/clone-deep":"^4.0.4","@types/jest":"^29.5.12","@types/uuid":"^10.0.0","eslint":"^9.11.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1","jest":"^29.7.0","jest-environment-jsdom":"^30.0.2","ts-jest":"^29.2.5"},"dependencies":{"@types/events":"^3.0.3","bowser":"^2.11.0","clone-deep":"^4.0.1","events":"^3.3.0","typed-emitter":"^2.1.0","uuid":"^10.0.0"}}');var Ho={},Pd={};ke(Pd,"TransportStateEnum",()=>Va);var Va;(function(t){t.DISCONNECTED="disconnected",t.INITIALIZING="initializing",t.INITIALIZED="initialized",t.AUTHENTICATING="authenticating",t.AUTHENTICATED="authenticated",t.CONNECTING="connecting",t.CONNECTED="connected",t.READY="ready",t.DISCONNECTING="disconnecting",t.ERROR="error"})(Va||(Va={}));var Yt={};ke(Yt,"RTVIError",()=>ft),ke(Yt,"ConnectionTimeoutError",()=>Ny),ke(Yt,"StartBotError",()=>Dd),ke(Yt,"TransportStartError",()=>Ld),ke(Yt,"InvalidTransportParamsError",()=>$y),ke(Yt,"BotNotReadyError",()=>Id),ke(Yt,"BotAlreadyStartedError",()=>Rd),ke(Yt,"UnsupportedFeatureError",()=>Fy),ke(Yt,"DeviceError",()=>cn);class ft extends Error{constructor(e,n){super(e),this.status=n}}class Ny extends ft{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class Dd extends ft{constructor(e,n){super(e??"Failed to connect / invalid auth bundle from base url",n??500),this.error="invalid-request-error"}}class Ld extends ft{constructor(e){super(e??"Unable to connect to transport")}}class $y extends ft{constructor(e){super(e??"Invalid transport connection parameters")}}class Id extends ft{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class Rd extends ft{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class Fy extends ft{constructor(e,n,r){let i=`${e} not supported${r?`: ${r}`:""}`;n&&(i=`${n} does not support ${e}${r?`: ${r}`:""}`),super(i),this.feature=e}}class cn extends ft{constructor(e,n,r,i){super(r??`Device error for ${e.join(", ")}: ${n}`),this.devices=e,this.type=n,this.details=i}}var Nd={};ke(Nd,"RTVIEvent",()=>ee);var ee;(function(t){t.Connected="connected",t.Disconnected="disconnected",t.TransportStateChanged="transportStateChanged",t.BotStarted="botStarted",t.BotConnected="botConnected",t.BotReady="botReady",t.BotDisconnected="botDisconnected",t.Error="error",t.ServerMessage="serverMessage",t.ServerResponse="serverResponse",t.MessageError="messageError",t.Metrics="metrics",t.BotStartedSpeaking="botStartedSpeaking",t.BotStoppedSpeaking="botStoppedSpeaking",t.UserStartedSpeaking="userStartedSpeaking",t.UserStoppedSpeaking="userStoppedSpeaking",t.UserTranscript="userTranscript",t.BotOutput="botOutput",t.BotTranscript="botTranscript",t.BotLlmText="botLlmText",t.BotLlmStarted="botLlmStarted",t.BotLlmStopped="botLlmStopped",t.LLMFunctionCall="llmFunctionCall",t.BotLlmSearchResponse="botLlmSearchResponse",t.BotTtsText="botTtsText",t.BotTtsStarted="botTtsStarted",t.BotTtsStopped="botTtsStopped",t.ParticipantConnected="participantConnected",t.ParticipantLeft="participantLeft",t.TrackStarted="trackStarted",t.TrackStopped="trackStopped",t.ScreenTrackStarted="screenTrackStarted",t.ScreenTrackStopped="screenTrackStopped",t.ScreenShareError="screenShareError",t.LocalAudioLevel="localAudioLevel",t.RemoteAudioLevel="remoteAudioLevel",t.AvailableCamsUpdated="availableCamsUpdated",t.AvailableMicsUpdated="availableMicsUpdated",t.AvailableSpeakersUpdated="availableSpeakersUpdated",t.CamUpdated="camUpdated",t.MicUpdated="micUpdated",t.SpeakerUpdated="speakerUpdated",t.DeviceError="deviceError"})(ee||(ee={}));var ir={};ke(ir,"RTVI_PROTOCOL_VERSION",()=>$d),ke(ir,"RTVI_MESSAGE_LABEL",()=>Fd),ke(ir,"RTVIMessageType",()=>ae),ke(ir,"AggregationType",()=>Wa),ke(ir,"setAboutClient",()=>Bd),ke(ir,"RTVIMessage",()=>Ze);const $d="1.0.0",Fd="rtvi-ai";var ae;(function(t){t.CLIENT_READY="client-ready",t.DISCONNECT_BOT="disconnect-bot",t.CLIENT_MESSAGE="client-message",t.SEND_TEXT="send-text",t.APPEND_TO_CONTEXT="append-to-context",t.BOT_READY="bot-ready",t.ERROR="error",t.METRICS="metrics",t.SERVER_MESSAGE="server-message",t.SERVER_RESPONSE="server-response",t.ERROR_RESPONSE="error-response",t.APPEND_TO_CONTEXT_RESULT="append-to-context-result",t.USER_TRANSCRIPTION="user-transcription",t.BOT_OUTPUT="bot-output",t.BOT_TRANSCRIPTION="bot-transcription",t.USER_STARTED_SPEAKING="user-started-speaking",t.USER_STOPPED_SPEAKING="user-stopped-speaking",t.BOT_STARTED_SPEAKING="bot-started-speaking",t.BOT_STOPPED_SPEAKING="bot-stopped-speaking",t.USER_LLM_TEXT="user-llm-text",t.BOT_LLM_TEXT="bot-llm-text",t.BOT_LLM_STARTED="bot-llm-started",t.BOT_LLM_STOPPED="bot-llm-stopped",t.LLM_FUNCTION_CALL="llm-function-call",t.LLM_FUNCTION_CALL_RESULT="llm-function-call-result",t.BOT_LLM_SEARCH_RESPONSE="bot-llm-search-response",t.BOT_TTS_TEXT="bot-tts-text",t.BOT_TTS_STARTED="bot-tts-started",t.BOT_TTS_STOPPED="bot-tts-stopped"})(ae||(ae={}));var Wa;(function(t){t.WORD="word",t.SENTENCE="sentence"})(Wa||(Wa={}));let Pi;function Bd(t){Pi?Pi={...Pi,...t}:Pi=t}class Ze{constructor(e,n,r){this.label=Fd,this.type=e,this.data=n,this.id=r||My().slice(0,8)}static clientReady(){return new Ze(ae.CLIENT_READY,{version:$d,about:Pi||{library:Ur.name,library_version:Ur.version}})}static disconnectBot(){return new Ze(ae.DISCONNECT_BOT,{})}static error(e,n=!1){return new Ze(ae.ERROR,{message:e,fatal:n})}}Qt(Ho,Pd),Qt(Ho,Yt),Qt(Ho,Nd),Qt(Ho,ir);function Di(t,e,n){const r=n.value;return n.value=function(...i){if(this.state==="ready")return r.apply(this,i);throw new Id(`Attempt to call ${e.toString()} when transport not in ready state. Await connect() first.`)},n}function Ka(t,e,n){const r=n.value,i=["authenticating","connecting","connected","ready"];return n.value=function(...o){if(i.includes(this.state))throw new Rd(`Attempt to call ${e.toString()} when client already started. Please call disconnect() before starting again.`);return r.apply(this,o)},n}var jd={};ke(jd,"MessageDispatcher",()=>Ud);var qa={};ke(qa,"LogLevel",()=>Mn),ke(qa,"logger",()=>pe);var Mn;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"})(Mn||(Mn={}));class zr{constructor(){this.level=Mn.DEBUG}static getInstance(){return zr.instance||(zr.instance=new zr),zr.instance}setLevel(e){this.level=e}debug(...e){this.level>=Mn.DEBUG&&console.debug(...e)}info(...e){this.level>=Mn.INFO&&console.info(...e)}warn(...e){this.level>=Mn.WARN&&console.warn(...e)}error(...e){this.level>=Mn.ERROR&&console.error(...e)}}const pe=zr.getInstance();class Ud{constructor(e){this._queue=new Array,this._gcInterval=void 0,this._queue=[],this._sendMethod=e}disconnect(){this.clearQueue(),clearInterval(this._gcInterval),this._gcInterval=void 0}dispatch(e,n=ae.CLIENT_MESSAGE,r=1e4){this._gcInterval||(this._gcInterval=setInterval(()=>{this._gc()},2e3));const i=new Ze(n,e),o=new Promise((s,a)=>{this._queue.push({message:i,timestamp:Date.now(),timeout:r,resolve:s,reject:a})});pe.debug("[MessageDispatcher] dispatch",i);try{this._sendMethod(i)}catch(s){return pe.error("[MessageDispatcher] Error sending message",s),Promise.reject(s)}return this._gc(),o}clearQueue(){this._queue=[]}_resolveReject(e,n=!0){const r=this._queue.find(i=>i.message.id===e.id);return r&&(n?(pe.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(pe.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(i=>i.message.id!==e.id),pe.debug("[MessageDispatcher] Queue",this._queue)),e}resolve(e){return this._resolveReject(e,!0)}reject(e){return this._resolveReject(e,!1)}_gc(){const e=[];this._queue=this._queue.filter(n=>{const r=Date.now()-n.timestamp<n.timeout;return r||e.push(n),r}),e.forEach(n=>{n.message.type===ae.CLIENT_MESSAGE&&n.reject(new Ze(ae.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:n.message.data.t,data:n.message.data.d,fatal:!1}))}),pe.debug("[MessageDispatcher] GC",this._queue)}}var Ja={};ke(Ja,"isAPIRequest",()=>zd),ke(Ja,"makeRequest",()=>Hd);function zd(t){if(typeof t=="object"&&t!==null&&Object.keys(t).includes("endpoint")){const e=t.endpoint;return typeof e=="string"||e instanceof URL||typeof Request<"u"&&e instanceof Request}return!1}async function Hd(t,e){e||(e=new AbortController);let n;return new Promise((r,i)=>{(async()=>(t.timeout&&(n=setTimeout(async()=>{e.abort(),i(new Error("Timed out"))},t.timeout)),pe.debug(`[Pipecat Client] Fetching from ${t.endpoint}`),fetch(t.endpoint,{method:"POST",mode:"cors",headers:new Headers({"Content-Type":"application/json",...Object.fromEntries((t.headers??new Headers).entries())}),body:JSON.stringify(t.requestData),signal:e==null?void 0:e.signal}).then(o=>{pe.debug(`[Pipecat Client] Received response from ${t.endpoint}`,o),o.ok||i(o),o.json().then(s=>r(s))}).catch(o=>{pe.error(`[Pipecat Client] Error fetching: ${o}`),i(o)}).finally(()=>{n&&clearTimeout(n)})))()})}var Ga={};ke(Ga,"Transport",()=>Vd),ke(Ga,"TransportWrapper",()=>Wd);class Vd{constructor(){this._state="disconnected"}connect(e){this._abortController=new AbortController;let n=e;try{n=this._validateConnectionParams(e)}catch(r){throw new ft(`Invalid connection params: ${r.message}. Please check your connection params and try again.`)}return this._connect(n)}get startBotParams(){return this._startBotParams}set startBotParams(e){this._startBotParams=e}disconnect(){return this._abortController&&this._abortController.abort(),this._disconnect()}}class Wd{constructor(e){this._transport=e,this._proxy=new Proxy(this._transport,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"initialize":o="Direct calls to initialize() are disabled and used internally by the PipecatClient.";break;case"initDevices":o="Direct calls to initDevices() are disabled. Please use the PipecatClient.initDevices() wrapper or let PipecatClient.connect() call it for you.";break;case"sendReadyMessage":o="Direct calls to sendReadyMessage() are disabled and used internally by the PipecatClient.";break;case"connect":o="Direct calls to connect() are disabled. Please use the PipecatClient.connect() wrapper.";break;case"disconnect":o="Direct calls to disconnect() are disabled. Please use the PipecatClient.disconnect() wrapper.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}var Kd={};ke(Kd,"learnAboutClient",()=>qd);function qd(){var n,r,i,o,s,a;let t={library:Ur.name,library_version:Ur.version,platform_details:{}},e=null;if((n=window==null?void 0:window.navigator)!=null&&n.userAgent)try{e=Iy.parse(window.navigator.userAgent)}catch{}return(r=e==null?void 0:e.browser)!=null&&r.name&&(t.platform_details.browser=e.browser.name),((i=e==null?void 0:e.browser)==null?void 0:i.name)==="Safari"&&!e.browser.version?t.platform_details.browser_version="Web View":(o=e==null?void 0:e.browser)!=null&&o.version&&(t.platform_details.browser_version=e.browser.version),(s=e==null?void 0:e.platform)!=null&&s.type&&(t.platform_details.platform_type=e.platform.type),(a=e==null?void 0:e.engine)!=null&&a.name&&(t.platform_details.engine=e.engine.name),e!=null&&e.os&&(t.platform=e.os.name,t.platform_version=e.os.version),t}var An=function(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,n,o):s(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};class By extends xy{}class Nt extends By{constructor(e){super(),this._functionCallCallbacks={},this._botTranscriptionWarned=!1,Bd(qd()),this._transport=e.transport,this._transportWrapper=new Wd(this._transport);const n={...e.callbacks,onMessageError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMessageError)==null||o.call(i,r),this.emit(ee.MessageError,r)},onError:r=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onError)==null||s.call(o,r);try{this.emit(ee.Error,r)}catch{pe.debug("Could not emit error",r)}const i=r.data;i!=null&&i.fatal&&(pe.error("Fatal error reported. Disconnecting..."),this.disconnect())},onConnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onConnected)==null||i.call(r),this.emit(ee.Connected)},onDisconnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onDisconnected)==null||i.call(r),this.emit(ee.Disconnected)},onTransportStateChanged:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onTransportStateChanged)==null||o.call(i,r),this.emit(ee.TransportStateChanged,r)},onParticipantJoined:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantJoined)==null||o.call(i,r),this.emit(ee.ParticipantConnected,r)},onParticipantLeft:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantLeft)==null||o.call(i,r),this.emit(ee.ParticipantLeft,r)},onTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStarted)==null||s.call(o,r,i),this.emit(ee.TrackStarted,r,i)},onTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStopped)==null||s.call(o,r,i),this.emit(ee.TrackStopped,r,i)},onScreenTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStarted)==null||s.call(o,r,i),this.emit(ee.ScreenTrackStarted,r,i)},onScreenTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStopped)==null||s.call(o,r,i),this.emit(ee.ScreenTrackStopped,r,i)},onScreenShareError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onScreenShareError)==null||o.call(i,r),this.emit(ee.ScreenShareError,r)},onAvailableCamsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableCamsUpdated)==null||o.call(i,r),this.emit(ee.AvailableCamsUpdated,r)},onAvailableMicsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableMicsUpdated)==null||o.call(i,r),this.emit(ee.AvailableMicsUpdated,r)},onAvailableSpeakersUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableSpeakersUpdated)==null||o.call(i,r),this.emit(ee.AvailableSpeakersUpdated,r)},onCamUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onCamUpdated)==null||o.call(i,r),this.emit(ee.CamUpdated,r)},onMicUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMicUpdated)==null||o.call(i,r),this.emit(ee.MicUpdated,r)},onSpeakerUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onSpeakerUpdated)==null||o.call(i,r),this.emit(ee.SpeakerUpdated,r)},onDeviceError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onDeviceError)==null||o.call(i,r),this.emit(ee.DeviceError,r)},onBotStarted:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotStarted)==null||o.call(i,r),this.emit(ee.BotStarted,r)},onBotConnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotConnected)==null||o.call(i,r),this.emit(ee.BotConnected,r)},onBotReady:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotReady)==null||o.call(i,r),this.emit(ee.BotReady,r)},onBotDisconnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotDisconnected)==null||o.call(i,r),this.emit(ee.BotDisconnected,r)},onBotStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStartedSpeaking)==null||i.call(r),this.emit(ee.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStoppedSpeaking)==null||i.call(r),this.emit(ee.BotStoppedSpeaking)},onRemoteAudioLevel:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onRemoteAudioLevel)==null||s.call(o,r,i),this.emit(ee.RemoteAudioLevel,r,i)},onUserStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStartedSpeaking)==null||i.call(r),this.emit(ee.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStoppedSpeaking)==null||i.call(r),this.emit(ee.UserStoppedSpeaking)},onLocalAudioLevel:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onLocalAudioLevel)==null||o.call(i,r),this.emit(ee.LocalAudioLevel,r)},onUserTranscript:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onUserTranscript)==null||o.call(i,r),this.emit(ee.UserTranscript,r)},onBotOutput:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotOutput)==null||o.call(i,r),this.emit(ee.BotOutput,r)},onBotTranscript:r=>{var i,o;this._botTranscriptionWarned||(pe.warn("[Pipecat Client] Bot transcription is deprecated. Please use the onBotOutput instead."),this._botTranscriptionWarned=!0),(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTranscript)==null||o.call(i,r),this.emit(ee.BotTranscript,r)},onBotLlmText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotLlmText)==null||o.call(i,r),this.emit(ee.BotLlmText,r)},onBotLlmStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStarted)==null||i.call(r),this.emit(ee.BotLlmStarted)},onBotLlmStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStopped)==null||i.call(r),this.emit(ee.BotLlmStopped)},onBotTtsText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTtsText)==null||o.call(i,r),this.emit(ee.BotTtsText,r)},onBotTtsStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStarted)==null||i.call(r),this.emit(ee.BotTtsStarted)},onBotTtsStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStopped)==null||i.call(r),this.emit(ee.BotTtsStopped)}};this._options={...e,callbacks:n,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),pe.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){pe.setLevel(e)}async initDevices(){pe.debug("[Pipecat Client] Initializing devices..."),await this._transport.initDevices()}async startBot(e){var r,i,o,s;this._transport.state="authenticating",this._transport.startBotParams=e,this._abortController=new AbortController;let n;try{n=await Hd(e,this._abortController)}catch(a){let l="An unknown error occurred while starting the bot.",c;if(a instanceof Response){const d=await a.json();l=d.info??d.detail??a.statusText,c=a.status}else a instanceof Error&&(l=a.message);throw(i=(r=this._options.callbacks)==null?void 0:r.onError)==null||i.call(r,new Ze(ae.ERROR_RESPONSE,{message:l,fatal:!0})),new Dd(l,c)}return this._transport.state="authenticated",(s=(o=this._options.callbacks)==null?void 0:o.onBotStarted)==null||s.call(o,n),n}async connect(e){return e&&zd(e)?(pe.warn("Calling connect with an API endpoint is deprecated. Use startBotAndConnect() instead."),this.startBotAndConnect(e)):new Promise((n,r)=>{(async()=>{this._connectResolve=n,this._transport.state==="disconnected"&&await this._transport.initDevices();try{await this._transport.connect(e),await this._transport.sendReadyMessage()}catch(i){this.disconnect(),r(i);return}})()})}async startBotAndConnect(e){this._transport.state==="disconnected"&&await this._transport.initDevices();const n=await this.startBot(e);return this.connect(n)}async disconnect(){await this._transport.disconnect(),this._messageDispatcher.disconnect()}_initialize(){this._transport.initialize(this._options,this.handleMessage.bind(this)),this._messageDispatcher=new Ud(this._transport.sendMessage.bind(this._transport))}get connected(){return["connected","ready"].includes(this._transport.state)}get transport(){return this._transportWrapper.proxy}get state(){return this._transport.state}get version(){return Ry(Ur).version}async getAllMics(){return await this._transport.getAllMics()}async getAllCams(){return await this._transport.getAllCams()}async getAllSpeakers(){return await this._transport.getAllSpeakers()}get selectedMic(){return this._transport.selectedMic}get selectedCam(){return this._transport.selectedCam}get selectedSpeaker(){return this._transport.selectedSpeaker}updateMic(e){this._transport.updateMic(e)}updateCam(e){this._transport.updateCam(e)}updateSpeaker(e){this._transport.updateSpeaker(e)}enableMic(e){this._transport.enableMic(e)}get isMicEnabled(){return this._transport.isMicEnabled}enableCam(e){this._transport.enableCam(e)}get isCamEnabled(){return this._transport.isCamEnabled}tracks(){return this._transport.tracks()}enableScreenShare(e){return this._transport.enableScreenShare(e)}get isSharingScreen(){return this._transport.isSharingScreen}sendClientMessage(e,n){this._transport.sendMessage(new Ze(ae.CLIENT_MESSAGE,{t:e,d:n}))}async sendClientRequest(e,n,r){const i={t:e,d:n};return(await this._messageDispatcher.dispatch(i,ae.CLIENT_MESSAGE,r)).data.d}registerFunctionCallHandler(e,n){this._functionCallCallbacks[e]=n}unregisterFunctionCallHandler(e){delete this._functionCallCallbacks[e]}unregisterAllFunctionCallHandlers(){this._functionCallCallbacks={}}async appendToContext(e){return pe.warn("appendToContext() is deprecated. Use sendText() instead."),await this._transport.sendMessage(new Ze(ae.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,n={}){await this._transport.sendMessage(new Ze(ae.SEND_TEXT,{content:e,options:n}))}disconnectBot(){this._transport.sendMessage(new Ze(ae.DISCONNECT_BOT,{}))}handleMessage(e){var n,r,i,o,s,a,l,c,d,f,h,b,y,m,S,v,w,k,C,T,O,P,$,X,V,B,W,K,se,J,G,ne,F,z,q,re,me,u,g,p,x;switch(pe.debug("[RTVI Message]",e),e.type){case ae.BOT_READY:{const _=e.data,M=_.version?_.version.split(".").map(Number):[0,0,0];pe.debug(`[Pipecat Client] Bot is ready. Version: ${_.version}`),M[0]<1&&pe.warn("[Pipecat Client] Bot version is less than 1.0.0, which may not be compatible with this client."),(n=this._connectResolve)==null||n.call(this,e.data),(i=(r=this._options.callbacks)==null?void 0:r.onBotReady)==null||i.call(r,e.data);break}case ae.ERROR:(s=(o=this._options.callbacks)==null?void 0:o.onError)==null||s.call(o,e);break;case ae.SERVER_RESPONSE:this._messageDispatcher.resolve(e);break;case ae.ERROR_RESPONSE:{const _=this._messageDispatcher.reject(e);(l=(a=this._options.callbacks)==null?void 0:a.onMessageError)==null||l.call(a,_);break}case ae.USER_STARTED_SPEAKING:(d=(c=this._options.callbacks)==null?void 0:c.onUserStartedSpeaking)==null||d.call(c);break;case ae.USER_STOPPED_SPEAKING:(h=(f=this._options.callbacks)==null?void 0:f.onUserStoppedSpeaking)==null||h.call(f);break;case ae.BOT_STARTED_SPEAKING:(y=(b=this._options.callbacks)==null?void 0:b.onBotStartedSpeaking)==null||y.call(b);break;case ae.BOT_STOPPED_SPEAKING:(S=(m=this._options.callbacks)==null?void 0:m.onBotStoppedSpeaking)==null||S.call(m);break;case ae.USER_TRANSCRIPTION:{const _=e.data;(w=(v=this._options.callbacks)==null?void 0:v.onUserTranscript)==null||w.call(v,_);break}case ae.BOT_OUTPUT:(C=(k=this._options.callbacks)==null?void 0:k.onBotOutput)==null||C.call(k,e.data);break;case ae.BOT_TRANSCRIPTION:(O=(T=this._options.callbacks)==null?void 0:T.onBotTranscript)==null||O.call(T,e.data);break;case ae.BOT_LLM_TEXT:($=(P=this._options.callbacks)==null?void 0:P.onBotLlmText)==null||$.call(P,e.data);break;case ae.BOT_LLM_STARTED:(V=(X=this._options.callbacks)==null?void 0:X.onBotLlmStarted)==null||V.call(X);break;case ae.BOT_LLM_STOPPED:(W=(B=this._options.callbacks)==null?void 0:B.onBotLlmStopped)==null||W.call(B);break;case ae.BOT_TTS_TEXT:(se=(K=this._options.callbacks)==null?void 0:K.onBotTtsText)==null||se.call(K,e.data);break;case ae.BOT_TTS_STARTED:(G=(J=this._options.callbacks)==null?void 0:J.onBotTtsStarted)==null||G.call(J);break;case ae.BOT_TTS_STOPPED:(F=(ne=this._options.callbacks)==null?void 0:ne.onBotTtsStopped)==null||F.call(ne);break;case ae.METRICS:(q=(z=this._options.callbacks)==null?void 0:z.onMetrics)==null||q.call(z,e.data),this.emit(ee.Metrics,e.data);break;case ae.SERVER_MESSAGE:(me=(re=this._options.callbacks)==null?void 0:re.onServerMessage)==null||me.call(re,e.data),this.emit(ee.ServerMessage,e.data);break;case ae.LLM_FUNCTION_CALL:{const _=e.data,M=this._functionCallCallbacks[_.function_name];if(M){const I={functionName:_.function_name,arguments:_.args};M(I).then(R=>{R!=null&&this._transport.sendMessage(new Ze(ae.LLM_FUNCTION_CALL_RESULT,{function_name:_.function_name,tool_call_id:_.tool_call_id,arguments:_.args,result:R}))})}(g=(u=this._options.callbacks)==null?void 0:u.onLLMFunctionCall)==null||g.call(u,_),this.emit(ee.LLMFunctionCall,_);break}case ae.BOT_LLM_SEARCH_RESPONSE:{const _=e.data;(x=(p=this._options.callbacks)==null?void 0:p.onBotLlmSearchResponse)==null||x.call(p,_),this.emit(ee.BotLlmSearchResponse,_);break}default:pe.debug("[Pipecat Client] Unrecognized message type",e.type);break}}}An([Ka],Nt.prototype,"startBot",null),An([Ka],Nt.prototype,"connect",null),An([Ka],Nt.prototype,"startBotAndConnect",null),An([Di],Nt.prototype,"sendClientMessage",null),An([Di],Nt.prototype,"sendClientRequest",null),An([Di],Nt.prototype,"appendToContext",null),An([Di],Nt.prototype,"sendText",null),An([Di],Nt.prototype,"disconnectBot",null),Qt(jr,Od),Qt(jr,jd),Qt(jr,qa),Qt(jr,Ja),Qt(jr,Ga),Qt(jr,Kd);function Jd(t,e){if(t==null)return{};var n,r,i=function(s,a){if(s==null)return{};var l={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.indexOf(c)!==-1)continue;l[c]=s[c]}return l}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function ht(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fe(t){return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fe(t)}function Gd(t){var e=function(n,r){if(fe(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r);if(fe(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return fe(e)=="symbol"?e:e+""}function Qd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Gd(r.key),r)}}function pt(t,e,n){return e&&Qd(t.prototype,e),n&&Qd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vo(t,e){if(e&&(fe(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(t)}function $t(t){return $t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$t(t)}function Li(t,e){return Li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Li(t,e)}function Wo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Li(t,e)}function Xt(t,e,n){return(e=Gd(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yd(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(c){return void n(c)}a.done?e(l):Promise.resolve(l).then(r,i)}function Z(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(l){Yd(o,r,i,s,a,"next",l)}function a(l){Yd(o,r,i,s,a,"throw",l)}s(void 0)})}}function Xd(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qe(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,s,a,l,c=[],d=!0,f=!1;try{if(a=(i=i.call(n)).next,r===0){if(Object(i)!==i)return;d=!1}else for(;!(d=(o=a.call(i)).done)&&(c.push(o.value),c.length!==r);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(f)throw s}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Xd(n,r);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Xd(n,r):void 0}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function jy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Zd,Ko={exports:{}},Qa=function(){if(Zd)return Ko.exports;Zd=1;var t,e=typeof Reflect=="object"?Reflect:null,n=e&&typeof e.apply=="function"?e.apply:function(m,S,v){return Function.prototype.apply.call(m,S,v)};t=e&&typeof e.ownKeys=="function"?e.ownKeys:Object.getOwnPropertySymbols?function(m){return Object.getOwnPropertyNames(m).concat(Object.getOwnPropertySymbols(m))}:function(m){return Object.getOwnPropertyNames(m)};var r=Number.isNaN||function(m){return m!=m};function i(){i.init.call(this)}Ko.exports=i,Ko.exports.once=function(m,S){return new Promise(function(v,w){function k(T){m.removeListener(S,C),w(T)}function C(){typeof m.removeListener=="function"&&m.removeListener("error",k),v([].slice.call(arguments))}y(m,S,C,{once:!0}),S!=="error"&&function(T,O,P){typeof T.on=="function"&&y(T,"error",O,P)}(m,k,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}function a(m){return m._maxListeners===void 0?i.defaultMaxListeners:m._maxListeners}function l(m,S,v,w){var k,C,T,O;if(s(v),(C=m._events)===void 0?(C=m._events=Object.create(null),m._eventsCount=0):(C.newListener!==void 0&&(m.emit("newListener",S,v.listener?v.listener:v),C=m._events),T=C[S]),T===void 0)T=C[S]=v,++m._eventsCount;else if(typeof T=="function"?T=C[S]=w?[v,T]:[T,v]:w?T.unshift(v):T.push(v),(k=a(m))>0&&T.length>k&&!T.warned){T.warned=!0;var P=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");P.name="MaxListenersExceededWarning",P.emitter=m,P.type=S,P.count=T.length,O=P,console&&console.warn&&console.warn(O)}return m}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(m,S,v){var w={fired:!1,wrapFn:void 0,target:m,type:S,listener:v},k=c.bind(w);return k.listener=v,w.wrapFn=k,k}function f(m,S,v){var w=m._events;if(w===void 0)return[];var k=w[S];return k===void 0?[]:typeof k=="function"?v?[k.listener||k]:[k]:v?function(C){for(var T=new Array(C.length),O=0;O<T.length;++O)T[O]=C[O].listener||C[O];return T}(k):b(k,k.length)}function h(m){var S=this._events;if(S!==void 0){var v=S[m];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}function b(m,S){for(var v=new Array(S),w=0;w<S;++w)v[w]=m[w];return v}function y(m,S,v,w){if(typeof m.on=="function")w.once?m.once(S,v):m.on(S,v);else{if(typeof m.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m);m.addEventListener(S,function k(C){w.once&&m.removeEventListener(S,k),v(C)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||r(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),i.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(m){if(typeof m!="number"||m<0||r(m))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+m+".");return this._maxListeners=m,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(m){for(var S=[],v=1;v<arguments.length;v++)S.push(arguments[v]);var w=m==="error",k=this._events;if(k!==void 0)w=w&&k.error===void 0;else if(!w)return!1;if(w){var C;if(S.length>0&&(C=S[0]),C instanceof Error)throw C;var T=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw T.context=C,T}var O=k[m];if(O===void 0)return!1;if(typeof O=="function")n(O,this,S);else{var P=O.length,$=b(O,P);for(v=0;v<P;++v)n($[v],this,S)}return!0},i.prototype.addListener=function(m,S){return l(this,m,S,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(m,S){return l(this,m,S,!0)},i.prototype.once=function(m,S){return s(S),this.on(m,d(this,m,S)),this},i.prototype.prependOnceListener=function(m,S){return s(S),this.prependListener(m,d(this,m,S)),this},i.prototype.removeListener=function(m,S){var v,w,k,C,T;if(s(S),(w=this._events)===void 0)return this;if((v=w[m])===void 0)return this;if(v===S||v.listener===S)--this._eventsCount==0?this._events=Object.create(null):(delete w[m],w.removeListener&&this.emit("removeListener",m,v.listener||S));else if(typeof v!="function"){for(k=-1,C=v.length-1;C>=0;C--)if(v[C]===S||v[C].listener===S){T=v[C].listener,k=C;break}if(k<0)return this;k===0?v.shift():function(O,P){for(;P+1<O.length;P++)O[P]=O[P+1];O.pop()}(v,k),v.length===1&&(w[m]=v[0]),w.removeListener!==void 0&&this.emit("removeListener",m,T||S)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(m){var S,v,w;if((v=this._events)===void 0)return this;if(v.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):v[m]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete v[m]),this;if(arguments.length===0){var k,C=Object.keys(v);for(w=0;w<C.length;++w)(k=C[w])!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(S=v[m])=="function")this.removeListener(m,S);else if(S!==void 0)for(w=S.length-1;w>=0;w--)this.removeListener(m,S[w]);return this},i.prototype.listeners=function(m){return f(this,m,!0)},i.prototype.rawListeners=function(m){return f(this,m,!1)},i.listenerCount=function(m,S){return typeof m.listenerCount=="function"?m.listenerCount(S):h.call(m,S)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},Ko.exports}(),qo=jy(Qa),ef=Object.prototype.hasOwnProperty;function tf(t,e,n){for(n of t.keys())if(et(n,e))return n}function et(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&et(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if((i=r)&&typeof i=="object"&&!(i=tf(e,i))||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if((i=r[0])&&typeof i=="object"&&!(i=tf(e,i))||!et(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){for(n in r=0,t)if(ef.call(t,n)&&++r&&!ef.call(e,n)||!(n in e)||!et(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!=t&&e!=e}const Uy={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},nf={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},De={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},tt={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},On={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};let L=class Oi{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),n[0]===10)switch(n[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5))return n[0]===1&&n[1]<6?"Cupcake":n[0]===1&&n[1]>=6?"Donut":n[0]===2&&n[1]<2?"Eclair":n[0]===2&&n[1]===2?"Froyo":n[0]===2&&n[1]>2?"Gingerbread":n[0]===3?"Honeycomb":n[0]===4&&n[1]<1?"Ice Cream Sandwich":n[0]===4&&n[1]<4?"Jelly Bean":n[0]===4&&n[1]>=4?"KitKat":n[0]===5?"Lollipop":n[0]===6?"Marshmallow":n[0]===7?"Nougat":n[0]===8?"Oreo":n[0]===9?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=Oi.getVersionPrecision(e),o=Oi.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=Oi.map([e,n],c=>{const d=s-Oi.getVersionPrecision(c),f=c+new Array(d+1).join(".0");return Oi.map(f.split("."),h=>new Array(20-h.length).join("0")+h).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(a=>{r[a]=s[a]})}return e}static getBrowserAlias(e){return Uy[e]}static getBrowserTypeByAlias(e){return nf[e]||""}};const be=/version\/(\d+(\.?_?\d+)+)/i,zy=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=L.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=L.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=L.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=L.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=L.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=L.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=L.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=L.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=L.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=L.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=L.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=L.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=L.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=L.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=L.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=L.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=L.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=L.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=L.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=L.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=L.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=L.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=L.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=L.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=L.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=L.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=L.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:L.getFirstMatch(e,t),version:L.getSecondMatch(e,t)}}}];var Hy=[{test:[/Roku\/DVP/],describe(t){const e=L.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:tt.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=L.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:tt.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=L.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=L.getWindowsVersionName(e);return{name:tt.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:tt.iOS},n=L.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=L.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=L.getMacOSVersionName(e),r={name:tt.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=L.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:tt.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=L.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=L.getAndroidVersionName(e),r={name:tt.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=L.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:tt.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=L.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||L.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||L.getFirstMatch(/\bbb(\d+)/i,t);return{name:tt.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=L.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:tt.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=L.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:tt.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:tt.Linux})},{test:[/CrOS/],describe:()=>({name:tt.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=L.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:tt.PlayStation4,version:e}}}],Vy=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=L.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:De.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:De.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:De.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:De.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:De.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:De.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:De.tablet})},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=L.getFirstMatch(/(ipod|iphone)/i,t);return{type:De.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:De.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:De.mobile})},{test:t=>t.getBrowserName(!0)==="blackberry",describe:()=>({type:De.mobile,vendor:"BlackBerry"})},{test:t=>t.getBrowserName(!0)==="bada",describe:()=>({type:De.mobile})},{test:t=>t.getBrowserName()==="windows phone",describe:()=>({type:De.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe:()=>({type:De.tablet})},{test:t=>t.getOSName(!0)==="android",describe:()=>({type:De.mobile})},{test:t=>t.getOSName(!0)==="macos",describe:()=>({type:De.desktop,vendor:"Apple"})},{test:t=>t.getOSName(!0)==="windows",describe:()=>({type:De.desktop})},{test:t=>t.getOSName(!0)==="linux",describe:()=>({type:De.desktop})},{test:t=>t.getOSName(!0)==="playstation 4",describe:()=>({type:De.tv})},{test:t=>t.getOSName(!0)==="roku",describe:()=>({type:De.tv})}],Wy=[{test:t=>t.getBrowserName(!0)==="microsoft edge",describe(t){if(/\sedg\//i.test(t))return{name:On.Blink};const e=L.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:On.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:On.Trident},n=L.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:On.Presto},n=L.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:On.Gecko},n=L.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:On.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:On.WebKit},n=L.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];let rf=class{constructor(e,n=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=L.find(zy,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=L.find(Hy,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=L.find(Vy,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=L.find(Wy,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return L.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(s=>{const a=e[s];typeof a=="string"?(i[s]=a,o+=1):typeof a=="object"&&(n[s]=a,r+=1)}),r>0){const s=Object.keys(n),a=L.find(s,c=>this.isOS(c));if(a){const c=this.satisfies(n[a]);if(c!==void 0)return c}const l=L.find(s,c=>this.isPlatform(c));if(l){const c=this.satisfies(n[l]);if(c!==void 0)return c}}if(o>0){const s=Object.keys(i),a=L.find(s,l=>this.isBrowser(l,!0));if(a!==void 0)return this.compareVersion(i[a])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=L.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(L.compareVersions(o,r,i))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}};/*!
|
|
6
|
+
*/class Ry{static getParser(e,n=!1,r=null){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Od(e,n,r)}static parse(e,n=null){return new Od(e,n).getResult()}static get BROWSER_MAP(){return Ad}static get ENGINE_MAP(){return Mn}static get OS_MAP(){return We}static get PLATFORMS_MAP(){return Q}}function Qt(t,e){return Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t}function Ny(t){return t&&t.__esModule?t.default:t}function ke(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var jr={},Dd={};ke(Dd,"PipecatClient",()=>Nt);var Ur={};Ur=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.5.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web.git"},"files":["dist","package.json","README.md"],"scripts":{"build":"jest --silent --passWithNoTests && parcel build --no-cache","dev":"parcel watch","lint":"eslint . --report-unused-disable-directives --max-warnings 0","test":"jest"},"jest":{"preset":"ts-jest","testEnvironment":"jsdom"},"devDependencies":{"@jest/globals":"^29.7.0","@types/clone-deep":"^4.0.4","@types/jest":"^29.5.12","@types/uuid":"^10.0.0","eslint":"^9.11.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1","jest":"^29.7.0","jest-environment-jsdom":"^30.0.2","ts-jest":"^29.2.5"},"dependencies":{"@types/events":"^3.0.3","bowser":"^2.11.0","clone-deep":"^4.0.1","events":"^3.3.0","typed-emitter":"^2.1.0","uuid":"^10.0.0"}}');var Ho={},Pd={};ke(Pd,"TransportStateEnum",()=>Ka);var Ka;(function(t){t.DISCONNECTED="disconnected",t.INITIALIZING="initializing",t.INITIALIZED="initialized",t.AUTHENTICATING="authenticating",t.AUTHENTICATED="authenticated",t.CONNECTING="connecting",t.CONNECTED="connected",t.READY="ready",t.DISCONNECTING="disconnecting",t.ERROR="error"})(Ka||(Ka={}));var Yt={};ke(Yt,"RTVIError",()=>ft),ke(Yt,"ConnectionTimeoutError",()=>$y),ke(Yt,"StartBotError",()=>Ld),ke(Yt,"TransportStartError",()=>Id),ke(Yt,"InvalidTransportParamsError",()=>Fy),ke(Yt,"BotNotReadyError",()=>Rd),ke(Yt,"BotAlreadyStartedError",()=>Nd),ke(Yt,"UnsupportedFeatureError",()=>By),ke(Yt,"DeviceError",()=>cn);class ft extends Error{constructor(e,n){super(e),this.status=n}}class $y extends ft{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class Ld extends ft{constructor(e,n){super(e??"Failed to connect / invalid auth bundle from base url",n??500),this.error="invalid-request-error"}}class Id extends ft{constructor(e){super(e??"Unable to connect to transport")}}class Fy extends ft{constructor(e){super(e??"Invalid transport connection parameters")}}class Rd extends ft{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class Nd extends ft{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class By extends ft{constructor(e,n,r){let i=`${e} not supported${r?`: ${r}`:""}`;n&&(i=`${n} does not support ${e}${r?`: ${r}`:""}`),super(i),this.feature=e}}class cn extends ft{constructor(e,n,r,i){super(r??`Device error for ${e.join(", ")}: ${n}`),this.devices=e,this.type=n,this.details=i}}var $d={};ke($d,"RTVIEvent",()=>ee);var ee;(function(t){t.Connected="connected",t.Disconnected="disconnected",t.TransportStateChanged="transportStateChanged",t.BotStarted="botStarted",t.BotConnected="botConnected",t.BotReady="botReady",t.BotDisconnected="botDisconnected",t.Error="error",t.ServerMessage="serverMessage",t.ServerResponse="serverResponse",t.MessageError="messageError",t.Metrics="metrics",t.BotStartedSpeaking="botStartedSpeaking",t.BotStoppedSpeaking="botStoppedSpeaking",t.UserStartedSpeaking="userStartedSpeaking",t.UserStoppedSpeaking="userStoppedSpeaking",t.UserTranscript="userTranscript",t.BotOutput="botOutput",t.BotTranscript="botTranscript",t.BotLlmText="botLlmText",t.BotLlmStarted="botLlmStarted",t.BotLlmStopped="botLlmStopped",t.LLMFunctionCall="llmFunctionCall",t.BotLlmSearchResponse="botLlmSearchResponse",t.BotTtsText="botTtsText",t.BotTtsStarted="botTtsStarted",t.BotTtsStopped="botTtsStopped",t.ParticipantConnected="participantConnected",t.ParticipantLeft="participantLeft",t.TrackStarted="trackStarted",t.TrackStopped="trackStopped",t.ScreenTrackStarted="screenTrackStarted",t.ScreenTrackStopped="screenTrackStopped",t.ScreenShareError="screenShareError",t.LocalAudioLevel="localAudioLevel",t.RemoteAudioLevel="remoteAudioLevel",t.AvailableCamsUpdated="availableCamsUpdated",t.AvailableMicsUpdated="availableMicsUpdated",t.AvailableSpeakersUpdated="availableSpeakersUpdated",t.CamUpdated="camUpdated",t.MicUpdated="micUpdated",t.SpeakerUpdated="speakerUpdated",t.DeviceError="deviceError"})(ee||(ee={}));var or={};ke(or,"RTVI_PROTOCOL_VERSION",()=>Fd),ke(or,"RTVI_MESSAGE_LABEL",()=>Bd),ke(or,"RTVIMessageType",()=>ae),ke(or,"AggregationType",()=>Wa),ke(or,"setAboutClient",()=>jd),ke(or,"RTVIMessage",()=>Ze);const Fd="1.0.0",Bd="rtvi-ai";var ae;(function(t){t.CLIENT_READY="client-ready",t.DISCONNECT_BOT="disconnect-bot",t.CLIENT_MESSAGE="client-message",t.SEND_TEXT="send-text",t.APPEND_TO_CONTEXT="append-to-context",t.BOT_READY="bot-ready",t.ERROR="error",t.METRICS="metrics",t.SERVER_MESSAGE="server-message",t.SERVER_RESPONSE="server-response",t.ERROR_RESPONSE="error-response",t.APPEND_TO_CONTEXT_RESULT="append-to-context-result",t.USER_TRANSCRIPTION="user-transcription",t.BOT_OUTPUT="bot-output",t.BOT_TRANSCRIPTION="bot-transcription",t.USER_STARTED_SPEAKING="user-started-speaking",t.USER_STOPPED_SPEAKING="user-stopped-speaking",t.BOT_STARTED_SPEAKING="bot-started-speaking",t.BOT_STOPPED_SPEAKING="bot-stopped-speaking",t.USER_LLM_TEXT="user-llm-text",t.BOT_LLM_TEXT="bot-llm-text",t.BOT_LLM_STARTED="bot-llm-started",t.BOT_LLM_STOPPED="bot-llm-stopped",t.LLM_FUNCTION_CALL="llm-function-call",t.LLM_FUNCTION_CALL_RESULT="llm-function-call-result",t.BOT_LLM_SEARCH_RESPONSE="bot-llm-search-response",t.BOT_TTS_TEXT="bot-tts-text",t.BOT_TTS_STARTED="bot-tts-started",t.BOT_TTS_STOPPED="bot-tts-stopped"})(ae||(ae={}));var Wa;(function(t){t.WORD="word",t.SENTENCE="sentence"})(Wa||(Wa={}));let Di;function jd(t){Di?Di={...Di,...t}:Di=t}class Ze{constructor(e,n,r){this.label=Bd,this.type=e,this.data=n,this.id=r||Ay().slice(0,8)}static clientReady(){return new Ze(ae.CLIENT_READY,{version:Fd,about:Di||{library:Ur.name,library_version:Ur.version}})}static disconnectBot(){return new Ze(ae.DISCONNECT_BOT,{})}static error(e,n=!1){return new Ze(ae.ERROR,{message:e,fatal:n})}}Qt(Ho,Pd),Qt(Ho,Yt),Qt(Ho,$d),Qt(Ho,or);function Pi(t,e,n){const r=n.value;return n.value=function(...i){if(this.state==="ready")return r.apply(this,i);throw new Rd(`Attempt to call ${e.toString()} when transport not in ready state. Await connect() first.`)},n}function qa(t,e,n){const r=n.value,i=["authenticating","connecting","connected","ready"];return n.value=function(...o){if(i.includes(this.state))throw new Nd(`Attempt to call ${e.toString()} when client already started. Please call disconnect() before starting again.`);return r.apply(this,o)},n}var Ud={};ke(Ud,"MessageDispatcher",()=>zd);var Ja={};ke(Ja,"LogLevel",()=>An),ke(Ja,"logger",()=>pe);var An;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"})(An||(An={}));class zr{constructor(){this.level=An.DEBUG}static getInstance(){return zr.instance||(zr.instance=new zr),zr.instance}setLevel(e){this.level=e}debug(...e){this.level>=An.DEBUG&&console.debug(...e)}info(...e){this.level>=An.INFO&&console.info(...e)}warn(...e){this.level>=An.WARN&&console.warn(...e)}error(...e){this.level>=An.ERROR&&console.error(...e)}}const pe=zr.getInstance();class zd{constructor(e){this._queue=new Array,this._gcInterval=void 0,this._queue=[],this._sendMethod=e}disconnect(){this.clearQueue(),clearInterval(this._gcInterval),this._gcInterval=void 0}dispatch(e,n=ae.CLIENT_MESSAGE,r=1e4){this._gcInterval||(this._gcInterval=setInterval(()=>{this._gc()},2e3));const i=new Ze(n,e),o=new Promise((s,a)=>{this._queue.push({message:i,timestamp:Date.now(),timeout:r,resolve:s,reject:a})});pe.debug("[MessageDispatcher] dispatch",i);try{this._sendMethod(i)}catch(s){return pe.error("[MessageDispatcher] Error sending message",s),Promise.reject(s)}return this._gc(),o}clearQueue(){this._queue=[]}_resolveReject(e,n=!0){const r=this._queue.find(i=>i.message.id===e.id);return r&&(n?(pe.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(pe.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(i=>i.message.id!==e.id),pe.debug("[MessageDispatcher] Queue",this._queue)),e}resolve(e){return this._resolveReject(e,!0)}reject(e){return this._resolveReject(e,!1)}_gc(){const e=[];this._queue=this._queue.filter(n=>{const r=Date.now()-n.timestamp<n.timeout;return r||e.push(n),r}),e.forEach(n=>{n.message.type===ae.CLIENT_MESSAGE&&n.reject(new Ze(ae.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:n.message.data.t,data:n.message.data.d,fatal:!1}))}),pe.debug("[MessageDispatcher] GC",this._queue)}}var Ga={};ke(Ga,"isAPIRequest",()=>Hd),ke(Ga,"makeRequest",()=>Vd);function Hd(t){if(typeof t=="object"&&t!==null&&Object.keys(t).includes("endpoint")){const e=t.endpoint;return typeof e=="string"||e instanceof URL||typeof Request<"u"&&e instanceof Request}return!1}async function Vd(t,e){e||(e=new AbortController);let n;return new Promise((r,i)=>{(async()=>(t.timeout&&(n=setTimeout(async()=>{e.abort(),i(new Error("Timed out"))},t.timeout)),pe.debug(`[Pipecat Client] Fetching from ${t.endpoint}`),fetch(t.endpoint,{method:"POST",mode:"cors",headers:new Headers({"Content-Type":"application/json",...Object.fromEntries((t.headers??new Headers).entries())}),body:JSON.stringify(t.requestData),signal:e==null?void 0:e.signal}).then(o=>{pe.debug(`[Pipecat Client] Received response from ${t.endpoint}`,o),o.ok||i(o),o.json().then(s=>r(s))}).catch(o=>{pe.error(`[Pipecat Client] Error fetching: ${o}`),i(o)}).finally(()=>{n&&clearTimeout(n)})))()})}var Qa={};ke(Qa,"Transport",()=>Kd),ke(Qa,"TransportWrapper",()=>Wd);class Kd{constructor(){this._state="disconnected"}connect(e){this._abortController=new AbortController;let n=e;try{n=this._validateConnectionParams(e)}catch(r){throw new ft(`Invalid connection params: ${r.message}. Please check your connection params and try again.`)}return this._connect(n)}get startBotParams(){return this._startBotParams}set startBotParams(e){this._startBotParams=e}disconnect(){return this._abortController&&this._abortController.abort(),this._disconnect()}}class Wd{constructor(e){this._transport=e,this._proxy=new Proxy(this._transport,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"initialize":o="Direct calls to initialize() are disabled and used internally by the PipecatClient.";break;case"initDevices":o="Direct calls to initDevices() are disabled. Please use the PipecatClient.initDevices() wrapper or let PipecatClient.connect() call it for you.";break;case"sendReadyMessage":o="Direct calls to sendReadyMessage() are disabled and used internally by the PipecatClient.";break;case"connect":o="Direct calls to connect() are disabled. Please use the PipecatClient.connect() wrapper.";break;case"disconnect":o="Direct calls to disconnect() are disabled. Please use the PipecatClient.disconnect() wrapper.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}var qd={};ke(qd,"learnAboutClient",()=>Jd);function Jd(){var n,r,i,o,s,a;let t={library:Ur.name,library_version:Ur.version,platform_details:{}},e=null;if((n=window==null?void 0:window.navigator)!=null&&n.userAgent)try{e=Ry.parse(window.navigator.userAgent)}catch{}return(r=e==null?void 0:e.browser)!=null&&r.name&&(t.platform_details.browser=e.browser.name),((i=e==null?void 0:e.browser)==null?void 0:i.name)==="Safari"&&!e.browser.version?t.platform_details.browser_version="Web View":(o=e==null?void 0:e.browser)!=null&&o.version&&(t.platform_details.browser_version=e.browser.version),(s=e==null?void 0:e.platform)!=null&&s.type&&(t.platform_details.platform_type=e.platform.type),(a=e==null?void 0:e.engine)!=null&&a.name&&(t.platform_details.engine=e.engine.name),e!=null&&e.os&&(t.platform=e.os.name,t.platform_version=e.os.version),t}var On=function(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,n,o):s(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};class jy extends _y{}class Nt extends jy{constructor(e){super(),this._functionCallCallbacks={},this._botTranscriptionWarned=!1,jd(Jd()),this._transport=e.transport,this._transportWrapper=new Wd(this._transport);const n={...e.callbacks,onMessageError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMessageError)==null||o.call(i,r),this.emit(ee.MessageError,r)},onError:r=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onError)==null||s.call(o,r);try{this.emit(ee.Error,r)}catch{pe.debug("Could not emit error",r)}const i=r.data;i!=null&&i.fatal&&(pe.error("Fatal error reported. Disconnecting..."),this.disconnect())},onConnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onConnected)==null||i.call(r),this.emit(ee.Connected)},onDisconnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onDisconnected)==null||i.call(r),this.emit(ee.Disconnected)},onTransportStateChanged:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onTransportStateChanged)==null||o.call(i,r),this.emit(ee.TransportStateChanged,r)},onParticipantJoined:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantJoined)==null||o.call(i,r),this.emit(ee.ParticipantConnected,r)},onParticipantLeft:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantLeft)==null||o.call(i,r),this.emit(ee.ParticipantLeft,r)},onTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStarted)==null||s.call(o,r,i),this.emit(ee.TrackStarted,r,i)},onTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStopped)==null||s.call(o,r,i),this.emit(ee.TrackStopped,r,i)},onScreenTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStarted)==null||s.call(o,r,i),this.emit(ee.ScreenTrackStarted,r,i)},onScreenTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStopped)==null||s.call(o,r,i),this.emit(ee.ScreenTrackStopped,r,i)},onScreenShareError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onScreenShareError)==null||o.call(i,r),this.emit(ee.ScreenShareError,r)},onAvailableCamsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableCamsUpdated)==null||o.call(i,r),this.emit(ee.AvailableCamsUpdated,r)},onAvailableMicsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableMicsUpdated)==null||o.call(i,r),this.emit(ee.AvailableMicsUpdated,r)},onAvailableSpeakersUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableSpeakersUpdated)==null||o.call(i,r),this.emit(ee.AvailableSpeakersUpdated,r)},onCamUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onCamUpdated)==null||o.call(i,r),this.emit(ee.CamUpdated,r)},onMicUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMicUpdated)==null||o.call(i,r),this.emit(ee.MicUpdated,r)},onSpeakerUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onSpeakerUpdated)==null||o.call(i,r),this.emit(ee.SpeakerUpdated,r)},onDeviceError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onDeviceError)==null||o.call(i,r),this.emit(ee.DeviceError,r)},onBotStarted:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotStarted)==null||o.call(i,r),this.emit(ee.BotStarted,r)},onBotConnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotConnected)==null||o.call(i,r),this.emit(ee.BotConnected,r)},onBotReady:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotReady)==null||o.call(i,r),this.emit(ee.BotReady,r)},onBotDisconnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotDisconnected)==null||o.call(i,r),this.emit(ee.BotDisconnected,r)},onBotStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStartedSpeaking)==null||i.call(r),this.emit(ee.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStoppedSpeaking)==null||i.call(r),this.emit(ee.BotStoppedSpeaking)},onRemoteAudioLevel:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onRemoteAudioLevel)==null||s.call(o,r,i),this.emit(ee.RemoteAudioLevel,r,i)},onUserStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStartedSpeaking)==null||i.call(r),this.emit(ee.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStoppedSpeaking)==null||i.call(r),this.emit(ee.UserStoppedSpeaking)},onLocalAudioLevel:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onLocalAudioLevel)==null||o.call(i,r),this.emit(ee.LocalAudioLevel,r)},onUserTranscript:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onUserTranscript)==null||o.call(i,r),this.emit(ee.UserTranscript,r)},onBotOutput:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotOutput)==null||o.call(i,r),this.emit(ee.BotOutput,r)},onBotTranscript:r=>{var i,o;this._botTranscriptionWarned||(pe.warn("[Pipecat Client] Bot transcription is deprecated. Please use the onBotOutput instead."),this._botTranscriptionWarned=!0),(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTranscript)==null||o.call(i,r),this.emit(ee.BotTranscript,r)},onBotLlmText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotLlmText)==null||o.call(i,r),this.emit(ee.BotLlmText,r)},onBotLlmStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStarted)==null||i.call(r),this.emit(ee.BotLlmStarted)},onBotLlmStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStopped)==null||i.call(r),this.emit(ee.BotLlmStopped)},onBotTtsText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTtsText)==null||o.call(i,r),this.emit(ee.BotTtsText,r)},onBotTtsStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStarted)==null||i.call(r),this.emit(ee.BotTtsStarted)},onBotTtsStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStopped)==null||i.call(r),this.emit(ee.BotTtsStopped)}};this._options={...e,callbacks:n,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),pe.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){pe.setLevel(e)}async initDevices(){pe.debug("[Pipecat Client] Initializing devices..."),await this._transport.initDevices()}async startBot(e){var r,i,o,s;this._transport.state="authenticating",this._transport.startBotParams=e,this._abortController=new AbortController;let n;try{n=await Vd(e,this._abortController)}catch(a){let l="An unknown error occurred while starting the bot.",c;if(a instanceof Response){const d=await a.json();l=d.info??d.detail??a.statusText,c=a.status}else a instanceof Error&&(l=a.message);throw(i=(r=this._options.callbacks)==null?void 0:r.onError)==null||i.call(r,new Ze(ae.ERROR_RESPONSE,{message:l,fatal:!0})),new Ld(l,c)}return this._transport.state="authenticated",(s=(o=this._options.callbacks)==null?void 0:o.onBotStarted)==null||s.call(o,n),n}async connect(e){return e&&Hd(e)?(pe.warn("Calling connect with an API endpoint is deprecated. Use startBotAndConnect() instead."),this.startBotAndConnect(e)):new Promise((n,r)=>{(async()=>{this._connectResolve=n,this._transport.state==="disconnected"&&await this._transport.initDevices();try{await this._transport.connect(e),await this._transport.sendReadyMessage()}catch(i){this.disconnect(),r(i);return}})()})}async startBotAndConnect(e){this._transport.state==="disconnected"&&await this._transport.initDevices();const n=await this.startBot(e);return this.connect(n)}async disconnect(){await this._transport.disconnect(),this._messageDispatcher.disconnect()}_initialize(){this._transport.initialize(this._options,this.handleMessage.bind(this)),this._messageDispatcher=new zd(this._transport.sendMessage.bind(this._transport))}get connected(){return["connected","ready"].includes(this._transport.state)}get transport(){return this._transportWrapper.proxy}get state(){return this._transport.state}get version(){return Ny(Ur).version}async getAllMics(){return await this._transport.getAllMics()}async getAllCams(){return await this._transport.getAllCams()}async getAllSpeakers(){return await this._transport.getAllSpeakers()}get selectedMic(){return this._transport.selectedMic}get selectedCam(){return this._transport.selectedCam}get selectedSpeaker(){return this._transport.selectedSpeaker}updateMic(e){this._transport.updateMic(e)}updateCam(e){this._transport.updateCam(e)}updateSpeaker(e){this._transport.updateSpeaker(e)}enableMic(e){this._transport.enableMic(e)}get isMicEnabled(){return this._transport.isMicEnabled}enableCam(e){this._transport.enableCam(e)}get isCamEnabled(){return this._transport.isCamEnabled}tracks(){return this._transport.tracks()}enableScreenShare(e){return this._transport.enableScreenShare(e)}get isSharingScreen(){return this._transport.isSharingScreen}sendClientMessage(e,n){this._transport.sendMessage(new Ze(ae.CLIENT_MESSAGE,{t:e,d:n}))}async sendClientRequest(e,n,r){const i={t:e,d:n};return(await this._messageDispatcher.dispatch(i,ae.CLIENT_MESSAGE,r)).data.d}registerFunctionCallHandler(e,n){this._functionCallCallbacks[e]=n}unregisterFunctionCallHandler(e){delete this._functionCallCallbacks[e]}unregisterAllFunctionCallHandlers(){this._functionCallCallbacks={}}async appendToContext(e){return pe.warn("appendToContext() is deprecated. Use sendText() instead."),await this._transport.sendMessage(new Ze(ae.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,n={}){await this._transport.sendMessage(new Ze(ae.SEND_TEXT,{content:e,options:n}))}disconnectBot(){this._transport.sendMessage(new Ze(ae.DISCONNECT_BOT,{}))}handleMessage(e){var n,r,i,o,s,a,l,c,d,f,h,b,y,g,S,v,w,k,C,E,A,D,$,X,V,B,K,W,se,J,G,ne,F,z,q,re,me,u,m,p,x;switch(pe.debug("[RTVI Message]",e),e.type){case ae.BOT_READY:{const _=e.data,M=_.version?_.version.split(".").map(Number):[0,0,0];pe.debug(`[Pipecat Client] Bot is ready. Version: ${_.version}`),M[0]<1&&pe.warn("[Pipecat Client] Bot version is less than 1.0.0, which may not be compatible with this client."),(n=this._connectResolve)==null||n.call(this,e.data),(i=(r=this._options.callbacks)==null?void 0:r.onBotReady)==null||i.call(r,e.data);break}case ae.ERROR:(s=(o=this._options.callbacks)==null?void 0:o.onError)==null||s.call(o,e);break;case ae.SERVER_RESPONSE:this._messageDispatcher.resolve(e);break;case ae.ERROR_RESPONSE:{const _=this._messageDispatcher.reject(e);(l=(a=this._options.callbacks)==null?void 0:a.onMessageError)==null||l.call(a,_);break}case ae.USER_STARTED_SPEAKING:(d=(c=this._options.callbacks)==null?void 0:c.onUserStartedSpeaking)==null||d.call(c);break;case ae.USER_STOPPED_SPEAKING:(h=(f=this._options.callbacks)==null?void 0:f.onUserStoppedSpeaking)==null||h.call(f);break;case ae.BOT_STARTED_SPEAKING:(y=(b=this._options.callbacks)==null?void 0:b.onBotStartedSpeaking)==null||y.call(b);break;case ae.BOT_STOPPED_SPEAKING:(S=(g=this._options.callbacks)==null?void 0:g.onBotStoppedSpeaking)==null||S.call(g);break;case ae.USER_TRANSCRIPTION:{const _=e.data;(w=(v=this._options.callbacks)==null?void 0:v.onUserTranscript)==null||w.call(v,_);break}case ae.BOT_OUTPUT:(C=(k=this._options.callbacks)==null?void 0:k.onBotOutput)==null||C.call(k,e.data);break;case ae.BOT_TRANSCRIPTION:(A=(E=this._options.callbacks)==null?void 0:E.onBotTranscript)==null||A.call(E,e.data);break;case ae.BOT_LLM_TEXT:($=(D=this._options.callbacks)==null?void 0:D.onBotLlmText)==null||$.call(D,e.data);break;case ae.BOT_LLM_STARTED:(V=(X=this._options.callbacks)==null?void 0:X.onBotLlmStarted)==null||V.call(X);break;case ae.BOT_LLM_STOPPED:(K=(B=this._options.callbacks)==null?void 0:B.onBotLlmStopped)==null||K.call(B);break;case ae.BOT_TTS_TEXT:(se=(W=this._options.callbacks)==null?void 0:W.onBotTtsText)==null||se.call(W,e.data);break;case ae.BOT_TTS_STARTED:(G=(J=this._options.callbacks)==null?void 0:J.onBotTtsStarted)==null||G.call(J);break;case ae.BOT_TTS_STOPPED:(F=(ne=this._options.callbacks)==null?void 0:ne.onBotTtsStopped)==null||F.call(ne);break;case ae.METRICS:(q=(z=this._options.callbacks)==null?void 0:z.onMetrics)==null||q.call(z,e.data),this.emit(ee.Metrics,e.data);break;case ae.SERVER_MESSAGE:(me=(re=this._options.callbacks)==null?void 0:re.onServerMessage)==null||me.call(re,e.data),this.emit(ee.ServerMessage,e.data);break;case ae.LLM_FUNCTION_CALL:{const _=e.data,M=this._functionCallCallbacks[_.function_name];if(M){const I={functionName:_.function_name,arguments:_.args};M(I).then(R=>{R!=null&&this._transport.sendMessage(new Ze(ae.LLM_FUNCTION_CALL_RESULT,{function_name:_.function_name,tool_call_id:_.tool_call_id,arguments:_.args,result:R}))})}(m=(u=this._options.callbacks)==null?void 0:u.onLLMFunctionCall)==null||m.call(u,_),this.emit(ee.LLMFunctionCall,_);break}case ae.BOT_LLM_SEARCH_RESPONSE:{const _=e.data;(x=(p=this._options.callbacks)==null?void 0:p.onBotLlmSearchResponse)==null||x.call(p,_),this.emit(ee.BotLlmSearchResponse,_);break}default:pe.debug("[Pipecat Client] Unrecognized message type",e.type);break}}}On([qa],Nt.prototype,"startBot",null),On([qa],Nt.prototype,"connect",null),On([qa],Nt.prototype,"startBotAndConnect",null),On([Pi],Nt.prototype,"sendClientMessage",null),On([Pi],Nt.prototype,"sendClientRequest",null),On([Pi],Nt.prototype,"appendToContext",null),On([Pi],Nt.prototype,"sendText",null),On([Pi],Nt.prototype,"disconnectBot",null),Qt(jr,Dd),Qt(jr,Ud),Qt(jr,Ja),Qt(jr,Ga),Qt(jr,Qa),Qt(jr,qd);function Gd(t,e){if(t==null)return{};var n,r,i=function(s,a){if(s==null)return{};var l={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.indexOf(c)!==-1)continue;l[c]=s[c]}return l}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function ht(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fe(t){return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fe(t)}function Qd(t){var e=function(n,r){if(fe(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r);if(fe(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return fe(e)=="symbol"?e:e+""}function Yd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qd(r.key),r)}}function pt(t,e,n){return e&&Yd(t.prototype,e),n&&Yd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vo(t,e){if(e&&(fe(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(t)}function $t(t){return $t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$t(t)}function Li(t,e){return Li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Li(t,e)}function Ko(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Li(t,e)}function Xt(t,e,n){return(e=Qd(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xd(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(c){return void n(c)}a.done?e(l):Promise.resolve(l).then(r,i)}function Z(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(l){Xd(o,r,i,s,a,"next",l)}function a(l){Xd(o,r,i,s,a,"throw",l)}s(void 0)})}}function Zd(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qe(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,s,a,l,c=[],d=!0,f=!1;try{if(a=(i=i.call(n)).next,r===0){if(Object(i)!==i)return;d=!1}else for(;!(d=(o=a.call(i)).done)&&(c.push(o.value),c.length!==r);d=!0);}catch(h){f=!0,s=h}finally{try{if(!d&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(f)throw s}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Zd(n,r);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zd(n,r):void 0}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Uy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ef,Wo={exports:{}},Ya=function(){if(ef)return Wo.exports;ef=1;var t,e=typeof Reflect=="object"?Reflect:null,n=e&&typeof e.apply=="function"?e.apply:function(g,S,v){return Function.prototype.apply.call(g,S,v)};t=e&&typeof e.ownKeys=="function"?e.ownKeys:Object.getOwnPropertySymbols?function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:function(g){return Object.getOwnPropertyNames(g)};var r=Number.isNaN||function(g){return g!=g};function i(){i.init.call(this)}Wo.exports=i,Wo.exports.once=function(g,S){return new Promise(function(v,w){function k(E){g.removeListener(S,C),w(E)}function C(){typeof g.removeListener=="function"&&g.removeListener("error",k),v([].slice.call(arguments))}y(g,S,C,{once:!0}),S!=="error"&&function(E,A,D){typeof E.on=="function"&&y(E,"error",A,D)}(g,k,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function s(g){if(typeof g!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof g)}function a(g){return g._maxListeners===void 0?i.defaultMaxListeners:g._maxListeners}function l(g,S,v,w){var k,C,E,A;if(s(v),(C=g._events)===void 0?(C=g._events=Object.create(null),g._eventsCount=0):(C.newListener!==void 0&&(g.emit("newListener",S,v.listener?v.listener:v),C=g._events),E=C[S]),E===void 0)E=C[S]=v,++g._eventsCount;else if(typeof E=="function"?E=C[S]=w?[v,E]:[E,v]:w?E.unshift(v):E.push(v),(k=a(g))>0&&E.length>k&&!E.warned){E.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+E.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=g,D.type=S,D.count=E.length,A=D,console&&console.warn&&console.warn(A)}return g}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(g,S,v){var w={fired:!1,wrapFn:void 0,target:g,type:S,listener:v},k=c.bind(w);return k.listener=v,w.wrapFn=k,k}function f(g,S,v){var w=g._events;if(w===void 0)return[];var k=w[S];return k===void 0?[]:typeof k=="function"?v?[k.listener||k]:[k]:v?function(C){for(var E=new Array(C.length),A=0;A<E.length;++A)E[A]=C[A].listener||C[A];return E}(k):b(k,k.length)}function h(g){var S=this._events;if(S!==void 0){var v=S[g];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}function b(g,S){for(var v=new Array(S),w=0;w<S;++w)v[w]=g[w];return v}function y(g,S,v,w){if(typeof g.on=="function")w.once?g.once(S,v):g.on(S,v);else{if(typeof g.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof g);g.addEventListener(S,function k(C){w.once&&g.removeEventListener(S,k),v(C)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(g){if(typeof g!="number"||g<0||r(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");o=g}}),i.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||r(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(g){for(var S=[],v=1;v<arguments.length;v++)S.push(arguments[v]);var w=g==="error",k=this._events;if(k!==void 0)w=w&&k.error===void 0;else if(!w)return!1;if(w){var C;if(S.length>0&&(C=S[0]),C instanceof Error)throw C;var E=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw E.context=C,E}var A=k[g];if(A===void 0)return!1;if(typeof A=="function")n(A,this,S);else{var D=A.length,$=b(A,D);for(v=0;v<D;++v)n($[v],this,S)}return!0},i.prototype.addListener=function(g,S){return l(this,g,S,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(g,S){return l(this,g,S,!0)},i.prototype.once=function(g,S){return s(S),this.on(g,d(this,g,S)),this},i.prototype.prependOnceListener=function(g,S){return s(S),this.prependListener(g,d(this,g,S)),this},i.prototype.removeListener=function(g,S){var v,w,k,C,E;if(s(S),(w=this._events)===void 0)return this;if((v=w[g])===void 0)return this;if(v===S||v.listener===S)--this._eventsCount==0?this._events=Object.create(null):(delete w[g],w.removeListener&&this.emit("removeListener",g,v.listener||S));else if(typeof v!="function"){for(k=-1,C=v.length-1;C>=0;C--)if(v[C]===S||v[C].listener===S){E=v[C].listener,k=C;break}if(k<0)return this;k===0?v.shift():function(A,D){for(;D+1<A.length;D++)A[D]=A[D+1];A.pop()}(v,k),v.length===1&&(w[g]=v[0]),w.removeListener!==void 0&&this.emit("removeListener",g,E||S)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(g){var S,v,w;if((v=this._events)===void 0)return this;if(v.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):v[g]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete v[g]),this;if(arguments.length===0){var k,C=Object.keys(v);for(w=0;w<C.length;++w)(k=C[w])!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(S=v[g])=="function")this.removeListener(g,S);else if(S!==void 0)for(w=S.length-1;w>=0;w--)this.removeListener(g,S[w]);return this},i.prototype.listeners=function(g){return f(this,g,!0)},i.prototype.rawListeners=function(g){return f(this,g,!1)},i.listenerCount=function(g,S){return typeof g.listenerCount=="function"?g.listenerCount(S):h.call(g,S)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},Wo.exports}(),qo=Uy(Ya),tf=Object.prototype.hasOwnProperty;function nf(t,e,n){for(n of t.keys())if(et(n,e))return n}function et(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&et(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if((i=r)&&typeof i=="object"&&!(i=nf(e,i))||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if((i=r[0])&&typeof i=="object"&&!(i=nf(e,i))||!et(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){for(n in r=0,t)if(tf.call(t,n)&&++r&&!tf.call(e,n)||!(n in e)||!et(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!=t&&e!=e}const zy={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},rf={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Pe={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},tt={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Dn={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};let L=class Oi{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),n[0]===10)switch(n[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5))return n[0]===1&&n[1]<6?"Cupcake":n[0]===1&&n[1]>=6?"Donut":n[0]===2&&n[1]<2?"Eclair":n[0]===2&&n[1]===2?"Froyo":n[0]===2&&n[1]>2?"Gingerbread":n[0]===3?"Honeycomb":n[0]===4&&n[1]<1?"Ice Cream Sandwich":n[0]===4&&n[1]<4?"Jelly Bean":n[0]===4&&n[1]>=4?"KitKat":n[0]===5?"Lollipop":n[0]===6?"Marshmallow":n[0]===7?"Nougat":n[0]===8?"Oreo":n[0]===9?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=Oi.getVersionPrecision(e),o=Oi.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=Oi.map([e,n],c=>{const d=s-Oi.getVersionPrecision(c),f=c+new Array(d+1).join(".0");return Oi.map(f.split("."),h=>new Array(20-h.length).join("0")+h).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(a=>{r[a]=s[a]})}return e}static getBrowserAlias(e){return zy[e]}static getBrowserTypeByAlias(e){return rf[e]||""}};const be=/version\/(\d+(\.?_?\d+)+)/i,Hy=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=L.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=L.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=L.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=L.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=L.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=L.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=L.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=L.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=L.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=L.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=L.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=L.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=L.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=L.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=L.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=L.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=L.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=L.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=L.getFirstMatch(be,t)||L.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=L.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=L.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=L.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=L.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=L.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=L.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=L.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=L.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=L.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=L.getFirstMatch(be,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:L.getFirstMatch(e,t),version:L.getSecondMatch(e,t)}}}];var Vy=[{test:[/Roku\/DVP/],describe(t){const e=L.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:tt.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=L.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:tt.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=L.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=L.getWindowsVersionName(e);return{name:tt.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:tt.iOS},n=L.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=L.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=L.getMacOSVersionName(e),r={name:tt.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=L.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:tt.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=L.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=L.getAndroidVersionName(e),r={name:tt.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=L.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:tt.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=L.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||L.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||L.getFirstMatch(/\bbb(\d+)/i,t);return{name:tt.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=L.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:tt.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=L.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:tt.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:tt.Linux})},{test:[/CrOS/],describe:()=>({name:tt.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=L.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:tt.PlayStation4,version:e}}}],Ky=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=L.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Pe.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Pe.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Pe.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Pe.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Pe.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Pe.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Pe.tablet})},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=L.getFirstMatch(/(ipod|iphone)/i,t);return{type:Pe.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Pe.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Pe.mobile})},{test:t=>t.getBrowserName(!0)==="blackberry",describe:()=>({type:Pe.mobile,vendor:"BlackBerry"})},{test:t=>t.getBrowserName(!0)==="bada",describe:()=>({type:Pe.mobile})},{test:t=>t.getBrowserName()==="windows phone",describe:()=>({type:Pe.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe:()=>({type:Pe.tablet})},{test:t=>t.getOSName(!0)==="android",describe:()=>({type:Pe.mobile})},{test:t=>t.getOSName(!0)==="macos",describe:()=>({type:Pe.desktop,vendor:"Apple"})},{test:t=>t.getOSName(!0)==="windows",describe:()=>({type:Pe.desktop})},{test:t=>t.getOSName(!0)==="linux",describe:()=>({type:Pe.desktop})},{test:t=>t.getOSName(!0)==="playstation 4",describe:()=>({type:Pe.tv})},{test:t=>t.getOSName(!0)==="roku",describe:()=>({type:Pe.tv})}],Wy=[{test:t=>t.getBrowserName(!0)==="microsoft edge",describe(t){if(/\sedg\//i.test(t))return{name:Dn.Blink};const e=L.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Dn.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:Dn.Trident},n=L.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:Dn.Presto},n=L.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:Dn.Gecko},n=L.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Dn.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:Dn.WebKit},n=L.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];let of=class{constructor(e,n=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=L.find(Hy,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=L.find(Vy,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=L.find(Ky,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=L.find(Wy,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return L.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(s=>{const a=e[s];typeof a=="string"?(i[s]=a,o+=1):typeof a=="object"&&(n[s]=a,r+=1)}),r>0){const s=Object.keys(n),a=L.find(s,c=>this.isOS(c));if(a){const c=this.satisfies(n[a]);if(c!==void 0)return c}const l=L.find(s,c=>this.isPlatform(c));if(l){const c=this.satisfies(n[l]);if(c!==void 0)return c}}if(o>0){const s=Object.keys(i),a=L.find(s,l=>this.isBrowser(l,!0));if(a!==void 0)return this.compareVersion(i[a])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=L.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(L.compareVersions(o,r,i))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}};/*!
|
|
8
8
|
* Bowser - a browser detector
|
|
9
9
|
* https://github.com/lancedikson/bowser
|
|
10
10
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
11
11
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
12
|
-
*/let
|
|
12
|
+
*/let qy=class{static getParser(e,n=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new of(e,n)}static parse(e){return new of(e).getResult()}static get BROWSER_MAP(){return rf}static get ENGINE_MAP(){return Dn}static get OS_MAP(){return tt}static get PLATFORMS_MAP(){return Pe}};function Jo(){return Date.now()+Math.random().toString()}function Ii(){throw new Error("Method must be implemented in subclass")}function sf(t,e){return e!=null&&e.proxyUrl?e.proxyUrl+(e.proxyUrl.slice(-1)==="/"?"":"/")+t.substring(8):t}function Go(t){return t!=null&&t.callObjectBundleUrlOverride?t.callObjectBundleUrlOverride:sf("https://c.daily.co/call-machine/versioned/".concat("0.84.0","/static/call-machine-object-bundle.js"),t)}function Qo(t){try{new URL(t)}catch{return!1}return!0}const xe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sr="8.55.0",ge=globalThis;function Yo(t,e,n){const r=ge,i=r.__SENTRY__=r.__SENTRY__||{},o=i[sr]=i[sr]||{};return o[t]||(o[t]=e())}const ar=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Xa=["debug","info","warn","error","log","assert","trace"],Xo={};function Ri(t){if(!("console"in ge))return t();const e=ge.console,n={},r=Object.keys(Xo);r.forEach(i=>{const o=Xo[i];n[i]=e[i],e[i]=o});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}const te=Yo("logger",function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return ar?Xa.forEach(n=>{e[n]=(...r)=>{t&&Ri(()=>{ge.console[n](`Sentry Logger [${n}]:`,...r)})}}):Xa.forEach(n=>{e[n]=()=>{}}),e}),lr="?",af=/\(error: (.*)\)/,lf=/captureMessage|captureException/;function Zo(t){return t[t.length-1]||{}}const cf="<anonymous>";function Pn(t){try{return t&&typeof t=="function"&&t.name||cf}catch{return cf}}function uf(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const es={},df={};function cr(t,e){es[t]=es[t]||[],es[t].push(e)}function ur(t,e){if(!df[t]){df[t]=!0;try{e()}catch(n){ar&&te.error(`Error while instrumenting ${t}`,n)}}}function Ft(t,e){const n=t&&es[t];if(n)for(const r of n)try{r(e)}catch(i){ar&&te.error(`Error while triggering instrumentation handler.
|
|
13
13
|
Type: ${t}
|
|
14
14
|
Name: ${Pn(r)}
|
|
15
|
-
Error:`,i)}}let Xa=null;function qy(){Xa=ge.onerror,ge.onerror=function(t,e,n,r,i){return Ft("error",{column:r,error:i,line:n,msg:t,url:e}),!!Xa&&Xa.apply(this,arguments)},ge.onerror.__SENTRY_INSTRUMENTED__=!0}let Za=null;function Jy(){Za=ge.onunhandledrejection,ge.onunhandledrejection=function(t){return Ft("unhandledrejection",t),!Za||Za.apply(this,arguments)},ge.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function ts(){return el(ge),ge}function el(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||or,e[or]=e[or]||{}}const df=Object.prototype.toString;function tl(t){switch(df.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ur(t,Error)}}function Hr(t,e){return df.call(t)===`[object ${e}]`}function ff(t){return Hr(t,"ErrorEvent")}function hf(t){return Hr(t,"DOMError")}function un(t){return Hr(t,"String")}function nl(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function rl(t){return t===null||nl(t)||typeof t!="object"&&typeof t!="function"}function Vr(t){return Hr(t,"Object")}function ns(t){return typeof Event<"u"&&ur(t,Event)}function rs(t){return!!(t&&t.then&&typeof t.then=="function")}function ur(t,e){try{return t instanceof e}catch{return!1}}function pf(t){return!(typeof t!="object"||t===null||!t.__isVue&&!t._isVue)}const il=ge;function gf(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(c=Gy(n,d),!(c==="html"||o>1&&s+i.length*l+c.length>=f));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Gy(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(il.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e&&e.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(i&&i.length)i.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const s=n.className;if(s&&un(s)){const a=s.split(/\s+/);for(const l of a)r.push(`.${l}`)}}const o=["aria-label","type","name","title","alt"];for(const s of o){const a=n.getAttribute(s);a&&r.push(`[${s}="${a}"]`)}return r.join("")}function Wr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function mf(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{pf(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Qy(t,e,n=!1){return!!un(t)&&(Hr(e,"RegExp")?e.test(t):!!un(e)&&(n?t===e:t.includes(e)))}function is(t,e=[],n=!1){return e.some(r=>Qy(t,r,n))}function gt(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&vf(i,r);try{t[e]=i}catch{sr&&te.log(`Failed to replace method "${e}" in object`,t)}}function dr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{sr&&te.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function vf(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,dr(t,"__sentry_original__",e)}catch{}}function ol(t){return t.__sentry_original__}function yf(t){if(tl(t))return{message:t.message,name:t.name,stack:t.stack,...wf(t)};if(ns(t)){const e={type:t.type,target:bf(t.target),currentTarget:bf(t.currentTarget),...wf(t)};return typeof CustomEvent<"u"&&ur(t,CustomEvent)&&(e.detail=t.detail),e}return t}function bf(t){try{return e=t,typeof Element<"u"&&ur(e,Element)?gf(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var e}function wf(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Ct(t){return sl(t,new Map)}function sl(t,e){if(function(n){if(!Vr(n))return!1;try{const r=Object.getPrototypeOf(n).constructor.name;return!r||r==="Object"}catch{return!0}}(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const i of Object.getOwnPropertyNames(t))t[i]!==void 0&&(r[i]=sl(t[i],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(i=>{r.push(sl(i,e))}),r}return t}function Ni(){return Date.now()/1e3}const dn=function(){const{performance:t}=ge;if(!t||!t.now)return Ni;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/1e3}();function Et(){const t=ge,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(15&n())>>r/4).toString(16))}function Sf(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Dn(t){const{message:e,event_id:n}=t;if(e)return e;const r=Sf(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function al(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type="Error")}function Kr(t,e){const n=Sf(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const i={...r&&r.data,...e.data};n.mechanism.data=i}}function kf(t){if(function(e){try{return e.__sentry_captured__}catch{}}(t))return!0;try{dr(t,"__sentry_captured__",!0)}catch{}return!1}var fn;function fr(t){return new Tt(e=>{e(t)})}function os(t){return new Tt((e,n)=>{n(t)})}(()=>{const{performance:t}=ge;!t||!t.now||(t.now(),t.timing&&t.timing.navigationStart)})(),function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(fn||(fn={}));class Tt{constructor(e){Tt.prototype.__init.call(this),Tt.prototype.__init2.call(this),Tt.prototype.__init3.call(this),Tt.prototype.__init4.call(this),this._state=fn.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Tt((r,i)=>{this._handlers.push([!1,o=>{if(e)try{r(e(o))}catch(s){i(s)}else r(o)},o=>{if(n)try{r(n(o))}catch(s){i(s)}else i(o)}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Tt((n,r)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{o?r(i):n(i)})})}__init(){this._resolve=e=>{this._setResult(fn.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(fn.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{this._state===fn.PENDING&&(rs(n)?n.then(this._resolve,this._reject):(this._state=e,this._value=n,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===fn.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===fn.RESOLVED&&n[1](this._value),this._state===fn.REJECTED&&n[2](this._value),n[0]=!0)})}}}function Yy(t){const e=dn(),n={sid:Et(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(r){return Ct({sid:`${r.sid}`,init:r.init,started:new Date(1e3*r.started).toISOString(),timestamp:new Date(1e3*r.timestamp).toISOString(),status:r.status,errors:r.errors,did:typeof r.did=="number"||typeof r.did=="string"?`${r.did}`:void 0,duration:r.duration,abnormal_mechanism:r.abnormal_mechanism,attrs:{release:r.release,environment:r.environment,ip_address:r.ipAddress,user_agent:r.userAgent}})}(n)};return t&&qr(n,t),n}function qr(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||dn(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Et()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function xf(){return Et()}function ll(){return Et().substring(16)}function ss(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&e&&Object.keys(e).length===0)return t;const r={...t};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=ss(r[i],e[i],n-1));return r}const cl="_sentrySpan";function _f(t,e){e?dr(t,cl,e):delete t[cl]}function Cf(t){return t[cl]}class ul{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:xf(),spanId:ll()}}clone(){const e=new ul;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,_f(e,Cf(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&qr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[r,i]=n instanceof Ln?[n.getScopeData(),n.getRequestSession()]:Vr(n)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:l,level:c,fingerprint:d=[],propagationContext:f}=r||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...s},this._contexts={...this._contexts,...l},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),d.length&&(this._fingerprint=d),f&&(this._propagationContext=f),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,_f(this,void 0),this._attachments=[],this.setPropagationContext({traceId:xf()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:100;if(r<=0)return this;const i={timestamp:Ni(),...e};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client&&this._client.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Cf(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ss(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:ll(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:Et();if(!this._client)return te.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureMessage(e,n,r){const i=r&&r.event_id?r.event_id:Et();if(!this._client)return te.warn("No client configured on scope - will not capture message!"),i;const o=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:o,...r,event_id:i},this),i}captureEvent(e,n){const r=n&&n.event_id?n.event_id:Et();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(te.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const Ln=ul;class Xy{constructor(e,n){let r,i;r=e||new Ln,i=n||new Ln,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(i){throw this._popScope(),i}return rs(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Jr(){const t=el(ts());return t.stack=t.stack||new Xy(Yo("defaultCurrentScope",()=>new Ln),Yo("defaultIsolationScope",()=>new Ln))}function Zy(t){return Jr().withScope(t)}function eb(t,e){const n=Jr();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Ef(t){return Jr().withScope(()=>t(Jr().getIsolationScope()))}function dl(t){const e=el(t);return e.acs?e.acs:{withIsolationScope:Ef,withScope:Zy,withSetScope:eb,withSetIsolationScope:(n,r)=>Ef(r),getCurrentScope:()=>Jr().getScope(),getIsolationScope:()=>Jr().getIsolationScope()}}function hr(){return dl(ts()).getCurrentScope()}function $i(){return dl(ts()).getIsolationScope()}function Je(){return hr().getClient()}function tb(t){const e=t.getPropagationContext(),{traceId:n,spanId:r,parentSpanId:i}=e;return Ct({trace_id:n,span_id:r,parent_span_id:i})}function nb(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[r,i]]of e)(n[r]||(n[r]=[])).push(Ct(i));return n}const rb=/^sentry-/;function ib(t){const e=function(r){if(!(!r||!un(r)&&!Array.isArray(r)))return Array.isArray(r)?r.reduce((i,o)=>{const s=Tf(o);return Object.entries(s).forEach(([a,l])=>{i[a]=l}),i},{}):Tf(r)}(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,o])=>(i.match(rb)&&(r[i.slice(7)]=o),r),{});return Object.keys(n).length>0?n:void 0}function Tf(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}let Mf=!1;function ob(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext();return Ct({parent_span_id:r?e:fl(t).parent_span_id,span_id:r?ll():e,trace_id:n})}function Af(t){return typeof t=="number"?Of(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Of(t.getTime()):dn()}function Of(t){return t>9999999999?t/1e3:t}function fl(t){if(function(e){return typeof e.getSpanJSON=="function"}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(r){const i=r;return!!(i.attributes&&i.startTime&&i.name&&i.endTime&&i.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,parentSpanId:a,status:l}=t;return Ct({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Af(i),timestamp:Af(s)||void 0,status:sb(l),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:nb(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function sb(t){if(t&&t.code!==0)return t.code===1?"ok":t.message||"unknown_error"}function Pf(t){return t._sentryRootSpan||t}function ab(){Mf||(Ri(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),Mf=!0)}const hl="production";function Df(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Ct({environment:n.environment||hl,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function lb(t){const e=Je();if(!e)return{};const n=Pf(t),r=n._frozenDsc;if(r)return r;const i=n.spanContext().traceState,o=i&&i.get("sentry.dsc"),s=o&&ib(o);if(s)return s;const a=Df(t.spanContext().traceId,e),l=fl(n),c=l.data||{},d=c["sentry.sample_rate"];d!=null&&(a.sample_rate=`${d}`);const f=c["sentry.source"],h=l.description;return f!=="url"&&h&&(a.transaction=h),function(b){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const y=Je(),m=y&&y.getOptions();return!!m&&(m.enableTracing||"tracesSampleRate"in m||"tracesSampler"in m)}()&&(a.sampled=String(function(b){const{traceFlags:y}=b.spanContext();return y===1}(n))),e.emit("createDsc",a,n),a}const cb=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function as(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function Lf(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function ub(t){const e=typeof t=="string"?function(n){const r=cb.exec(n);if(!r)return void Ri(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[i,o,s="",a="",l="",c=""]=r.slice(1);let d="",f=c;const h=f.split("/");if(h.length>1&&(d=h.slice(0,-1).join("/"),f=h.pop()),f){const b=f.match(/^\d+/);b&&(f=b[0])}return Lf({host:a,pass:s,path:d,projectId:f,port:l,protocol:i,publicKey:o})}(t):Lf(t);if(e&&function(n){if(!sr)return!0;const{port:r,projectId:i,protocol:o}=n;return!(["protocol","publicKey","host","projectId"].find(s=>!n[s]&&(te.error(`Invalid Sentry Dsn: ${s} missing`),!0))||(i.match(/^\d+$/)?function(s){return s==="http"||s==="https"}(o)?r&&isNaN(parseInt(r,10))&&(te.error(`Invalid Sentry Dsn: Invalid port ${r}`),1):(te.error(`Invalid Sentry Dsn: Invalid protocol ${o}`),1):(te.error(`Invalid Sentry Dsn: Invalid projectId ${i}`),1)))}(e))return e}function hn(t,e=100,n=1/0){try{return pl("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function If(t,e=3,n=102400){const r=hn(t,e);return i=r,function(o){return~-encodeURI(o).split(/%..|./).length}(JSON.stringify(i))>n?If(t,e-1,n):r;var i}function pl(t,e,n=1/0,r=1/0,i=function(){const o=typeof WeakSet=="function",s=o?new WeakSet:[];return[function(a){if(o)return!!s.has(a)||(s.add(a),!1);for(let l=0;l<s.length;l++)if(s[l]===a)return!0;return s.push(a),!1},function(a){if(o)s.delete(a);else for(let l=0;l<s.length;l++)if(s[l]===a){s.splice(l,1);break}}]}()){const[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=function(b,y){try{if(b==="domain"&&y&&typeof y=="object"&&y._events)return"[Domain]";if(b==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&y===global)return"[Global]";if(typeof window<"u"&&y===window)return"[Window]";if(typeof document<"u"&&y===document)return"[Document]";if(pf(y))return"[VueViewModel]";if(Vr(m=y)&&"nativeEvent"in m&&"preventDefault"in m&&"stopPropagation"in m)return"[SyntheticEvent]";if(typeof y=="number"&&!Number.isFinite(y))return`[${y}]`;if(typeof y=="function")return`[Function: ${Pn(y)}]`;if(typeof y=="symbol")return`[${String(y)}]`;if(typeof y=="bigint")return`[BigInt: ${String(y)}]`;const S=function(v){const w=Object.getPrototypeOf(v);return w?w.constructor.name:"null prototype"}(y);return/^HTML(\w*)Element$/.test(S)?`[HTMLElement: ${S}]`:`[object ${S}]`}catch(S){return`**non-serializable** (${S})`}var m}(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(o(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{return pl("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const h=yf(e);for(const b in h){if(!Object.prototype.hasOwnProperty.call(h,b))continue;if(f>=r){d[b]="[MaxProperties ~]";break}const y=h[b];d[b]=pl(b,y,l-1,r,i),f++}return s(e),d}function Fi(t,e=[]){return[t,e]}function db(t,e){const[n,r]=t;return[n,[...r,e]]}function Rf(t,e){const n=t[1];for(const r of n)if(e(r,r[0].type))return!0;return!1}function gl(t){return ge.__SENTRY__&&ge.__SENTRY__.encodePolyfill?ge.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function fb(t){const[e,n]=t;let r=JSON.stringify(e);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[gl(r),o]:r.push(typeof o=="string"?gl(o):o)}for(const o of n){const[s,a]=o;if(i(`
|
|
15
|
+
Error:`,i)}}let Za=null;function Jy(){Za=ge.onerror,ge.onerror=function(t,e,n,r,i){return Ft("error",{column:r,error:i,line:n,msg:t,url:e}),!!Za&&Za.apply(this,arguments)},ge.onerror.__SENTRY_INSTRUMENTED__=!0}let el=null;function Gy(){el=ge.onunhandledrejection,ge.onunhandledrejection=function(t){return Ft("unhandledrejection",t),!el||el.apply(this,arguments)},ge.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function ts(){return tl(ge),ge}function tl(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||sr,e[sr]=e[sr]||{}}const ff=Object.prototype.toString;function nl(t){switch(ff.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return dr(t,Error)}}function Hr(t,e){return ff.call(t)===`[object ${e}]`}function hf(t){return Hr(t,"ErrorEvent")}function pf(t){return Hr(t,"DOMError")}function un(t){return Hr(t,"String")}function rl(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function il(t){return t===null||rl(t)||typeof t!="object"&&typeof t!="function"}function Vr(t){return Hr(t,"Object")}function ns(t){return typeof Event<"u"&&dr(t,Event)}function rs(t){return!!(t&&t.then&&typeof t.then=="function")}function dr(t,e){try{return t instanceof e}catch{return!1}}function gf(t){return!(typeof t!="object"||t===null||!t.__isVue&&!t._isVue)}const ol=ge;function mf(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(c=Qy(n,d),!(c==="html"||o>1&&s+i.length*l+c.length>=f));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Qy(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(ol.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e&&e.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(i&&i.length)i.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const s=n.className;if(s&&un(s)){const a=s.split(/\s+/);for(const l of a)r.push(`.${l}`)}}const o=["aria-label","type","name","title","alt"];for(const s of o){const a=n.getAttribute(s);a&&r.push(`[${s}="${a}"]`)}return r.join("")}function Kr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function vf(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{gf(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Yy(t,e,n=!1){return!!un(t)&&(Hr(e,"RegExp")?e.test(t):!!un(e)&&(n?t===e:t.includes(e)))}function is(t,e=[],n=!1){return e.some(r=>Yy(t,r,n))}function gt(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&yf(i,r);try{t[e]=i}catch{ar&&te.log(`Failed to replace method "${e}" in object`,t)}}function fr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{ar&&te.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function yf(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,fr(t,"__sentry_original__",e)}catch{}}function sl(t){return t.__sentry_original__}function bf(t){if(nl(t))return{message:t.message,name:t.name,stack:t.stack,...Sf(t)};if(ns(t)){const e={type:t.type,target:wf(t.target),currentTarget:wf(t.currentTarget),...Sf(t)};return typeof CustomEvent<"u"&&dr(t,CustomEvent)&&(e.detail=t.detail),e}return t}function wf(t){try{return e=t,typeof Element<"u"&&dr(e,Element)?mf(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var e}function Sf(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Ct(t){return al(t,new Map)}function al(t,e){if(function(n){if(!Vr(n))return!1;try{const r=Object.getPrototypeOf(n).constructor.name;return!r||r==="Object"}catch{return!0}}(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const i of Object.getOwnPropertyNames(t))t[i]!==void 0&&(r[i]=al(t[i],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(i=>{r.push(al(i,e))}),r}return t}function Ni(){return Date.now()/1e3}const dn=function(){const{performance:t}=ge;if(!t||!t.now)return Ni;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/1e3}();function Et(){const t=ge,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(15&n())>>r/4).toString(16))}function kf(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Ln(t){const{message:e,event_id:n}=t;if(e)return e;const r=kf(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ll(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type="Error")}function Wr(t,e){const n=kf(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const i={...r&&r.data,...e.data};n.mechanism.data=i}}function xf(t){if(function(e){try{return e.__sentry_captured__}catch{}}(t))return!0;try{fr(t,"__sentry_captured__",!0)}catch{}return!1}var fn;function hr(t){return new Tt(e=>{e(t)})}function os(t){return new Tt((e,n)=>{n(t)})}(()=>{const{performance:t}=ge;!t||!t.now||(t.now(),t.timing&&t.timing.navigationStart)})(),function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(fn||(fn={}));class Tt{constructor(e){Tt.prototype.__init.call(this),Tt.prototype.__init2.call(this),Tt.prototype.__init3.call(this),Tt.prototype.__init4.call(this),this._state=fn.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Tt((r,i)=>{this._handlers.push([!1,o=>{if(e)try{r(e(o))}catch(s){i(s)}else r(o)},o=>{if(n)try{r(n(o))}catch(s){i(s)}else i(o)}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Tt((n,r)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{o?r(i):n(i)})})}__init(){this._resolve=e=>{this._setResult(fn.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(fn.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{this._state===fn.PENDING&&(rs(n)?n.then(this._resolve,this._reject):(this._state=e,this._value=n,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===fn.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===fn.RESOLVED&&n[1](this._value),this._state===fn.REJECTED&&n[2](this._value),n[0]=!0)})}}}function Xy(t){const e=dn(),n={sid:Et(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(r){return Ct({sid:`${r.sid}`,init:r.init,started:new Date(1e3*r.started).toISOString(),timestamp:new Date(1e3*r.timestamp).toISOString(),status:r.status,errors:r.errors,did:typeof r.did=="number"||typeof r.did=="string"?`${r.did}`:void 0,duration:r.duration,abnormal_mechanism:r.abnormal_mechanism,attrs:{release:r.release,environment:r.environment,ip_address:r.ipAddress,user_agent:r.userAgent}})}(n)};return t&&qr(n,t),n}function qr(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||dn(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Et()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function _f(){return Et()}function cl(){return Et().substring(16)}function ss(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&e&&Object.keys(e).length===0)return t;const r={...t};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=ss(r[i],e[i],n-1));return r}const ul="_sentrySpan";function Cf(t,e){e?fr(t,ul,e):delete t[ul]}function Ef(t){return t[ul]}class dl{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:_f(),spanId:cl()}}clone(){const e=new dl;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Cf(e,Ef(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&qr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[r,i]=n instanceof In?[n.getScopeData(),n.getRequestSession()]:Vr(n)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:l,level:c,fingerprint:d=[],propagationContext:f}=r||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...s},this._contexts={...this._contexts,...l},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),d.length&&(this._fingerprint=d),f&&(this._propagationContext=f),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Cf(this,void 0),this._attachments=[],this.setPropagationContext({traceId:_f()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:100;if(r<=0)return this;const i={timestamp:Ni(),...e};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client&&this._client.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Ef(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ss(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:cl(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:Et();if(!this._client)return te.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureMessage(e,n,r){const i=r&&r.event_id?r.event_id:Et();if(!this._client)return te.warn("No client configured on scope - will not capture message!"),i;const o=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:o,...r,event_id:i},this),i}captureEvent(e,n){const r=n&&n.event_id?n.event_id:Et();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(te.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const In=dl;class Zy{constructor(e,n){let r,i;r=e||new In,i=n||new In,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(i){throw this._popScope(),i}return rs(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Jr(){const t=tl(ts());return t.stack=t.stack||new Zy(Yo("defaultCurrentScope",()=>new In),Yo("defaultIsolationScope",()=>new In))}function eb(t){return Jr().withScope(t)}function tb(t,e){const n=Jr();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Tf(t){return Jr().withScope(()=>t(Jr().getIsolationScope()))}function fl(t){const e=tl(t);return e.acs?e.acs:{withIsolationScope:Tf,withScope:eb,withSetScope:tb,withSetIsolationScope:(n,r)=>Tf(r),getCurrentScope:()=>Jr().getScope(),getIsolationScope:()=>Jr().getIsolationScope()}}function pr(){return fl(ts()).getCurrentScope()}function $i(){return fl(ts()).getIsolationScope()}function Je(){return pr().getClient()}function nb(t){const e=t.getPropagationContext(),{traceId:n,spanId:r,parentSpanId:i}=e;return Ct({trace_id:n,span_id:r,parent_span_id:i})}function rb(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[r,i]]of e)(n[r]||(n[r]=[])).push(Ct(i));return n}const ib=/^sentry-/;function ob(t){const e=function(r){if(!(!r||!un(r)&&!Array.isArray(r)))return Array.isArray(r)?r.reduce((i,o)=>{const s=Mf(o);return Object.entries(s).forEach(([a,l])=>{i[a]=l}),i},{}):Mf(r)}(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,o])=>(i.match(ib)&&(r[i.slice(7)]=o),r),{});return Object.keys(n).length>0?n:void 0}function Mf(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}let Af=!1;function sb(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext();return Ct({parent_span_id:r?e:hl(t).parent_span_id,span_id:r?cl():e,trace_id:n})}function Of(t){return typeof t=="number"?Df(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Df(t.getTime()):dn()}function Df(t){return t>9999999999?t/1e3:t}function hl(t){if(function(e){return typeof e.getSpanJSON=="function"}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(r){const i=r;return!!(i.attributes&&i.startTime&&i.name&&i.endTime&&i.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,parentSpanId:a,status:l}=t;return Ct({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Of(i),timestamp:Of(s)||void 0,status:ab(l),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:rb(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function ab(t){if(t&&t.code!==0)return t.code===1?"ok":t.message||"unknown_error"}function Pf(t){return t._sentryRootSpan||t}function lb(){Af||(Ri(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),Af=!0)}const pl="production";function Lf(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Ct({environment:n.environment||pl,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function cb(t){const e=Je();if(!e)return{};const n=Pf(t),r=n._frozenDsc;if(r)return r;const i=n.spanContext().traceState,o=i&&i.get("sentry.dsc"),s=o&&ob(o);if(s)return s;const a=Lf(t.spanContext().traceId,e),l=hl(n),c=l.data||{},d=c["sentry.sample_rate"];d!=null&&(a.sample_rate=`${d}`);const f=c["sentry.source"],h=l.description;return f!=="url"&&h&&(a.transaction=h),function(b){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const y=Je(),g=y&&y.getOptions();return!!g&&(g.enableTracing||"tracesSampleRate"in g||"tracesSampler"in g)}()&&(a.sampled=String(function(b){const{traceFlags:y}=b.spanContext();return y===1}(n))),e.emit("createDsc",a,n),a}const ub=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function as(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function If(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function db(t){const e=typeof t=="string"?function(n){const r=ub.exec(n);if(!r)return void Ri(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[i,o,s="",a="",l="",c=""]=r.slice(1);let d="",f=c;const h=f.split("/");if(h.length>1&&(d=h.slice(0,-1).join("/"),f=h.pop()),f){const b=f.match(/^\d+/);b&&(f=b[0])}return If({host:a,pass:s,path:d,projectId:f,port:l,protocol:i,publicKey:o})}(t):If(t);if(e&&function(n){if(!ar)return!0;const{port:r,projectId:i,protocol:o}=n;return!(["protocol","publicKey","host","projectId"].find(s=>!n[s]&&(te.error(`Invalid Sentry Dsn: ${s} missing`),!0))||(i.match(/^\d+$/)?function(s){return s==="http"||s==="https"}(o)?r&&isNaN(parseInt(r,10))&&(te.error(`Invalid Sentry Dsn: Invalid port ${r}`),1):(te.error(`Invalid Sentry Dsn: Invalid protocol ${o}`),1):(te.error(`Invalid Sentry Dsn: Invalid projectId ${i}`),1)))}(e))return e}function hn(t,e=100,n=1/0){try{return gl("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Rf(t,e=3,n=102400){const r=hn(t,e);return i=r,function(o){return~-encodeURI(o).split(/%..|./).length}(JSON.stringify(i))>n?Rf(t,e-1,n):r;var i}function gl(t,e,n=1/0,r=1/0,i=function(){const o=typeof WeakSet=="function",s=o?new WeakSet:[];return[function(a){if(o)return!!s.has(a)||(s.add(a),!1);for(let l=0;l<s.length;l++)if(s[l]===a)return!0;return s.push(a),!1},function(a){if(o)s.delete(a);else for(let l=0;l<s.length;l++)if(s[l]===a){s.splice(l,1);break}}]}()){const[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=function(b,y){try{if(b==="domain"&&y&&typeof y=="object"&&y._events)return"[Domain]";if(b==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&y===global)return"[Global]";if(typeof window<"u"&&y===window)return"[Window]";if(typeof document<"u"&&y===document)return"[Document]";if(gf(y))return"[VueViewModel]";if(Vr(g=y)&&"nativeEvent"in g&&"preventDefault"in g&&"stopPropagation"in g)return"[SyntheticEvent]";if(typeof y=="number"&&!Number.isFinite(y))return`[${y}]`;if(typeof y=="function")return`[Function: ${Pn(y)}]`;if(typeof y=="symbol")return`[${String(y)}]`;if(typeof y=="bigint")return`[BigInt: ${String(y)}]`;const S=function(v){const w=Object.getPrototypeOf(v);return w?w.constructor.name:"null prototype"}(y);return/^HTML(\w*)Element$/.test(S)?`[HTMLElement: ${S}]`:`[object ${S}]`}catch(S){return`**non-serializable** (${S})`}var g}(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(o(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{return gl("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const h=bf(e);for(const b in h){if(!Object.prototype.hasOwnProperty.call(h,b))continue;if(f>=r){d[b]="[MaxProperties ~]";break}const y=h[b];d[b]=gl(b,y,l-1,r,i),f++}return s(e),d}function Fi(t,e=[]){return[t,e]}function fb(t,e){const[n,r]=t;return[n,[...r,e]]}function Nf(t,e){const n=t[1];for(const r of n)if(e(r,r[0].type))return!0;return!1}function ml(t){return ge.__SENTRY__&&ge.__SENTRY__.encodePolyfill?ge.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function hb(t){const[e,n]=t;let r=JSON.stringify(e);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[ml(r),o]:r.push(typeof o=="string"?ml(o):o)}for(const o of n){const[s,a]=o;if(i(`
|
|
16
16
|
${JSON.stringify(s)}
|
|
17
|
-
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(hn(a))}i(l)}}return typeof r=="string"?r:function(o){const s=o.reduce((c,d)=>c+d.length,0),a=new Uint8Array(s);let l=0;for(const c of o)a.set(c,l),l+=c.length;return a}(r)}function hb(t){const e=typeof t.data=="string"?gl(t.data):t.data;return[Ct({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const pb={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket",raw_security:"security"};function Nf(t){return pb[t]}function $f(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function gb(t,e,n,r){const i=$f(n),o=t.type&&t.type!=="replay_event"?t.type:"event";(function(a,l){l&&(a.sdk=a.sdk||{},a.sdk.name=a.sdk.name||l.name,a.sdk.version=a.sdk.version||l.version,a.sdk.integrations=[...a.sdk.integrations||[],...l.integrations||[]],a.sdk.packages=[...a.sdk.packages||[],...l.packages||[]])})(t,n&&n.sdk);const s=function(a,l,c,d){const f=a.sdkProcessingMetadata&&a.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:a.event_id,sent_at:new Date().toISOString(),...l&&{sdk:l},...!!c&&d&&{dsn:as(d)},...f&&{trace:Ct({...f})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Fi(s,[[{type:o},t]])}function ml(t,e,n,r=0){return new Tt((i,o)=>{const s=t[r];if(e===null||typeof s!="function")i(e);else{const a=s({...e},n);xe&&s.id&&a===null&&te.log(`Event processor "${s.id}" dropped event`),rs(a)?a.then(l=>ml(t,l,n,r+1).then(i)).then(null,o):ml(t,a,n,r+1).then(i).then(null,o)}})}let ls,Ff,vl;function mb(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;(function(s,a){const{extra:l,tags:c,user:d,contexts:f,level:h,transactionName:b}=a,y=Ct(l);y&&Object.keys(y).length&&(s.extra={...y,...s.extra});const m=Ct(c);m&&Object.keys(m).length&&(s.tags={...m,...s.tags});const S=Ct(d);S&&Object.keys(S).length&&(s.user={...S,...s.user});const v=Ct(f);v&&Object.keys(v).length&&(s.contexts={...v,...s.contexts}),h&&(s.level=h),b&&s.type!=="transaction"&&(s.transaction=b)})(t,e),r&&function(s,a){s.contexts={trace:ob(a),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:lb(a),...s.sdkProcessingMetadata};const l=Pf(a),c=fl(l).description;c&&!s.transaction&&s.type==="transaction"&&(s.transaction=c)}(t,r),function(s,a){s.fingerprint=s.fingerprint?Array.isArray(s.fingerprint)?s.fingerprint:[s.fingerprint]:[],a&&(s.fingerprint=s.fingerprint.concat(a)),s.fingerprint&&!s.fingerprint.length&&delete s.fingerprint}(t,n),function(s,a){const l=[...s.breadcrumbs||[],...a];s.breadcrumbs=l.length?l:void 0}(t,i),function(s,a){s.sdkProcessingMetadata={...s.sdkProcessingMetadata,...a}}(t,o)}function Bf(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:d,attachments:f,propagationContext:h,transactionName:b,span:y}=e;cs(t,"extra",n),cs(t,"tags",r),cs(t,"user",i),cs(t,"contexts",o),t.sdkProcessingMetadata=ss(t.sdkProcessingMetadata,a,2),s&&(t.level=s),b&&(t.transactionName=b),y&&(t.span=y),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),c.length&&(t.fingerprint=[...t.fingerprint,...c]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,...h}}function cs(t,e,n){t[e]=ss(t[e],n,1)}function vb(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Et(),timestamp:e.timestamp||Ni()},c=n.integrations||t.integrations.map(y=>y.name);(function(y,m){const{environment:S,release:v,dist:w,maxValueLength:k=250}=m;y.environment=y.environment||S||hl,!y.release&&v&&(y.release=v),!y.dist&&w&&(y.dist=w),y.message&&(y.message=Wr(y.message,k));const C=y.exception&&y.exception.values&&y.exception.values[0];C&&C.value&&(C.value=Wr(C.value,k));const T=y.request;T&&T.url&&(T.url=Wr(T.url,k))})(l,t),function(y,m){m.length>0&&(y.sdk=y.sdk||{},y.sdk.integrations=[...y.sdk.integrations||[],...m])}(l,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&function(y,m){const S=function(v){const w=ge._sentryDebugIds;if(!w)return{};const k=Object.keys(w);return vl&&k.length===Ff||(Ff=k.length,vl=k.reduce((C,T)=>{ls||(ls={});const O=ls[T];if(O)C[O[0]]=O[1];else{const P=v(T);for(let $=P.length-1;$>=0;$--){const X=P[$],V=X&&X.filename,B=w[T];if(V&&B){C[V]=B,ls[T]=[V,B];break}}}return C},{})),vl}(m);try{y.exception.values.forEach(v=>{v.stacktrace.frames.forEach(w=>{S&&w.filename&&(w.debug_id=S[w.filename])})})}catch{}}(l,t.stackParser);const d=function(y,m){if(!m)return y;const S=y?y.clone():new Ln;return S.update(m),S}(r,n.captureContext);n.mechanism&&Kr(l,n.mechanism);const f=i?i.getEventProcessors():[],h=Yo("globalScope",()=>new Ln).getScopeData();o&&Bf(h,o.getScopeData()),d&&Bf(h,d.getScopeData());const b=[...n.attachments||[],...h.attachments];return b.length&&(n.attachments=b),mb(l,h),ml([...f,...h.eventProcessors],l,n).then(y=>(y&&function(m){const S={};try{m.exception.values.forEach(w=>{w.stacktrace.frames.forEach(k=>{k.debug_id&&(k.abs_path?S[k.abs_path]=k.debug_id:k.filename&&(S[k.filename]=k.debug_id),delete k.debug_id)})})}catch{}if(Object.keys(S).length===0)return;m.debug_meta=m.debug_meta||{},m.debug_meta.images=m.debug_meta.images||[];const v=m.debug_meta.images;Object.entries(S).forEach(([w,k])=>{v.push({type:"sourcemap",code_file:w,debug_id:k})})}(y),typeof s=="number"&&s>0?function(m,S,v){if(!m)return null;const w={...m,...m.breadcrumbs&&{breadcrumbs:m.breadcrumbs.map(k=>({...k,...k.data&&{data:hn(k.data,S,v)}}))},...m.user&&{user:hn(m.user,S,v)},...m.contexts&&{contexts:hn(m.contexts,S,v)},...m.extra&&{extra:hn(m.extra,S,v)}};return m.contexts&&m.contexts.trace&&w.contexts&&(w.contexts.trace=m.contexts.trace,m.contexts.trace.data&&(w.contexts.trace.data=hn(m.contexts.trace.data,S,v))),m.spans&&(w.spans=m.spans.map(k=>({...k,...k.data&&{data:hn(k.data,S,v)}}))),m.contexts&&m.contexts.flags&&w.contexts&&(w.contexts.flags=hn(m.contexts.flags,3,v)),w}(y,s,a):y))}function Vx(t){}function jf(t,e){return hr().captureEvent(t,e)}function Uf(t){const e=Je(),n=$i(),r=hr(),{release:i,environment:o=hl}=e&&e.getOptions()||{},{userAgent:s}=ge.navigator||{},a=Yy({release:i,environment:o,user:r.getUser()||n.getUser(),...s&&{userAgent:s},...t}),l=n.getSession();return l&&l.status==="ok"&&qr(l,{status:"exited"}),zf(),n.setSession(a),r.setSession(a),a}function zf(){const t=$i(),e=hr(),n=e.getSession()||t.getSession();n&&function(r,i){let o={};r.status==="ok"&&(o={status:"exited"}),qr(r,o)}(n),Hf(),t.setSession(),e.setSession()}function Hf(){const t=$i(),e=hr(),n=Je(),r=e.getSession()||t.getSession();r&&n&&n.captureSession(r)}function Vf(t=!1){t?zf():Hf()}function yb(t,e,n){return e||`${function(r){return`${function(i){const o=i.protocol?`${i.protocol}:`:"",s=i.port?`:${i.port}`:"";return`${o}//${i.host}${s}${i.path?`/${i.path}`:""}/api/`}(r)}${r.projectId}/envelope/`}(t)}?${function(r,i){const o={sentry_version:"7"};return r.publicKey&&(o.sentry_key=r.publicKey),i&&(o.sentry_client=`${i.name}/${i.version}`),new URLSearchParams(o).toString()}(t,n)}`}const Wf=[];function Kf(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function qf(t,e,n){if(n[e.name])xe&&te.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,Wf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Wf.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>r(i,o,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((o,s)=>r(o,s,t),{id:e.name});t.addEventProcessor(i)}xe&&te.log(`Integration installed: ${e.name}`)}}class Bt extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const Jf="Not capturing exception because it's already been captured.";class bb{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=ub(e.dsn):xe&&te.warn("No DSN provided, client will not send events."),this._dsn){const r=yb(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}const n=["enableTracing","tracesSampleRate","tracesSampler"].find(r=>r in e&&e[r]==null);n&&Ri(()=>{console.warn(`[Sentry] Deprecation warning: \`${n}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.`)})}captureException(e,n,r){const i=Et();if(kf(e))return xe&&te.log(Jf),i;const o={event_id:i,...n};return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,r))),o.event_id}captureMessage(e,n,r,i){const o={event_id:Et(),...r},s=nl(e)?e:String(e),a=rl(e)?this.eventFromMessage(s,n,o):this.eventFromException(e,o);return this._process(a.then(l=>this._captureEvent(l,o,i))),o.event_id}captureEvent(e,n,r){const i=Et();if(n&&n.originalException&&kf(n.originalException))return xe&&te.log(Jf),i;const o={event_id:i,...n},s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,o,s||r)),o.event_id}captureSession(e){typeof e.release!="string"?xe&&te.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),qr(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(i=>r&&i))):fr(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];qf(this,e,this._integrations),n||Kf(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=gb(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])r=db(r,hb(o));const i=this.sendEnvelope(r);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){const n=function(r,i,o,s){const a=$f(o);return Fi({sent_at:new Date().toISOString(),...a&&{sdk:a},...!!s&&i&&{dsn:as(i)}},["aggregates"in r?[{type:"sessions"},r]:[{type:"session"},r.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){const i=typeof r=="number"?r:1,o=`${e}:${n}`;xe&&te.log(`Recording outcome: "${o}"${i>1?` (${i} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+i}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const i=r.indexOf(n);i>-1&&r.splice(i,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(i=>i(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(xe&&te.error("Error while sending envelope:",n),n)):(xe&&te.error("Transport disabled"),fr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(n,r){const i={};return r.forEach(o=>{o&&qf(n,o,i)}),i}(this,e),Kf(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",i=!1;const o=n.exception&&n.exception.values;if(o){i=!0;for(const a of o){const l=a.mechanism;if(l&&l.handled===!1){r=!0;break}}}const s=e.status==="ok";(s&&e.errors===0||s&&r)&&(qr(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Tt(n=>{let r=0;const i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=1,e&&r>=e&&(clearInterval(i),n(!1)))},1)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r=hr(),i=$i()){const o=this.getOptions(),s=Object.keys(this._integrations);return!n.integrations&&s.length>0&&(n.integrations=s),this.emit("preprocessEvent",e,n),e.type||i.setLastEventId(e.event_id||n.event_id),vb(o,e,n,r,this,i).then(a=>{if(a===null)return a;a.contexts={trace:tb(r),...a.contexts};const l=function(c,d){const f=d.getPropagationContext();return f.dsc||Df(f.traceId,c)}(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(i=>i.event_id,i=>{xe&&(i instanceof Bt&&i.logLevel==="log"?te.log(i.message):te.warn(i))})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Qf(e),a=Gf(e),l=e.type||"error",c=`before send for type \`${l}\``,d=o===void 0?void 0:function(b){if(typeof b=="boolean")return Number(b);const y=typeof b=="string"?parseFloat(b):b;if(!(typeof y!="number"||isNaN(y)||y<0||y>1))return y;xe&&te.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(b)} of type ${JSON.stringify(typeof b)}.`)}(o);if(a&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),os(new Bt(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const f=l==="replay_event"?"replay":l,h=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,h).then(b=>{if(b===null)throw this.recordDroppedEvent("event_processor",f,e),new Bt("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return b;const y=function(m,S,v,w){const{beforeSend:k,beforeSendTransaction:C,beforeSendSpan:T}=S;if(Gf(v)&&k)return k(v,w);if(Qf(v)){if(v.spans&&T){const O=[];for(const P of v.spans){const $=T(P);$?O.push($):(ab(),m.recordDroppedEvent("before_send","span"))}v.spans=O}if(C){if(v.spans){const O=v.spans.length;v.sdkProcessingMetadata={...v.sdkProcessingMetadata,spanCountBeforeProcessing:O}}return C(v,w)}}return v}(this,i,b,n);return function(m,S){const v=`${S} must return \`null\` or a valid event.`;if(rs(m))return m.then(w=>{if(!Vr(w)&&w!==null)throw new Bt(v);return w},w=>{throw new Bt(`${S} rejected with ${w}`)});if(!Vr(m)&&m!==null)throw new Bt(v);return m}(y,c)}).then(b=>{if(b===null){if(this.recordDroppedEvent("before_send",f,e),s){const S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw new Bt(`${c} returned \`null\`, will not send event.`,"log")}const y=r&&r.getSession();if(!s&&y&&this._updateSessionFromEvent(y,b),s){const S=(b.sdkProcessingMetadata&&b.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(b.spans?b.spans.length:0);S>0&&this.recordDroppedEvent("before_send","span",S)}const m=b.transaction_info;if(s&&m&&b.transaction!==e.transaction){const S="custom";b.transaction_info={...m,source:S}}return this.sendEvent(b,n),b}).then(null,b=>{throw b instanceof Bt?b:(this.captureException(b,{data:{__sentry__:!0},originalException:b}),new Bt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
18
|
-
Reason: ${b}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[i,o]=n.split(":");return{reason:i,category:o,quantity:r}})}_flushOutcomes(){xe&&te.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0)return void(xe&&te.log("No outcomes to send"));if(!this._dsn)return void(xe&&te.log("No dsn provided, will not send outcomes"));xe&&te.log("Sending outcomes:",e);const n=(r=e,Fi((i=this._options.tunnel&&as(this._dsn))?{dsn:i}:{},[[{type:"client_report"},{timestamp:o||Ni(),discarded_events:r}]]));var r,i,o;this.sendEnvelope(n)}}function
|
|
19
|
-
Event: ${
|
|
20
|
-
Event: ${
|
|
21
|
-
Event: ${
|
|
22
|
-
Event: ${
|
|
23
|
-
Event: ${
|
|
17
|
+
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(hn(a))}i(l)}}return typeof r=="string"?r:function(o){const s=o.reduce((c,d)=>c+d.length,0),a=new Uint8Array(s);let l=0;for(const c of o)a.set(c,l),l+=c.length;return a}(r)}function pb(t){const e=typeof t.data=="string"?ml(t.data):t.data;return[Ct({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const gb={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket",raw_security:"security"};function $f(t){return gb[t]}function Ff(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function mb(t,e,n,r){const i=Ff(n),o=t.type&&t.type!=="replay_event"?t.type:"event";(function(a,l){l&&(a.sdk=a.sdk||{},a.sdk.name=a.sdk.name||l.name,a.sdk.version=a.sdk.version||l.version,a.sdk.integrations=[...a.sdk.integrations||[],...l.integrations||[]],a.sdk.packages=[...a.sdk.packages||[],...l.packages||[]])})(t,n&&n.sdk);const s=function(a,l,c,d){const f=a.sdkProcessingMetadata&&a.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:a.event_id,sent_at:new Date().toISOString(),...l&&{sdk:l},...!!c&&d&&{dsn:as(d)},...f&&{trace:Ct({...f})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Fi(s,[[{type:o},t]])}function vl(t,e,n,r=0){return new Tt((i,o)=>{const s=t[r];if(e===null||typeof s!="function")i(e);else{const a=s({...e},n);xe&&s.id&&a===null&&te.log(`Event processor "${s.id}" dropped event`),rs(a)?a.then(l=>vl(t,l,n,r+1).then(i)).then(null,o):vl(t,a,n,r+1).then(i).then(null,o)}})}let ls,Bf,yl;function vb(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;(function(s,a){const{extra:l,tags:c,user:d,contexts:f,level:h,transactionName:b}=a,y=Ct(l);y&&Object.keys(y).length&&(s.extra={...y,...s.extra});const g=Ct(c);g&&Object.keys(g).length&&(s.tags={...g,...s.tags});const S=Ct(d);S&&Object.keys(S).length&&(s.user={...S,...s.user});const v=Ct(f);v&&Object.keys(v).length&&(s.contexts={...v,...s.contexts}),h&&(s.level=h),b&&s.type!=="transaction"&&(s.transaction=b)})(t,e),r&&function(s,a){s.contexts={trace:sb(a),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:cb(a),...s.sdkProcessingMetadata};const l=Pf(a),c=hl(l).description;c&&!s.transaction&&s.type==="transaction"&&(s.transaction=c)}(t,r),function(s,a){s.fingerprint=s.fingerprint?Array.isArray(s.fingerprint)?s.fingerprint:[s.fingerprint]:[],a&&(s.fingerprint=s.fingerprint.concat(a)),s.fingerprint&&!s.fingerprint.length&&delete s.fingerprint}(t,n),function(s,a){const l=[...s.breadcrumbs||[],...a];s.breadcrumbs=l.length?l:void 0}(t,i),function(s,a){s.sdkProcessingMetadata={...s.sdkProcessingMetadata,...a}}(t,o)}function jf(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:d,attachments:f,propagationContext:h,transactionName:b,span:y}=e;cs(t,"extra",n),cs(t,"tags",r),cs(t,"user",i),cs(t,"contexts",o),t.sdkProcessingMetadata=ss(t.sdkProcessingMetadata,a,2),s&&(t.level=s),b&&(t.transactionName=b),y&&(t.span=y),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),c.length&&(t.fingerprint=[...t.fingerprint,...c]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,...h}}function cs(t,e,n){t[e]=ss(t[e],n,1)}function yb(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Et(),timestamp:e.timestamp||Ni()},c=n.integrations||t.integrations.map(y=>y.name);(function(y,g){const{environment:S,release:v,dist:w,maxValueLength:k=250}=g;y.environment=y.environment||S||pl,!y.release&&v&&(y.release=v),!y.dist&&w&&(y.dist=w),y.message&&(y.message=Kr(y.message,k));const C=y.exception&&y.exception.values&&y.exception.values[0];C&&C.value&&(C.value=Kr(C.value,k));const E=y.request;E&&E.url&&(E.url=Kr(E.url,k))})(l,t),function(y,g){g.length>0&&(y.sdk=y.sdk||{},y.sdk.integrations=[...y.sdk.integrations||[],...g])}(l,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&function(y,g){const S=function(v){const w=ge._sentryDebugIds;if(!w)return{};const k=Object.keys(w);return yl&&k.length===Bf||(Bf=k.length,yl=k.reduce((C,E)=>{ls||(ls={});const A=ls[E];if(A)C[A[0]]=A[1];else{const D=v(E);for(let $=D.length-1;$>=0;$--){const X=D[$],V=X&&X.filename,B=w[E];if(V&&B){C[V]=B,ls[E]=[V,B];break}}}return C},{})),yl}(g);try{y.exception.values.forEach(v=>{v.stacktrace.frames.forEach(w=>{S&&w.filename&&(w.debug_id=S[w.filename])})})}catch{}}(l,t.stackParser);const d=function(y,g){if(!g)return y;const S=y?y.clone():new In;return S.update(g),S}(r,n.captureContext);n.mechanism&&Wr(l,n.mechanism);const f=i?i.getEventProcessors():[],h=Yo("globalScope",()=>new In).getScopeData();o&&jf(h,o.getScopeData()),d&&jf(h,d.getScopeData());const b=[...n.attachments||[],...h.attachments];return b.length&&(n.attachments=b),vb(l,h),vl([...f,...h.eventProcessors],l,n).then(y=>(y&&function(g){const S={};try{g.exception.values.forEach(w=>{w.stacktrace.frames.forEach(k=>{k.debug_id&&(k.abs_path?S[k.abs_path]=k.debug_id:k.filename&&(S[k.filename]=k.debug_id),delete k.debug_id)})})}catch{}if(Object.keys(S).length===0)return;g.debug_meta=g.debug_meta||{},g.debug_meta.images=g.debug_meta.images||[];const v=g.debug_meta.images;Object.entries(S).forEach(([w,k])=>{v.push({type:"sourcemap",code_file:w,debug_id:k})})}(y),typeof s=="number"&&s>0?function(g,S,v){if(!g)return null;const w={...g,...g.breadcrumbs&&{breadcrumbs:g.breadcrumbs.map(k=>({...k,...k.data&&{data:hn(k.data,S,v)}}))},...g.user&&{user:hn(g.user,S,v)},...g.contexts&&{contexts:hn(g.contexts,S,v)},...g.extra&&{extra:hn(g.extra,S,v)}};return g.contexts&&g.contexts.trace&&w.contexts&&(w.contexts.trace=g.contexts.trace,g.contexts.trace.data&&(w.contexts.trace.data=hn(g.contexts.trace.data,S,v))),g.spans&&(w.spans=g.spans.map(k=>({...k,...k.data&&{data:hn(k.data,S,v)}}))),g.contexts&&g.contexts.flags&&w.contexts&&(w.contexts.flags=hn(g.contexts.flags,3,v)),w}(y,s,a):y))}function Vx(t){}function Uf(t,e){return pr().captureEvent(t,e)}function zf(t){const e=Je(),n=$i(),r=pr(),{release:i,environment:o=pl}=e&&e.getOptions()||{},{userAgent:s}=ge.navigator||{},a=Xy({release:i,environment:o,user:r.getUser()||n.getUser(),...s&&{userAgent:s},...t}),l=n.getSession();return l&&l.status==="ok"&&qr(l,{status:"exited"}),Hf(),n.setSession(a),r.setSession(a),a}function Hf(){const t=$i(),e=pr(),n=e.getSession()||t.getSession();n&&function(r,i){let o={};r.status==="ok"&&(o={status:"exited"}),qr(r,o)}(n),Vf(),t.setSession(),e.setSession()}function Vf(){const t=$i(),e=pr(),n=Je(),r=e.getSession()||t.getSession();r&&n&&n.captureSession(r)}function Kf(t=!1){t?Hf():Vf()}function bb(t,e,n){return e||`${function(r){return`${function(i){const o=i.protocol?`${i.protocol}:`:"",s=i.port?`:${i.port}`:"";return`${o}//${i.host}${s}${i.path?`/${i.path}`:""}/api/`}(r)}${r.projectId}/envelope/`}(t)}?${function(r,i){const o={sentry_version:"7"};return r.publicKey&&(o.sentry_key=r.publicKey),i&&(o.sentry_client=`${i.name}/${i.version}`),new URLSearchParams(o).toString()}(t,n)}`}const Wf=[];function qf(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function Jf(t,e,n){if(n[e.name])xe&&te.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,Wf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Wf.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>r(i,o,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((o,s)=>r(o,s,t),{id:e.name});t.addEventProcessor(i)}xe&&te.log(`Integration installed: ${e.name}`)}}class Bt extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const Gf="Not capturing exception because it's already been captured.";class wb{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=db(e.dsn):xe&&te.warn("No DSN provided, client will not send events."),this._dsn){const r=bb(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}const n=["enableTracing","tracesSampleRate","tracesSampler"].find(r=>r in e&&e[r]==null);n&&Ri(()=>{console.warn(`[Sentry] Deprecation warning: \`${n}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.`)})}captureException(e,n,r){const i=Et();if(xf(e))return xe&&te.log(Gf),i;const o={event_id:i,...n};return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,r))),o.event_id}captureMessage(e,n,r,i){const o={event_id:Et(),...r},s=rl(e)?e:String(e),a=il(e)?this.eventFromMessage(s,n,o):this.eventFromException(e,o);return this._process(a.then(l=>this._captureEvent(l,o,i))),o.event_id}captureEvent(e,n,r){const i=Et();if(n&&n.originalException&&xf(n.originalException))return xe&&te.log(Gf),i;const o={event_id:i,...n},s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,o,s||r)),o.event_id}captureSession(e){typeof e.release!="string"?xe&&te.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),qr(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(i=>r&&i))):hr(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];Jf(this,e,this._integrations),n||qf(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=mb(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])r=fb(r,pb(o));const i=this.sendEnvelope(r);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){const n=function(r,i,o,s){const a=Ff(o);return Fi({sent_at:new Date().toISOString(),...a&&{sdk:a},...!!s&&i&&{dsn:as(i)}},["aggregates"in r?[{type:"sessions"},r]:[{type:"session"},r.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){const i=typeof r=="number"?r:1,o=`${e}:${n}`;xe&&te.log(`Recording outcome: "${o}"${i>1?` (${i} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+i}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const i=r.indexOf(n);i>-1&&r.splice(i,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(i=>i(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(xe&&te.error("Error while sending envelope:",n),n)):(xe&&te.error("Transport disabled"),hr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(n,r){const i={};return r.forEach(o=>{o&&Jf(n,o,i)}),i}(this,e),qf(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",i=!1;const o=n.exception&&n.exception.values;if(o){i=!0;for(const a of o){const l=a.mechanism;if(l&&l.handled===!1){r=!0;break}}}const s=e.status==="ok";(s&&e.errors===0||s&&r)&&(qr(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Tt(n=>{let r=0;const i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=1,e&&r>=e&&(clearInterval(i),n(!1)))},1)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r=pr(),i=$i()){const o=this.getOptions(),s=Object.keys(this._integrations);return!n.integrations&&s.length>0&&(n.integrations=s),this.emit("preprocessEvent",e,n),e.type||i.setLastEventId(e.event_id||n.event_id),yb(o,e,n,r,this,i).then(a=>{if(a===null)return a;a.contexts={trace:nb(r),...a.contexts};const l=function(c,d){const f=d.getPropagationContext();return f.dsc||Lf(f.traceId,c)}(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(i=>i.event_id,i=>{xe&&(i instanceof Bt&&i.logLevel==="log"?te.log(i.message):te.warn(i))})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Yf(e),a=Qf(e),l=e.type||"error",c=`before send for type \`${l}\``,d=o===void 0?void 0:function(b){if(typeof b=="boolean")return Number(b);const y=typeof b=="string"?parseFloat(b):b;if(!(typeof y!="number"||isNaN(y)||y<0||y>1))return y;xe&&te.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(b)} of type ${JSON.stringify(typeof b)}.`)}(o);if(a&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),os(new Bt(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const f=l==="replay_event"?"replay":l,h=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,h).then(b=>{if(b===null)throw this.recordDroppedEvent("event_processor",f,e),new Bt("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return b;const y=function(g,S,v,w){const{beforeSend:k,beforeSendTransaction:C,beforeSendSpan:E}=S;if(Qf(v)&&k)return k(v,w);if(Yf(v)){if(v.spans&&E){const A=[];for(const D of v.spans){const $=E(D);$?A.push($):(lb(),g.recordDroppedEvent("before_send","span"))}v.spans=A}if(C){if(v.spans){const A=v.spans.length;v.sdkProcessingMetadata={...v.sdkProcessingMetadata,spanCountBeforeProcessing:A}}return C(v,w)}}return v}(this,i,b,n);return function(g,S){const v=`${S} must return \`null\` or a valid event.`;if(rs(g))return g.then(w=>{if(!Vr(w)&&w!==null)throw new Bt(v);return w},w=>{throw new Bt(`${S} rejected with ${w}`)});if(!Vr(g)&&g!==null)throw new Bt(v);return g}(y,c)}).then(b=>{if(b===null){if(this.recordDroppedEvent("before_send",f,e),s){const S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw new Bt(`${c} returned \`null\`, will not send event.`,"log")}const y=r&&r.getSession();if(!s&&y&&this._updateSessionFromEvent(y,b),s){const S=(b.sdkProcessingMetadata&&b.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(b.spans?b.spans.length:0);S>0&&this.recordDroppedEvent("before_send","span",S)}const g=b.transaction_info;if(s&&g&&b.transaction!==e.transaction){const S="custom";b.transaction_info={...g,source:S}}return this.sendEvent(b,n),b}).then(null,b=>{throw b instanceof Bt?b:(this.captureException(b,{data:{__sentry__:!0},originalException:b}),new Bt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
18
|
+
Reason: ${b}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[i,o]=n.split(":");return{reason:i,category:o,quantity:r}})}_flushOutcomes(){xe&&te.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0)return void(xe&&te.log("No outcomes to send"));if(!this._dsn)return void(xe&&te.log("No dsn provided, will not send outcomes"));xe&&te.log("Sending outcomes:",e);const n=(r=e,Fi((i=this._options.tunnel&&as(this._dsn))?{dsn:i}:{},[[{type:"client_report"},{timestamp:o||Ni(),discarded_events:r}]]));var r,i,o;this.sendEnvelope(n)}}function Qf(t){return t.type===void 0}function Yf(t){return t.type==="transaction"}function Sb(t){const e=[];function n(r){return e.splice(e.indexOf(r),1)[0]||Promise.resolve(void 0)}return{$:e,add:function(r){if(!(t===void 0||e.length<t))return os(new Bt("Not adding Promise because buffer limit was reached."));const i=r();return e.indexOf(i)===-1&&e.push(i),i.then(()=>n(i)).then(null,()=>n(i).then(null,()=>{})),i},drain:function(r){return new Tt((i,o)=>{let s=e.length;if(!s)return i(!0);const a=setTimeout(()=>{r&&r>0&&i(!1)},r);e.forEach(l=>{hr(l).then(()=>{--s||(clearTimeout(a),i(!0))},o)})})}}}function kb(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n&&n["x-sentry-rate-limits"],s=n&&n["retry-after"];if(o)for(const a of o.trim().split(",")){const[l,c,,,d]=a.split(":",5),f=parseInt(l,10),h=1e3*(isNaN(f)?60:f);if(c)for(const b of c.split(";"))b==="metric_bucket"&&d&&!d.split(";").includes("custom")||(i[b]=r+h);else i.all=r+h}else s?i.all=r+function(a,l=Date.now()){const c=parseInt(`${a}`,10);if(!isNaN(c))return 1e3*c;const d=Date.parse(`${a}`);return isNaN(d)?6e4:d-l}(s,r):e===429&&(i.all=r+6e4);return i}function xb(t,e,n=Sb(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Nf(i,(l,c)=>{const d=$f(c);if(function(f,h,b=Date.now()){return function(y,g){return y[g]||y.all||0}(f,h)>b}(r,d)){const f=Xf(l,c);t.recordDroppedEvent("ratelimit_backoff",d,f)}else o.push(l)}),o.length===0)return hr({});const s=Fi(i[0],o),a=l=>{Nf(s,(c,d)=>{const f=Xf(c,d);t.recordDroppedEvent(l,$f(d),f)})};return n.add(()=>e({body:hb(s)}).then(l=>(l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&xe&&te.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=kb(r,l),l),l=>{throw a("network_error"),l})).then(l=>l,l=>{if(l instanceof Bt)return xe&&te.error("Skipped sending event because buffer is full."),a("queue_overflow"),hr({});throw l})},flush:i=>n.drain(i)}}function Xf(t,e){if(e==="event"||e==="transaction")return Array.isArray(t)?t[1]:void 0}const _b=100;function gr(t,e){const n=Je(),r=$i();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=_b}=n.getOptions();if(o<=0)return;const s={timestamp:Ni(),...t},a=i?Ri(()=>i(s,e)):s;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let Zf;const eh=new WeakMap,Cb=()=>({name:"FunctionToString",setupOnce(){Zf=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=sl(this),n=eh.has(Je())&&e!==void 0?e:this;return Zf.apply(n,t)}}catch{}},setup(t){eh.set(t,!0)}}),Eb=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/],Tb=(t={})=>({name:"InboundFilters",processEvent(e,n,r){const i=r.getOptions(),o=function(s={},a={}){return{allowUrls:[...s.allowUrls||[],...a.allowUrls||[]],denyUrls:[...s.denyUrls||[],...a.denyUrls||[]],ignoreErrors:[...s.ignoreErrors||[],...a.ignoreErrors||[],...s.disableErrorDefaults?[]:Eb],ignoreTransactions:[...s.ignoreTransactions||[],...a.ignoreTransactions||[]],ignoreInternal:s.ignoreInternal===void 0||s.ignoreInternal}}(t,i);return function(s,a){return a.ignoreInternal&&function(l){try{return l.exception.values[0].type==="SentryError"}catch{}return!1}(s)?(xe&&te.warn(`Event dropped due to being internal Sentry Error.
|
|
19
|
+
Event: ${Ln(s)}`),!0):function(l,c){return l.type||!c||!c.length?!1:function(d){const f=[];d.message&&f.push(d.message);let h;try{h=d.exception.values[d.exception.values.length-1]}catch{}return h&&h.value&&(f.push(h.value),h.type&&f.push(`${h.type}: ${h.value}`)),f}(l).some(d=>is(d,c))}(s,a.ignoreErrors)?(xe&&te.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
20
|
+
Event: ${Ln(s)}`),!0):function(l){return l.type||!l.exception||!l.exception.values||l.exception.values.length===0?!1:!l.message&&!l.exception.values.some(c=>c.stacktrace||c.type&&c.type!=="Error"||c.value)}(s)?(xe&&te.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
21
|
+
Event: ${Ln(s)}`),!0):function(l,c){if(l.type!=="transaction"||!c||!c.length)return!1;const d=l.transaction;return!!d&&is(d,c)}(s,a.ignoreTransactions)?(xe&&te.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
22
|
+
Event: ${Ln(s)}`),!0):function(l,c){if(!c||!c.length)return!1;const d=us(l);return!!d&&is(d,c)}(s,a.denyUrls)?(xe&&te.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
23
|
+
Event: ${Ln(s)}.
|
|
24
24
|
Url: ${us(s)}`),!0):function(l,c){if(!c||!c.length)return!0;const d=us(l);return!d||is(d,c)}(s,a.allowUrls)?!1:(xe&&te.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
25
|
-
Event: ${
|
|
26
|
-
Url: ${us(s)}`),!0)}(e,o)?null:e}});function us(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?function(n=[]){for(let r=n.length-1;r>=0;r--){const i=n[r];if(i&&i.filename!=="<anonymous>"&&i.filename!=="[native code]")return i.filename||null}return null}(e):null}catch{return xe&&te.error(`Cannot extract url for event ${Dn(t)}`),null}}function Tb(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&ur(s.originalException,Error)))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var l,c;a&&(o.exception.values=(l=yl(t,e,i,s.originalException,r,o.exception.values,a,0),c=n,l.map(d=>(d.value&&(d.value=Wr(d.value,c)),d))))}function yl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(ur(r[i],Error)){eh(s,a);const c=t(e,r[i]),d=l.length;th(c,i,d,a),l=yl(t,e,n,r[i],i,[c,...l],c,d)}return Array.isArray(r.errors)&&r.errors.forEach((c,d)=>{if(ur(c,Error)){eh(s,a);const f=t(e,c),h=l.length;th(f,`errors[${d}]`,h,a),l=yl(t,e,n,c,i,[f,...l],f,h)}}),l}function eh(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function th(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function bl(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Mb(){"console"in ge&&Ya.forEach(function(t){t in ge.console&>(ge.console,t,function(e){return Xo[t]=e,function(...n){Ft("console",{args:n,level:t});const r=Xo[t];r&&r.apply(ge.console,n)}})})}function Ab(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Ob=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(n,r){return r?!!(function(i,o){const s=i.message,a=o.message;return!(!s&&!a||s&&!a||!s&&a||s!==a||!rh(i,o)||!nh(i,o))}(n,r)||function(i,o){const s=ih(o),a=ih(i);return!(!s||!a||s.type!==a.type||s.value!==a.value||!rh(i,o)||!nh(i,o))}(n,r)):!1}(e,t))return xe&&te.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function nh(t,e){let n=cf(t),r=cf(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let i=0;i<r.length;i++){const o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function rh(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return n.join("")===r.join("")}catch{return!1}}function ih(t){return t.exception&&t.exception.values&&t.exception.values[0]}function oh(t){return t===void 0?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const wl=ge;function Sl(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Pb(){if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in wl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(Sl(wl.fetch))return!0;let t=!1;const e=wl.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=Sl(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){sr&&te.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function Db(t,e){const n="fetch";lr(n,t),cr(n,()=>function(r,i=!1){i&&!Pb()||gt(ge,"fetch",function(o){return function(...s){const a=new Error,{method:l,url:c}=function(f){if(f.length===0)return{method:"GET",url:""};if(f.length===2){const[b,y]=f;return{url:sh(b),method:kl(y,"method")?String(y.method).toUpperCase():"GET"}}const h=f[0];return{url:sh(h),method:kl(h,"method")?String(h.method).toUpperCase():"GET"}}(s),d={args:s,fetchData:{method:l,url:c},startTimestamp:1e3*dn(),virtualError:a};return r||Ft("fetch",{...d}),o.apply(ge,s).then(async f=>(r?r(f):Ft("fetch",{...d,endTimestamp:1e3*dn(),response:f}),f),f=>{throw Ft("fetch",{...d,endTimestamp:1e3*dn(),error:f}),tl(f)&&f.stack===void 0&&(f.stack=a.stack,dr(f,"framesToPop",1)),f})}})}(void 0,e))}function kl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function sh(t){return typeof t=="string"?t:t?kl(t,"url")?t.url:t.toString?t.toString():"":""}const ds=ge,$e=ge;let xl=0;function ah(){return xl>0}function Gr(t,e={}){if(!function(r){return typeof r=="function"}(t))return t;try{const r=t.__sentry_wrapped__;if(r)return typeof r=="function"?r:t;if(ol(t))return t}catch{return t}const n=function(...r){try{const i=r.map(o=>Gr(o,e));return t.apply(this,i)}catch(i){throw xl++,setTimeout(()=>{xl--}),function(...o){const s=dl(ts());if(o.length===2){const[a,l]=o;return a?s.withSetScope(a,l):s.withScope(l)}s.withScope(o[0])}(o=>{var s;o.addEventProcessor(a=>(e.mechanism&&(al(a,void 0),Kr(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),s=i,hr().captureException(s,void 0)}),i}};try{for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}catch{}vf(n,t),dr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}const fs=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function _l(t,e){const n=El(t,e),r={type:Rb(e),value:Nb(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function Lb(t,e,n,r){const i=Je(),o=i&&i.getOptions().normalizeDepth,s=function(c){for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d)){const f=c[d];if(f instanceof Error)return f}}(e),a={__serialized__:If(e,o)};if(s)return{exception:{values:[_l(t,s)]},extra:a};const l={exception:{values:[{type:ns(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:$b(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=El(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function Cl(t,e){return{exception:{values:[_l(t,e)]}}}function El(t,e){const n=e.stacktrace||e.stack||"",r=function(o){return o&&Ib.test(o.message)?1:0}(e),i=function(o){return typeof o.framesToPop=="number"?o.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const Ib=/Minified React error #\d+;/i;function lh(t){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&t instanceof WebAssembly.Exception}function Rb(t){const e=t&&t.name;return!e&&lh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Nb(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:lh(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function Tl(t,e,n,r,i){let o;if(ff(e)&&e.error)return Cl(t,e.error);if(hf(e)||Hr(e,"DOMException")){const s=e;if("stack"in e)o=Cl(t,e);else{const a=s.name||(hf(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=Ml(t,l,n,r),al(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return tl(e)?Cl(t,e):Vr(e)||ns(e)?(o=Lb(t,e,n,i),Kr(o,{synthetic:!0}),o):(o=Ml(t,e,n,r),al(o,`${e}`),Kr(o,{synthetic:!0}),o)}function Ml(t,e,n,r){const i={};if(r&&n){const o=El(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Kr(i,{synthetic:!0})}if(nl(e)){const{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function $b(t,{isUnhandledRejection:e}){const n=function(i,o=40){const s=Object.keys(yf(i));s.sort();const a=s[0];if(!a)return"[object has no keys]";if(a.length>=o)return Wr(a,o);for(let l=s.length;l>0;l--){const c=s.slice(0,l).join(", ");if(!(c.length>o))return l===s.length?c:Wr(c,o)}return""}(t),r=e?"promise rejection":"exception";return ff(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:ns(t)?`Event \`${function(i){try{const o=Object.getPrototypeOf(i);return o?o.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Fb extends bb{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e};(function(r,i,o=[i],s="npm"){const a=r._metadata||{};a.sdk||(a.sdk={name:`sentry.javascript.${i}`,packages:o.map(l=>({name:`${s}:@sentry/${l}`,version:or})),version:or}),r._metadata=a})(n,"browser",["browser"],$e.SENTRY_SDK_SOURCE||"npm"),super(n),n.sendClientReports&&$e.document&&$e.document.addEventListener("visibilitychange",()=>{$e.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return function(r,i,o,s){const a=Tl(r,i,o&&o.syntheticException||void 0,s);return Kr(a),a.level="error",o&&o.event_id&&(a.event_id=o.event_id),fr(a)}(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return function(i,o,s="info",a,l){const c=Ml(i,o,a&&a.syntheticException||void 0,l);return c.level=s,a&&a.event_id&&(c.event_id=a.event_id),fr(c)}(this._options.stackParser,e,n,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(fs&&te.warn("SDK not enabled, will not capture user feedback."));const n=function(r,{metadata:i,tunnel:o,dsn:s}){const a={event_id:r.event_id,sent_at:new Date().toISOString(),...i&&i.sdk&&{sdk:{name:i.sdk.name,version:i.sdk.version}},...!!o&&!!s&&{dsn:as(s)}};return Fi(a,[function(c){return[{type:"user_report"},c]}(r)])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}}const Bb=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nt=ge;let ch,Al,Ol,hs;function jb(){if(!nt.document)return;const t=Ft.bind(null,"dom"),e=uh(t,!0);nt.document.addEventListener("click",e,!1),nt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=nt[n],i=r&&r.prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(gt(i,"addEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=c[s]=c[s]||{refCount:0};if(!d.handler){const f=uh(t);d.handler=f,o.call(this,s,f,l)}d.refCount++}catch{}return o.call(this,s,a,l)}}),gt(i,"removeEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},d=c[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,l),d.handler=void 0,delete c[s]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,l)}}))})}function uh(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(o){try{return o.target}catch{return null}}(n);if(function(o,s){return o==="keypress"&&(!s||!s.tagName||s.tagName!=="INPUT"&&s.tagName!=="TEXTAREA"&&!s.isContentEditable)}(n.type,r))return;dr(n,"_sentryCaptured",!0),r&&!r._sentryId&&dr(r,"_sentryId",Et());const i=n.type==="keypress"?"input":n.type;(function(o){if(o.type!==Al)return!1;try{if(!o.target||o.target._sentryId!==Ol)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Al=n.type,Ol=r?r._sentryId:void 0),clearTimeout(ch),ch=nt.setTimeout(()=>{Ol=void 0,Al=void 0},1e3)}}function dh(t){const e="history";lr(e,t),cr(e,Ub)}function Ub(){if(!function(){const n=ds.chrome,r=n&&n.app&&n.app.runtime,i="history"in ds&&!!ds.history.pushState&&!!ds.history.replaceState;return!r&&i}())return;const t=nt.onpopstate;function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const o=hs,s=String(i);hs=s,Ft("history",{from:o,to:s})}return n.apply(this,r)}}nt.onpopstate=function(...n){const r=nt.location.href,i=hs;if(hs=r,Ft("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}},gt(nt.history,"pushState",e),gt(nt.history,"replaceState",e)}const ps={};function fh(t){ps[t]=void 0}const Bi="__sentry_xhr_v3__";function zb(){if(!nt.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,o=1e3*dn(),s=un(r[0])?r[0].toUpperCase():void 0,a=function(c){if(un(c))return c;try{return c.toString()}catch{}}(r[1]);if(!s||!a)return e.apply(n,r);n[Bi]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[Bi];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}Ft("xhr",{endTimestamp:1e3*dn(),startTimestamp:o,xhr:n,virtualError:i})}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply:(c,d,f)=>(l(),c.apply(d,f))}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,d,f){const[h,b]=f,y=d[Bi];return y&&un(h)&&un(b)&&(y.request_headers[h.toLowerCase()]=b),c.apply(d,f)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[Bi];return i?(r[0]!==void 0&&(i.body=r[0]),Ft("xhr",{startTimestamp:1e3*dn(),xhr:n}),e.apply(n,r)):e.apply(n,r)}})}function Hb(t,e=function(n){const r=ps[n];if(r)return r;let i=nt[n];if(Sl(i))return ps[n]=i.bind(nt);const o=nt.document;if(o&&typeof o.createElement=="function")try{const s=o.createElement("iframe");s.hidden=!0,o.head.appendChild(s);const a=s.contentWindow;a&&a[n]&&(i=a[n]),o.head.removeChild(s)}catch(s){Bb&&te.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,s)}return i&&(ps[n]=i.bind(nt))}("fetch")){let n=0,r=0;return kb(t,function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return fh("fetch"),os("No fetch implementation available");try{return e(t.url,s).then(a=>(n-=o,r--,{statusCode:a.status,headers:{"x-sentry-rate-limits":a.headers.get("X-Sentry-Rate-Limits"),"retry-after":a.headers.get("Retry-After")}}))}catch(a){return fh("fetch"),n-=o,r--,os(a)}})}function Pl(t,e,n,r){const i={filename:t,function:e==="<anonymous>"?ar:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const Vb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Wb=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Kb=/\((\S*)(?::(\d+))(?::(\d+))\)/,qb=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Jb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Gb=function(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const o=[],s=n.split(`
|
|
27
|
-
`);for(let a=r;a<s.length;a++){const l=s[a];if(l.length>1024)continue;const c=sf.test(l)?l.replace(sf,"$1"):l;if(!c.match(/\S*Error: /)){for(const d of e){const f=d(c);if(f){o.push(f);break}}if(o.length>=50+i)break}}return function(a){if(!a.length)return[];const l=Array.from(a);return/sentryWrapped/.test(Zo(l).function||"")&&l.pop(),l.reverse(),af.test(Zo(l).function||"")&&(l.pop(),af.test(Zo(l).function||"")&&l.pop()),l.slice(0,50).map(c=>({...c,filename:c.filename||Zo(l).filename,function:c.function||ar}))}(o.slice(i))}}([30,t=>{const e=Vb.exec(t);if(e){const[,r,i,o]=e;return Pl(r,ar,+i,+o)}const n=Wb.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=Kb.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,i]=hh(n[1]||ar,n[2]);return Pl(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=qb.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=Jb.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let n=e[3],r=e[1]||ar;return[r,n]=hh(r,n),Pl(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),hh=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:ar,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},ph=1024,Qb=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(n){var r;e.console&&function(i){const o="console";lr(o,i),cr(o,Mb)}(function(i){return function(o){if(Je()!==i)return;const s={category:"console",data:{arguments:o.args,logger:"console"},level:Ab(o.level),message:mf(o.args," ")};if(o.level==="assert"){if(o.args[0]!==!1)return;s.message=`Assertion failed: ${mf(o.args.slice(1)," ")||"console.assert"}`,s.data.arguments=o.args.slice(1)}pr(s,{input:o.args,level:o.level})}}(n)),e.dom&&(r=function(i,o){return function(s){if(Je()!==i)return;let a,l,c=typeof o=="object"?o.serializeAttribute:void 0,d=typeof o=="object"&&typeof o.maxStringLength=="number"?o.maxStringLength:void 0;d&&d>ph&&(fs&&te.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${d} was configured. Sentry will use 1024 instead.`),d=ph),typeof c=="string"&&(c=[c]);try{const h=s.event,b=function(y){return!!y&&!!y.target}(h)?h.target:h;a=gf(b,{keyAttrs:c,maxStringLength:d}),l=function(y){if(!il.HTMLElement)return null;let m=y;for(let S=0;S<5;S++){if(!m)return null;if(m instanceof HTMLElement){if(m.dataset.sentryComponent)return m.dataset.sentryComponent;if(m.dataset.sentryElement)return m.dataset.sentryElement}m=m.parentNode}return null}(b)}catch{a="<unknown>"}if(a.length===0)return;const f={category:`ui.${s.name}`,message:a};l&&(f.data={"ui.component_name":l}),pr(f,{event:s.event,name:s.name,global:s.global})}}(n,e.dom),lr("dom",r),cr("dom",jb)),e.xhr&&function(i){lr("xhr",i),cr("xhr",zb)}(function(i){return function(o){if(Je()!==i)return;const{startTimestamp:s,endTimestamp:a}=o,l=o.xhr[Bi];if(!s||!a||!l)return;const{method:c,url:d,status_code:f,body:h}=l,b={method:c,url:d,status_code:f},y={xhr:o.xhr,input:h,startTimestamp:s,endTimestamp:a};pr({category:"xhr",data:b,type:"http",level:oh(f)},y)}}(n)),e.fetch&&Db(function(i){return function(o){if(Je()!==i)return;const{startTimestamp:s,endTimestamp:a}=o;if(a&&(!o.fetchData.url.match(/sentry_key/)||o.fetchData.method!=="POST"))if(o.error)pr({category:"fetch",data:o.fetchData,level:"error",type:"http"},{data:o.error,input:o.args,startTimestamp:s,endTimestamp:a});else{const l=o.response,c={...o.fetchData,status_code:l&&l.status},d={input:o.args,response:l,startTimestamp:s,endTimestamp:a};pr({category:"fetch",data:c,type:"http",level:oh(c.status_code)},d)}}}(n)),e.history&&dh(function(i){return function(o){if(Je()!==i)return;let s=o.from,a=o.to;const l=bl($e.location.href);let c=s?bl(s):void 0;const d=bl(a);c&&c.path||(c=l),l.protocol===d.protocol&&l.host===d.host&&(a=d.relative),l.protocol===c.protocol&&l.host===c.host&&(s=c.relative),pr({category:"navigation",data:{from:s,to:a}})}}(n)),e.sentry&&n.on("beforeSendEvent",function(i){return function(o){Je()===i&&pr({category:"sentry."+(o.type==="transaction"?"transaction":"event"),event_id:o.event_id,level:o.level,message:Dn(o)},{event:o})}}(n))}}},Yb=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Xb=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&>($e,"setTimeout",gh),e.setInterval&>($e,"setInterval",gh),e.requestAnimationFrame&>($e,"requestAnimationFrame",Zb),e.XMLHttpRequest&&"XMLHttpRequest"in $e&>(XMLHttpRequest.prototype,"send",e0);const n=e.eventTarget;n&&(Array.isArray(n)?n:Yb).forEach(t0)}}};function gh(t){return function(...e){const n=e[0];return e[0]=Gr(n,{mechanism:{data:{function:Pn(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Zb(t){return function(e){return t.apply(this,[Gr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Pn(t)},handled:!1,type:"instrument"}})])}}function e0(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&>(n,r,function(i){const o={mechanism:{data:{function:r,handler:Pn(i)},handled:!1,type:"instrument"}},s=ol(i);return s&&(o.mechanism.data.handler=Pn(s)),Gr(i,o)})}),t.apply(this,e)}}function t0(t){const e=$e[t],n=e&&e.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(gt(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=Gr(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Pn(o),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Gr(o,{mechanism:{data:{function:"addEventListener",handler:Pn(o),target:t},handled:!1,type:"instrument"}}),s])}}),gt(n,"removeEventListener",function(r){return function(i,o,s){try{const a=o.__sentry_wrapped__;a&&r.call(this,i,a,s)}catch{}return r.call(this,i,o,s)}}))}const n0=()=>({name:"BrowserSession",setupOnce(){$e.document!==void 0?(Uf({ignoreDuration:!0}),Vf(),dh(({from:t,to:e})=>{t!==void 0&&t!==e&&(Uf({ignoreDuration:!0}),Vf())})):fs&&te.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),r0=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(function(r){(function(i){const o="error";lr(o,i),cr(o,qy)})(i=>{const{stackParser:o,attachStacktrace:s}=vh();if(Je()!==r||ah())return;const{msg:a,url:l,line:c,column:d,error:f}=i,h=function(b,y,m,S){const v=b.exception=b.exception||{},w=v.values=v.values||[],k=w[0]=w[0]||{},C=k.stacktrace=k.stacktrace||{},T=C.frames=C.frames||[],O=S,P=m,$=un(y)&&y.length>0?y:function(){try{return il.document.location.href}catch{return""}}();return T.length===0&&T.push({colno:O,filename:$,function:ar,in_app:!0,lineno:P}),b}(Tl(o,f||a,void 0,s,!1),l,c,d);h.level="error",jf(h,{originalException:f,mechanism:{handled:!1,type:"onerror"}})})}(n),mh("onerror")),e.onunhandledrejection&&(function(r){(function(i){const o="unhandledrejection";lr(o,i),cr(o,Jy)})(i=>{const{stackParser:o,attachStacktrace:s}=vh();if(Je()!==r||ah())return;const a=function(c){if(rl(c))return c;try{if("reason"in c)return c.reason;if("detail"in c&&"reason"in c.detail)return c.detail.reason}catch{}return c}(i),l=rl(a)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`}]}}:Tl(o,a,void 0,s,!0);l.level="error",jf(l,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(n),mh("onunhandledrejection"))}}};function mh(t){fs&&te.log(`Global Handler attached: ${t}`)}function vh(){const t=Je();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const i0=()=>({name:"HttpContext",preprocessEvent(t){if(!$e.navigator&&!$e.location&&!$e.document)return;const e=t.request&&t.request.url||$e.location&&$e.location.href,{referrer:n}=$e.document||{},{userAgent:r}=$e.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...t.request,...e&&{url:e},headers:i};t.request=o}}),o0=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(r,i,o){const s=o.getOptions();Tb(_l,s.stackParser,s.maxValueLength,n,e,r,i)}}};var yh="new",bh="loading",wh="loaded",Dl="joining-meeting",gr="joined-meeting",mr="left-meeting",In="error",s0="playable",Ll="unknown",a0="full",l0="base",Sh="no-room",c0="end-of-life",u0="connection-error",d0="iframe-ready-for-launch-config",f0="iframe-launch-config",h0="theme-updated",p0="loading",g0="load-attempt-failed",kh="loaded",m0="started-camera",v0="camera-error",y0="joining-meeting",b0="joined-meeting",w0="left-meeting",S0="participant-joined",k0="participant-updated",x0="participant-left",_0="participant-counts-updated",C0="access-state-updated",E0="meeting-session-summary-updated",T0="meeting-session-state-updated",M0="waiting-participant-added",A0="waiting-participant-updated",O0="waiting-participant-removed",P0="track-started",D0="track-stopped",L0="transcription-started",I0="transcription-stopped",R0="transcription-error",xh="recording-started",_h="recording-stopped",N0="recording-stats",$0="recording-error",F0="recording-upload-completed",B0="recording-data",j0="app-message",U0="transcription-message",z0="remote-media-player-started",H0="remote-media-player-updated",V0="remote-media-player-stopped",W0="local-screen-share-started",K0="local-screen-share-stopped",q0="local-screen-share-canceled",J0="active-speaker-change",G0="active-speaker-mode-change",Q0="network-quality-change",Y0="network-connection",X0="cpu-load-change",Z0="face-counts-updated",gs="fullscreen",ms="exited-fullscreen",ew="live-streaming-started",tw="live-streaming-updated",nw="live-streaming-stopped",rw="live-streaming-error",iw="lang-updated",ow="receive-settings-updated",Ch="input-settings-updated",Eh="nonfatal-error",Th="error",Il=4096,Mh=102400,Rl="iframe-call-message",Ah="local-screen-start",Oh="daily-method-update-live-streaming-endpoints",vs="transmit-log",pn="daily-custom-track",ys={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},Ph={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},Nl={PLAY:"play",PAUSE:"pause"},$l=["jpg","png","jpeg"],sw="add-endpoints",aw="remove-endpoints",Dh="sip-call-transfer";function Mt(){return!ce()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function ce(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function Lh(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function lw(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)&&(function(t,e){if(!t||!e)return!0;switch(t){case"Chrome":return e.major>=75;case"Safari":return RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")&&!(e.major===13&&e.minor===0&&e.point===0);case"Firefox":return e.major>=67}return!0}(vr(),bs())||ce())}function Ih(){if(ce()||!document)return!1;var t=document.createElement("iframe");return!!t.requestFullscreen||!!t.webkitRequestFullscreen}var Fl="none",cw="software",uw="hardware",dw=function(){try{var t,e=document.createElement("canvas"),n=!1;(t=e.getContext("webgl2",{failIfMajorPerformanceCaveat:!0}))||(n=!0,t=e.getContext("webgl2"));var r=t!=null;return e.remove(),r?n?cw:uw:Fl}catch{return Fl}}();function Rh(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!ce()&&dw!==Fl&&(t?function(){return Fh()?!1:["Chrome","Firefox"].includes(vr())}():function(){if(Fh())return!1;var e=vr();if(e==="Safari"){var n=Ul();if(n.major<15||n.major===15&&n.minor<4)return!1}return e==="Chrome"?jl().major>=77:e==="Firefox"?zl().major>=97:["Chrome","Firefox","Safari"].includes(e)}())}function Nh(){if(ce()||$h()||typeof AudioWorkletNode>"u")return!1;switch(vr()){case"Chrome":case"Firefox":return!0;case"Safari":var t=bs();return t.major>17||t.major===17&&t.minor>=4}return!1}function Bl(){return Lh()&&typeof MediaStreamTrack<"u"&&!function(){var t,e=vr();if(!Mt())return!0;switch(e){case"Chrome":return(t=jl()).major&&t.major>0&&t.major<75;case"Firefox":return(t=zl()).major<91;case"Safari":return(t=Ul()).major<13||t.major===13&&t.minor<1;default:return!0}}()}function $h(){return Mt().match(/Linux; Android/)}function Fh(){var t,e=Mt(),n=e.match(/Mac/)&&(!ce()&&typeof window<"u"&&(t=window)!==null&&t!==void 0&&(t=t.navigator)!==null&&t!==void 0&&t.maxTouchPoints?window.navigator.maxTouchPoints:0)>=5;return!!(e.match(/Mobi/)||e.match(/Android/)||n)||!!Mt().match(/DailyAnd\//)||void 0}function vr(){if(typeof window<"u"){var t=Mt();return Bh()?"Safari":t.indexOf("Edge")>-1?"Edge":t.match(/Chrome\//)?"Chrome":t.indexOf("Safari")>-1||jh()?"Safari":t.indexOf("Firefox")>-1?"Firefox":t.indexOf("MSIE")>-1||t.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function bs(){switch(vr()){case"Chrome":return jl();case"Safari":return Ul();case"Firefox":return zl();case"Edge":return function(){var t=0,e=0;if(typeof window<"u"){var n=Mt().match(/Edge\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}()}}function jl(){var t=0,e=0,n=0,r=0,i=!1;if(typeof window<"u"){var o=Mt(),s=o.match(/Chrome\/(\d+).(\d+).(\d+).(\d+)/);if(s)try{t=parseInt(s[1]),e=parseInt(s[2]),n=parseInt(s[3]),r=parseInt(s[4]),i=o.indexOf("OPR/")>-1}catch{}}return{major:t,minor:e,build:n,patch:r,opera:i}}function Bh(){return!!Mt().match(/iPad|iPhone|iPod/i)&&Lh()}function jh(){return Mt().indexOf("AppleWebKit/605.1.15")>-1}function Ul(){var t=0,e=0,n=0;if(typeof window<"u"){var r=Mt().match(/Version\/(\d+).(\d+)(.(\d+))?/);if(r)try{t=parseInt(r[1]),e=parseInt(r[2]),n=parseInt(r[4])}catch{}else(Bh()||jh())&&(t=14,e=0,n=3)}return{major:t,minor:e,point:n}}function zl(){var t=0,e=0;if(typeof window<"u"){var n=Mt().match(/Firefox\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}var Uh=function(){return pt(function t(){ht(this,t)},[{key:"addListenerForMessagesFromCallMachine",value:function(t,e,n){Ii()}},{key:"addListenerForMessagesFromDailyJs",value:function(t,e,n){Ii()}},{key:"sendMessageToCallMachine",value:function(t,e,n,r){Ii()}},{key:"sendMessageToDailyJs",value:function(t,e){Ii()}},{key:"removeListener",value:function(t){Ii()}}])}();function zh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zh(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Hh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hh=function(){return!!t})()}var fw=function(){function t(){var e,n,r,i;return ht(this,t),n=this,r=$t(r=t),(e=Vo(n,Hh()?Reflect.construct(r,[],$t(n).constructor):r.apply(n,i)))._wrappedListeners={},e._messageCallbacks={},e}return Wo(t,Uh),pt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){var i=this,o=function(s){if(s.data&&s.data.what==="iframe-call-message"&&(!s.data.callClientId||s.data.callClientId===n)&&(!s.data.from||s.data.from!=="module")){var a=Hl({},s.data);if(delete a.from,a.callbackStamp&&i._messageCallbacks[a.callbackStamp]){var l=a.callbackStamp;i._messageCallbacks[l].call(r,a),delete i._messageCallbacks[l]}delete a.what,delete a.callbackStamp,e.call(r,a)}};this._wrappedListeners[e]=o,window.addEventListener("message",o)}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){var i=function(o){var s;if(!(!o.data||o.data.what!==Rl||!o.data.action||o.data.from&&o.data.from!=="module"||o.data.callClientId&&n&&o.data.callClientId!==n||o!=null&&(s=o.data)!==null&&s!==void 0&&s.callFrameId)){var a=o.data;e.call(r,a)}};this._wrappedListeners[e]=i,window.addEventListener("message",i)}},{key:"sendMessageToCallMachine",value:function(e,n,r,i){if(!r)throw new Error("undefined callClientId. Are you trying to use a DailyCall instance previously destroyed?");var o=Hl({},e);if(o.what=Rl,o.from="module",o.callClientId=r,n){var s=Jo();this._messageCallbacks[s]=n,o.callbackStamp=s}var a=i?i.contentWindow:window,l=this._callMachineTargetOrigin(i);l&&a.postMessage(o,l)}},{key:"sendMessageToDailyJs",value:function(e,n){e.what=Rl,e.callClientId=n,e.from="embedded",window.postMessage(e,this._targetOriginFromWindowLocation())}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"forwardPackagedMessageToCallMachine",value:function(e,n,r){var i=Hl({},e);i.callClientId=r;var o=n?n.contentWindow:window,s=this._callMachineTargetOrigin(n);s&&o.postMessage(i,s)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(e,n){var r=function(i){if(i.data&&i.data.what==="iframe-call-message"&&(!i.data.callClientId||i.data.callClientId===n)&&(!i.data.from||i.data.from!=="module")){var o=i.data;e(o)}};return this._wrappedListeners[e]=r,window.addEventListener("message",r),e}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"_callMachineTargetOrigin",value:function(e){return e?e.src?new URL(e.src).origin:void 0:this._targetOriginFromWindowLocation()}},{key:"_targetOriginFromWindowLocation",value:function(){return window.location.protocol==="file:"?"*":window.location.origin}}])}();function Vh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wh=function(){return!!t})()}var hw=function(){function t(){var e,n,r,i;return ht(this,t),n=this,r=$t(r=t),e=Vo(n,Wh()?Reflect.construct(r,[],$t(n).constructor):r.apply(n,i)),global.callMachineToDailyJsEmitter=global.callMachineToDailyJsEmitter||new Qa.EventEmitter,global.dailyJsToCallMachineEmitter=global.dailyJsToCallMachineEmitter||new Qa.EventEmitter,e._wrappedListeners={},e._messageCallbacks={},e}return Wo(t,Uh),pt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){this._addListener(e,global.callMachineToDailyJsEmitter,n,r,"received call machine message")}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){this._addListener(e,global.dailyJsToCallMachineEmitter,n,r,"received daily-js message")}},{key:"sendMessageToCallMachine",value:function(e,n,r){this._sendMessage(e,global.dailyJsToCallMachineEmitter,r,n,"sending message to call machine")}},{key:"sendMessageToDailyJs",value:function(e,n){this._sendMessage(e,global.callMachineToDailyJsEmitter,n,null,"sending message to daily-js")}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(global.callMachineToDailyJsEmitter.removeListener("message",n),global.dailyJsToCallMachineEmitter.removeListener("message",n),delete this._wrappedListeners[e])}},{key:"_addListener",value:function(e,n,r,i,o){var s=this,a=function(l){if(l.callClientId===r){if(l.callbackStamp&&s._messageCallbacks[l.callbackStamp]){var c=l.callbackStamp;s._messageCallbacks[c].call(i,l),delete s._messageCallbacks[c]}e.call(i,l)}};this._wrappedListeners[e]=a,n.addListener("message",a)}},{key:"_sendMessage",value:function(e,n,r,i,o){var s=function(l){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?Vh(Object(d),!0).forEach(function(f){Xt(l,f,d[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):Vh(Object(d)).forEach(function(f){Object.defineProperty(l,f,Object.getOwnPropertyDescriptor(d,f))})}return l}({},e);if(s.callClientId=r,i){var a=Jo();this._messageCallbacks[a]=i,s.callbackStamp=a}n.emit("message",s)}}])}(),Vl="replace",Wl="shallow-merge",Kh=[Vl,Wl],pw=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.data,r=e.mergeStrategy,i=r===void 0?Vl:r;ht(this,t),t._validateMergeStrategy(i),t._validateData(n,i),this.mergeStrategy=i,this.data=n}return pt(t,[{key:"isNoOp",value:function(){return t.isNoOpUpdate(this.data,this.mergeStrategy)}}],[{key:"isNoOpUpdate",value:function(e,n){return Object.keys(e).length===0&&n===Wl}},{key:"_validateMergeStrategy",value:function(e){if(!Kh.includes(e))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(Kh,"]"))}},{key:"_validateData",value:function(e,n){if(!function(a){if(a==null||fe(a)!=="object")return!1;var l=Object.getPrototypeOf(a);return l==null||l===Object.prototype}(e))throw Error("Meeting session data must be a plain (map-like) object");var r;try{if(r=JSON.stringify(e),n===Vl){var i=JSON.parse(r);et(i,e)||console.warn("The meeting session data provided will be modified when serialized.",i,e)}else if(n===Wl){for(var o in e)if(Object.hasOwnProperty.call(e,o)&&e[o]!==void 0){var s=JSON.parse(JSON.stringify(e[o]));et(e[o],s)||console.warn("At least one key in the meeting session data provided will be modified when serialized.",s,e[o])}}}catch(a){throw Error("Meeting session data must be serializable to JSON: ".concat(a))}if(r.length>Mh)throw Error("Meeting session data is too large (".concat(r.length," characters). Maximum size suppported is ").concat(Mh,"."))}}])}();function qh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qh=function(){return!!t})()}function Kl(t){var e=typeof Map=="function"?new Map:void 0;return Kl=function(n){if(n===null||!function(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return function(i,o,s){if(qh())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,o);var l=new(i.bind.apply(i,a));return s&&Li(l,s.prototype),l}(n,arguments,$t(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Li(r,n)},Kl(t)}function Jh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jh=function(){return!!t})()}function Gh(t){var e,n=(e=window._daily)===null||e===void 0?void 0:e.pendings;if(n){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}var gw=function(){return pt(function t(e){ht(this,t),this._currentLoad=null,this._callClientId=e},[{key:"load",value:function(){var t,e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;if(this.loaded)return window._daily.instances[this._callClientId].callMachine.reset(),void r(!0);t=this._callClientId,window._daily.pendings.push(t),this._currentLoad&&this._currentLoad.cancel(),this._currentLoad=new mw(n,function(){r(!1)},function(o,s){s||Gh(e._callClientId),i(o,s)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),Gh(this._callClientId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}])}(),mw=function(){return pt(function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;ht(this,t),this._attemptsRemaining=3,this._currentAttempt=null,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r},[{key:"start",value:function(){var t=this;if(!this._currentAttempt){var e=function(n){t._currentAttempt.cancelled||(t._attemptsRemaining--,t._failureCallback(n,t._attemptsRemaining>0),t._attemptsRemaining<=0||setTimeout(function(){t._currentAttempt.cancelled||(t._currentAttempt=new Qh(t._dailyConfig,t._successCallback,e),t._currentAttempt.start())},3e3))};this._currentAttempt=new Qh(this._dailyConfig,this._successCallback,e),this._currentAttempt.start()}}},{key:"cancel",value:function(){this._currentAttempt&&this._currentAttempt.cancel()}},{key:"cancelled",get:function(){return this._currentAttempt&&this._currentAttempt.cancelled}},{key:"succeeded",get:function(){return this._currentAttempt&&this._currentAttempt.succeeded}}])}(),ql=function(){function t(){return ht(this,t),e=this,r=arguments,n=$t(n=t),Vo(e,Jh()?Reflect.construct(n,r||[],$t(e).constructor):n.apply(e,r));var e,n,r}return Wo(t,Kl(Error)),pt(t)}(),ws=2e4,Qh=function(){return pt(function e(n,r,i){ht(this,e),this._loadAttemptImpl=ce()||!n.avoidEval?new vw(n,r,i):new yw(n,r,i)},[{key:"start",value:(t=Z(function*(){return this._loadAttemptImpl.start()}),function(){return t.apply(this,arguments)})},{key:"cancel",value:function(){this._loadAttemptImpl.cancel()}},{key:"cancelled",get:function(){return this._loadAttemptImpl.cancelled}},{key:"succeeded",get:function(){return this._loadAttemptImpl.succeeded}}]);var t}(),vw=function(){return pt(function i(o,s,a){ht(this,i),this.cancelled=!1,this.succeeded=!1,this._networkTimedOut=!1,this._networkTimeout=null,this._iosCache=typeof iOSCallObjectBundleCache<"u"&&iOSCallObjectBundleCache,this._refetchHeaders=null,this._dailyConfig=o,this._successCallback=s,this._failureCallback=a},[{key:"start",value:(r=Z(function*(){var i=Go(this._dailyConfig);!(yield this._tryLoadFromIOSCache(i))&&this._loadFromNetwork(i)}),function(){return r.apply(this,arguments)})},{key:"cancel",value:function(){clearTimeout(this._networkTimeout),this.cancelled=!0}},{key:"_tryLoadFromIOSCache",value:(n=Z(function*(i){if(!this._iosCache)return!1;try{var o=yield this._iosCache.get(i);return!!this.cancelled||!!o&&(o.code?(Function('"use strict";'+o.code)(),this.succeeded=!0,this._successCallback(),!0):(this._refetchHeaders=o.refetchHeaders,!1))}catch{return!1}}),function(i){return n.apply(this,arguments)})},{key:"_loadFromNetwork",value:(e=Z(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(ws," ms) when loading call object bundle ").concat(i),type:"timeout"})},ws);try{var s=this._refetchHeaders?{headers:this._refetchHeaders}:{},a=yield fetch(i,s);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new ql;var l=yield this._getBundleCodeFromResponse(i,a);if(this.cancelled)throw new ql;Function('"use strict";'+l)(),this._iosCache&&this._iosCache.set(i,l,a.headers),this.succeeded=!0,this._successCallback()}catch(c){if(clearTimeout(this._networkTimeout),c instanceof ql||this.cancelled||this._networkTimedOut)return;this._failureCallback({msg:"Failed to load call object bundle ".concat(i,": ").concat(c),type:c.message})}}),function(i){return e.apply(this,arguments)})},{key:"_getBundleCodeFromResponse",value:(t=Z(function*(i,o){if(o.ok)return yield o.text();if(this._iosCache&&o.status===304)return(yield this._iosCache.renew(i,o.headers)).code;throw new Error("Received ".concat(o.status," response"))}),function(i,o){return t.apply(this,arguments)})}]);var t,e,n,r}(),yw=function(){return pt(function t(e,n,r){ht(this,t),this.cancelled=!1,this.succeeded=!1,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r,this._attemptId=Jo(),this._networkTimeout=null,this._scriptElement=null},[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=Go(this._dailyConfig);(typeof document>"u"?"undefined":fe(document))==="object"?this._startLoading(t):this._failureCallback({msg:"Call object bundle must be loaded in a DOM/web context",type:"missing context"})}},{key:"cancel",value:function(){this._stopLoading(),this.cancelled=!0}},{key:"_startLoading",value:function(t){var e=this;this._signUpForCallMachineLoadWaitlist(),this._networkTimeout=setTimeout(function(){e._stopLoading(),e._failureCallback({msg:"Timed out (>".concat(ws," ms) when loading call object bundle ").concat(t),type:"timeout"})},ws);var n=document.getElementsByTagName("head")[0],r=document.createElement("script");this._scriptElement=r,r.onload=function(){e._stopLoading(),e.succeeded=!0,e._successCallback()},r.onerror=function(i){e._stopLoading(),e._failureCallback({msg:"Failed to load call object bundle ".concat(i.target.src),type:i.message})},r.src=t,n.appendChild(r)}},{key:"_stopLoading",value:function(){this._withdrawFromCallMachineLoadWaitlist(),clearTimeout(this._networkTimeout),this._scriptElement&&(this._scriptElement.onload=null,this._scriptElement.onerror=null)}},{key:"_signUpForCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.add(this._attemptId)}},{key:"_withdrawFromCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.delete(this._attemptId)}}])}(),Ss=function(t,e,n){return ww(t.local,e,n)===!0},bw=function(t,e,n){return t.local.streams&&t.local.streams[e]&&t.local.streams[e].stream&&t.local.streams[e].stream["get".concat(n==="video"?"Video":"Audio","Tracks")]()[0]},Qr=function(t,e,n,r){var i=Sw(t,e,n,r);return i&&i.pendingTrack},ww=function(t,e,n){if(!t)return!1;var r=function(o){switch(o){case"avatar":return!0;case"staged":return o;default:return!!o}},i=t.public.subscribedTracks;return i&&i[e]?["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo"].indexOf(n)===-1&&i[e].custom?[!0,"staged"].includes(i[e].custom)?r(i[e].custom):r(i[e].custom[n]):r(i[e][n]):!i||r(i.ALL)},Sw=function(t,e,n,r){var i=Object.values(t.streams||{}).filter(function(o){return o.participantId===e&&o.type===n&&o.pendingTrack&&o.pendingTrack.kind===r}).sort(function(o,s){return new Date(s.starttime)-new Date(o.starttime)});return i&&i[0]},kw=function(t,e){var n=t.local.public.customTracks;if(n&&n[e])return n[e].track};function Yh(t,e){for(var n=e.getState(),r=0,i=["cam","screen"];r<i.length;r++)for(var o=i[r],s=0,a=["video","audio"];s<a.length;s++){var l=a[s],c=o==="cam"?l:"screen".concat(l.charAt(0).toUpperCase()+l.slice(1)),d=t.tracks[c];if(d){var f=t.local?bw(n,o,l):Qr(n,t.session_id,o,l);d.state==="playable"&&(d.track=f),d.persistentTrack=f}}}function Xh(t,e){try{var n=e.getState();for(var r in t.tracks)if(!xw(r)){var i=t.tracks[r].kind;if(i){var o=t.tracks[r];if(o){var s=t.local?kw(n,r):Qr(n,t.session_id,r,i);o.state==="playable"&&(t.tracks[r].track=s),o.persistentTrack=s}}else console.error("unknown type for custom track")}}catch(a){console.error(a)}}function xw(t){return["video","audio","screenVideo","screenAudio"].includes(t)}function Zh(t,e,n){var r=n.getState();if(t.local){if(t.audio)try{t.audioTrack=r.local.streams.cam.stream.getAudioTracks()[0],t.audioTrack||(t.audio=!1)}catch{}if(t.video)try{t.videoTrack=r.local.streams.cam.stream.getVideoTracks()[0],t.videoTrack||(t.video=!1)}catch{}if(t.screen)try{t.screenVideoTrack=r.local.streams.screen.stream.getVideoTracks()[0],t.screenAudioTrack=r.local.streams.screen.stream.getAudioTracks()[0],t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch{}}else{var i=!0;try{var o=r.participants[t.session_id];o&&o.public&&o.public.rtcType&&o.public.rtcType.impl==="peer-to-peer"&&o.private&&!["connected","completed"].includes(o.private.peeringState)&&(i=!1)}catch(d){console.error(d)}if(!i)return t.audio=!1,t.audioTrack=!1,t.video=!1,t.videoTrack=!1,t.screen=!1,void(t.screenTrack=!1);try{if(r.streams,t.audio&&Ss(r,t.session_id,"cam-audio")){var s=Qr(r,t.session_id,"cam","audio");s&&(e&&e.audioTrack&&e.audioTrack.id===s.id?t.audioTrack=s:s.muted||(t.audioTrack=s)),t.audioTrack||(t.audio=!1)}if(t.video&&Ss(r,t.session_id,"cam-video")){var a=Qr(r,t.session_id,"cam","video");a&&(e&&e.videoTrack&&e.videoTrack.id===a.id?t.videoTrack=a:a.muted||(t.videoTrack=a)),t.videoTrack||(t.video=!1)}if(t.screen&&Ss(r,t.session_id,"screen-audio")){var l=Qr(r,t.session_id,"screen","audio");l&&(e&&e.screenAudioTrack&&e.screenAudioTrack.id===l.id?t.screenAudioTrack=l:l.muted||(t.screenAudioTrack=l))}if(t.screen&&Ss(r,t.session_id,"screen-video")){var c=Qr(r,t.session_id,"screen","video");c&&(e&&e.screenVideoTrack&&e.screenVideoTrack.id===c.id?t.screenVideoTrack=c:c.muted||(t.screenVideoTrack=c))}t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch(d){console.error("unexpected error matching up tracks",d)}}}function _w(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return ep(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?ep(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
28
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function
|
|
29
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function tp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var en=new Map,ji=null;function Ew(t){np()?function(e){Zt.has(e)||(Zt.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){Zt.has(e)&&(Zt.get(e).lastDevicesString=JSON.stringify(n),Yr||(Yr=function(){var r=Z(function*(){var i,o=yield navigator.mediaDevices.enumerateDevices(),s=_w(Zt.keys());try{for(s.s();!(i=s.n()).done;){var a=i.value,l=JSON.stringify(o);l!==Zt.get(a).lastDevicesString&&(Zt.get(a).lastDevicesString=l,a(o))}}catch(c){s.e(c)}finally{s.f()}});return function(){return r.apply(this,arguments)}}(),navigator.mediaDevices.addEventListener("devicechange",Yr)))}).catch(function(){}))}(t):function(e){en.has(e)||(en.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){en.has(e)&&(en.get(e).lastDevicesString=JSON.stringify(n),ji||(ji=setInterval(Z(function*(){var r,i=yield navigator.mediaDevices.enumerateDevices(),o=Cw(en.keys());try{for(o.s();!(r=o.n()).done;){var s=r.value,a=JSON.stringify(i);a!==en.get(s).lastDevicesString&&(en.get(s).lastDevicesString=a,s(i))}}catch(l){o.e(l)}finally{o.f()}}),3e3)))}))}(t)}function Tw(t){np()?function(e){Zt.has(e)&&(Zt.delete(e),Zt.size===0&&Yr&&(navigator.mediaDevices.removeEventListener("devicechange",Yr),Yr=null))}(t):function(e){en.has(e)&&(en.delete(e),en.size===0&&ji&&(clearInterval(ji),ji=null))}(t)}function np(){var t;return ce()||((t=navigator.mediaDevices)===null||t===void 0?void 0:t.ondevicechange)!==void 0}var Mw=new Set;function Aw(t,e){return t&&t.readyState==="live"&&!function(n,r){return n.muted&&!Mw.has(n.id)}(t)}function rp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Rn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rp(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var Ui=Object.freeze({VIDEO:"video",AUDIO:"audio",SCREEN_VIDEO:"screenVideo",SCREEN_AUDIO:"screenAudio",CUSTOM_VIDEO:"customVideo",CUSTOM_AUDIO:"customAudio"}),Ow=Object.freeze({PARTICIPANTS:"participants",STREAMING:"streaming",TRANSCRIPTION:"transcription"}),zi=Object.values(Ui),ip=["v","a","sv","sa","cv","ca"];Object.freeze(zi.reduce(function(t,e,n){return t[e]=ip[n],t},{})),Object.freeze(ip.reduce(function(t,e,n){return t[e]=zi[n],t},{}));var Pw=[Ui.VIDEO,Ui.AUDIO,Ui.SCREEN_VIDEO,Ui.SCREEN_AUDIO],op=Object.values(Ow),sp=["p","s","t"];Object.freeze(op.reduce(function(t,e,n){return t[e]=sp[n],t},{})),Object.freeze(sp.reduce(function(t,e,n){return t[e]=op[n],t},{}));var ap=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.base,r=e.byUserId,i=e.byParticipantId;ht(this,t),this.base=n,this.byUserId=r,this.byParticipantId=i}return pt(t,[{key:"clone",value:function(){var e=new t;if(this.base instanceof ze?e.base=this.base.clone():e.base=this.base,this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof ze?r.clone():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof ze?o.clone():o}return e}},{key:"toJSONObject",value:function(){var e={};if(typeof this.base=="boolean"?e.base=this.base:this.base instanceof ze&&(e.base=this.base.toJSONObject()),this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof ze?r.toJSONObject():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof ze?o.toJSONObject():o}return e}},{key:"toMinifiedJSONObject",value:function(){var e={};if(this.base!==void 0&&(typeof this.base=="boolean"?e.b=this.base:e.b=this.base.toMinifiedJSONObject()),this.byUserId!==void 0)for(var n in e.u={},this.byUserId){var r=this.byUserId[n];e.u[n]=typeof r=="boolean"?r:r.toMinifiedJSONObject()}if(this.byParticipantId!==void 0)for(var i in e.p={},this.byParticipantId){var o=this.byParticipantId[i];e.p[i]=typeof o=="boolean"?o:o.toMinifiedJSONObject()}return e}},{key:"normalize",value:function(){return this.base instanceof ze&&(this.base=this.base.normalize()),this.byUserId&&(this.byUserId=Object.fromEntries(Object.entries(this.byUserId).map(function(e){var n=qe(e,2),r=n[0],i=n[1];return[r,i instanceof ze?i.normalize():i]}))),this.byParticipantId&&(this.byParticipantId=Object.fromEntries(Object.entries(this.byParticipantId).map(function(e){var n=qe(e,2),r=n[0],i=n[1];return[r,i instanceof ze?i.normalize():i]}))),this}}],[{key:"fromJSONObject",value:function(e){var n,r,i;if(e.base!==void 0&&(n=typeof e.base=="boolean"?e.base:ze.fromJSONObject(e.base)),e.byUserId!==void 0)for(var o in r={},e.byUserId){var s=e.byUserId[o];r[o]=typeof s=="boolean"?s:ze.fromJSONObject(s)}if(e.byParticipantId!==void 0)for(var a in i={},e.byParticipantId){var l=e.byParticipantId[a];i[a]=typeof l=="boolean"?l:ze.fromJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"fromMinifiedJSONObject",value:function(e){var n,r,i;if(e.b!==void 0&&(n=typeof e.b=="boolean"?e.b:ze.fromMinifiedJSONObject(e.b)),e.u!==void 0)for(var o in r={},e.u){var s=e.u[o];r[o]=typeof s=="boolean"?s:ze.fromMinifiedJSONObject(s)}if(e.p!==void 0)for(var a in i={},e.p){var l=e.p[a];i[a]=typeof l=="boolean"?l:ze.fromMinifiedJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"validateJSONObject",value:function(e){if(fe(e)!=="object")return[!1,"canReceive must be an object"];for(var n=["base","byUserId","byParticipantId"],r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];if(!n.includes(o))return[!1,"canReceive can only contain keys (".concat(n.join(", "),")")];if(o==="base"){var s=qe(ze.validateJSONObject(e.base,!0),2),a=s[0],l=s[1];if(!a)return[!1,l]}else{if(fe(e[o])!=="object")return[!1,"invalid (non-object) value for field '".concat(o,"' in canReceive")];for(var c=0,d=Object.values(e[o]);c<d.length;c++){var f=d[c],h=qe(ze.validateJSONObject(f),2),b=h[0],y=h[1];if(!b)return[!1,y]}}}return[!0]}}])}(),ze=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.video,r=e.audio,i=e.screenVideo,o=e.screenAudio,s=e.customVideo,a=e.customAudio;ht(this,t),this.video=n,this.audio=r,this.screenVideo=i,this.screenAudio=o,this.customVideo=s,this.customAudio=a}return pt(t,[{key:"clone",value:function(){var e=new t;return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=Rn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Rn({},this.customAudio)),e}},{key:"toJSONObject",value:function(){var e={};return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=Rn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Rn({},this.customAudio)),e}},{key:"toMinifiedJSONObject",value:function(){var e={};return this.video!==void 0&&(e.v=this.video),this.audio!==void 0&&(e.a=this.audio),this.screenVideo!==void 0&&(e.sv=this.screenVideo),this.screenAudio!==void 0&&(e.sa=this.screenAudio),this.customVideo!==void 0&&(e.cv=Rn({},this.customVideo)),this.customAudio!==void 0&&(e.ca=Rn({},this.customAudio)),e}},{key:"normalize",value:function(){function e(n,r){return n&&Object.keys(n).length===1&&n["*"]===r}return!(this.video!==!0||this.audio!==!0||this.screenVideo!==!0||this.screenAudio!==!0||!e(this.customVideo,!0)||!e(this.customAudio,!0))||(this.video!==!1||this.audio!==!1||this.screenVideo!==!1||this.screenAudio!==!1||!e(this.customVideo,!1)||!e(this.customAudio,!1))&&this}}],[{key:"fromBoolean",value:function(e){return new t({video:e,audio:e,screenVideo:e,screenAudio:e,customVideo:{"*":e},customAudio:{"*":e}})}},{key:"fromJSONObject",value:function(e){return new t({video:e.video,audio:e.audio,screenVideo:e.screenVideo,screenAudio:e.screenAudio,customVideo:e.customVideo!==void 0?Rn({},e.customVideo):void 0,customAudio:e.customAudio!==void 0?Rn({},e.customAudio):void 0})}},{key:"fromMinifiedJSONObject",value:function(e){return new t({video:e.v,audio:e.a,screenVideo:e.sv,screenAudio:e.sa,customVideo:e.cv,customAudio:e.ca})}},{key:"validateJSONObject",value:function(e,n){if(typeof e=="boolean")return[!0];if(fe(e)!=="object")return[!1,"invalid (non-object, non-boolean) value in canReceive"];for(var r=Object.keys(e),i=0,o=r;i<o.length;i++){var s=o[i];if(!zi.includes(s))return[!1,"invalid media type '".concat(s,"' in canReceive")];if(Pw.includes(s)){if(typeof e[s]!="boolean")return[!1,"invalid (non-boolean) value for media type '".concat(s,"' in canReceive")]}else{if(fe(e[s])!=="object")return[!1,"invalid (non-object) value for media type '".concat(s,"' in canReceive")];for(var a=0,l=Object.values(e[s]);a<l.length;a++)if(typeof l[a]!="boolean")return[!1,"invalid (non-boolean) value for entry within '".concat(s,"' in canReceive")];if(n&&e[s]["*"]===void 0)return[!1,`canReceive "base" permission must specify "*" as an entry within '`.concat(s,"'")]}}return n&&r.length!==zi.length?[!1,'canReceive "base" permission must specify all media types: '.concat(zi.join(", ")," (or be set to a boolean shorthand)")]:[!0]}}])}(),Dw=["result"],Lw=["preserveIframe"];function lp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function H(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lp(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cp=function(){return!!t})()}function up(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return dp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?dp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
30
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function dp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var yr={},fp="video",Iw="voice",hp=ce()?{data:{}}:{data:{},topology:"none"},pp={present:0,hidden:0},gp={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},Jl=Object.keys(gp),mp=["state","volume","simulcastEncodings"],vp={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},ks={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string",visualState:"'default' | 'sidebar-open' | 'active'"}},Gl={id:{allow:"string",controlledBy:"'*' | 'owners' | string[]",csp:"string",iconURL:"string",label:"string",loading:"'eager' | 'lazy'",location:"'main' | 'sidebar'",name:"string",referrerPolicy:"string",sandbox:"string",src:"string",srcdoc:"string",shared:"string[] | 'owners' | boolean"}},br={customIntegrations:{validate:Tp,help:Cp()},customTrayButtons:{validate:Ep,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(ks))},url:{validate:function(t){return typeof t=="string"},help:"url should be a string"},baseUrl:{validate:function(t){return typeof t=="string"},help:"baseUrl should be a string"},token:{validate:function(t){return typeof t=="string"},help:"token should be a string",queryString:"t"},dailyConfig:{validate:function(t,e){try{return e.validateDailyConfig(t),!0}catch(n){console.error("Failed to validate dailyConfig",n)}return!1},help:"Unsupported dailyConfig. Check error logs for detailed info."},reactNativeConfig:{validate:function(t){return Mp(t,vp)},help:"reactNativeConfig should look like ".concat(JSON.stringify(vp),", all fields optional")},lang:{validate:function(t){return["da","de","en-us","en","es","fi","fr","it","jp","ka","nl","no","pl","pt","pt-BR","ru","sv","tr","user"].includes(t)},help:"language not supported. Options are: da, de, en-us, en, es, fi, fr, it, jp, ka, nl, no, pl, pt, pt-BR, ru, sv, tr, user"},userName:!0,userData:{validate:function(t){try{return bp(t),!0}catch(e){return console.error(e),!1}},help:"invalid userData type provided"},startVideoOff:!0,startAudioOff:!0,allowLocalVideo:!0,allowLocalAudio:!0,activeSpeakerMode:!0,showLeaveButton:!0,showLocalVideo:!0,showParticipantsBar:!0,showFullscreenButton:!0,showUserNameChangeUI:!0,iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,videoSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalVideo=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.videoTrack=t,n={customTrack:pn};else{if(delete e._sharedTracks.videoTrack,typeof t!="string")return console.error("videoSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({video:{settings:n}},!1),!0}},audioSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalAudio=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.audioTrack=t,n={customTrack:pn};else{if(delete e._sharedTracks.audioTrack,typeof t!="string")return console.error("audioSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({audio:{settings:n}},!1),!0}},subscribeToTracksAutomatically:{validate:function(t,e){return e._preloadCache.subscribeToTracksAutomatically=t,!0}},theme:{validate:function(t){var e=["accent","accentText","background","backgroundAccent","baseText","border","mainAreaBg","mainAreaBgAccent","mainAreaText","supportiveText"],n=function(r){for(var i=0,o=Object.keys(r);i<o.length;i++){var s=o[i];if(!e.includes(s))return console.error('unsupported color "'.concat(s,'". Valid colors: ').concat(e.join(", "))),!1;if(!r[s].match(/^#[0-9a-f]{6}|#[0-9a-f]{3}$/i))return console.error("".concat(s,' theme color should be provided in valid hex color format. Received: "').concat(r[s],'"')),!1}return!0};return fe(t)==="object"&&("light"in t&&"dark"in t||"colors"in t)?"light"in t&&"dark"in t?"colors"in t.light?"colors"in t.dark?n(t.light.colors)&&n(t.dark.colors):(console.error('Dark theme is missing "colors" property.',t),!1):(console.error('Light theme is missing "colors" property.',t),!1):n(t.colors):(console.error('Theme must contain either both "light" and "dark" properties, or "colors".',t),!1)},help:"unsupported theme configuration. Check error logs for detailed info."},layoutConfig:{validate:function(t){if("grid"in t){var e=t.grid;if("maxTilesPerPage"in e){if(!Number.isInteger(e.maxTilesPerPage))return console.error("grid.maxTilesPerPage should be an integer. You passed ".concat(e.maxTilesPerPage,".")),!1;if(e.maxTilesPerPage>49)return console.error("grid.maxTilesPerPage can't be larger than 49 without sacrificing browser performance. Please contact us at https://www.daily.co/contact to talk about your use case."),!1}if("minTilesPerPage"in e){if(!Number.isInteger(e.minTilesPerPage))return console.error("grid.minTilesPerPage should be an integer. You passed ".concat(e.minTilesPerPage,".")),!1;if(e.minTilesPerPage<1)return console.error("grid.minTilesPerPage can't be lower than 1."),!1;if("maxTilesPerPage"in e&&e.minTilesPerPage>e.maxTilesPerPage)return console.error("grid.minTilesPerPage can't be higher than grid.maxTilesPerPage."),!1}}return!0},help:"unsupported layoutConfig. Check error logs for detailed info."},receiveSettings:{validate:function(t){return wp(t,{allowAllParticipantsKey:!1})},help:_p({allowAllParticipantsKey:!1})},sendSettings:{validate:function(t,e){return!!function(n,r){try{return r.validateUpdateSendSettings(n),!0}catch(i){return console.error("Failed to validate send settings",i),!1}}(t,e)&&(e._preloadCache.sendSettings=t,!0)},help:"Invalid sendSettings provided. Check error logs for detailed info."},inputSettings:{validate:function(t,e){var n;return!!Sp(t)&&(e._inputSettings||(e._inputSettings={}),kp(t,(n=e.properties)===null||n===void 0?void 0:n.dailyConfig,e._sharedTracks),e._updatePreloadCacheInputSettings(t,!0),!0)},help:Xl()},layout:{validate:function(t){return t==="custom-v1"||t==="browser"||t==="none"},help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"},embHref:{queryString:"embHref"},dailyJsVersion:{queryString:"dailyJsVersion"},proxy:{queryString:"proxy"},strictMode:!0,allowMultipleCallInstances:!0},xs={styles:{validate:function(t){for(var e in t)if(e!=="cam"&&e!=="screen")return!1;if(t.cam){for(var n in t.cam)if(n!=="div"&&n!=="video")return!1}if(t.screen){for(var r in t.screen)if(r!=="div"&&r!=="video")return!1}return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setSubscribedTracks:{validate:function(t,e){if(e._preloadCache.subscribeToTracksAutomatically)return!1;var n=[!0,!1,"staged"];if(n.includes(t)||!ce()&&t==="avatar")return!0;var r=["audio","video","screenAudio","screenVideo","rmpAudio","rmpVideo"],i=function(o){var s=arguments.length>1&&arguments[1]!==void 0&&arguments[1];for(var a in o)if(a==="custom"){if(!n.includes(o[a])&&!i(o[a],!0))return!1}else{var l=!s&&!r.includes(a),c=!n.includes(o[a]);if(l||c)return!1}return!0};return i(t)},help:"setSubscribedTracks cannot be used when setSubscribeToTracksAutomatically is enabled, and should be of the form: "+"true".concat(ce()?"":" | 'avatar'"," | false | 'staged' | { [audio: true|false|'staged'], [video: true|false|'staged'], [screenAudio: true|false|'staged'], [screenVideo: true|false|'staged'] }")},setAudio:!0,setVideo:!0,setScreenShare:{validate:function(t){return t===!1},help:"setScreenShare must be false, as it's only meant for stopping remote participants' screen shares"},eject:!0,updatePermissions:{validate:function(t){for(var e=0,n=Object.entries(t);e<n.length;e++){var r=qe(n[e],2),i=r[0],o=r[1];switch(i){case"hasPresence":if(typeof o!="boolean")return!1;break;case"canSend":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var s,a=["video","audio","screenVideo","screenAudio","customVideo","customAudio"],l=up(o);try{for(l.s();!(s=l.n()).done;){var c=s.value;if(!a.includes(c))return!1}}catch(v){l.e(v)}finally{l.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canSend=new Set(o));break;case"canReceive":var d=qe(ap.validateJSONObject(o),2),f=d[0],h=d[1];if(!f)return console.error(h),!1;break;case"canAdmin":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var b,y=["participants","streaming","transcription"],m=up(o);try{for(m.s();!(b=m.n()).done;){var S=b.value;if(!y.includes(S))return!1}}catch(v){m.e(v)}finally{m.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canAdmin=new Set(o));break;default:return!1}}return!0},help:"updatePermissions can take hasPresence, canSend, canReceive, and canAdmin permissions. hasPresence must be a boolean. canSend can be a boolean or an Array or Set of media types (video, audio, screenVideo, screenAudio, customVideo, customAudio). canReceive must be an object specifying base, byUserId, and/or byParticipantId fields (see documentation for more details). canAdmin can be a boolean or an Array or Set of admin types (participants, streaming, transcription)."}};Promise.any||(Promise.any=function(){var t=Z(function*(e){return new Promise(function(n,r){var i=[];e.forEach(function(o){return Promise.resolve(o).then(function(s){n(s)}).catch(function(s){i.push(s),i.length===e.length&&r(i)})})})});return function(e){return t.apply(this,arguments)}}());var Rw=function(){function t(u){var g,p,x,_,M,I,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ht(this,t),x=this,_=$t(_=t),Xt(p=Vo(x,cp()?Reflect.construct(_,[],$t(x).constructor):_.apply(x,M)),"startListeningForDeviceChanges",function(){Ew(p.handleDeviceChange)}),Xt(p,"stopListeningForDeviceChanges",function(){Tw(p.handleDeviceChange)}),Xt(p,"handleDeviceChange",function(ie){ie=ie.map(function(de){return JSON.parse(JSON.stringify(de))}),p.emitDailyJSEvent({action:"available-devices-updated",availableDevices:ie})}),Xt(p,"handleNativeAppStateChange",function(){var ie=Z(function*(de){if(de==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield p.destroy());var an=de==="active";p.disableReactNativeAutoDeviceManagement("video")||(an?p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!0):(p.camUnmutedBeforeLosingNativeActiveState=p.localVideo(),p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!1)))});return function(de){return ie.apply(this,arguments)}}()),Xt(p,"handleNativeAudioFocusChange",function(ie){p.disableReactNativeAutoDeviceManagement("audio")||(p._hasNativeAudioFocus=ie,p.toggleParticipantAudioBasedOnNativeAudioFocus(),p._hasNativeAudioFocus?p.micUnmutedBeforeLosingNativeAudioFocus&&p.setLocalAudio(!0):(p.micUnmutedBeforeLosingNativeAudioFocus=p.localAudio(),p.setLocalAudio(!1)))}),Xt(p,"handleNativeSystemScreenCaptureStop",function(){p.stopScreenShare()}),!Bl()&&!ce())throw new Error("WebRTC not supported or suppressed");if(p.strictMode=R.strictMode===void 0||R.strictMode,p.allowMultipleCallInstances=(g=R.allowMultipleCallInstances)!==null&&g!==void 0&&g,Object.keys(yr).length&&(p._logDuplicateInstanceAttempt(),!p.allowMultipleCallInstances)){if(p.strictMode)throw new Error("Duplicate DailyIframe instances are not allowed");console.warn("Using strictMode: false to allow multiple call instances is now deprecated. Set `allowMultipleCallInstances: true`")}if(window._daily||(window._daily={pendings:[],instances:{}}),p.callClientId=Jo(),yr[(I=p).callClientId]=I,window._daily.instances[p.callClientId]={},p._sharedTracks={},window._daily.instances[p.callClientId].tracks=p._sharedTracks,R.dailyJsVersion=t.version(),p._iframe=u,p._callObjectMode=R.layout==="none"&&!p._iframe,p._preloadCache={subscribeToTracksAutomatically:!0,outputDeviceId:null,inputSettings:null,sendSettings:null,videoTrackForNetworkConnectivityTest:null,videoTrackForConnectionQualityTest:null},R.showLocalVideo!==void 0?p._callObjectMode?console.error("showLocalVideo is not available in call object mode"):p._showLocalVideo=!!R.showLocalVideo:p._showLocalVideo=!0,R.showParticipantsBar!==void 0?p._callObjectMode?console.error("showParticipantsBar is not available in call object mode"):p._showParticipantsBar=!!R.showParticipantsBar:p._showParticipantsBar=!0,R.customIntegrations!==void 0?p._callObjectMode?console.error("customIntegrations is not available in call object mode"):p._customIntegrations=R.customIntegrations:p._customIntegrations={},R.customTrayButtons!==void 0?p._callObjectMode?console.error("customTrayButtons is not available in call object mode"):p._customTrayButtons=R.customTrayButtons:p._customTrayButtons={},R.activeSpeakerMode!==void 0?p._callObjectMode?console.error("activeSpeakerMode is not available in call object mode"):p._activeSpeakerMode=!!R.activeSpeakerMode:p._activeSpeakerMode=!1,R.receiveSettings?p._callObjectMode?p._receiveSettings=R.receiveSettings:console.error("receiveSettings is only available in call object mode"):p._receiveSettings={},p.validateProperties(R),p.properties=H({},R),p._inputSettings||(p._inputSettings={}),p._callObjectLoader=p._callObjectMode?new gw(p.callClientId):null,p._callState=yh,p._isPreparingToJoin=!1,p._accessState={access:Ll},p._meetingSessionSummary={},p._finalSummaryOfPrevSession={},p._meetingSessionState=Zl(hp,p._callObjectMode),p._nativeInCallAudioMode=fp,p._participants={},p._isScreenSharing=!1,p._participantCounts=pp,p._rmpPlayerState={},p._waitingParticipants={},p._network={threshold:"good",quality:100,networkState:"unknown",stats:{}},p._activeSpeaker={},p._localAudioLevel=0,p._isLocalAudioLevelObserverRunning=!1,p._remoteParticipantsAudioLevel={},p._isRemoteParticipantsAudioLevelObserverRunning=!1,p._maxAppMessageSize=Il,p._messageChannel=ce()?new hw:new fw,p._iframe&&(p._iframe.requestFullscreen?p._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===p._iframe?(p.emitDailyJSEvent({action:gs}),p.sendMessageToCallMachine({action:gs})):(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms}))}):p._iframe.webkitRequestFullscreen&&p._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===p._iframe?(p.emitDailyJSEvent({action:gs}),p.sendMessageToCallMachine({action:gs})):(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms}))})),ce()){var U=p.nativeUtils();U.addAudioFocusChangeListener&&U.removeAudioFocusChangeListener&&U.addAppStateChangeListener&&U.removeAppStateChangeListener&&U.addSystemScreenCaptureStopListener&&U.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),p._hasNativeAudioFocus=!0,U.addAudioFocusChangeListener(p.handleNativeAudioFocusChange),U.addAppStateChangeListener(p.handleNativeAppStateChange),U.addSystemScreenCaptureStopListener(p.handleNativeSystemScreenCaptureStop)}return p._callObjectMode&&p.startListeningForDeviceChanges(),p._messageChannel.addListenerForMessagesFromCallMachine(p.handleMessageFromCallMachine,p.callClientId,p),p}return Wo(t,qo),pt(t,[{key:"destroy",value:(me=Z(function*(){var u;try{yield this.leave()}catch{}var g=this._iframe;if(g){var p=g.parentElement;p&&p.removeChild(g)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),ce()){var x=this.nativeUtils();x.removeAudioFocusChangeListener(this.handleNativeAudioFocusChange),x.removeAppStateChangeListener(this.handleNativeAppStateChange),x.removeSystemScreenCaptureStopListener(this.handleNativeSystemScreenCaptureStop)}this._callObjectMode&&this.stopListeningForDeviceChanges(),this.resetMeetingDependentVars(),this._destroyed=!0,this.emitDailyJSEvent({action:"call-instance-destroyed"}),delete yr[this.callClientId],!((u=window)===null||u===void 0||(u=u._daily)===null||u===void 0)&&u.instances&&delete window._daily.instances[this.callClientId],this.strictMode&&(this.callClientId=void 0)}),function(){return me.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(u){var g=u.bodyClass,p=u.cssFile,x=u.cssText;return ue(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl(p),bodyClass:g,cssText:x}),this}},{key:"iframe",value:function(){return ue(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return jt(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return jt(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(u,g){for(var p in g){if(!xs[p])throw new Error("unrecognized updateParticipant property ".concat(p));if(xs[p].validate&&!xs[p].validate(g[p],this,this._participants[u]))throw new Error(xs[p].help)}}},{key:"updateParticipant",value:function(u,g){return this._participants.local&&this._participants.local.session_id===u&&(u="local"),u&&g&&(this.validateParticipantProperties(u,g),this.sendMessageToCallMachine({action:"update-participant",id:u,properties:g})),this}},{key:"updateParticipants",value:function(u){var g=this._participants.local&&this._participants.local.session_id;for(var p in u)p===g&&(p="local"),p&&u[p]&&this.validateParticipantProperties(p,u[p]);return this.sendMessageToCallMachine({action:"update-participants",participants:u}),this}},{key:"updateWaitingParticipant",value:(re=Z(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(jt(this._callObjectMode,"updateWaitingParticipant()"),we(this._callState,"updateWaitingParticipant()"),typeof g!="string"||fe(p)!=="object")throw new Error("updateWaitingParticipant() must take an id string and a updates object");return new Promise(function(x,_){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participant",id:g,updates:p},function(M){M.error&&_(M.error),M.id||_(new Error("unknown error in updateWaitingParticipant()")),x({id:M.id})})})}),function(){return re.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(q=Z(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jt(this._callObjectMode,"updateWaitingParticipants()"),we(this._callState,"updateWaitingParticipants()"),fe(g)!=="object")throw new Error("updateWaitingParticipants() must take a mapping between ids and update objects");return new Promise(function(p,x){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participants",updatesById:g},function(_){_.error&&x(_.error),_.ids||x(new Error("unknown error in updateWaitingParticipants()")),p({ids:_.ids})})})}),function(){return q.apply(this,arguments)})},{key:"requestAccess",value:(z=Z(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=g.access,x=p===void 0?{level:a0}:p,_=g.name,M=_===void 0?"":_;return jt(this._callObjectMode,"requestAccess()"),we(this._callState,"requestAccess()"),new Promise(function(I,R){u.sendMessageToCallMachine({action:"daily-method-request-access",access:x,name:M},function(U){U.error&&R(U.error),U.access||R(new Error("unknown error in requestAccess()")),I({access:U.access,granted:U.granted})})})}),function(){return z.apply(this,arguments)})},{key:"localAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.audio.state):null}},{key:"localVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.video.state):null}},{key:"setLocalAudio",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return"forceDiscardTrack"in g&&(ce()?(console.warn("forceDiscardTrack option not supported in React Native; ignoring"),g={}):u&&(console.warn("forceDiscardTrack option only supported when calling setLocalAudio(false); ignoring"),g={})),this.sendMessageToCallMachine({action:"local-audio",state:u,options:g}),this}},{key:"localScreenAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenAudio.state):null}},{key:"localScreenVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenVideo.state):null}},{key:"updateScreenShare",value:function(u){if(this._isScreenSharing)return this.sendMessageToCallMachine({action:"local-screen-update",options:u}),this;console.warn("There is no screen share in progress. Try calling startScreenShare first.")}},{key:"setLocalVideo",value:function(u){return this.sendMessageToCallMachine({action:"local-video",state:u}),this}},{key:"_setAllowLocalAudio",value:function(u){if(this._preloadCache.allowLocalAudio=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-audio",state:u}),this}},{key:"_setAllowLocalVideo",value:function(u){if(this._preloadCache.allowLocalVideo=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-video",state:u}),this}},{key:"getReceiveSettings",value:(F=Z(function*(u){var g=this,p=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,x=p!==void 0&&p;if(jt(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(fe(u)){case"string":return new Promise(function(_){g.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:u,showInheritedValues:x},function(M){_(M.receiveSettings)})});case"undefined":return this._receiveSettings;default:throw new Error('first argument to getReceiveSettings() must be a participant id (or "base"), or there should be no arguments')}}),function(u){return F.apply(this,arguments)})},{key:"updateReceiveSettings",value:(ne=Z(function*(u){var g=this;if(jt(this._callObjectMode,"updateReceiveSettings()"),!wp(u,{allowAllParticipantsKey:!0}))throw new Error(_p({allowAllParticipantsKey:!0}));return we(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function(p){g.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:u},function(x){p({receiveSettings:x.receiveSettings})})})}),function(u){return ne.apply(this,arguments)})},{key:"_prepInputSettingsForSharing",value:function(u,g){if(u){var p={};if(u.audio){var x,_,M;u.audio.settings&&(!Object.keys(u.audio.settings).length&&g||(p.audio={settings:H({},u.audio.settings)})),g&&(x=p.audio)!==null&&x!==void 0&&(x=x.settings)!==null&&x!==void 0&&x.customTrack&&(p.audio.settings={customTrack:this._sharedTracks.audioTrack});var I=((_=u.audio.processor)===null||_===void 0?void 0:_.type)==="none"&&((M=u.audio.processor)===null||M===void 0?void 0:M._isDefaultWhenNone);if(u.audio.processor&&!I){var R=H({},u.audio.processor);delete R._isDefaultWhenNone,p.audio=H(H({},p.audio),{},{processor:R})}}if(u.video){var U,ie,de;u.video.settings&&(!Object.keys(u.video.settings).length&&g||(p.video={settings:H({},u.video.settings)})),g&&(U=p.video)!==null&&U!==void 0&&(U=U.settings)!==null&&U!==void 0&&U.customTrack&&(p.video.settings={customTrack:this._sharedTracks.videoTrack});var an=((ie=u.video.processor)===null||ie===void 0?void 0:ie.type)==="none"&&((de=u.video.processor)===null||de===void 0?void 0:de._isDefaultWhenNone);if(u.video.processor&&!an){var $r=H({},u.video.processor);delete $r._isDefaultWhenNone,p.video=H(H({},p.video),{},{processor:$r})}}return p}}},{key:"getInputSettings",value:function(){var u=this;return ue(),new Promise(function(g){g(u._getInputSettings())})}},{key:"_getInputSettings",value:function(){var u,g,p,x,_,M,I={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(u=((p=this._inputSettings)===null||p===void 0?void 0:p.video)||I,g=((x=this._inputSettings)===null||x===void 0?void 0:x.audio)||I):(u=((_=this._preloadCache)===null||_===void 0||(_=_.inputSettings)===null||_===void 0?void 0:_.video)||I,g=((M=this._preloadCache)===null||M===void 0||(M=M.inputSettings)===null||M===void 0?void 0:M.audio)||I);var R={audio:g,video:u};return this._prepInputSettingsForSharing(R,!0)}},{key:"_updatePreloadCacheInputSettings",value:function(u,g){var p=this._inputSettings||{},x={};if(u.video){var _,M,I;x.video={},u.video.settings?(x.video.settings={},g||u.video.settings.customTrack||(I=p.video)===null||I===void 0||!I.settings?x.video.settings=u.video.settings:x.video.settings=H(H({},p.video.settings),u.video.settings),Object.keys(x.video.settings).length||delete x.video.settings):(_=p.video)!==null&&_!==void 0&&_.settings&&(x.video.settings=p.video.settings),u.video.processor?x.video.processor=u.video.processor:(M=p.video)!==null&&M!==void 0&&M.processor&&(x.video.processor=p.video.processor)}else p.video&&(x.video=p.video);if(u.audio){var R,U,ie;x.audio={},u.audio.settings?(x.audio.settings={},g||u.audio.settings.customTrack||(ie=p.audio)===null||ie===void 0||!ie.settings?x.audio.settings=u.audio.settings:x.audio.settings=H(H({},p.audio.settings),u.audio.settings),Object.keys(x.audio.settings).length||delete x.audio.settings):(R=p.audio)!==null&&R!==void 0&&R.settings&&(x.audio.settings=p.audio.settings),u.audio.processor?x.audio.processor=u.audio.processor:(U=p.audio)!==null&&U!==void 0&&U.processor&&(x.audio.processor=p.audio.processor)}else p.audio&&(x.audio=p.audio);this._maybeUpdateInputSettings(x)}},{key:"_devicesFromInputSettings",value:function(u){var g,p,x=(u==null||(g=u.video)===null||g===void 0||(g=g.settings)===null||g===void 0?void 0:g.deviceId)||null,_=(u==null||(p=u.audio)===null||p===void 0||(p=p.settings)===null||p===void 0?void 0:p.deviceId)||null,M=this._preloadCache.outputDeviceId||null;return{camera:x?{deviceId:x}:{},mic:_?{deviceId:_}:{},speaker:M?{deviceId:M}:{}}}},{key:"updateInputSettings",value:(G=Z(function*(u){var g=this;return ue(),Sp(u)?u.video||u.audio?(kp(u,this.properties.dailyConfig,this._sharedTracks),this._callObjectMode&&!this._callMachineInitialized?(this._updatePreloadCacheInputSettings(u,!0),this._getInputSettings()):new Promise(function(p,x){g.sendMessageToCallMachine({action:"update-input-settings",inputSettings:u},function(_){if(_.error)x(_.error);else{if(_.returnPreloadCache)return g._updatePreloadCacheInputSettings(u,!0),void p(g._getInputSettings());g._maybeUpdateInputSettings(_.inputSettings),p(g._prepInputSettingsForSharing(_.inputSettings,!0))}})})):this._getInputSettings():(console.error(Xl()),Promise.reject(Xl()))}),function(u){return G.apply(this,arguments)})},{key:"setBandwidth",value:function(u){var g=u.kbs,p=u.trackConstraints;if(ue(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:g,trackConstraints:p}),this}},{key:"getDailyLang",value:function(){var u=this;if(ue(),this._callMachineInitialized)return new Promise(function(g){u.sendMessageToCallMachine({action:"get-daily-lang"},function(p){delete p.action,delete p.callbackStamp,g(p)})})}},{key:"setDailyLang",value:function(u){return ue(),this.sendMessageToCallMachine({action:"set-daily-lang",lang:u}),this}},{key:"setProxyUrl",value:function(u){return this.sendMessageToCallMachine({action:"set-proxy-url",proxyUrl:u}),this}},{key:"setIceConfig",value:function(u){return this.sendMessageToCallMachine({action:"set-ice-config",iceConfig:u}),this}},{key:"meetingSessionSummary",value:function(){return[mr,In].includes(this._callState)?this._finalSummaryOfPrevSession:this._meetingSessionSummary}},{key:"getMeetingSession",value:(J=Z(function*(){var u=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),we(this._callState,"getMeetingSession()"),new Promise(function(g){u.sendMessageToCallMachine({action:"get-meeting-session"},function(p){delete p.action,delete p.callbackStamp,g(p)})})}),function(){return J.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return we(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";jt(this._callObjectMode,"setMeetingSessionData()"),we(this._callState,"setMeetingSessionData");try{(function(p,x){new pw({data:p,mergeStrategy:x})})(u,g)}catch(p){throw console.error(p),p}try{this.sendMessageToCallMachine({action:"set-session-data",data:u,mergeStrategy:g})}catch(p){throw new Error("Error setting meeting session data: ".concat(p))}}},{key:"setUserName",value:function(u,g){var p=this;return this.properties.userName=u,new Promise(function(x){p.sendMessageToCallMachine({action:"set-user-name",name:u??"",thisMeetingOnly:ce()||!!g&&!!g.thisMeetingOnly},function(_){delete _.action,delete _.callbackStamp,x(_)})})}},{key:"setUserData",value:(se=Z(function*(u){var g=this;try{bp(u)}catch(p){throw console.error(p),p}if(this.properties.userData=u,this._callMachineInitialized)return new Promise(function(p){try{g.sendMessageToCallMachine({action:"set-user-data",userData:u},function(x){delete x.action,delete x.callbackStamp,p(x)})}catch(x){throw new Error("Error setting user data: ".concat(x))}})}),function(u){return se.apply(this,arguments)})},{key:"validateAudioLevelInterval",value:function(u){if(u&&(u<100||typeof u!="number"))throw new Error("The interval must be a number greater than or equal to 100 milliseconds.")}},{key:"startLocalAudioLevelObserver",value:function(u){var g=this;if(typeof AudioWorkletNode>"u"&&!ce())throw new Error("startLocalAudioLevelObserver() is not supported on this browser");if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isLocalAudioLevelObserverRunning=!0,new Promise(function(p,x){g.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:u},function(_){g._isLocalAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.localAudioLevelObserver={enabled:!0,interval:u}}},{key:"isLocalAudioLevelObserverRunning",value:function(){return this._isLocalAudioLevelObserverRunning}},{key:"stopLocalAudioLevelObserver",value:function(){this._preloadCache.localAudioLevelObserver=null,this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-local-audio-level-observer"})}},{key:"startRemoteParticipantsAudioLevelObserver",value:function(u){var g=this;if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isRemoteParticipantsAudioLevelObserverRunning=!0,new Promise(function(p,x){g.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:u},function(_){g._isRemoteParticipantsAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.remoteParticipantsAudioLevelObserver={enabled:!0,interval:u}}},{key:"isRemoteParticipantsAudioLevelObserverRunning",value:function(){return this._isRemoteParticipantsAudioLevelObserverRunning}},{key:"stopRemoteParticipantsAudioLevelObserver",value:function(){this._preloadCache.remoteParticipantsAudioLevelObserver=null,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-remote-participants-audio-level-observer"})}},{key:"startCamera",value:(K=Z(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jt(this._callObjectMode,"startCamera()"),Ql(this._callState,this._isPreparingToJoin,"startCamera()","Did you mean to use setLocalAudio() and/or setLocalVideo() instead?"),this.needsLoad())try{yield this.load(g)}catch(p){return Promise.reject(p)}else{if(this._didPreAuth){if(g.url&&g.url!==this.properties.url)return console.error("url in startCamera() is different than the one used in preAuth()"),Promise.reject();if(g.token&&g.token!==this.properties.token)return console.error("token in startCamera() is different than the one used in preAuth()"),Promise.reject()}this.validateProperties(g),this.properties=H(H({},this.properties),g)}return new Promise(function(p){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"start-camera",properties:Xr(u.properties,u.callClientId),preloadCache:Xr(u._preloadCache,u.callClientId)},function(x){p({camera:x.camera,mic:x.mic,speaker:x.speaker})})})}),function(){return K.apply(this,arguments)})},{key:"validateCustomTrack",value:function(u,g,p){if(p&&p.length>50)throw new Error("Custom track `trackName` must not be more than 50 characters");if(g&&g!=="music"&&g!=="speech"&&!(g instanceof Object))throw new Error("Custom track `mode` must be either `music` | `speech` | `DailyMicAudioModeSettings` or `undefined`");if(p&&["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo","customVideoDefaults"].includes(p))throw new Error("Custom track `trackName` must not match a track name already used by daily: cam-audio, cam-video, customVideoDefaults, screen-video, screen-audio, rmpAudio, rmpVideo");if(!(u instanceof MediaStreamTrack))throw new Error("Custom tracks provided must be instances of MediaStreamTrack")}},{key:"startCustomTrack",value:function(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{track,mode,trackName,ignoreAudioLevel};return ue(),we(this._callState,"startCustomTrack()"),this.validateCustomTrack(g.track,g.mode,g.trackName),new Promise(function(p,x){u._sharedTracks.customTrack=g.track,g.track=pn,u.sendMessageToCallMachine({action:"start-custom-track",properties:g},function(_){_.error?x({error:_.error}):p(_.mediaTag)})})}},{key:"stopCustomTrack",value:function(u){var g=this;return ue(),we(this._callState,"stopCustomTrack()"),new Promise(function(p){g.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:u},function(x){p(x.mediaTag)})})}},{key:"setCamera",value:function(u){var g=this;return Hi(),Cs(this._callMachineInitialized,"setCamera()"),new Promise(function(p){g.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:u},function(x){p({device:x.device})})})}},{key:"setAudioDevice",value:(W=Z(function*(u){return Hi(),this.nativeUtils().setAudioDevice(u),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(u){return W.apply(this,arguments)})},{key:"cycleCamera",value:function(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p){u.sendMessageToCallMachine({action:"cycle-camera",properties:g},function(x){p({device:x.device})})})}},{key:"cycleMic",value:function(){var u=this;return ue(),new Promise(function(g){u.sendMessageToCallMachine({action:"cycle-mic"},function(p){g({device:p.device})})})}},{key:"getCameraFacingMode",value:function(){var u=this;return Hi(),new Promise(function(g){u.sendMessageToCallMachine({action:"get-camera-facing-mode"},function(p){g(p.facingMode)})})}},{key:"setInputDevicesAsync",value:(B=Z(function*(u){var g=this,p=u.audioDeviceId,x=u.videoDeviceId,_=u.audioSource,M=u.videoSource;if(ue(),_!==void 0&&(p=_),M!==void 0&&(x=M),typeof p=="boolean"&&(this._setAllowLocalAudio(p),p=void 0),typeof x=="boolean"&&(this._setAllowLocalVideo(x),x=void 0),!p&&!x)return yield this.getInputDevices();var I={};return p&&(p instanceof MediaStreamTrack?(this._sharedTracks.audioTrack=p,p=pn,I.audio={settings:{customTrack:p}}):(delete this._sharedTracks.audioTrack,I.audio={settings:{deviceId:p}})),x&&(x instanceof MediaStreamTrack?(this._sharedTracks.videoTrack=x,x=pn,I.video={settings:{customTrack:x}}):(delete this._sharedTracks.videoTrack,I.video={settings:{deviceId:x}})),this._callObjectMode&&this.needsLoad()?(this._updatePreloadCacheInputSettings(I,!1),this._devicesFromInputSettings(this._inputSettings)):new Promise(function(R){g.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:p,videoDeviceId:x},function(U){if(delete U.action,delete U.callbackStamp,U.returnPreloadCache)return g._updatePreloadCacheInputSettings(I,!1),void R(g._devicesFromInputSettings(g._inputSettings));R(U)})})}),function(u){return B.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(V=Z(function*(u){var g=this,p=u.outputDeviceId;if(ue(),!p||typeof p!="string")throw new Error("outputDeviceId must be provided and must be a valid device id");return this._preloadCache.outputDeviceId=p,this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(x,_){g.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:p},function(M){if(delete M.action,delete M.callbackStamp,M.error){var I=new Error(M.error.message);return I.type=M.error.type,void _(I)}M.returnPreloadCache?x(g._devicesFromInputSettings(g._inputSettings)):x(M)})})}),function(u){return V.apply(this,arguments)})},{key:"getInputDevices",value:(X=Z(function*(){var u=this;return this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(g){u.sendMessageToCallMachine({action:"get-input-devices"},function(p){p.returnPreloadCache?g(u._devicesFromInputSettings(u._inputSettings)):g({camera:p.camera,mic:p.mic,speaker:p.speaker})})})}),function(){return X.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return Hi(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(u){if(Hi(),[fp,Iw].includes(u)){if(u!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=u,!this.disableReactNativeAutoDeviceManagement("audio")&&_s(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMode(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",u)}},{key:"preAuth",value:($=Z(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jt(this._callObjectMode,"preAuth()"),Ql(this._callState,this._isPreparingToJoin,"preAuth()"),this.needsLoad()&&(yield this.load(g)),!g.url)throw new Error("preAuth() requires at least a url to be provided");return this.validateProperties(g),this.properties=H(H({},this.properties),g),new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"daily-method-preauth",properties:Xr(u.properties,u.callClientId),preloadCache:Xr(u._preloadCache,u.callClientId)},function(_){return _.error?x(_.error):_.access?(u._didPreAuth=!0,void p({access:_.access})):x(new Error("unknown error in preAuth()"))})})}),function(){return $.apply(this,arguments)})},{key:"load",value:(P=Z(function*(u){var g=this;if(this.needsLoad()){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");if(u&&(this.validateProperties(u),this.properties=H(H({},this.properties),u)),!this._callObjectMode&&!this.properties.url)throw new Error("can't load iframe meeting because url property isn't set");return this._updateCallState(bh),this.emitDailyJSEvent({action:p0}),this._callObjectMode?new Promise(function(p,x){g._callObjectLoader.cancel();var _=Date.now();g._callObjectLoader.load(g.properties.dailyConfig,function(M){g._bundleLoadTime=M?"no-op":Date.now()-_,g._updateCallState(wh),M&&g.emitDailyJSEvent({action:kh}),p()},function(M,I){if(g.emitDailyJSEvent({action:g0}),!I){g._updateCallState(In),g.resetMeetingDependentVars();var R={action:Th,errorMsg:M.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:M,bundleUrl:Go(g.properties.dailyConfig)}}};g._maybeSendToSentry(R),g.emitDailyJSEvent(R),x(M.msg)}})}):(this._iframe.src=of(this.assembleMeetingUrl(),this.properties.dailyConfig),new Promise(function(p,x){g._loadedCallback=function(_){g._callState!==In?(g._updateCallState(wh),(g.properties.cssFile||g.properties.cssText)&&g.loadCss(g.properties),p()):x(_)}}))}}),function(u){return P.apply(this,arguments)})},{key:"join",value:(O=Z(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._testCallInProgress&&this.stopTestCallQuality();var p=!1;if(this.needsLoad()){this.updateIsPreparingToJoin(!0);try{yield this.load(g)}catch(x){return this.updateIsPreparingToJoin(!1),Promise.reject(x)}}else{if(p=!(!this.properties.cssFile&&!this.properties.cssText),this._didPreAuth){if(g.url&&g.url!==this.properties.url)return console.error("url in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject();if(g.token&&g.token!==this.properties.token)return console.error("token in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject()}if(g.url&&!this._callObjectMode&&g.url&&g.url!==this.properties.url)return console.error("url in join() is different than the one used in load() (".concat(this.properties.url," -> ").concat(g.url,")")),this.updateIsPreparingToJoin(!1),Promise.reject();this.validateProperties(g),this.properties=H(H({},this.properties),g)}return g.showLocalVideo!==void 0&&(this._callObjectMode?console.error("showLocalVideo is not available in callObject mode"):this._showLocalVideo=!!g.showLocalVideo),g.showParticipantsBar!==void 0&&(this._callObjectMode?console.error("showParticipantsBar is not available in callObject mode"):this._showParticipantsBar=!!g.showParticipantsBar),this._callState===gr||this._callState===Dl?(console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1)):(this._updateCallState(Dl,!1),this.emitDailyJSEvent({action:y0}),this._preloadCache.inputSettings=this._prepInputSettingsForSharing(this._inputSettings||{},!1),this.sendMessageToCallMachine({action:"join-meeting",properties:Xr(this.properties,this.callClientId),preloadCache:Xr(this._preloadCache,this.callClientId)}),new Promise(function(x,_){u._joinedCallback=function(M,I){if(u._callState!==In){if(u._updateCallState(gr),M)for(var R in M){if(u._callObjectMode){var U=u._callMachine().store;Yh(M[R],U),Xh(M[R],U),Zh(M[R],u._participants[R],U)}u._participants[R]=H({},M[R]),u.toggleParticipantAudioBasedOnNativeAudioFocus()}p&&u.loadCss(u.properties),x(M)}else _(I)}}))}),function(){return O.apply(this,arguments)})},{key:"leave",value:(T=Z(function*(){var u=this;return this._testCallInProgress&&this.stopTestCallQuality(),new Promise(function(g){u._callState===mr||u._callState===In?g():u._callObjectLoader&&!u._callObjectLoader.loaded?(u._callObjectLoader.cancel(),u._updateCallState(mr),u.resetMeetingDependentVars(),u.emitDailyJSEvent({action:mr}),g()):(u._resolveLeave=g,u.sendMessageToCallMachine({action:"leave-meeting"}))})}),function(){return T.apply(this,arguments)})},{key:"startScreenShare",value:(C=Z(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Cs(this._callMachineInitialized,"startScreenShare()"),g.screenVideoSendSettings&&this._validateVideoSendSettings("screenVideo",g.screenVideoSendSettings),g.mediaStream&&(this._sharedTracks.screenMediaStream=g.mediaStream,g.mediaStream=pn),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var p=this.nativeUtils();if(yield p.isScreenBeingCaptured())return void this.emitDailyJSEvent({action:Eh,type:"screen-share-error",errorMsg:"Could not start the screen sharing. The screen is already been captured!"});p.setSystemScreenCaptureStartCallback(function(){p.setSystemScreenCaptureStartCallback(null),u.sendMessageToCallMachine({action:Ah,captureOptions:g})}),p.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:Ah,captureOptions:g})}),function(){return C.apply(this,arguments)})},{key:"stopScreenShare",value:function(){Cs(this._callMachineInitialized,"stopScreenShare()"),this.sendMessageToCallMachine({action:"local-screen-stop"})}},{key:"startRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},g=u.type;if(g&&g!=="cloud"&&g!=="raw-tracks"&&g!=="local")throw new Error("invalid type: ".concat(g,", allowed values 'cloud', 'raw-tracks', or 'local'"));this.sendMessageToCallMachine(H({action:"local-recording-start"},u))}},{key:"updateRecording",value:function(u){var g=u.layout,p=g===void 0?{preset:"default"}:g,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-recording",layout:p,instanceId:x})}},{key:"stopRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(H({action:"local-recording-stop"},u))}},{key:"startLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(H({action:"daily-method-start-live-streaming"},u))}},{key:"updateLiveStreaming",value:function(u){var g=u.layout,p=g===void 0?{preset:"default"}:g,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:p,instanceId:x})}},{key:"addLiveStreamingEndpoints",value:function(u){var g=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Oh,endpointsOp:sw,endpoints:g,instanceId:p})}},{key:"removeLiveStreamingEndpoints",value:function(u){var g=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Oh,endpointsOp:aw,endpoints:g,instanceId:p})}},{key:"stopLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(H({action:"daily-method-stop-live-streaming"},u))}},{key:"validateDailyConfig",value:function(u){u.camSimulcastEncodings&&(console.warn("camSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide camera simulcast settings."),this.validateSimulcastEncodings(u.camSimulcastEncodings)),u.screenSimulcastEncodings&&console.warn("screenSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide screen simulcast settings."),$h()&&u.noAutoDefaultDeviceChange&&console.warn("noAutoDefaultDeviceChange is not supported on Android, and will be ignored.")}},{key:"validateSimulcastEncodings",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(u){if(!(u instanceof Array||Array.isArray(u)))throw new Error("encodings must be an Array");if(!Pp(u.length,1,3))throw new Error("encodings must be an Array with between 1 to ".concat(3," layers"));for(var x=0;x<u.length;x++){var _=u[x];for(var M in this._validateEncodingLayerHasValidProperties(_),_)if(Jl.includes(M)){if(typeof _[M]!="number")throw new Error("".concat(M," must be a number"));if(g){var I=g[M],R=I.min,U=I.max;if(!Pp(_[M],R,U))throw new Error("".concat(M," value not in range. valid range: ").concat(R," to ").concat(U))}}else if(!["active","scalabilityMode"].includes(M))throw new Error("Invalid key ".concat(M,", valid keys are:")+Object.values(Jl));if(p&&!_.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(k=Z(function*(u){var g=this,p=u.url,x=u.settings,_=x===void 0?{state:Nl.PLAY}:x;try{(function(M){if(typeof M!="string")throw new Error('url parameter must be "string" type')})(p),Op(_),function(M){for(var I in M)if(!mp.includes(I))throw new Error("Invalid key ".concat(I,", valid keys are: ").concat(mp));M.simulcastEncodings&&this.validateSimulcastEncodings(M.simulcastEncodings,gp,!0)}(_)}catch(M){throw console.error("invalid argument Error: ".concat(M)),console.error(`startRemoteMediaPlayer arguments must be of the form:
|
|
25
|
+
Event: ${Ln(s)}.
|
|
26
|
+
Url: ${us(s)}`),!0)}(e,o)?null:e}});function us(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?function(n=[]){for(let r=n.length-1;r>=0;r--){const i=n[r];if(i&&i.filename!=="<anonymous>"&&i.filename!=="[native code]")return i.filename||null}return null}(e):null}catch{return xe&&te.error(`Cannot extract url for event ${Ln(t)}`),null}}function Mb(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&dr(s.originalException,Error)))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var l,c;a&&(o.exception.values=(l=bl(t,e,i,s.originalException,r,o.exception.values,a,0),c=n,l.map(d=>(d.value&&(d.value=Kr(d.value,c)),d))))}function bl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(dr(r[i],Error)){th(s,a);const c=t(e,r[i]),d=l.length;nh(c,i,d,a),l=bl(t,e,n,r[i],i,[c,...l],c,d)}return Array.isArray(r.errors)&&r.errors.forEach((c,d)=>{if(dr(c,Error)){th(s,a);const f=t(e,c),h=l.length;nh(f,`errors[${d}]`,h,a),l=bl(t,e,n,c,i,[f,...l],f,h)}}),l}function th(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function nh(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function wl(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Ab(){"console"in ge&&Xa.forEach(function(t){t in ge.console&>(ge.console,t,function(e){return Xo[t]=e,function(...n){Ft("console",{args:n,level:t});const r=Xo[t];r&&r.apply(ge.console,n)}})})}function Ob(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Db=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(n,r){return r?!!(function(i,o){const s=i.message,a=o.message;return!(!s&&!a||s&&!a||!s&&a||s!==a||!ih(i,o)||!rh(i,o))}(n,r)||function(i,o){const s=oh(o),a=oh(i);return!(!s||!a||s.type!==a.type||s.value!==a.value||!ih(i,o)||!rh(i,o))}(n,r)):!1}(e,t))return xe&&te.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function rh(t,e){let n=uf(t),r=uf(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let i=0;i<r.length;i++){const o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function ih(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return n.join("")===r.join("")}catch{return!1}}function oh(t){return t.exception&&t.exception.values&&t.exception.values[0]}function sh(t){return t===void 0?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const Sl=ge;function kl(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Pb(){if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in Sl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(kl(Sl.fetch))return!0;let t=!1;const e=Sl.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=kl(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){ar&&te.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function Lb(t,e){const n="fetch";cr(n,t),ur(n,()=>function(r,i=!1){i&&!Pb()||gt(ge,"fetch",function(o){return function(...s){const a=new Error,{method:l,url:c}=function(f){if(f.length===0)return{method:"GET",url:""};if(f.length===2){const[b,y]=f;return{url:ah(b),method:xl(y,"method")?String(y.method).toUpperCase():"GET"}}const h=f[0];return{url:ah(h),method:xl(h,"method")?String(h.method).toUpperCase():"GET"}}(s),d={args:s,fetchData:{method:l,url:c},startTimestamp:1e3*dn(),virtualError:a};return r||Ft("fetch",{...d}),o.apply(ge,s).then(async f=>(r?r(f):Ft("fetch",{...d,endTimestamp:1e3*dn(),response:f}),f),f=>{throw Ft("fetch",{...d,endTimestamp:1e3*dn(),error:f}),nl(f)&&f.stack===void 0&&(f.stack=a.stack,fr(f,"framesToPop",1)),f})}})}(void 0,e))}function xl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ah(t){return typeof t=="string"?t:t?xl(t,"url")?t.url:t.toString?t.toString():"":""}const ds=ge,$e=ge;let _l=0;function lh(){return _l>0}function Gr(t,e={}){if(!function(r){return typeof r=="function"}(t))return t;try{const r=t.__sentry_wrapped__;if(r)return typeof r=="function"?r:t;if(sl(t))return t}catch{return t}const n=function(...r){try{const i=r.map(o=>Gr(o,e));return t.apply(this,i)}catch(i){throw _l++,setTimeout(()=>{_l--}),function(...o){const s=fl(ts());if(o.length===2){const[a,l]=o;return a?s.withSetScope(a,l):s.withScope(l)}s.withScope(o[0])}(o=>{var s;o.addEventProcessor(a=>(e.mechanism&&(ll(a,void 0),Wr(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),s=i,pr().captureException(s,void 0)}),i}};try{for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}catch{}yf(n,t),fr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}const fs=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Cl(t,e){const n=Tl(t,e),r={type:Nb(e),value:$b(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function Ib(t,e,n,r){const i=Je(),o=i&&i.getOptions().normalizeDepth,s=function(c){for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d)){const f=c[d];if(f instanceof Error)return f}}(e),a={__serialized__:Rf(e,o)};if(s)return{exception:{values:[Cl(t,s)]},extra:a};const l={exception:{values:[{type:ns(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Fb(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=Tl(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function El(t,e){return{exception:{values:[Cl(t,e)]}}}function Tl(t,e){const n=e.stacktrace||e.stack||"",r=function(o){return o&&Rb.test(o.message)?1:0}(e),i=function(o){return typeof o.framesToPop=="number"?o.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const Rb=/Minified React error #\d+;/i;function ch(t){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&t instanceof WebAssembly.Exception}function Nb(t){const e=t&&t.name;return!e&&ch(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function $b(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:ch(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function Ml(t,e,n,r,i){let o;if(hf(e)&&e.error)return El(t,e.error);if(pf(e)||Hr(e,"DOMException")){const s=e;if("stack"in e)o=El(t,e);else{const a=s.name||(pf(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=Al(t,l,n,r),ll(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return nl(e)?El(t,e):Vr(e)||ns(e)?(o=Ib(t,e,n,i),Wr(o,{synthetic:!0}),o):(o=Al(t,e,n,r),ll(o,`${e}`),Wr(o,{synthetic:!0}),o)}function Al(t,e,n,r){const i={};if(r&&n){const o=Tl(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Wr(i,{synthetic:!0})}if(rl(e)){const{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function Fb(t,{isUnhandledRejection:e}){const n=function(i,o=40){const s=Object.keys(bf(i));s.sort();const a=s[0];if(!a)return"[object has no keys]";if(a.length>=o)return Kr(a,o);for(let l=s.length;l>0;l--){const c=s.slice(0,l).join(", ");if(!(c.length>o))return l===s.length?c:Kr(c,o)}return""}(t),r=e?"promise rejection":"exception";return hf(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:ns(t)?`Event \`${function(i){try{const o=Object.getPrototypeOf(i);return o?o.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Bb extends wb{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e};(function(r,i,o=[i],s="npm"){const a=r._metadata||{};a.sdk||(a.sdk={name:`sentry.javascript.${i}`,packages:o.map(l=>({name:`${s}:@sentry/${l}`,version:sr})),version:sr}),r._metadata=a})(n,"browser",["browser"],$e.SENTRY_SDK_SOURCE||"npm"),super(n),n.sendClientReports&&$e.document&&$e.document.addEventListener("visibilitychange",()=>{$e.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return function(r,i,o,s){const a=Ml(r,i,o&&o.syntheticException||void 0,s);return Wr(a),a.level="error",o&&o.event_id&&(a.event_id=o.event_id),hr(a)}(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return function(i,o,s="info",a,l){const c=Al(i,o,a&&a.syntheticException||void 0,l);return c.level=s,a&&a.event_id&&(c.event_id=a.event_id),hr(c)}(this._options.stackParser,e,n,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(fs&&te.warn("SDK not enabled, will not capture user feedback."));const n=function(r,{metadata:i,tunnel:o,dsn:s}){const a={event_id:r.event_id,sent_at:new Date().toISOString(),...i&&i.sdk&&{sdk:{name:i.sdk.name,version:i.sdk.version}},...!!o&&!!s&&{dsn:as(s)}};return Fi(a,[function(c){return[{type:"user_report"},c]}(r)])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}}const jb=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nt=ge;let uh,Ol,Dl,hs;function Ub(){if(!nt.document)return;const t=Ft.bind(null,"dom"),e=dh(t,!0);nt.document.addEventListener("click",e,!1),nt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=nt[n],i=r&&r.prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(gt(i,"addEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=c[s]=c[s]||{refCount:0};if(!d.handler){const f=dh(t);d.handler=f,o.call(this,s,f,l)}d.refCount++}catch{}return o.call(this,s,a,l)}}),gt(i,"removeEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},d=c[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,l),d.handler=void 0,delete c[s]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,l)}}))})}function dh(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(o){try{return o.target}catch{return null}}(n);if(function(o,s){return o==="keypress"&&(!s||!s.tagName||s.tagName!=="INPUT"&&s.tagName!=="TEXTAREA"&&!s.isContentEditable)}(n.type,r))return;fr(n,"_sentryCaptured",!0),r&&!r._sentryId&&fr(r,"_sentryId",Et());const i=n.type==="keypress"?"input":n.type;(function(o){if(o.type!==Ol)return!1;try{if(!o.target||o.target._sentryId!==Dl)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Ol=n.type,Dl=r?r._sentryId:void 0),clearTimeout(uh),uh=nt.setTimeout(()=>{Dl=void 0,Ol=void 0},1e3)}}function fh(t){const e="history";cr(e,t),ur(e,zb)}function zb(){if(!function(){const n=ds.chrome,r=n&&n.app&&n.app.runtime,i="history"in ds&&!!ds.history.pushState&&!!ds.history.replaceState;return!r&&i}())return;const t=nt.onpopstate;function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const o=hs,s=String(i);hs=s,Ft("history",{from:o,to:s})}return n.apply(this,r)}}nt.onpopstate=function(...n){const r=nt.location.href,i=hs;if(hs=r,Ft("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}},gt(nt.history,"pushState",e),gt(nt.history,"replaceState",e)}const ps={};function hh(t){ps[t]=void 0}const Bi="__sentry_xhr_v3__";function Hb(){if(!nt.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,o=1e3*dn(),s=un(r[0])?r[0].toUpperCase():void 0,a=function(c){if(un(c))return c;try{return c.toString()}catch{}}(r[1]);if(!s||!a)return e.apply(n,r);n[Bi]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[Bi];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}Ft("xhr",{endTimestamp:1e3*dn(),startTimestamp:o,xhr:n,virtualError:i})}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply:(c,d,f)=>(l(),c.apply(d,f))}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,d,f){const[h,b]=f,y=d[Bi];return y&&un(h)&&un(b)&&(y.request_headers[h.toLowerCase()]=b),c.apply(d,f)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[Bi];return i?(r[0]!==void 0&&(i.body=r[0]),Ft("xhr",{startTimestamp:1e3*dn(),xhr:n}),e.apply(n,r)):e.apply(n,r)}})}function Vb(t,e=function(n){const r=ps[n];if(r)return r;let i=nt[n];if(kl(i))return ps[n]=i.bind(nt);const o=nt.document;if(o&&typeof o.createElement=="function")try{const s=o.createElement("iframe");s.hidden=!0,o.head.appendChild(s);const a=s.contentWindow;a&&a[n]&&(i=a[n]),o.head.removeChild(s)}catch(s){jb&&te.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,s)}return i&&(ps[n]=i.bind(nt))}("fetch")){let n=0,r=0;return xb(t,function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return hh("fetch"),os("No fetch implementation available");try{return e(t.url,s).then(a=>(n-=o,r--,{statusCode:a.status,headers:{"x-sentry-rate-limits":a.headers.get("X-Sentry-Rate-Limits"),"retry-after":a.headers.get("Retry-After")}}))}catch(a){return hh("fetch"),n-=o,r--,os(a)}})}function Pl(t,e,n,r){const i={filename:t,function:e==="<anonymous>"?lr:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const Kb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Wb=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qb=/\((\S*)(?::(\d+))(?::(\d+))\)/,Jb=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Gb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qb=function(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const o=[],s=n.split(`
|
|
27
|
+
`);for(let a=r;a<s.length;a++){const l=s[a];if(l.length>1024)continue;const c=af.test(l)?l.replace(af,"$1"):l;if(!c.match(/\S*Error: /)){for(const d of e){const f=d(c);if(f){o.push(f);break}}if(o.length>=50+i)break}}return function(a){if(!a.length)return[];const l=Array.from(a);return/sentryWrapped/.test(Zo(l).function||"")&&l.pop(),l.reverse(),lf.test(Zo(l).function||"")&&(l.pop(),lf.test(Zo(l).function||"")&&l.pop()),l.slice(0,50).map(c=>({...c,filename:c.filename||Zo(l).filename,function:c.function||lr}))}(o.slice(i))}}([30,t=>{const e=Kb.exec(t);if(e){const[,r,i,o]=e;return Pl(r,lr,+i,+o)}const n=Wb.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=qb.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,i]=ph(n[1]||lr,n[2]);return Pl(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=Jb.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=Gb.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let n=e[3],r=e[1]||lr;return[r,n]=ph(r,n),Pl(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),ph=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:lr,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},gh=1024,Yb=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(n){var r;e.console&&function(i){const o="console";cr(o,i),ur(o,Ab)}(function(i){return function(o){if(Je()!==i)return;const s={category:"console",data:{arguments:o.args,logger:"console"},level:Ob(o.level),message:vf(o.args," ")};if(o.level==="assert"){if(o.args[0]!==!1)return;s.message=`Assertion failed: ${vf(o.args.slice(1)," ")||"console.assert"}`,s.data.arguments=o.args.slice(1)}gr(s,{input:o.args,level:o.level})}}(n)),e.dom&&(r=function(i,o){return function(s){if(Je()!==i)return;let a,l,c=typeof o=="object"?o.serializeAttribute:void 0,d=typeof o=="object"&&typeof o.maxStringLength=="number"?o.maxStringLength:void 0;d&&d>gh&&(fs&&te.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${d} was configured. Sentry will use 1024 instead.`),d=gh),typeof c=="string"&&(c=[c]);try{const h=s.event,b=function(y){return!!y&&!!y.target}(h)?h.target:h;a=mf(b,{keyAttrs:c,maxStringLength:d}),l=function(y){if(!ol.HTMLElement)return null;let g=y;for(let S=0;S<5;S++){if(!g)return null;if(g instanceof HTMLElement){if(g.dataset.sentryComponent)return g.dataset.sentryComponent;if(g.dataset.sentryElement)return g.dataset.sentryElement}g=g.parentNode}return null}(b)}catch{a="<unknown>"}if(a.length===0)return;const f={category:`ui.${s.name}`,message:a};l&&(f.data={"ui.component_name":l}),gr(f,{event:s.event,name:s.name,global:s.global})}}(n,e.dom),cr("dom",r),ur("dom",Ub)),e.xhr&&function(i){cr("xhr",i),ur("xhr",Hb)}(function(i){return function(o){if(Je()!==i)return;const{startTimestamp:s,endTimestamp:a}=o,l=o.xhr[Bi];if(!s||!a||!l)return;const{method:c,url:d,status_code:f,body:h}=l,b={method:c,url:d,status_code:f},y={xhr:o.xhr,input:h,startTimestamp:s,endTimestamp:a};gr({category:"xhr",data:b,type:"http",level:sh(f)},y)}}(n)),e.fetch&&Lb(function(i){return function(o){if(Je()!==i)return;const{startTimestamp:s,endTimestamp:a}=o;if(a&&(!o.fetchData.url.match(/sentry_key/)||o.fetchData.method!=="POST"))if(o.error)gr({category:"fetch",data:o.fetchData,level:"error",type:"http"},{data:o.error,input:o.args,startTimestamp:s,endTimestamp:a});else{const l=o.response,c={...o.fetchData,status_code:l&&l.status},d={input:o.args,response:l,startTimestamp:s,endTimestamp:a};gr({category:"fetch",data:c,type:"http",level:sh(c.status_code)},d)}}}(n)),e.history&&fh(function(i){return function(o){if(Je()!==i)return;let s=o.from,a=o.to;const l=wl($e.location.href);let c=s?wl(s):void 0;const d=wl(a);c&&c.path||(c=l),l.protocol===d.protocol&&l.host===d.host&&(a=d.relative),l.protocol===c.protocol&&l.host===c.host&&(s=c.relative),gr({category:"navigation",data:{from:s,to:a}})}}(n)),e.sentry&&n.on("beforeSendEvent",function(i){return function(o){Je()===i&&gr({category:"sentry."+(o.type==="transaction"?"transaction":"event"),event_id:o.event_id,level:o.level,message:Ln(o)},{event:o})}}(n))}}},Xb=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Zb=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&>($e,"setTimeout",mh),e.setInterval&>($e,"setInterval",mh),e.requestAnimationFrame&>($e,"requestAnimationFrame",e0),e.XMLHttpRequest&&"XMLHttpRequest"in $e&>(XMLHttpRequest.prototype,"send",t0);const n=e.eventTarget;n&&(Array.isArray(n)?n:Xb).forEach(n0)}}};function mh(t){return function(...e){const n=e[0];return e[0]=Gr(n,{mechanism:{data:{function:Pn(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function e0(t){return function(e){return t.apply(this,[Gr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Pn(t)},handled:!1,type:"instrument"}})])}}function t0(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&>(n,r,function(i){const o={mechanism:{data:{function:r,handler:Pn(i)},handled:!1,type:"instrument"}},s=sl(i);return s&&(o.mechanism.data.handler=Pn(s)),Gr(i,o)})}),t.apply(this,e)}}function n0(t){const e=$e[t],n=e&&e.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(gt(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=Gr(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Pn(o),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Gr(o,{mechanism:{data:{function:"addEventListener",handler:Pn(o),target:t},handled:!1,type:"instrument"}}),s])}}),gt(n,"removeEventListener",function(r){return function(i,o,s){try{const a=o.__sentry_wrapped__;a&&r.call(this,i,a,s)}catch{}return r.call(this,i,o,s)}}))}const r0=()=>({name:"BrowserSession",setupOnce(){$e.document!==void 0?(zf({ignoreDuration:!0}),Kf(),fh(({from:t,to:e})=>{t!==void 0&&t!==e&&(zf({ignoreDuration:!0}),Kf())})):fs&&te.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),i0=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(function(r){(function(i){const o="error";cr(o,i),ur(o,Jy)})(i=>{const{stackParser:o,attachStacktrace:s}=yh();if(Je()!==r||lh())return;const{msg:a,url:l,line:c,column:d,error:f}=i,h=function(b,y,g,S){const v=b.exception=b.exception||{},w=v.values=v.values||[],k=w[0]=w[0]||{},C=k.stacktrace=k.stacktrace||{},E=C.frames=C.frames||[],A=S,D=g,$=un(y)&&y.length>0?y:function(){try{return ol.document.location.href}catch{return""}}();return E.length===0&&E.push({colno:A,filename:$,function:lr,in_app:!0,lineno:D}),b}(Ml(o,f||a,void 0,s,!1),l,c,d);h.level="error",Uf(h,{originalException:f,mechanism:{handled:!1,type:"onerror"}})})}(n),vh("onerror")),e.onunhandledrejection&&(function(r){(function(i){const o="unhandledrejection";cr(o,i),ur(o,Gy)})(i=>{const{stackParser:o,attachStacktrace:s}=yh();if(Je()!==r||lh())return;const a=function(c){if(il(c))return c;try{if("reason"in c)return c.reason;if("detail"in c&&"reason"in c.detail)return c.detail.reason}catch{}return c}(i),l=il(a)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`}]}}:Ml(o,a,void 0,s,!0);l.level="error",Uf(l,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(n),vh("onunhandledrejection"))}}};function vh(t){fs&&te.log(`Global Handler attached: ${t}`)}function yh(){const t=Je();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const o0=()=>({name:"HttpContext",preprocessEvent(t){if(!$e.navigator&&!$e.location&&!$e.document)return;const e=t.request&&t.request.url||$e.location&&$e.location.href,{referrer:n}=$e.document||{},{userAgent:r}=$e.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...t.request,...e&&{url:e},headers:i};t.request=o}}),s0=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(r,i,o){const s=o.getOptions();Mb(Cl,s.stackParser,s.maxValueLength,n,e,r,i)}}};var bh="new",wh="loading",Sh="loaded",Ll="joining-meeting",mr="joined-meeting",vr="left-meeting",Rn="error",a0="playable",Il="unknown",l0="full",c0="base",kh="no-room",u0="end-of-life",d0="connection-error",f0="iframe-ready-for-launch-config",h0="iframe-launch-config",p0="theme-updated",g0="loading",m0="load-attempt-failed",xh="loaded",v0="started-camera",y0="camera-error",b0="joining-meeting",w0="joined-meeting",S0="left-meeting",k0="participant-joined",x0="participant-updated",_0="participant-left",C0="participant-counts-updated",E0="access-state-updated",T0="meeting-session-summary-updated",M0="meeting-session-state-updated",A0="waiting-participant-added",O0="waiting-participant-updated",D0="waiting-participant-removed",P0="track-started",L0="track-stopped",I0="transcription-started",R0="transcription-stopped",N0="transcription-error",_h="recording-started",Ch="recording-stopped",$0="recording-stats",F0="recording-error",B0="recording-upload-completed",j0="recording-data",U0="app-message",z0="transcription-message",H0="remote-media-player-started",V0="remote-media-player-updated",K0="remote-media-player-stopped",W0="local-screen-share-started",q0="local-screen-share-stopped",J0="local-screen-share-canceled",G0="active-speaker-change",Q0="active-speaker-mode-change",Y0="network-quality-change",X0="network-connection",Z0="cpu-load-change",ew="face-counts-updated",gs="fullscreen",ms="exited-fullscreen",tw="live-streaming-started",nw="live-streaming-updated",rw="live-streaming-stopped",iw="live-streaming-error",ow="lang-updated",sw="receive-settings-updated",Eh="input-settings-updated",Th="nonfatal-error",Mh="error",Rl=4096,Ah=102400,Nl="iframe-call-message",Oh="local-screen-start",Dh="daily-method-update-live-streaming-endpoints",vs="transmit-log",pn="daily-custom-track",ys={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},Ph={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},$l={PLAY:"play",PAUSE:"pause"},Fl=["jpg","png","jpeg"],aw="add-endpoints",lw="remove-endpoints",Lh="sip-call-transfer";function Mt(){return!ce()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function ce(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function Ih(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function cw(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)&&(function(t,e){if(!t||!e)return!0;switch(t){case"Chrome":return e.major>=75;case"Safari":return RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")&&!(e.major===13&&e.minor===0&&e.point===0);case"Firefox":return e.major>=67}return!0}(yr(),bs())||ce())}function Rh(){if(ce()||!document)return!1;var t=document.createElement("iframe");return!!t.requestFullscreen||!!t.webkitRequestFullscreen}var Bl="none",uw="software",dw="hardware",fw=function(){try{var t,e=document.createElement("canvas"),n=!1;(t=e.getContext("webgl2",{failIfMajorPerformanceCaveat:!0}))||(n=!0,t=e.getContext("webgl2"));var r=t!=null;return e.remove(),r?n?uw:dw:Bl}catch{return Bl}}();function Nh(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!ce()&&fw!==Bl&&(t?function(){return Bh()?!1:["Chrome","Firefox"].includes(yr())}():function(){if(Bh())return!1;var e=yr();if(e==="Safari"){var n=zl();if(n.major<15||n.major===15&&n.minor<4)return!1}return e==="Chrome"?Ul().major>=77:e==="Firefox"?Hl().major>=97:["Chrome","Firefox","Safari"].includes(e)}())}function $h(){if(ce()||Fh()||typeof AudioWorkletNode>"u")return!1;switch(yr()){case"Chrome":case"Firefox":return!0;case"Safari":var t=bs();return t.major>17||t.major===17&&t.minor>=4}return!1}function jl(){return Ih()&&typeof MediaStreamTrack<"u"&&!function(){var t,e=yr();if(!Mt())return!0;switch(e){case"Chrome":return(t=Ul()).major&&t.major>0&&t.major<75;case"Firefox":return(t=Hl()).major<91;case"Safari":return(t=zl()).major<13||t.major===13&&t.minor<1;default:return!0}}()}function Fh(){return Mt().match(/Linux; Android/)}function Bh(){var t,e=Mt(),n=e.match(/Mac/)&&(!ce()&&typeof window<"u"&&(t=window)!==null&&t!==void 0&&(t=t.navigator)!==null&&t!==void 0&&t.maxTouchPoints?window.navigator.maxTouchPoints:0)>=5;return!!(e.match(/Mobi/)||e.match(/Android/)||n)||!!Mt().match(/DailyAnd\//)||void 0}function yr(){if(typeof window<"u"){var t=Mt();return jh()?"Safari":t.indexOf("Edge")>-1?"Edge":t.match(/Chrome\//)?"Chrome":t.indexOf("Safari")>-1||Uh()?"Safari":t.indexOf("Firefox")>-1?"Firefox":t.indexOf("MSIE")>-1||t.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function bs(){switch(yr()){case"Chrome":return Ul();case"Safari":return zl();case"Firefox":return Hl();case"Edge":return function(){var t=0,e=0;if(typeof window<"u"){var n=Mt().match(/Edge\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}()}}function Ul(){var t=0,e=0,n=0,r=0,i=!1;if(typeof window<"u"){var o=Mt(),s=o.match(/Chrome\/(\d+).(\d+).(\d+).(\d+)/);if(s)try{t=parseInt(s[1]),e=parseInt(s[2]),n=parseInt(s[3]),r=parseInt(s[4]),i=o.indexOf("OPR/")>-1}catch{}}return{major:t,minor:e,build:n,patch:r,opera:i}}function jh(){return!!Mt().match(/iPad|iPhone|iPod/i)&&Ih()}function Uh(){return Mt().indexOf("AppleWebKit/605.1.15")>-1}function zl(){var t=0,e=0,n=0;if(typeof window<"u"){var r=Mt().match(/Version\/(\d+).(\d+)(.(\d+))?/);if(r)try{t=parseInt(r[1]),e=parseInt(r[2]),n=parseInt(r[4])}catch{}else(jh()||Uh())&&(t=14,e=0,n=3)}return{major:t,minor:e,point:n}}function Hl(){var t=0,e=0;if(typeof window<"u"){var n=Mt().match(/Firefox\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}var zh=function(){return pt(function t(){ht(this,t)},[{key:"addListenerForMessagesFromCallMachine",value:function(t,e,n){Ii()}},{key:"addListenerForMessagesFromDailyJs",value:function(t,e,n){Ii()}},{key:"sendMessageToCallMachine",value:function(t,e,n,r){Ii()}},{key:"sendMessageToDailyJs",value:function(t,e){Ii()}},{key:"removeListener",value:function(t){Ii()}}])}();function Hh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Vl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hh(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Vh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vh=function(){return!!t})()}var hw=function(){function t(){var e,n,r,i;return ht(this,t),n=this,r=$t(r=t),(e=Vo(n,Vh()?Reflect.construct(r,[],$t(n).constructor):r.apply(n,i)))._wrappedListeners={},e._messageCallbacks={},e}return Ko(t,zh),pt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){var i=this,o=function(s){if(s.data&&s.data.what==="iframe-call-message"&&(!s.data.callClientId||s.data.callClientId===n)&&(!s.data.from||s.data.from!=="module")){var a=Vl({},s.data);if(delete a.from,a.callbackStamp&&i._messageCallbacks[a.callbackStamp]){var l=a.callbackStamp;i._messageCallbacks[l].call(r,a),delete i._messageCallbacks[l]}delete a.what,delete a.callbackStamp,e.call(r,a)}};this._wrappedListeners[e]=o,window.addEventListener("message",o)}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){var i=function(o){var s;if(!(!o.data||o.data.what!==Nl||!o.data.action||o.data.from&&o.data.from!=="module"||o.data.callClientId&&n&&o.data.callClientId!==n||o!=null&&(s=o.data)!==null&&s!==void 0&&s.callFrameId)){var a=o.data;e.call(r,a)}};this._wrappedListeners[e]=i,window.addEventListener("message",i)}},{key:"sendMessageToCallMachine",value:function(e,n,r,i){if(!r)throw new Error("undefined callClientId. Are you trying to use a DailyCall instance previously destroyed?");var o=Vl({},e);if(o.what=Nl,o.from="module",o.callClientId=r,n){var s=Jo();this._messageCallbacks[s]=n,o.callbackStamp=s}var a=i?i.contentWindow:window,l=this._callMachineTargetOrigin(i);l&&a.postMessage(o,l)}},{key:"sendMessageToDailyJs",value:function(e,n){e.what=Nl,e.callClientId=n,e.from="embedded",window.postMessage(e,this._targetOriginFromWindowLocation())}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"forwardPackagedMessageToCallMachine",value:function(e,n,r){var i=Vl({},e);i.callClientId=r;var o=n?n.contentWindow:window,s=this._callMachineTargetOrigin(n);s&&o.postMessage(i,s)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(e,n){var r=function(i){if(i.data&&i.data.what==="iframe-call-message"&&(!i.data.callClientId||i.data.callClientId===n)&&(!i.data.from||i.data.from!=="module")){var o=i.data;e(o)}};return this._wrappedListeners[e]=r,window.addEventListener("message",r),e}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"_callMachineTargetOrigin",value:function(e){return e?e.src?new URL(e.src).origin:void 0:this._targetOriginFromWindowLocation()}},{key:"_targetOriginFromWindowLocation",value:function(){return window.location.protocol==="file:"?"*":window.location.origin}}])}();function Kh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wh=function(){return!!t})()}var pw=function(){function t(){var e,n,r,i;return ht(this,t),n=this,r=$t(r=t),e=Vo(n,Wh()?Reflect.construct(r,[],$t(n).constructor):r.apply(n,i)),global.callMachineToDailyJsEmitter=global.callMachineToDailyJsEmitter||new Ya.EventEmitter,global.dailyJsToCallMachineEmitter=global.dailyJsToCallMachineEmitter||new Ya.EventEmitter,e._wrappedListeners={},e._messageCallbacks={},e}return Ko(t,zh),pt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){this._addListener(e,global.callMachineToDailyJsEmitter,n,r,"received call machine message")}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){this._addListener(e,global.dailyJsToCallMachineEmitter,n,r,"received daily-js message")}},{key:"sendMessageToCallMachine",value:function(e,n,r){this._sendMessage(e,global.dailyJsToCallMachineEmitter,r,n,"sending message to call machine")}},{key:"sendMessageToDailyJs",value:function(e,n){this._sendMessage(e,global.callMachineToDailyJsEmitter,n,null,"sending message to daily-js")}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(global.callMachineToDailyJsEmitter.removeListener("message",n),global.dailyJsToCallMachineEmitter.removeListener("message",n),delete this._wrappedListeners[e])}},{key:"_addListener",value:function(e,n,r,i,o){var s=this,a=function(l){if(l.callClientId===r){if(l.callbackStamp&&s._messageCallbacks[l.callbackStamp]){var c=l.callbackStamp;s._messageCallbacks[c].call(i,l),delete s._messageCallbacks[c]}e.call(i,l)}};this._wrappedListeners[e]=a,n.addListener("message",a)}},{key:"_sendMessage",value:function(e,n,r,i,o){var s=function(l){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?Kh(Object(d),!0).forEach(function(f){Xt(l,f,d[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):Kh(Object(d)).forEach(function(f){Object.defineProperty(l,f,Object.getOwnPropertyDescriptor(d,f))})}return l}({},e);if(s.callClientId=r,i){var a=Jo();this._messageCallbacks[a]=i,s.callbackStamp=a}n.emit("message",s)}}])}(),Kl="replace",Wl="shallow-merge",qh=[Kl,Wl],gw=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.data,r=e.mergeStrategy,i=r===void 0?Kl:r;ht(this,t),t._validateMergeStrategy(i),t._validateData(n,i),this.mergeStrategy=i,this.data=n}return pt(t,[{key:"isNoOp",value:function(){return t.isNoOpUpdate(this.data,this.mergeStrategy)}}],[{key:"isNoOpUpdate",value:function(e,n){return Object.keys(e).length===0&&n===Wl}},{key:"_validateMergeStrategy",value:function(e){if(!qh.includes(e))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(qh,"]"))}},{key:"_validateData",value:function(e,n){if(!function(a){if(a==null||fe(a)!=="object")return!1;var l=Object.getPrototypeOf(a);return l==null||l===Object.prototype}(e))throw Error("Meeting session data must be a plain (map-like) object");var r;try{if(r=JSON.stringify(e),n===Kl){var i=JSON.parse(r);et(i,e)||console.warn("The meeting session data provided will be modified when serialized.",i,e)}else if(n===Wl){for(var o in e)if(Object.hasOwnProperty.call(e,o)&&e[o]!==void 0){var s=JSON.parse(JSON.stringify(e[o]));et(e[o],s)||console.warn("At least one key in the meeting session data provided will be modified when serialized.",s,e[o])}}}catch(a){throw Error("Meeting session data must be serializable to JSON: ".concat(a))}if(r.length>Ah)throw Error("Meeting session data is too large (".concat(r.length," characters). Maximum size suppported is ").concat(Ah,"."))}}])}();function Jh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jh=function(){return!!t})()}function ql(t){var e=typeof Map=="function"?new Map:void 0;return ql=function(n){if(n===null||!function(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return function(i,o,s){if(Jh())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,o);var l=new(i.bind.apply(i,a));return s&&Li(l,s.prototype),l}(n,arguments,$t(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Li(r,n)},ql(t)}function Gh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Gh=function(){return!!t})()}function Qh(t){var e,n=(e=window._daily)===null||e===void 0?void 0:e.pendings;if(n){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}var mw=function(){return pt(function t(e){ht(this,t),this._currentLoad=null,this._callClientId=e},[{key:"load",value:function(){var t,e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;if(this.loaded)return window._daily.instances[this._callClientId].callMachine.reset(),void r(!0);t=this._callClientId,window._daily.pendings.push(t),this._currentLoad&&this._currentLoad.cancel(),this._currentLoad=new vw(n,function(){r(!1)},function(o,s){s||Qh(e._callClientId),i(o,s)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),Qh(this._callClientId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}])}(),vw=function(){return pt(function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;ht(this,t),this._attemptsRemaining=3,this._currentAttempt=null,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r},[{key:"start",value:function(){var t=this;if(!this._currentAttempt){var e=function(n){t._currentAttempt.cancelled||(t._attemptsRemaining--,t._failureCallback(n,t._attemptsRemaining>0),t._attemptsRemaining<=0||setTimeout(function(){t._currentAttempt.cancelled||(t._currentAttempt=new Yh(t._dailyConfig,t._successCallback,e),t._currentAttempt.start())},3e3))};this._currentAttempt=new Yh(this._dailyConfig,this._successCallback,e),this._currentAttempt.start()}}},{key:"cancel",value:function(){this._currentAttempt&&this._currentAttempt.cancel()}},{key:"cancelled",get:function(){return this._currentAttempt&&this._currentAttempt.cancelled}},{key:"succeeded",get:function(){return this._currentAttempt&&this._currentAttempt.succeeded}}])}(),Jl=function(){function t(){return ht(this,t),e=this,r=arguments,n=$t(n=t),Vo(e,Gh()?Reflect.construct(n,r||[],$t(e).constructor):n.apply(e,r));var e,n,r}return Ko(t,ql(Error)),pt(t)}(),ws=2e4,Yh=function(){return pt(function e(n,r,i){ht(this,e),this._loadAttemptImpl=ce()||!n.avoidEval?new yw(n,r,i):new bw(n,r,i)},[{key:"start",value:(t=Z(function*(){return this._loadAttemptImpl.start()}),function(){return t.apply(this,arguments)})},{key:"cancel",value:function(){this._loadAttemptImpl.cancel()}},{key:"cancelled",get:function(){return this._loadAttemptImpl.cancelled}},{key:"succeeded",get:function(){return this._loadAttemptImpl.succeeded}}]);var t}(),yw=function(){return pt(function i(o,s,a){ht(this,i),this.cancelled=!1,this.succeeded=!1,this._networkTimedOut=!1,this._networkTimeout=null,this._iosCache=typeof iOSCallObjectBundleCache<"u"&&iOSCallObjectBundleCache,this._refetchHeaders=null,this._dailyConfig=o,this._successCallback=s,this._failureCallback=a},[{key:"start",value:(r=Z(function*(){var i=Go(this._dailyConfig);!(yield this._tryLoadFromIOSCache(i))&&this._loadFromNetwork(i)}),function(){return r.apply(this,arguments)})},{key:"cancel",value:function(){clearTimeout(this._networkTimeout),this.cancelled=!0}},{key:"_tryLoadFromIOSCache",value:(n=Z(function*(i){if(!this._iosCache)return!1;try{var o=yield this._iosCache.get(i);return!!this.cancelled||!!o&&(o.code?(Function('"use strict";'+o.code)(),this.succeeded=!0,this._successCallback(),!0):(this._refetchHeaders=o.refetchHeaders,!1))}catch{return!1}}),function(i){return n.apply(this,arguments)})},{key:"_loadFromNetwork",value:(e=Z(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(ws," ms) when loading call object bundle ").concat(i),type:"timeout"})},ws);try{var s=this._refetchHeaders?{headers:this._refetchHeaders}:{},a=yield fetch(i,s);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new Jl;var l=yield this._getBundleCodeFromResponse(i,a);if(this.cancelled)throw new Jl;Function('"use strict";'+l)(),this._iosCache&&this._iosCache.set(i,l,a.headers),this.succeeded=!0,this._successCallback()}catch(c){if(clearTimeout(this._networkTimeout),c instanceof Jl||this.cancelled||this._networkTimedOut)return;this._failureCallback({msg:"Failed to load call object bundle ".concat(i,": ").concat(c),type:c.message})}}),function(i){return e.apply(this,arguments)})},{key:"_getBundleCodeFromResponse",value:(t=Z(function*(i,o){if(o.ok)return yield o.text();if(this._iosCache&&o.status===304)return(yield this._iosCache.renew(i,o.headers)).code;throw new Error("Received ".concat(o.status," response"))}),function(i,o){return t.apply(this,arguments)})}]);var t,e,n,r}(),bw=function(){return pt(function t(e,n,r){ht(this,t),this.cancelled=!1,this.succeeded=!1,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r,this._attemptId=Jo(),this._networkTimeout=null,this._scriptElement=null},[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=Go(this._dailyConfig);(typeof document>"u"?"undefined":fe(document))==="object"?this._startLoading(t):this._failureCallback({msg:"Call object bundle must be loaded in a DOM/web context",type:"missing context"})}},{key:"cancel",value:function(){this._stopLoading(),this.cancelled=!0}},{key:"_startLoading",value:function(t){var e=this;this._signUpForCallMachineLoadWaitlist(),this._networkTimeout=setTimeout(function(){e._stopLoading(),e._failureCallback({msg:"Timed out (>".concat(ws," ms) when loading call object bundle ").concat(t),type:"timeout"})},ws);var n=document.getElementsByTagName("head")[0],r=document.createElement("script");this._scriptElement=r,r.onload=function(){e._stopLoading(),e.succeeded=!0,e._successCallback()},r.onerror=function(i){e._stopLoading(),e._failureCallback({msg:"Failed to load call object bundle ".concat(i.target.src),type:i.message})},r.src=t,n.appendChild(r)}},{key:"_stopLoading",value:function(){this._withdrawFromCallMachineLoadWaitlist(),clearTimeout(this._networkTimeout),this._scriptElement&&(this._scriptElement.onload=null,this._scriptElement.onerror=null)}},{key:"_signUpForCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.add(this._attemptId)}},{key:"_withdrawFromCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.delete(this._attemptId)}}])}(),Ss=function(t,e,n){return Sw(t.local,e,n)===!0},ww=function(t,e,n){return t.local.streams&&t.local.streams[e]&&t.local.streams[e].stream&&t.local.streams[e].stream["get".concat(n==="video"?"Video":"Audio","Tracks")]()[0]},Qr=function(t,e,n,r){var i=kw(t,e,n,r);return i&&i.pendingTrack},Sw=function(t,e,n){if(!t)return!1;var r=function(o){switch(o){case"avatar":return!0;case"staged":return o;default:return!!o}},i=t.public.subscribedTracks;return i&&i[e]?["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo"].indexOf(n)===-1&&i[e].custom?[!0,"staged"].includes(i[e].custom)?r(i[e].custom):r(i[e].custom[n]):r(i[e][n]):!i||r(i.ALL)},kw=function(t,e,n,r){var i=Object.values(t.streams||{}).filter(function(o){return o.participantId===e&&o.type===n&&o.pendingTrack&&o.pendingTrack.kind===r}).sort(function(o,s){return new Date(s.starttime)-new Date(o.starttime)});return i&&i[0]},xw=function(t,e){var n=t.local.public.customTracks;if(n&&n[e])return n[e].track};function Xh(t,e){for(var n=e.getState(),r=0,i=["cam","screen"];r<i.length;r++)for(var o=i[r],s=0,a=["video","audio"];s<a.length;s++){var l=a[s],c=o==="cam"?l:"screen".concat(l.charAt(0).toUpperCase()+l.slice(1)),d=t.tracks[c];if(d){var f=t.local?ww(n,o,l):Qr(n,t.session_id,o,l);d.state==="playable"&&(d.track=f),d.persistentTrack=f}}}function Zh(t,e){try{var n=e.getState();for(var r in t.tracks)if(!_w(r)){var i=t.tracks[r].kind;if(i){var o=t.tracks[r];if(o){var s=t.local?xw(n,r):Qr(n,t.session_id,r,i);o.state==="playable"&&(t.tracks[r].track=s),o.persistentTrack=s}}else console.error("unknown type for custom track")}}catch(a){console.error(a)}}function _w(t){return["video","audio","screenVideo","screenAudio"].includes(t)}function ep(t,e,n){var r=n.getState();if(t.local){if(t.audio)try{t.audioTrack=r.local.streams.cam.stream.getAudioTracks()[0],t.audioTrack||(t.audio=!1)}catch{}if(t.video)try{t.videoTrack=r.local.streams.cam.stream.getVideoTracks()[0],t.videoTrack||(t.video=!1)}catch{}if(t.screen)try{t.screenVideoTrack=r.local.streams.screen.stream.getVideoTracks()[0],t.screenAudioTrack=r.local.streams.screen.stream.getAudioTracks()[0],t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch{}}else{var i=!0;try{var o=r.participants[t.session_id];o&&o.public&&o.public.rtcType&&o.public.rtcType.impl==="peer-to-peer"&&o.private&&!["connected","completed"].includes(o.private.peeringState)&&(i=!1)}catch(d){console.error(d)}if(!i)return t.audio=!1,t.audioTrack=!1,t.video=!1,t.videoTrack=!1,t.screen=!1,void(t.screenTrack=!1);try{if(r.streams,t.audio&&Ss(r,t.session_id,"cam-audio")){var s=Qr(r,t.session_id,"cam","audio");s&&(e&&e.audioTrack&&e.audioTrack.id===s.id?t.audioTrack=s:s.muted||(t.audioTrack=s)),t.audioTrack||(t.audio=!1)}if(t.video&&Ss(r,t.session_id,"cam-video")){var a=Qr(r,t.session_id,"cam","video");a&&(e&&e.videoTrack&&e.videoTrack.id===a.id?t.videoTrack=a:a.muted||(t.videoTrack=a)),t.videoTrack||(t.video=!1)}if(t.screen&&Ss(r,t.session_id,"screen-audio")){var l=Qr(r,t.session_id,"screen","audio");l&&(e&&e.screenAudioTrack&&e.screenAudioTrack.id===l.id?t.screenAudioTrack=l:l.muted||(t.screenAudioTrack=l))}if(t.screen&&Ss(r,t.session_id,"screen-video")){var c=Qr(r,t.session_id,"screen","video");c&&(e&&e.screenVideoTrack&&e.screenVideoTrack.id===c.id?t.screenVideoTrack=c:c.muted||(t.screenVideoTrack=c))}t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch(d){console.error("unexpected error matching up tracks",d)}}}function Cw(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return tp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?tp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
28
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function tp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Zt=new Map,Yr=null;function Ew(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return np(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?np(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
29
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function np(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var en=new Map,ji=null;function Tw(t){rp()?function(e){Zt.has(e)||(Zt.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){Zt.has(e)&&(Zt.get(e).lastDevicesString=JSON.stringify(n),Yr||(Yr=function(){var r=Z(function*(){var i,o=yield navigator.mediaDevices.enumerateDevices(),s=Cw(Zt.keys());try{for(s.s();!(i=s.n()).done;){var a=i.value,l=JSON.stringify(o);l!==Zt.get(a).lastDevicesString&&(Zt.get(a).lastDevicesString=l,a(o))}}catch(c){s.e(c)}finally{s.f()}});return function(){return r.apply(this,arguments)}}(),navigator.mediaDevices.addEventListener("devicechange",Yr)))}).catch(function(){}))}(t):function(e){en.has(e)||(en.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){en.has(e)&&(en.get(e).lastDevicesString=JSON.stringify(n),ji||(ji=setInterval(Z(function*(){var r,i=yield navigator.mediaDevices.enumerateDevices(),o=Ew(en.keys());try{for(o.s();!(r=o.n()).done;){var s=r.value,a=JSON.stringify(i);a!==en.get(s).lastDevicesString&&(en.get(s).lastDevicesString=a,s(i))}}catch(l){o.e(l)}finally{o.f()}}),3e3)))}))}(t)}function Mw(t){rp()?function(e){Zt.has(e)&&(Zt.delete(e),Zt.size===0&&Yr&&(navigator.mediaDevices.removeEventListener("devicechange",Yr),Yr=null))}(t):function(e){en.has(e)&&(en.delete(e),en.size===0&&ji&&(clearInterval(ji),ji=null))}(t)}function rp(){var t;return ce()||((t=navigator.mediaDevices)===null||t===void 0?void 0:t.ondevicechange)!==void 0}var Aw=new Set;function Ow(t,e){return t&&t.readyState==="live"&&!function(n,r){return n.muted&&!Aw.has(n.id)}(t)}function ip(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Nn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ip(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ip(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var Ui=Object.freeze({VIDEO:"video",AUDIO:"audio",SCREEN_VIDEO:"screenVideo",SCREEN_AUDIO:"screenAudio",CUSTOM_VIDEO:"customVideo",CUSTOM_AUDIO:"customAudio"}),Dw=Object.freeze({PARTICIPANTS:"participants",STREAMING:"streaming",TRANSCRIPTION:"transcription"}),zi=Object.values(Ui),op=["v","a","sv","sa","cv","ca"];Object.freeze(zi.reduce(function(t,e,n){return t[e]=op[n],t},{})),Object.freeze(op.reduce(function(t,e,n){return t[e]=zi[n],t},{}));var Pw=[Ui.VIDEO,Ui.AUDIO,Ui.SCREEN_VIDEO,Ui.SCREEN_AUDIO],sp=Object.values(Dw),ap=["p","s","t"];Object.freeze(sp.reduce(function(t,e,n){return t[e]=ap[n],t},{})),Object.freeze(ap.reduce(function(t,e,n){return t[e]=sp[n],t},{}));var lp=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.base,r=e.byUserId,i=e.byParticipantId;ht(this,t),this.base=n,this.byUserId=r,this.byParticipantId=i}return pt(t,[{key:"clone",value:function(){var e=new t;if(this.base instanceof ze?e.base=this.base.clone():e.base=this.base,this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof ze?r.clone():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof ze?o.clone():o}return e}},{key:"toJSONObject",value:function(){var e={};if(typeof this.base=="boolean"?e.base=this.base:this.base instanceof ze&&(e.base=this.base.toJSONObject()),this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof ze?r.toJSONObject():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof ze?o.toJSONObject():o}return e}},{key:"toMinifiedJSONObject",value:function(){var e={};if(this.base!==void 0&&(typeof this.base=="boolean"?e.b=this.base:e.b=this.base.toMinifiedJSONObject()),this.byUserId!==void 0)for(var n in e.u={},this.byUserId){var r=this.byUserId[n];e.u[n]=typeof r=="boolean"?r:r.toMinifiedJSONObject()}if(this.byParticipantId!==void 0)for(var i in e.p={},this.byParticipantId){var o=this.byParticipantId[i];e.p[i]=typeof o=="boolean"?o:o.toMinifiedJSONObject()}return e}},{key:"normalize",value:function(){return this.base instanceof ze&&(this.base=this.base.normalize()),this.byUserId&&(this.byUserId=Object.fromEntries(Object.entries(this.byUserId).map(function(e){var n=qe(e,2),r=n[0],i=n[1];return[r,i instanceof ze?i.normalize():i]}))),this.byParticipantId&&(this.byParticipantId=Object.fromEntries(Object.entries(this.byParticipantId).map(function(e){var n=qe(e,2),r=n[0],i=n[1];return[r,i instanceof ze?i.normalize():i]}))),this}}],[{key:"fromJSONObject",value:function(e){var n,r,i;if(e.base!==void 0&&(n=typeof e.base=="boolean"?e.base:ze.fromJSONObject(e.base)),e.byUserId!==void 0)for(var o in r={},e.byUserId){var s=e.byUserId[o];r[o]=typeof s=="boolean"?s:ze.fromJSONObject(s)}if(e.byParticipantId!==void 0)for(var a in i={},e.byParticipantId){var l=e.byParticipantId[a];i[a]=typeof l=="boolean"?l:ze.fromJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"fromMinifiedJSONObject",value:function(e){var n,r,i;if(e.b!==void 0&&(n=typeof e.b=="boolean"?e.b:ze.fromMinifiedJSONObject(e.b)),e.u!==void 0)for(var o in r={},e.u){var s=e.u[o];r[o]=typeof s=="boolean"?s:ze.fromMinifiedJSONObject(s)}if(e.p!==void 0)for(var a in i={},e.p){var l=e.p[a];i[a]=typeof l=="boolean"?l:ze.fromMinifiedJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"validateJSONObject",value:function(e){if(fe(e)!=="object")return[!1,"canReceive must be an object"];for(var n=["base","byUserId","byParticipantId"],r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];if(!n.includes(o))return[!1,"canReceive can only contain keys (".concat(n.join(", "),")")];if(o==="base"){var s=qe(ze.validateJSONObject(e.base,!0),2),a=s[0],l=s[1];if(!a)return[!1,l]}else{if(fe(e[o])!=="object")return[!1,"invalid (non-object) value for field '".concat(o,"' in canReceive")];for(var c=0,d=Object.values(e[o]);c<d.length;c++){var f=d[c],h=qe(ze.validateJSONObject(f),2),b=h[0],y=h[1];if(!b)return[!1,y]}}}return[!0]}}])}(),ze=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.video,r=e.audio,i=e.screenVideo,o=e.screenAudio,s=e.customVideo,a=e.customAudio;ht(this,t),this.video=n,this.audio=r,this.screenVideo=i,this.screenAudio=o,this.customVideo=s,this.customAudio=a}return pt(t,[{key:"clone",value:function(){var e=new t;return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=Nn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Nn({},this.customAudio)),e}},{key:"toJSONObject",value:function(){var e={};return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=Nn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Nn({},this.customAudio)),e}},{key:"toMinifiedJSONObject",value:function(){var e={};return this.video!==void 0&&(e.v=this.video),this.audio!==void 0&&(e.a=this.audio),this.screenVideo!==void 0&&(e.sv=this.screenVideo),this.screenAudio!==void 0&&(e.sa=this.screenAudio),this.customVideo!==void 0&&(e.cv=Nn({},this.customVideo)),this.customAudio!==void 0&&(e.ca=Nn({},this.customAudio)),e}},{key:"normalize",value:function(){function e(n,r){return n&&Object.keys(n).length===1&&n["*"]===r}return!(this.video!==!0||this.audio!==!0||this.screenVideo!==!0||this.screenAudio!==!0||!e(this.customVideo,!0)||!e(this.customAudio,!0))||(this.video!==!1||this.audio!==!1||this.screenVideo!==!1||this.screenAudio!==!1||!e(this.customVideo,!1)||!e(this.customAudio,!1))&&this}}],[{key:"fromBoolean",value:function(e){return new t({video:e,audio:e,screenVideo:e,screenAudio:e,customVideo:{"*":e},customAudio:{"*":e}})}},{key:"fromJSONObject",value:function(e){return new t({video:e.video,audio:e.audio,screenVideo:e.screenVideo,screenAudio:e.screenAudio,customVideo:e.customVideo!==void 0?Nn({},e.customVideo):void 0,customAudio:e.customAudio!==void 0?Nn({},e.customAudio):void 0})}},{key:"fromMinifiedJSONObject",value:function(e){return new t({video:e.v,audio:e.a,screenVideo:e.sv,screenAudio:e.sa,customVideo:e.cv,customAudio:e.ca})}},{key:"validateJSONObject",value:function(e,n){if(typeof e=="boolean")return[!0];if(fe(e)!=="object")return[!1,"invalid (non-object, non-boolean) value in canReceive"];for(var r=Object.keys(e),i=0,o=r;i<o.length;i++){var s=o[i];if(!zi.includes(s))return[!1,"invalid media type '".concat(s,"' in canReceive")];if(Pw.includes(s)){if(typeof e[s]!="boolean")return[!1,"invalid (non-boolean) value for media type '".concat(s,"' in canReceive")]}else{if(fe(e[s])!=="object")return[!1,"invalid (non-object) value for media type '".concat(s,"' in canReceive")];for(var a=0,l=Object.values(e[s]);a<l.length;a++)if(typeof l[a]!="boolean")return[!1,"invalid (non-boolean) value for entry within '".concat(s,"' in canReceive")];if(n&&e[s]["*"]===void 0)return[!1,`canReceive "base" permission must specify "*" as an entry within '`.concat(s,"'")]}}return n&&r.length!==zi.length?[!1,'canReceive "base" permission must specify all media types: '.concat(zi.join(", ")," (or be set to a boolean shorthand)")]:[!0]}}])}(),Lw=["result"],Iw=["preserveIframe"];function cp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function H(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cp(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function up(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(up=function(){return!!t})()}function dp(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return fp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?fp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
30
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function fp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var br={},hp="video",Rw="voice",pp=ce()?{data:{}}:{data:{},topology:"none"},gp={present:0,hidden:0},mp={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},Gl=Object.keys(mp),vp=["state","volume","simulcastEncodings"],yp={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},ks={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string",visualState:"'default' | 'sidebar-open' | 'active'"}},Ql={id:{allow:"string",controlledBy:"'*' | 'owners' | string[]",csp:"string",iconURL:"string",label:"string",loading:"'eager' | 'lazy'",location:"'main' | 'sidebar'",name:"string",referrerPolicy:"string",sandbox:"string",src:"string",srcdoc:"string",shared:"string[] | 'owners' | boolean"}},wr={customIntegrations:{validate:Mp,help:Ep()},customTrayButtons:{validate:Tp,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(ks))},url:{validate:function(t){return typeof t=="string"},help:"url should be a string"},baseUrl:{validate:function(t){return typeof t=="string"},help:"baseUrl should be a string"},token:{validate:function(t){return typeof t=="string"},help:"token should be a string",queryString:"t"},dailyConfig:{validate:function(t,e){try{return e.validateDailyConfig(t),!0}catch(n){console.error("Failed to validate dailyConfig",n)}return!1},help:"Unsupported dailyConfig. Check error logs for detailed info."},reactNativeConfig:{validate:function(t){return Ap(t,yp)},help:"reactNativeConfig should look like ".concat(JSON.stringify(yp),", all fields optional")},lang:{validate:function(t){return["da","de","en-us","en","es","fi","fr","it","jp","ka","nl","no","pl","pt","pt-BR","ru","sv","tr","user"].includes(t)},help:"language not supported. Options are: da, de, en-us, en, es, fi, fr, it, jp, ka, nl, no, pl, pt, pt-BR, ru, sv, tr, user"},userName:!0,userData:{validate:function(t){try{return wp(t),!0}catch(e){return console.error(e),!1}},help:"invalid userData type provided"},startVideoOff:!0,startAudioOff:!0,allowLocalVideo:!0,allowLocalAudio:!0,activeSpeakerMode:!0,showLeaveButton:!0,showLocalVideo:!0,showParticipantsBar:!0,showFullscreenButton:!0,showUserNameChangeUI:!0,iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,videoSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalVideo=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.videoTrack=t,n={customTrack:pn};else{if(delete e._sharedTracks.videoTrack,typeof t!="string")return console.error("videoSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({video:{settings:n}},!1),!0}},audioSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalAudio=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.audioTrack=t,n={customTrack:pn};else{if(delete e._sharedTracks.audioTrack,typeof t!="string")return console.error("audioSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({audio:{settings:n}},!1),!0}},subscribeToTracksAutomatically:{validate:function(t,e){return e._preloadCache.subscribeToTracksAutomatically=t,!0}},theme:{validate:function(t){var e=["accent","accentText","background","backgroundAccent","baseText","border","mainAreaBg","mainAreaBgAccent","mainAreaText","supportiveText"],n=function(r){for(var i=0,o=Object.keys(r);i<o.length;i++){var s=o[i];if(!e.includes(s))return console.error('unsupported color "'.concat(s,'". Valid colors: ').concat(e.join(", "))),!1;if(!r[s].match(/^#[0-9a-f]{6}|#[0-9a-f]{3}$/i))return console.error("".concat(s,' theme color should be provided in valid hex color format. Received: "').concat(r[s],'"')),!1}return!0};return fe(t)==="object"&&("light"in t&&"dark"in t||"colors"in t)?"light"in t&&"dark"in t?"colors"in t.light?"colors"in t.dark?n(t.light.colors)&&n(t.dark.colors):(console.error('Dark theme is missing "colors" property.',t),!1):(console.error('Light theme is missing "colors" property.',t),!1):n(t.colors):(console.error('Theme must contain either both "light" and "dark" properties, or "colors".',t),!1)},help:"unsupported theme configuration. Check error logs for detailed info."},layoutConfig:{validate:function(t){if("grid"in t){var e=t.grid;if("maxTilesPerPage"in e){if(!Number.isInteger(e.maxTilesPerPage))return console.error("grid.maxTilesPerPage should be an integer. You passed ".concat(e.maxTilesPerPage,".")),!1;if(e.maxTilesPerPage>49)return console.error("grid.maxTilesPerPage can't be larger than 49 without sacrificing browser performance. Please contact us at https://www.daily.co/contact to talk about your use case."),!1}if("minTilesPerPage"in e){if(!Number.isInteger(e.minTilesPerPage))return console.error("grid.minTilesPerPage should be an integer. You passed ".concat(e.minTilesPerPage,".")),!1;if(e.minTilesPerPage<1)return console.error("grid.minTilesPerPage can't be lower than 1."),!1;if("maxTilesPerPage"in e&&e.minTilesPerPage>e.maxTilesPerPage)return console.error("grid.minTilesPerPage can't be higher than grid.maxTilesPerPage."),!1}}return!0},help:"unsupported layoutConfig. Check error logs for detailed info."},receiveSettings:{validate:function(t){return Sp(t,{allowAllParticipantsKey:!1})},help:Cp({allowAllParticipantsKey:!1})},sendSettings:{validate:function(t,e){return!!function(n,r){try{return r.validateUpdateSendSettings(n),!0}catch(i){return console.error("Failed to validate send settings",i),!1}}(t,e)&&(e._preloadCache.sendSettings=t,!0)},help:"Invalid sendSettings provided. Check error logs for detailed info."},inputSettings:{validate:function(t,e){var n;return!!kp(t)&&(e._inputSettings||(e._inputSettings={}),xp(t,(n=e.properties)===null||n===void 0?void 0:n.dailyConfig,e._sharedTracks),e._updatePreloadCacheInputSettings(t,!0),!0)},help:Zl()},layout:{validate:function(t){return t==="custom-v1"||t==="browser"||t==="none"},help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"},embHref:{queryString:"embHref"},dailyJsVersion:{queryString:"dailyJsVersion"},proxy:{queryString:"proxy"},strictMode:!0,allowMultipleCallInstances:!0},xs={styles:{validate:function(t){for(var e in t)if(e!=="cam"&&e!=="screen")return!1;if(t.cam){for(var n in t.cam)if(n!=="div"&&n!=="video")return!1}if(t.screen){for(var r in t.screen)if(r!=="div"&&r!=="video")return!1}return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setSubscribedTracks:{validate:function(t,e){if(e._preloadCache.subscribeToTracksAutomatically)return!1;var n=[!0,!1,"staged"];if(n.includes(t)||!ce()&&t==="avatar")return!0;var r=["audio","video","screenAudio","screenVideo","rmpAudio","rmpVideo"],i=function(o){var s=arguments.length>1&&arguments[1]!==void 0&&arguments[1];for(var a in o)if(a==="custom"){if(!n.includes(o[a])&&!i(o[a],!0))return!1}else{var l=!s&&!r.includes(a),c=!n.includes(o[a]);if(l||c)return!1}return!0};return i(t)},help:"setSubscribedTracks cannot be used when setSubscribeToTracksAutomatically is enabled, and should be of the form: "+"true".concat(ce()?"":" | 'avatar'"," | false | 'staged' | { [audio: true|false|'staged'], [video: true|false|'staged'], [screenAudio: true|false|'staged'], [screenVideo: true|false|'staged'] }")},setAudio:!0,setVideo:!0,setScreenShare:{validate:function(t){return t===!1},help:"setScreenShare must be false, as it's only meant for stopping remote participants' screen shares"},eject:!0,updatePermissions:{validate:function(t){for(var e=0,n=Object.entries(t);e<n.length;e++){var r=qe(n[e],2),i=r[0],o=r[1];switch(i){case"hasPresence":if(typeof o!="boolean")return!1;break;case"canSend":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var s,a=["video","audio","screenVideo","screenAudio","customVideo","customAudio"],l=dp(o);try{for(l.s();!(s=l.n()).done;){var c=s.value;if(!a.includes(c))return!1}}catch(v){l.e(v)}finally{l.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canSend=new Set(o));break;case"canReceive":var d=qe(lp.validateJSONObject(o),2),f=d[0],h=d[1];if(!f)return console.error(h),!1;break;case"canAdmin":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var b,y=["participants","streaming","transcription"],g=dp(o);try{for(g.s();!(b=g.n()).done;){var S=b.value;if(!y.includes(S))return!1}}catch(v){g.e(v)}finally{g.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canAdmin=new Set(o));break;default:return!1}}return!0},help:"updatePermissions can take hasPresence, canSend, canReceive, and canAdmin permissions. hasPresence must be a boolean. canSend can be a boolean or an Array or Set of media types (video, audio, screenVideo, screenAudio, customVideo, customAudio). canReceive must be an object specifying base, byUserId, and/or byParticipantId fields (see documentation for more details). canAdmin can be a boolean or an Array or Set of admin types (participants, streaming, transcription)."}};Promise.any||(Promise.any=function(){var t=Z(function*(e){return new Promise(function(n,r){var i=[];e.forEach(function(o){return Promise.resolve(o).then(function(s){n(s)}).catch(function(s){i.push(s),i.length===e.length&&r(i)})})})});return function(e){return t.apply(this,arguments)}}());var Nw=function(){function t(u){var m,p,x,_,M,I,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ht(this,t),x=this,_=$t(_=t),Xt(p=Vo(x,up()?Reflect.construct(_,[],$t(x).constructor):_.apply(x,M)),"startListeningForDeviceChanges",function(){Tw(p.handleDeviceChange)}),Xt(p,"stopListeningForDeviceChanges",function(){Mw(p.handleDeviceChange)}),Xt(p,"handleDeviceChange",function(ie){ie=ie.map(function(de){return JSON.parse(JSON.stringify(de))}),p.emitDailyJSEvent({action:"available-devices-updated",availableDevices:ie})}),Xt(p,"handleNativeAppStateChange",function(){var ie=Z(function*(de){if(de==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield p.destroy());var an=de==="active";p.disableReactNativeAutoDeviceManagement("video")||(an?p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!0):(p.camUnmutedBeforeLosingNativeActiveState=p.localVideo(),p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!1)))});return function(de){return ie.apply(this,arguments)}}()),Xt(p,"handleNativeAudioFocusChange",function(ie){p.disableReactNativeAutoDeviceManagement("audio")||(p._hasNativeAudioFocus=ie,p.toggleParticipantAudioBasedOnNativeAudioFocus(),p._hasNativeAudioFocus?p.micUnmutedBeforeLosingNativeAudioFocus&&p.setLocalAudio(!0):(p.micUnmutedBeforeLosingNativeAudioFocus=p.localAudio(),p.setLocalAudio(!1)))}),Xt(p,"handleNativeSystemScreenCaptureStop",function(){p.stopScreenShare()}),!jl()&&!ce())throw new Error("WebRTC not supported or suppressed");if(p.strictMode=R.strictMode===void 0||R.strictMode,p.allowMultipleCallInstances=(m=R.allowMultipleCallInstances)!==null&&m!==void 0&&m,Object.keys(br).length&&(p._logDuplicateInstanceAttempt(),!p.allowMultipleCallInstances)){if(p.strictMode)throw new Error("Duplicate DailyIframe instances are not allowed");console.warn("Using strictMode: false to allow multiple call instances is now deprecated. Set `allowMultipleCallInstances: true`")}if(window._daily||(window._daily={pendings:[],instances:{}}),p.callClientId=Jo(),br[(I=p).callClientId]=I,window._daily.instances[p.callClientId]={},p._sharedTracks={},window._daily.instances[p.callClientId].tracks=p._sharedTracks,R.dailyJsVersion=t.version(),p._iframe=u,p._callObjectMode=R.layout==="none"&&!p._iframe,p._preloadCache={subscribeToTracksAutomatically:!0,outputDeviceId:null,inputSettings:null,sendSettings:null,videoTrackForNetworkConnectivityTest:null,videoTrackForConnectionQualityTest:null},R.showLocalVideo!==void 0?p._callObjectMode?console.error("showLocalVideo is not available in call object mode"):p._showLocalVideo=!!R.showLocalVideo:p._showLocalVideo=!0,R.showParticipantsBar!==void 0?p._callObjectMode?console.error("showParticipantsBar is not available in call object mode"):p._showParticipantsBar=!!R.showParticipantsBar:p._showParticipantsBar=!0,R.customIntegrations!==void 0?p._callObjectMode?console.error("customIntegrations is not available in call object mode"):p._customIntegrations=R.customIntegrations:p._customIntegrations={},R.customTrayButtons!==void 0?p._callObjectMode?console.error("customTrayButtons is not available in call object mode"):p._customTrayButtons=R.customTrayButtons:p._customTrayButtons={},R.activeSpeakerMode!==void 0?p._callObjectMode?console.error("activeSpeakerMode is not available in call object mode"):p._activeSpeakerMode=!!R.activeSpeakerMode:p._activeSpeakerMode=!1,R.receiveSettings?p._callObjectMode?p._receiveSettings=R.receiveSettings:console.error("receiveSettings is only available in call object mode"):p._receiveSettings={},p.validateProperties(R),p.properties=H({},R),p._inputSettings||(p._inputSettings={}),p._callObjectLoader=p._callObjectMode?new mw(p.callClientId):null,p._callState=bh,p._isPreparingToJoin=!1,p._accessState={access:Il},p._meetingSessionSummary={},p._finalSummaryOfPrevSession={},p._meetingSessionState=ec(pp,p._callObjectMode),p._nativeInCallAudioMode=hp,p._participants={},p._isScreenSharing=!1,p._participantCounts=gp,p._rmpPlayerState={},p._waitingParticipants={},p._network={threshold:"good",quality:100,networkState:"unknown",stats:{}},p._activeSpeaker={},p._localAudioLevel=0,p._isLocalAudioLevelObserverRunning=!1,p._remoteParticipantsAudioLevel={},p._isRemoteParticipantsAudioLevelObserverRunning=!1,p._maxAppMessageSize=Rl,p._messageChannel=ce()?new pw:new hw,p._iframe&&(p._iframe.requestFullscreen?p._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===p._iframe?(p.emitDailyJSEvent({action:gs}),p.sendMessageToCallMachine({action:gs})):(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms}))}):p._iframe.webkitRequestFullscreen&&p._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===p._iframe?(p.emitDailyJSEvent({action:gs}),p.sendMessageToCallMachine({action:gs})):(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms}))})),ce()){var U=p.nativeUtils();U.addAudioFocusChangeListener&&U.removeAudioFocusChangeListener&&U.addAppStateChangeListener&&U.removeAppStateChangeListener&&U.addSystemScreenCaptureStopListener&&U.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),p._hasNativeAudioFocus=!0,U.addAudioFocusChangeListener(p.handleNativeAudioFocusChange),U.addAppStateChangeListener(p.handleNativeAppStateChange),U.addSystemScreenCaptureStopListener(p.handleNativeSystemScreenCaptureStop)}return p._callObjectMode&&p.startListeningForDeviceChanges(),p._messageChannel.addListenerForMessagesFromCallMachine(p.handleMessageFromCallMachine,p.callClientId,p),p}return Ko(t,qo),pt(t,[{key:"destroy",value:(me=Z(function*(){var u;try{yield this.leave()}catch{}var m=this._iframe;if(m){var p=m.parentElement;p&&p.removeChild(m)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),ce()){var x=this.nativeUtils();x.removeAudioFocusChangeListener(this.handleNativeAudioFocusChange),x.removeAppStateChangeListener(this.handleNativeAppStateChange),x.removeSystemScreenCaptureStopListener(this.handleNativeSystemScreenCaptureStop)}this._callObjectMode&&this.stopListeningForDeviceChanges(),this.resetMeetingDependentVars(),this._destroyed=!0,this.emitDailyJSEvent({action:"call-instance-destroyed"}),delete br[this.callClientId],!((u=window)===null||u===void 0||(u=u._daily)===null||u===void 0)&&u.instances&&delete window._daily.instances[this.callClientId],this.strictMode&&(this.callClientId=void 0)}),function(){return me.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(u){var m=u.bodyClass,p=u.cssFile,x=u.cssText;return ue(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl(p),bodyClass:m,cssText:x}),this}},{key:"iframe",value:function(){return ue(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return jt(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return jt(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(u,m){for(var p in m){if(!xs[p])throw new Error("unrecognized updateParticipant property ".concat(p));if(xs[p].validate&&!xs[p].validate(m[p],this,this._participants[u]))throw new Error(xs[p].help)}}},{key:"updateParticipant",value:function(u,m){return this._participants.local&&this._participants.local.session_id===u&&(u="local"),u&&m&&(this.validateParticipantProperties(u,m),this.sendMessageToCallMachine({action:"update-participant",id:u,properties:m})),this}},{key:"updateParticipants",value:function(u){var m=this._participants.local&&this._participants.local.session_id;for(var p in u)p===m&&(p="local"),p&&u[p]&&this.validateParticipantProperties(p,u[p]);return this.sendMessageToCallMachine({action:"update-participants",participants:u}),this}},{key:"updateWaitingParticipant",value:(re=Z(function*(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(jt(this._callObjectMode,"updateWaitingParticipant()"),we(this._callState,"updateWaitingParticipant()"),typeof m!="string"||fe(p)!=="object")throw new Error("updateWaitingParticipant() must take an id string and a updates object");return new Promise(function(x,_){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participant",id:m,updates:p},function(M){M.error&&_(M.error),M.id||_(new Error("unknown error in updateWaitingParticipant()")),x({id:M.id})})})}),function(){return re.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(q=Z(function*(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jt(this._callObjectMode,"updateWaitingParticipants()"),we(this._callState,"updateWaitingParticipants()"),fe(m)!=="object")throw new Error("updateWaitingParticipants() must take a mapping between ids and update objects");return new Promise(function(p,x){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participants",updatesById:m},function(_){_.error&&x(_.error),_.ids||x(new Error("unknown error in updateWaitingParticipants()")),p({ids:_.ids})})})}),function(){return q.apply(this,arguments)})},{key:"requestAccess",value:(z=Z(function*(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=m.access,x=p===void 0?{level:l0}:p,_=m.name,M=_===void 0?"":_;return jt(this._callObjectMode,"requestAccess()"),we(this._callState,"requestAccess()"),new Promise(function(I,R){u.sendMessageToCallMachine({action:"daily-method-request-access",access:x,name:M},function(U){U.error&&R(U.error),U.access||R(new Error("unknown error in requestAccess()")),I({access:U.access,granted:U.granted})})})}),function(){return z.apply(this,arguments)})},{key:"localAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.audio.state):null}},{key:"localVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.video.state):null}},{key:"setLocalAudio",value:function(u){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return"forceDiscardTrack"in m&&(ce()?(console.warn("forceDiscardTrack option not supported in React Native; ignoring"),m={}):u&&(console.warn("forceDiscardTrack option only supported when calling setLocalAudio(false); ignoring"),m={})),this.sendMessageToCallMachine({action:"local-audio",state:u,options:m}),this}},{key:"localScreenAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenAudio.state):null}},{key:"localScreenVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenVideo.state):null}},{key:"updateScreenShare",value:function(u){if(this._isScreenSharing)return this.sendMessageToCallMachine({action:"local-screen-update",options:u}),this;console.warn("There is no screen share in progress. Try calling startScreenShare first.")}},{key:"setLocalVideo",value:function(u){return this.sendMessageToCallMachine({action:"local-video",state:u}),this}},{key:"_setAllowLocalAudio",value:function(u){if(this._preloadCache.allowLocalAudio=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-audio",state:u}),this}},{key:"_setAllowLocalVideo",value:function(u){if(this._preloadCache.allowLocalVideo=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-video",state:u}),this}},{key:"getReceiveSettings",value:(F=Z(function*(u){var m=this,p=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,x=p!==void 0&&p;if(jt(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(fe(u)){case"string":return new Promise(function(_){m.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:u,showInheritedValues:x},function(M){_(M.receiveSettings)})});case"undefined":return this._receiveSettings;default:throw new Error('first argument to getReceiveSettings() must be a participant id (or "base"), or there should be no arguments')}}),function(u){return F.apply(this,arguments)})},{key:"updateReceiveSettings",value:(ne=Z(function*(u){var m=this;if(jt(this._callObjectMode,"updateReceiveSettings()"),!Sp(u,{allowAllParticipantsKey:!0}))throw new Error(Cp({allowAllParticipantsKey:!0}));return we(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function(p){m.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:u},function(x){p({receiveSettings:x.receiveSettings})})})}),function(u){return ne.apply(this,arguments)})},{key:"_prepInputSettingsForSharing",value:function(u,m){if(u){var p={};if(u.audio){var x,_,M;u.audio.settings&&(!Object.keys(u.audio.settings).length&&m||(p.audio={settings:H({},u.audio.settings)})),m&&(x=p.audio)!==null&&x!==void 0&&(x=x.settings)!==null&&x!==void 0&&x.customTrack&&(p.audio.settings={customTrack:this._sharedTracks.audioTrack});var I=((_=u.audio.processor)===null||_===void 0?void 0:_.type)==="none"&&((M=u.audio.processor)===null||M===void 0?void 0:M._isDefaultWhenNone);if(u.audio.processor&&!I){var R=H({},u.audio.processor);delete R._isDefaultWhenNone,p.audio=H(H({},p.audio),{},{processor:R})}}if(u.video){var U,ie,de;u.video.settings&&(!Object.keys(u.video.settings).length&&m||(p.video={settings:H({},u.video.settings)})),m&&(U=p.video)!==null&&U!==void 0&&(U=U.settings)!==null&&U!==void 0&&U.customTrack&&(p.video.settings={customTrack:this._sharedTracks.videoTrack});var an=((ie=u.video.processor)===null||ie===void 0?void 0:ie.type)==="none"&&((de=u.video.processor)===null||de===void 0?void 0:de._isDefaultWhenNone);if(u.video.processor&&!an){var $r=H({},u.video.processor);delete $r._isDefaultWhenNone,p.video=H(H({},p.video),{},{processor:$r})}}return p}}},{key:"getInputSettings",value:function(){var u=this;return ue(),new Promise(function(m){m(u._getInputSettings())})}},{key:"_getInputSettings",value:function(){var u,m,p,x,_,M,I={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(u=((p=this._inputSettings)===null||p===void 0?void 0:p.video)||I,m=((x=this._inputSettings)===null||x===void 0?void 0:x.audio)||I):(u=((_=this._preloadCache)===null||_===void 0||(_=_.inputSettings)===null||_===void 0?void 0:_.video)||I,m=((M=this._preloadCache)===null||M===void 0||(M=M.inputSettings)===null||M===void 0?void 0:M.audio)||I);var R={audio:m,video:u};return this._prepInputSettingsForSharing(R,!0)}},{key:"_updatePreloadCacheInputSettings",value:function(u,m){var p=this._inputSettings||{},x={};if(u.video){var _,M,I;x.video={},u.video.settings?(x.video.settings={},m||u.video.settings.customTrack||(I=p.video)===null||I===void 0||!I.settings?x.video.settings=u.video.settings:x.video.settings=H(H({},p.video.settings),u.video.settings),Object.keys(x.video.settings).length||delete x.video.settings):(_=p.video)!==null&&_!==void 0&&_.settings&&(x.video.settings=p.video.settings),u.video.processor?x.video.processor=u.video.processor:(M=p.video)!==null&&M!==void 0&&M.processor&&(x.video.processor=p.video.processor)}else p.video&&(x.video=p.video);if(u.audio){var R,U,ie;x.audio={},u.audio.settings?(x.audio.settings={},m||u.audio.settings.customTrack||(ie=p.audio)===null||ie===void 0||!ie.settings?x.audio.settings=u.audio.settings:x.audio.settings=H(H({},p.audio.settings),u.audio.settings),Object.keys(x.audio.settings).length||delete x.audio.settings):(R=p.audio)!==null&&R!==void 0&&R.settings&&(x.audio.settings=p.audio.settings),u.audio.processor?x.audio.processor=u.audio.processor:(U=p.audio)!==null&&U!==void 0&&U.processor&&(x.audio.processor=p.audio.processor)}else p.audio&&(x.audio=p.audio);this._maybeUpdateInputSettings(x)}},{key:"_devicesFromInputSettings",value:function(u){var m,p,x=(u==null||(m=u.video)===null||m===void 0||(m=m.settings)===null||m===void 0?void 0:m.deviceId)||null,_=(u==null||(p=u.audio)===null||p===void 0||(p=p.settings)===null||p===void 0?void 0:p.deviceId)||null,M=this._preloadCache.outputDeviceId||null;return{camera:x?{deviceId:x}:{},mic:_?{deviceId:_}:{},speaker:M?{deviceId:M}:{}}}},{key:"updateInputSettings",value:(G=Z(function*(u){var m=this;return ue(),kp(u)?u.video||u.audio?(xp(u,this.properties.dailyConfig,this._sharedTracks),this._callObjectMode&&!this._callMachineInitialized?(this._updatePreloadCacheInputSettings(u,!0),this._getInputSettings()):new Promise(function(p,x){m.sendMessageToCallMachine({action:"update-input-settings",inputSettings:u},function(_){if(_.error)x(_.error);else{if(_.returnPreloadCache)return m._updatePreloadCacheInputSettings(u,!0),void p(m._getInputSettings());m._maybeUpdateInputSettings(_.inputSettings),p(m._prepInputSettingsForSharing(_.inputSettings,!0))}})})):this._getInputSettings():(console.error(Zl()),Promise.reject(Zl()))}),function(u){return G.apply(this,arguments)})},{key:"setBandwidth",value:function(u){var m=u.kbs,p=u.trackConstraints;if(ue(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:m,trackConstraints:p}),this}},{key:"getDailyLang",value:function(){var u=this;if(ue(),this._callMachineInitialized)return new Promise(function(m){u.sendMessageToCallMachine({action:"get-daily-lang"},function(p){delete p.action,delete p.callbackStamp,m(p)})})}},{key:"setDailyLang",value:function(u){return ue(),this.sendMessageToCallMachine({action:"set-daily-lang",lang:u}),this}},{key:"setProxyUrl",value:function(u){return this.sendMessageToCallMachine({action:"set-proxy-url",proxyUrl:u}),this}},{key:"setIceConfig",value:function(u){return this.sendMessageToCallMachine({action:"set-ice-config",iceConfig:u}),this}},{key:"meetingSessionSummary",value:function(){return[vr,Rn].includes(this._callState)?this._finalSummaryOfPrevSession:this._meetingSessionSummary}},{key:"getMeetingSession",value:(J=Z(function*(){var u=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),we(this._callState,"getMeetingSession()"),new Promise(function(m){u.sendMessageToCallMachine({action:"get-meeting-session"},function(p){delete p.action,delete p.callbackStamp,m(p)})})}),function(){return J.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return we(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(u){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";jt(this._callObjectMode,"setMeetingSessionData()"),we(this._callState,"setMeetingSessionData");try{(function(p,x){new gw({data:p,mergeStrategy:x})})(u,m)}catch(p){throw console.error(p),p}try{this.sendMessageToCallMachine({action:"set-session-data",data:u,mergeStrategy:m})}catch(p){throw new Error("Error setting meeting session data: ".concat(p))}}},{key:"setUserName",value:function(u,m){var p=this;return this.properties.userName=u,new Promise(function(x){p.sendMessageToCallMachine({action:"set-user-name",name:u??"",thisMeetingOnly:ce()||!!m&&!!m.thisMeetingOnly},function(_){delete _.action,delete _.callbackStamp,x(_)})})}},{key:"setUserData",value:(se=Z(function*(u){var m=this;try{wp(u)}catch(p){throw console.error(p),p}if(this.properties.userData=u,this._callMachineInitialized)return new Promise(function(p){try{m.sendMessageToCallMachine({action:"set-user-data",userData:u},function(x){delete x.action,delete x.callbackStamp,p(x)})}catch(x){throw new Error("Error setting user data: ".concat(x))}})}),function(u){return se.apply(this,arguments)})},{key:"validateAudioLevelInterval",value:function(u){if(u&&(u<100||typeof u!="number"))throw new Error("The interval must be a number greater than or equal to 100 milliseconds.")}},{key:"startLocalAudioLevelObserver",value:function(u){var m=this;if(typeof AudioWorkletNode>"u"&&!ce())throw new Error("startLocalAudioLevelObserver() is not supported on this browser");if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isLocalAudioLevelObserverRunning=!0,new Promise(function(p,x){m.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:u},function(_){m._isLocalAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.localAudioLevelObserver={enabled:!0,interval:u}}},{key:"isLocalAudioLevelObserverRunning",value:function(){return this._isLocalAudioLevelObserverRunning}},{key:"stopLocalAudioLevelObserver",value:function(){this._preloadCache.localAudioLevelObserver=null,this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-local-audio-level-observer"})}},{key:"startRemoteParticipantsAudioLevelObserver",value:function(u){var m=this;if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isRemoteParticipantsAudioLevelObserverRunning=!0,new Promise(function(p,x){m.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:u},function(_){m._isRemoteParticipantsAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.remoteParticipantsAudioLevelObserver={enabled:!0,interval:u}}},{key:"isRemoteParticipantsAudioLevelObserverRunning",value:function(){return this._isRemoteParticipantsAudioLevelObserverRunning}},{key:"stopRemoteParticipantsAudioLevelObserver",value:function(){this._preloadCache.remoteParticipantsAudioLevelObserver=null,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-remote-participants-audio-level-observer"})}},{key:"startCamera",value:(W=Z(function*(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jt(this._callObjectMode,"startCamera()"),Yl(this._callState,this._isPreparingToJoin,"startCamera()","Did you mean to use setLocalAudio() and/or setLocalVideo() instead?"),this.needsLoad())try{yield this.load(m)}catch(p){return Promise.reject(p)}else{if(this._didPreAuth){if(m.url&&m.url!==this.properties.url)return console.error("url in startCamera() is different than the one used in preAuth()"),Promise.reject();if(m.token&&m.token!==this.properties.token)return console.error("token in startCamera() is different than the one used in preAuth()"),Promise.reject()}this.validateProperties(m),this.properties=H(H({},this.properties),m)}return new Promise(function(p){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"start-camera",properties:Xr(u.properties,u.callClientId),preloadCache:Xr(u._preloadCache,u.callClientId)},function(x){p({camera:x.camera,mic:x.mic,speaker:x.speaker})})})}),function(){return W.apply(this,arguments)})},{key:"validateCustomTrack",value:function(u,m,p){if(p&&p.length>50)throw new Error("Custom track `trackName` must not be more than 50 characters");if(m&&m!=="music"&&m!=="speech"&&!(m instanceof Object))throw new Error("Custom track `mode` must be either `music` | `speech` | `DailyMicAudioModeSettings` or `undefined`");if(p&&["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo","customVideoDefaults"].includes(p))throw new Error("Custom track `trackName` must not match a track name already used by daily: cam-audio, cam-video, customVideoDefaults, screen-video, screen-audio, rmpAudio, rmpVideo");if(!(u instanceof MediaStreamTrack))throw new Error("Custom tracks provided must be instances of MediaStreamTrack")}},{key:"startCustomTrack",value:function(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{track,mode,trackName,ignoreAudioLevel};return ue(),we(this._callState,"startCustomTrack()"),this.validateCustomTrack(m.track,m.mode,m.trackName),new Promise(function(p,x){u._sharedTracks.customTrack=m.track,m.track=pn,u.sendMessageToCallMachine({action:"start-custom-track",properties:m},function(_){_.error?x({error:_.error}):p(_.mediaTag)})})}},{key:"stopCustomTrack",value:function(u){var m=this;return ue(),we(this._callState,"stopCustomTrack()"),new Promise(function(p){m.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:u},function(x){p(x.mediaTag)})})}},{key:"setCamera",value:function(u){var m=this;return Hi(),Cs(this._callMachineInitialized,"setCamera()"),new Promise(function(p){m.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:u},function(x){p({device:x.device})})})}},{key:"setAudioDevice",value:(K=Z(function*(u){return Hi(),this.nativeUtils().setAudioDevice(u),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(u){return K.apply(this,arguments)})},{key:"cycleCamera",value:function(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p){u.sendMessageToCallMachine({action:"cycle-camera",properties:m},function(x){p({device:x.device})})})}},{key:"cycleMic",value:function(){var u=this;return ue(),new Promise(function(m){u.sendMessageToCallMachine({action:"cycle-mic"},function(p){m({device:p.device})})})}},{key:"getCameraFacingMode",value:function(){var u=this;return Hi(),new Promise(function(m){u.sendMessageToCallMachine({action:"get-camera-facing-mode"},function(p){m(p.facingMode)})})}},{key:"setInputDevicesAsync",value:(B=Z(function*(u){var m=this,p=u.audioDeviceId,x=u.videoDeviceId,_=u.audioSource,M=u.videoSource;if(ue(),_!==void 0&&(p=_),M!==void 0&&(x=M),typeof p=="boolean"&&(this._setAllowLocalAudio(p),p=void 0),typeof x=="boolean"&&(this._setAllowLocalVideo(x),x=void 0),!p&&!x)return yield this.getInputDevices();var I={};return p&&(p instanceof MediaStreamTrack?(this._sharedTracks.audioTrack=p,p=pn,I.audio={settings:{customTrack:p}}):(delete this._sharedTracks.audioTrack,I.audio={settings:{deviceId:p}})),x&&(x instanceof MediaStreamTrack?(this._sharedTracks.videoTrack=x,x=pn,I.video={settings:{customTrack:x}}):(delete this._sharedTracks.videoTrack,I.video={settings:{deviceId:x}})),this._callObjectMode&&this.needsLoad()?(this._updatePreloadCacheInputSettings(I,!1),this._devicesFromInputSettings(this._inputSettings)):new Promise(function(R){m.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:p,videoDeviceId:x},function(U){if(delete U.action,delete U.callbackStamp,U.returnPreloadCache)return m._updatePreloadCacheInputSettings(I,!1),void R(m._devicesFromInputSettings(m._inputSettings));R(U)})})}),function(u){return B.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(V=Z(function*(u){var m=this,p=u.outputDeviceId;if(ue(),!p||typeof p!="string")throw new Error("outputDeviceId must be provided and must be a valid device id");return this._preloadCache.outputDeviceId=p,this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(x,_){m.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:p},function(M){if(delete M.action,delete M.callbackStamp,M.error){var I=new Error(M.error.message);return I.type=M.error.type,void _(I)}M.returnPreloadCache?x(m._devicesFromInputSettings(m._inputSettings)):x(M)})})}),function(u){return V.apply(this,arguments)})},{key:"getInputDevices",value:(X=Z(function*(){var u=this;return this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(m){u.sendMessageToCallMachine({action:"get-input-devices"},function(p){p.returnPreloadCache?m(u._devicesFromInputSettings(u._inputSettings)):m({camera:p.camera,mic:p.mic,speaker:p.speaker})})})}),function(){return X.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return Hi(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(u){if(Hi(),[hp,Rw].includes(u)){if(u!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=u,!this.disableReactNativeAutoDeviceManagement("audio")&&_s(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMode(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",u)}},{key:"preAuth",value:($=Z(function*(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jt(this._callObjectMode,"preAuth()"),Yl(this._callState,this._isPreparingToJoin,"preAuth()"),this.needsLoad()&&(yield this.load(m)),!m.url)throw new Error("preAuth() requires at least a url to be provided");return this.validateProperties(m),this.properties=H(H({},this.properties),m),new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"daily-method-preauth",properties:Xr(u.properties,u.callClientId),preloadCache:Xr(u._preloadCache,u.callClientId)},function(_){return _.error?x(_.error):_.access?(u._didPreAuth=!0,void p({access:_.access})):x(new Error("unknown error in preAuth()"))})})}),function(){return $.apply(this,arguments)})},{key:"load",value:(D=Z(function*(u){var m=this;if(this.needsLoad()){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");if(u&&(this.validateProperties(u),this.properties=H(H({},this.properties),u)),!this._callObjectMode&&!this.properties.url)throw new Error("can't load iframe meeting because url property isn't set");return this._updateCallState(wh),this.emitDailyJSEvent({action:g0}),this._callObjectMode?new Promise(function(p,x){m._callObjectLoader.cancel();var _=Date.now();m._callObjectLoader.load(m.properties.dailyConfig,function(M){m._bundleLoadTime=M?"no-op":Date.now()-_,m._updateCallState(Sh),M&&m.emitDailyJSEvent({action:xh}),p()},function(M,I){if(m.emitDailyJSEvent({action:m0}),!I){m._updateCallState(Rn),m.resetMeetingDependentVars();var R={action:Mh,errorMsg:M.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:M,bundleUrl:Go(m.properties.dailyConfig)}}};m._maybeSendToSentry(R),m.emitDailyJSEvent(R),x(M.msg)}})}):(this._iframe.src=sf(this.assembleMeetingUrl(),this.properties.dailyConfig),new Promise(function(p,x){m._loadedCallback=function(_){m._callState!==Rn?(m._updateCallState(Sh),(m.properties.cssFile||m.properties.cssText)&&m.loadCss(m.properties),p()):x(_)}}))}}),function(u){return D.apply(this,arguments)})},{key:"join",value:(A=Z(function*(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._testCallInProgress&&this.stopTestCallQuality();var p=!1;if(this.needsLoad()){this.updateIsPreparingToJoin(!0);try{yield this.load(m)}catch(x){return this.updateIsPreparingToJoin(!1),Promise.reject(x)}}else{if(p=!(!this.properties.cssFile&&!this.properties.cssText),this._didPreAuth){if(m.url&&m.url!==this.properties.url)return console.error("url in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject();if(m.token&&m.token!==this.properties.token)return console.error("token in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject()}if(m.url&&!this._callObjectMode&&m.url&&m.url!==this.properties.url)return console.error("url in join() is different than the one used in load() (".concat(this.properties.url," -> ").concat(m.url,")")),this.updateIsPreparingToJoin(!1),Promise.reject();this.validateProperties(m),this.properties=H(H({},this.properties),m)}return m.showLocalVideo!==void 0&&(this._callObjectMode?console.error("showLocalVideo is not available in callObject mode"):this._showLocalVideo=!!m.showLocalVideo),m.showParticipantsBar!==void 0&&(this._callObjectMode?console.error("showParticipantsBar is not available in callObject mode"):this._showParticipantsBar=!!m.showParticipantsBar),this._callState===mr||this._callState===Ll?(console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1)):(this._updateCallState(Ll,!1),this.emitDailyJSEvent({action:b0}),this._preloadCache.inputSettings=this._prepInputSettingsForSharing(this._inputSettings||{},!1),this.sendMessageToCallMachine({action:"join-meeting",properties:Xr(this.properties,this.callClientId),preloadCache:Xr(this._preloadCache,this.callClientId)}),new Promise(function(x,_){u._joinedCallback=function(M,I){if(u._callState!==Rn){if(u._updateCallState(mr),M)for(var R in M){if(u._callObjectMode){var U=u._callMachine().store;Xh(M[R],U),Zh(M[R],U),ep(M[R],u._participants[R],U)}u._participants[R]=H({},M[R]),u.toggleParticipantAudioBasedOnNativeAudioFocus()}p&&u.loadCss(u.properties),x(M)}else _(I)}}))}),function(){return A.apply(this,arguments)})},{key:"leave",value:(E=Z(function*(){var u=this;return this._testCallInProgress&&this.stopTestCallQuality(),new Promise(function(m){u._callState===vr||u._callState===Rn?m():u._callObjectLoader&&!u._callObjectLoader.loaded?(u._callObjectLoader.cancel(),u._updateCallState(vr),u.resetMeetingDependentVars(),u.emitDailyJSEvent({action:vr}),m()):(u._resolveLeave=m,u.sendMessageToCallMachine({action:"leave-meeting"}))})}),function(){return E.apply(this,arguments)})},{key:"startScreenShare",value:(C=Z(function*(){var u=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Cs(this._callMachineInitialized,"startScreenShare()"),m.screenVideoSendSettings&&this._validateVideoSendSettings("screenVideo",m.screenVideoSendSettings),m.mediaStream&&(this._sharedTracks.screenMediaStream=m.mediaStream,m.mediaStream=pn),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var p=this.nativeUtils();if(yield p.isScreenBeingCaptured())return void this.emitDailyJSEvent({action:Th,type:"screen-share-error",errorMsg:"Could not start the screen sharing. The screen is already been captured!"});p.setSystemScreenCaptureStartCallback(function(){p.setSystemScreenCaptureStartCallback(null),u.sendMessageToCallMachine({action:Oh,captureOptions:m})}),p.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:Oh,captureOptions:m})}),function(){return C.apply(this,arguments)})},{key:"stopScreenShare",value:function(){Cs(this._callMachineInitialized,"stopScreenShare()"),this.sendMessageToCallMachine({action:"local-screen-stop"})}},{key:"startRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},m=u.type;if(m&&m!=="cloud"&&m!=="raw-tracks"&&m!=="local")throw new Error("invalid type: ".concat(m,", allowed values 'cloud', 'raw-tracks', or 'local'"));this.sendMessageToCallMachine(H({action:"local-recording-start"},u))}},{key:"updateRecording",value:function(u){var m=u.layout,p=m===void 0?{preset:"default"}:m,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-recording",layout:p,instanceId:x})}},{key:"stopRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(H({action:"local-recording-stop"},u))}},{key:"startLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(H({action:"daily-method-start-live-streaming"},u))}},{key:"updateLiveStreaming",value:function(u){var m=u.layout,p=m===void 0?{preset:"default"}:m,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:p,instanceId:x})}},{key:"addLiveStreamingEndpoints",value:function(u){var m=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Dh,endpointsOp:aw,endpoints:m,instanceId:p})}},{key:"removeLiveStreamingEndpoints",value:function(u){var m=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Dh,endpointsOp:lw,endpoints:m,instanceId:p})}},{key:"stopLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(H({action:"daily-method-stop-live-streaming"},u))}},{key:"validateDailyConfig",value:function(u){u.camSimulcastEncodings&&(console.warn("camSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide camera simulcast settings."),this.validateSimulcastEncodings(u.camSimulcastEncodings)),u.screenSimulcastEncodings&&console.warn("screenSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide screen simulcast settings."),Fh()&&u.noAutoDefaultDeviceChange&&console.warn("noAutoDefaultDeviceChange is not supported on Android, and will be ignored.")}},{key:"validateSimulcastEncodings",value:function(u){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(u){if(!(u instanceof Array||Array.isArray(u)))throw new Error("encodings must be an Array");if(!Pp(u.length,1,3))throw new Error("encodings must be an Array with between 1 to ".concat(3," layers"));for(var x=0;x<u.length;x++){var _=u[x];for(var M in this._validateEncodingLayerHasValidProperties(_),_)if(Gl.includes(M)){if(typeof _[M]!="number")throw new Error("".concat(M," must be a number"));if(m){var I=m[M],R=I.min,U=I.max;if(!Pp(_[M],R,U))throw new Error("".concat(M," value not in range. valid range: ").concat(R," to ").concat(U))}}else if(!["active","scalabilityMode"].includes(M))throw new Error("Invalid key ".concat(M,", valid keys are:")+Object.values(Gl));if(p&&!_.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(k=Z(function*(u){var m=this,p=u.url,x=u.settings,_=x===void 0?{state:$l.PLAY}:x;try{(function(M){if(typeof M!="string")throw new Error('url parameter must be "string" type')})(p),Dp(_),function(M){for(var I in M)if(!vp.includes(I))throw new Error("Invalid key ".concat(I,", valid keys are: ").concat(vp));M.simulcastEncodings&&this.validateSimulcastEncodings(M.simulcastEncodings,mp,!0)}(_)}catch(M){throw console.error("invalid argument Error: ".concat(M)),console.error(`startRemoteMediaPlayer arguments must be of the form:
|
|
31
31
|
{ url: "playback url",
|
|
32
32
|
settings?:
|
|
33
|
-
{state: "play"|"pause", simulcastEncodings?: [{}] } }`),M}return new Promise(function(M,I){
|
|
33
|
+
{state: "play"|"pause", simulcastEncodings?: [{}] } }`),M}return new Promise(function(M,I){m.sendMessageToCallMachine({action:"daily-method-start-remote-media-player",url:p,settings:_},function(R){R.error?I({error:R.error,errorMsg:R.errorMsg}):M({session_id:R.session_id,remoteMediaPlayerState:{state:R.state,settings:R.settings}})})})}),function(u){return k.apply(this,arguments)})},{key:"stopRemoteMediaPlayer",value:(w=Z(function*(u){var m=this;if(typeof u!="string")throw new Error(" remotePlayerID must be of type string");return new Promise(function(p,x){m.sendMessageToCallMachine({action:"daily-method-stop-remote-media-player",session_id:u},function(_){_.error?x({error:_.error,errorMsg:_.errorMsg}):p()})})}),function(u){return w.apply(this,arguments)})},{key:"updateRemoteMediaPlayer",value:(v=Z(function*(u){var m=this,p=u.session_id,x=u.settings;try{Dp(x)}catch(_){throw console.error("invalid argument Error: ".concat(_)),console.error(`updateRemoteMediaPlayer arguments must be of the form:
|
|
34
34
|
session_id: "participant session",
|
|
35
|
-
{ settings?: {state: "play"|"pause"} }`),_}return new Promise(function(_,M){g.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:p,settings:x},function(I){I.error?M({error:I.error,errorMsg:I.errorMsg}):_({session_id:I.session_id,remoteMediaPlayerState:{state:I.state,settings:I.settings}})})})}),function(u){return v.apply(this,arguments)})},{key:"startTranscription",value:function(u){we(this._callState,"startTranscription()"),this.sendMessageToCallMachine(H({action:"daily-method-start-transcription"},u))}},{key:"updateTranscription",value:function(u){if(we(this._callState,"updateTranscription()"),!u)throw new Error("updateTranscription Error: options is mandatory");if(fe(u)!=="object")throw new Error("updateTranscription Error: options must be object type");if(u.participants&&!Array.isArray(u.participants))throw new Error("updateTranscription Error: participants must be an array");this.sendMessageToCallMachine(H({action:"daily-method-update-transcription"},u))}},{key:"stopTranscription",value:function(u){if(we(this._callState,"stopTranscription()"),u&&fe(u)!=="object")throw new Error("stopTranscription Error: options must be object type");if(u&&!u.instanceId)throw new Error('"instanceId" not provided');this.sendMessageToCallMachine(H({action:"daily-method-stop-transcription"},u))}},{key:"startDialOut",value:(S=Z(function*(u){var g=this;we(this._callState,"startDialOut()");var p=function(I){if(I){if(!Array.isArray(I))throw new Error("Error starting dial out: audio codec must be an array");if(I.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");I.forEach(function(R){if(typeof R!="string")throw new Error("Error starting dial out: audio codec must be a string");if(R!=="OPUS"&&R!=="PCMU"&&R!=="PCMA"&&R!=="G722")throw new Error("Error starting dial out: audio codec must be one of OPUS, PCMU, PCMA, G722")})}};if(!u.sipUri&&!u.phoneNumber)throw new Error("Error starting dial out: either a sip uri or phone number must be provided");if(u.sipUri&&u.phoneNumber)throw new Error("Error starting dial out: only one of sip uri or phone number must be provided");if(u.sipUri){if(typeof u.sipUri!="string")throw new Error("Error starting dial out: sipUri must be a string");if(!u.sipUri.startsWith("sip:"))throw new Error("Error starting dial out: Invalid SIP URI, must start with 'sip:'");if(u.video&&typeof u.video!="boolean")throw new Error("Error starting dial out: video must be a boolean value");(function(I){if(I&&(p(I.audio),I.video)){if(!Array.isArray(I.video))throw new Error("Error starting dial out: video codec must be an array");if(I.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");I.video.forEach(function(R){if(typeof R!="string")throw new Error("Error starting dial out: video codec must be a string");if(R!=="H264"&&R!=="VP8")throw new Error("Error starting dial out: video codec must be H264 or VP8")})}})(u.codecs)}if(u.phoneNumber){if(typeof u.phoneNumber!="string")throw new Error("Error starting dial out: phoneNumber must be a string");if(!/^\+\d{1,}$/.test(u.phoneNumber))throw new Error("Error starting dial out: Invalid phone number, must be valid phone number as per E.164");u.codecs&&p(u.codecs.audio)}if(u.callerId){if(typeof u.callerId!="string")throw new Error("Error starting dial out: callerId must be a string");if(u.sipUri)throw new Error("Error starting dial out: callerId not allowed with sipUri")}if(u.displayName){if(typeof u.displayName!="string")throw new Error("Error starting dial out: displayName must be a string");if(u.displayName.length>=200)throw new Error("Error starting dial out: displayName length must be less than 200")}if(u.userId){if(typeof u.userId!="string")throw new Error("Error starting dial out: userId must be a string");if(u.userId.length>36)throw new Error("Error starting dial out: userId length must be less than or equal to 36")}if(yp(u),u.permissions&&u.permissions.canReceive){var x=qe(ap.validateJSONObject(u.permissions.canReceive),2),_=x[0],M=x[1];if(!_)throw new Error(M)}return new Promise(function(I,R){g.sendMessageToCallMachine(H({action:"dialout-start"},u),function(U){U.error?R(U.error):I(U)})})}),function(u){return S.apply(this,arguments)})},{key:"stopDialOut",value:function(u){var g=this;return we(this._callState,"stopDialOut()"),new Promise(function(p,x){g.sendMessageToCallMachine(H({action:"dialout-stop"},u),function(_){_.error?x(_.error):p(_)})})}},{key:"sipCallTransfer",value:(m=Z(function*(u){var g=this;if(we(this._callState,"sipCallTransfer()"),!u)throw new Error("sipCallTransfer() requires a sessionId and toEndPoint");return u.useSipRefer=!1,Ap(u,"sipCallTransfer"),yp(u),new Promise(function(p,x){g.sendMessageToCallMachine(H({action:Dh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return m.apply(this,arguments)})},{key:"sipRefer",value:(y=Z(function*(u){var g=this;if(we(this._callState,"sipRefer()"),!u)throw new Error("sessionId and toEndPoint are mandatory parameter");return u.useSipRefer=!0,Ap(u,"sipRefer"),new Promise(function(p,x){g.sendMessageToCallMachine(H({action:Dh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return y.apply(this,arguments)})},{key:"sendDTMF",value:(b=Z(function*(u){var g=this;return we(this._callState,"sendDTMF()"),function(p){var x=p.sessionId,_=p.tones;if(!x||!_)throw new Error("sessionId and tones are mandatory parameter");if(typeof x!="string"||typeof _!="string")throw new Error("sessionId and tones should be of string type");if(_.length>20)throw new Error("tones string must be upto 20 characters");var M=/[^0-9A-D*#]/g,I=_.match(M);if(I&&I[0])throw new Error("".concat(I[0]," is not valid DTMF tone"))}(u),new Promise(function(p,x){g.sendMessageToCallMachine(H({action:"send-dtmf"},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return b.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var u=this;return this._callState!==gr?Promise.resolve(H({stats:{latest:{}}},this._network)):new Promise(function(g){u.sendMessageToCallMachine({action:"get-calc-stats"},function(p){g(H(H({},u._network),{},{stats:p.stats}))})})}},{key:"testWebsocketConnectivity",value:(h=Z(function*(){var u=this;if(Yl(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(g){return Promise.reject(g)}return new Promise(function(g,p){u.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(x){x.error?p(x.error):g(x.results)})})}),function(){return h.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(u){return u?u instanceof MediaStreamTrack?!!Aw(u)||(console.error("Video track is not playable. This test needs a live video track."),!1):(console.error("Video track needs to be of type `MediaStreamTrack`."),!1):(console.error("Missing video track. You must provide a video track in order to run this test."),!1)}},{key:"testCallQuality",value:(f=Z(function*(){var u=this;ue(),jt(this._callObjectMode,"testCallQuality()"),Cs(this._callMachineInitialized,"testCallQuality()",null,!0),Ql(this._callState,this._isPreparingToJoin,"testCallQuality()");var g=this._testCallAlreadyInProgress,p=function(_){g||(u._testCallInProgress=_)};if(p(!0),this.needsLoad())try{var x=this._callState;yield this.load(),this._callState=x}catch(_){return p(!1),Promise.reject(_)}return new Promise(function(_){u.sendMessageToCallMachine({action:"test-call-quality",dailyJsVersion:u.properties.dailyJsVersion},function(M){var I=M.results,R=I.result,U=Jd(I,Dw);if(R==="failed"){var ie,de=H({},U);(ie=U.error)!==null&&ie!==void 0&&ie.details?(U.error.details=JSON.parse(U.error.details),de.error=H(H({},de.error),{},{details:H({},de.error.details)}),de.error.details.duringTest="testCallQuality"):(de.error=de.error?H({},de.error):{},de.error.details={duringTest:"testCallQuality"}),u._maybeSendToSentry(de)}p(!1),_(H({result:R},U))})})}),function(){return f.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(d=Z(function*(u){var g;ce()?(console.warn("testConnectionQuality() is deprecated: use testPeerToPeerCallQuality() instead"),g=yield this.testPeerToPeerCallQuality(u)):(console.warn("testConnectionQuality() is deprecated: use testCallQuality() instead"),g=yield this.testCallQuality());var p={result:g.result,secondsElapsed:g.secondsElapsed};return g.data&&(p.data={maxRTT:g.data.maxRoundTripTime,packetLoss:g.data.avgRecvPacketLoss}),p}),function(u){return d.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(c=Z(function*(u){var g=this;if(Yl(this._testCallInProgress,"testPeerToPeerCallQuality()"),this.needsLoad())try{yield this.load()}catch(_){return Promise.reject(_)}var p=u.videoTrack,x=u.duration;if(!this._validateVideoTrackForNetworkTests(p))throw new Error("Video track error");return this._sharedTracks.videoTrackForConnectionQualityTest=p,new Promise(function(_,M){g.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:x},function(I){I.error?M(I.error):_(I.results)})})}),function(u){return c.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){ce()?(console.warn("stopTestConnectionQuality() is deprecated: use testPeerToPeerCallQuality() and stopTestPeerToPeerCallQuality() instead"),this.stopTestPeerToPeerCallQuality()):(console.warn("stopTestConnectionQuality() is deprecated: use testCallQuality() and stopTestCallQuality() instead"),this.stopTestCallQuality())}},{key:"stopTestPeerToPeerCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-p2p-call-quality"})}},{key:"testNetworkConnectivity",value:(l=Z(function*(u){var g=this;if(Yl(this._testCallInProgress,"testNetworkConnectivity()"),this.needsLoad())try{yield this.load()}catch(p){return Promise.reject(p)}if(!this._validateVideoTrackForNetworkTests(u))throw new Error("Video track error");return this._sharedTracks.videoTrackForNetworkConnectivityTest=u,new Promise(function(p,x){g.sendMessageToCallMachine({action:"test-network-connectivity"},function(_){_.error?x(_.error):p(_.results)})})}),function(u){return l.apply(this,arguments)})},{key:"abortTestNetworkConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-network-connectivity"})}},{key:"getCpuLoadStats",value:function(){var u=this;return new Promise(function(g){u._callState===gr?u.sendMessageToCallMachine({action:"get-cpu-load-stats"},function(p){g(p.cpuStats)}):g({cpuLoadState:void 0,cpuLoadStateReason:void 0,stats:{}})})}},{key:"_validateEncodingLayerHasValidProperties",value:function(u){var g;if(!(((g=Object.keys(u))===null||g===void 0?void 0:g.length)>0))throw new Error("Empty encoding is not allowed. At least one of these valid keys should be specified:"+Object.values(Jl))}},{key:"_validateVideoSendSettings",value:function(u,g){var p=u==="screenVideo"?["default-screen-video","detail-optimized","motion-optimized","motion-and-detail-balanced"]:["default-video","bandwidth-optimized","bandwidth-and-quality-balanced","quality-optimized","adaptive-2-layers","adaptive-3-layers"],x="Video send settings should be either an object or one of the supported presets: ".concat(p.join());if(typeof g=="string"){if(!p.includes(g))throw new Error(x)}else{if(fe(g)!=="object")throw new Error(x);if(!g.maxQuality&&!g.encodings&&g.allowAdaptiveLayers===void 0)throw new Error("Video send settings must contain at least maxQuality, allowAdaptiveLayers or encodings attribute");if(g.maxQuality&&["low","medium","high"].indexOf(g.maxQuality)===-1)throw new Error("maxQuality must be either low, medium or high");if(g.encodings){var _=!1;switch(Object.keys(g.encodings).length){case 1:_=!g.encodings.low;break;case 2:_=!g.encodings.low||!g.encodings.medium;break;case 3:_=!g.encodings.low||!g.encodings.medium||!g.encodings.high;break;default:_=!0}if(_)throw new Error("Encodings must be defined as: low, low and medium, or low, medium and high.");g.encodings.low&&this._validateEncodingLayerHasValidProperties(g.encodings.low),g.encodings.medium&&this._validateEncodingLayerHasValidProperties(g.encodings.medium),g.encodings.high&&this._validateEncodingLayerHasValidProperties(g.encodings.high)}}}},{key:"validateUpdateSendSettings",value:function(u){var g=this;if(!u||Object.keys(u).length===0)throw new Error("Send settings must contain at least information for one track!");Object.entries(u).forEach(function(p){var x=qe(p,2),_=x[0],M=x[1];g._validateVideoSendSettings(_,M)})}},{key:"updateSendSettings",value:function(u){var g=this;return this.validateUpdateSendSettings(u),this.needsLoad()?(this._preloadCache.sendSettings=u,{sendSettings:this._preloadCache.sendSettings}):new Promise(function(p,x){g.sendMessageToCallMachine({action:"update-send-settings",sendSettings:u},function(_){_.error?x(_.error):p(_.sendSettings)})})}},{key:"getSendSettings",value:function(){return this._sendSettings||this._preloadCache.sendSettings}},{key:"getLocalAudioLevel",value:function(){return this._localAudioLevel}},{key:"getRemoteParticipantsAudioLevel",value:function(){return this._remoteParticipantsAudioLevel}},{key:"getActiveSpeaker",value:function(){return ue(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(u){return ue(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:u}),this}},{key:"activeSpeakerMode",value:function(){return ue(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(u){return we(this._callState,"setSubscribeToTracksAutomatically()","Use the subscribeToTracksAutomatically configuration property."),this._preloadCache.subscribeToTracksAutomatically=u,this.sendMessageToCallMachine({action:"daily-method-subscribe-to-tracks-automatically",enabled:u}),this}},{key:"enumerateDevices",value:(a=Z(function*(){var u=this;if(this._callObjectMode){var g=yield navigator.mediaDevices.enumerateDevices();return vr()==="Firefox"&&bs().major>115&&bs().major<123&&(g=g.filter(function(p){return p.kind!=="audiooutput"})),{devices:g.map(function(p){var x=JSON.parse(JSON.stringify(p));if(!ce()&&p.kind==="videoinput"&&p.getCapabilities){var _,M=p.getCapabilities();x.facing=(M==null||(_=M.facingMode)===null||_===void 0?void 0:_.length)>=1?M.facingMode[0]:void 0}return x})}}return new Promise(function(p){u.sendMessageToCallMachine({action:"enumerate-devices"},function(x){p({devices:x.devices})})})}),function(){return a.apply(this,arguments)})},{key:"sendAppMessage",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"*";if(we(this._callState,"sendAppMessage()"),JSON.stringify(u).length>this._maxAppMessageSize)throw new Error("Message data too large. Max size is "+this._maxAppMessageSize);return this.sendMessageToCallMachine({action:"app-msg",data:u,to:g}),this}},{key:"addFakeParticipant",value:function(u){return ue(),we(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(H({action:"add-fake-participant"},u)),this}},{key:"setShowNamesMode",value:function(u){return mt(this._callObjectMode,"setShowNamesMode()"),ue(),u&&u!=="always"&&u!=="never"?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this.sendMessageToCallMachine({action:"set-show-names",mode:u}),this)}},{key:"setShowLocalVideo",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return mt(this._callObjectMode,"setShowLocalVideo()"),ue(),we(this._callState,"setShowLocalVideo()"),typeof u!="boolean"?(console.error("setShowLocalVideo only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-local-video",show:u}),this._showLocalVideo=u,this)}},{key:"showLocalVideo",value:function(){return mt(this._callObjectMode,"showLocalVideo()"),ue(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return mt(this._callObjectMode,"setShowParticipantsBar()"),ue(),we(this._callState,"setShowParticipantsBar()"),typeof u!="boolean"?(console.error("setShowParticipantsBar only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-participants-bar",show:u}),this._showParticipantsBar=u,this)}},{key:"showParticipantsBar",value:function(){return mt(this._callObjectMode,"showParticipantsBar()"),ue(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return ue(),mt(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(u){return ue(),mt(this._callObjectMode,"setCustomIntegrations()"),we(this._callState,"setCustomIntegrations()"),Tp(u)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:u}),this._customIntegrations=u,this):this}},{key:"startCustomIntegrations",value:function(u){var g=this;if(ue(),mt(this._callObjectMode,"startCustomIntegrations()"),we(this._callState,"startCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("startCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in g._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"start-custom-integrations",ids:p}),this)}},{key:"stopCustomIntegrations",value:function(u){var g=this;if(ue(),mt(this._callObjectMode,"stopCustomIntegrations()"),we(this._callState,"stopCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("stopCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in g._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"stop-custom-integrations",ids:p}),this)}},{key:"customTrayButtons",value:function(){return mt(this._callObjectMode,"customTrayButtons()"),ue(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(u){return mt(this._callObjectMode,"updateCustomTrayButtons()"),ue(),we(this._callState,"updateCustomTrayButtons()"),Ep(u)?(this.sendMessageToCallMachine({action:"update-custom-tray-buttons",btns:u}),this._customTrayButtons=u,this):(console.error("updateCustomTrayButtons only accepts a dictionary of the type ".concat(JSON.stringify(ks))),this)}},{key:"theme",value:function(){return mt(this._callObjectMode,"theme()"),this.properties.theme}},{key:"setTheme",value:function(u){var g=this;return mt(this._callObjectMode,"setTheme()"),new Promise(function(p,x){try{g.validateProperties({theme:u}),g.properties.theme=H({},u),g.sendMessageToCallMachine({action:"set-theme",theme:g.properties.theme});try{g.emitDailyJSEvent({action:h0,theme:g.properties.theme})}catch(_){console.log("could not emit 'theme-updated'",_)}p(g.properties.theme)}catch(_){x(_)}})}},{key:"requestFullscreen",value:(s=Z(function*(){if(ue(),this._iframe&&!document.fullscreenElement&&Ih())try{(yield this._iframe.requestFullscreen)?this._iframe.requestFullscreen():this._iframe.webkitRequestFullscreen()}catch(u){console.log("could not make video call fullscreen",u)}}),function(){return s.apply(this,arguments)})},{key:"exitFullscreen",value:function(){ue(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(o=Z(function*(){var u=this;return this._callObjectMode?(console.error("getSidebarView is not available in callObject mode"),Promise.resolve(null)):new Promise(function(g){u.sendMessageToCallMachine({action:"get-sidebar-view"},function(p){g(p.view)})})}),function(){return o.apply(this,arguments)})},{key:"setSidebarView",value:function(u){return this._callObjectMode?(console.error("setSidebarView is not available in callObject mode"),this):(this.sendMessageToCallMachine({action:"set-sidebar-view",view:u}),this)}},{key:"room",value:(i=Z(function*(){var u=this,g=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,p=g===void 0||g;return this._accessState.access===Ll||this.needsLoad()?this.properties.url?{roomUrlPendingJoin:this.properties.url}:null:new Promise(function(x){u.sendMessageToCallMachine({action:"lib-room-info",includeRoomConfigDefaults:p},function(_){delete _.action,delete _.callbackStamp,x(_)})})}),function(){return i.apply(this,arguments)})},{key:"geo",value:(r=Z(function*(){try{var u=yield fetch("https://gs.daily.co/_ks_/x-swsl/:");return{current:(yield u.json()).geo}}catch(g){return console.error("geo lookup failed",g),{current:""}}}),function(){return r.apply(this,arguments)})},{key:"setNetworkTopology",value:(n=Z(function*(u){var g=this;return ue(),we(this._callState,"setNetworkTopology()"),new Promise(function(p,x){g.sendMessageToCallMachine({action:"set-network-topology",opts:u},function(_){_.error?x({error:_.error}):p({workerId:_.workerId})})})}),function(u){return n.apply(this,arguments)})},{key:"getNetworkTopology",value:(e=Z(function*(){var u=this;return new Promise(function(g,p){u.needsLoad()&&g({topology:"none"}),u.sendMessageToCallMachine({action:"get-network-topology"},function(x){x.error?p({error:x.error}):g({topology:x.topology})})})}),function(){return e.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(u){if(ue(),typeof u!="number"&&u!==!0&&u!==!1)throw new Error("argument to setShouldPlayNewParticipantSound should be true, false, or a number, but is ".concat(u));this.sendMessageToCallMachine({action:"daily-method-set-play-ding",arg:u})}},{key:"on",value:function(u,g){return qo.prototype.on.call(this,u,g)}},{key:"once",value:function(u,g){return qo.prototype.once.call(this,u,g)}},{key:"off",value:function(u,g){return qo.prototype.off.call(this,u,g)}},{key:"validateProperties",value:function(u){var g,p;if(u!=null&&(g=u.dailyConfig)!==null&&g!==void 0&&g.userMediaAudioConstraints){var x,_;ce()||console.warn("userMediaAudioConstraints is deprecated. You can override constraints with inputSettings.audio.settings, found in DailyCallOptions.");var M=u.inputSettings||{};M.audio=((x=u.inputSettings)===null||x===void 0?void 0:x.audio)||{},M.audio.settings=((_=u.inputSettings)===null||_===void 0||(_=_.audio)===null||_===void 0?void 0:_.settings)||{},M.audio.settings=H(H({},M.audio.settings),u.dailyConfig.userMediaAudioConstraints),u.inputSettings=M,delete u.dailyConfig.userMediaAudioConstraints}if(u!=null&&(p=u.dailyConfig)!==null&&p!==void 0&&p.userMediaVideoConstraints){var I,R;ce()||console.warn("userMediaVideoConstraints is deprecated. You can override constraints with inputSettings.video.settings, found in DailyCallOptions.");var U=u.inputSettings||{};U.video=((I=u.inputSettings)===null||I===void 0?void 0:I.video)||{},U.video.settings=((R=u.inputSettings)===null||R===void 0||(R=R.video)===null||R===void 0?void 0:R.settings)||{},U.video.settings=H(H({},U.video.settings),u.dailyConfig.userMediaVideoConstraints),u.inputSettings=U,delete u.dailyConfig.userMediaVideoConstraints}for(var ie in u)if(br[ie]){if(br[ie].validate&&!br[ie].validate(u[ie],this))throw new Error("property '".concat(ie,"': ").concat(br[ie].help))}else console.warn("Ignoring unrecognized property '".concat(ie,"'")),delete u[ie]}},{key:"assembleMeetingUrl",value:function(){var u,g,p=H(H({},this.properties),{},{emb:this.callClientId,embHref:encodeURIComponent(window.location.href),proxy:(u=this.properties.dailyConfig)!==null&&u!==void 0&&u.proxyUrl?encodeURIComponent((g=this.properties.dailyConfig)===null||g===void 0?void 0:g.proxyUrl):void 0}),x=p.url.match(/\?/)?"&":"?";return p.url+x+Object.keys(br).filter(function(_){return br[_].queryString&&p[_]!==void 0}).map(function(_){return"".concat(br[_].queryString,"=").concat(p[_])}).join("&")}},{key:"needsLoad",value:function(){return[yh,bh,mr,In].includes(this._callState)}},{key:"sendMessageToCallMachine",value:function(u,g){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");this._messageChannel.sendMessageToCallMachine(u,g,this.callClientId,this._iframe)}},{key:"forwardPackagedMessageToCallMachine",value:function(u){this._messageChannel.forwardPackagedMessageToCallMachine(u,this._iframe,this.callClientId)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(u){return this._messageChannel.addListenerForPackagedMessagesFromCallMachine(u,this.callClientId)}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(u){this._messageChannel.removeListenerForPackagedMessagesFromCallMachine(u)}},{key:"handleMessageFromCallMachine",value:function(u){switch(u.action){case d0:this.sendMessageToCallMachine(H({action:f0},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var g={action:vs,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:Go(this.properties.dailyConfig)}};this.sendMessageToCallMachine(g),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case kh:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emitDailyJSEvent(u);break;case b0:var p,x=H({},u);delete x.internal,this._maxAppMessageSize=((p=u.internal)===null||p===void 0?void 0:p._maxAppMessageSize)||Il,this._joinedCallback&&(this._joinedCallback(u.participants),this._joinedCallback=null),this.emitDailyJSEvent(x);break;case S0:case k0:if(this._callState===mr)return;if(u.participant&&u.participant.session_id){var _=u.participant.local?"local":u.participant.session_id;if(this._callObjectMode){var M=this._callMachine().store;Yh(u.participant,M),Xh(u.participant,M),Zh(u.participant,this._participants[_],M)}try{this.maybeParticipantTracksStopped(this._participants[_],u.participant),this.maybeParticipantTracksStarted(this._participants[_],u.participant),this.maybeEventRecordingStopped(this._participants[_],u.participant),this.maybeEventRecordingStarted(this._participants[_],u.participant)}catch(Ux){console.error("track events error",Ux)}this.compareEqualForParticipantUpdateEvent(u.participant,this._participants[_])||(this._participants[_]=H({},u.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus(),this.emitDailyJSEvent(u))}break;case x0:if(u.participant&&u.participant.session_id){var I=this._participants[u.participant.session_id];I&&this.maybeParticipantTracksStopped(I,null),delete this._participants[u.participant.session_id],this.emitDailyJSEvent(u)}break;case _0:et(this._participantCounts,u.participantCounts)||(this._participantCounts=u.participantCounts,this.emitDailyJSEvent(u));break;case C0:var R={access:u.access};u.awaitingAccess&&(R.awaitingAccess=u.awaitingAccess),et(this._accessState,R)||(this._accessState=R,this.emitDailyJSEvent(u));break;case E0:if(u.meetingSession){this._meetingSessionSummary=u.meetingSession,this.emitDailyJSEvent(u);var U=H(H({},u),{},{action:"meeting-session-updated"});this.emitDailyJSEvent(U)}break;case Th:var ie;this._iframe&&!u.preserveIframe&&(this._iframe.src=""),this._updateCallState(In),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(u.errorMsg),this._loadedCallback=null),u.preserveIframe;var de=Jd(u,Lw);de!=null&&(ie=de.error)!==null&&ie!==void 0&&ie.details&&(de.error.details=JSON.parse(de.error.details)),this._maybeSendToSentry(u),this._joinedCallback&&(this._joinedCallback(null,de),this._joinedCallback=null),this.emitDailyJSEvent(de);break;case w0:this._callState!==In&&this._updateCallState(mr),this.resetMeetingDependentVars(),this._resolveLeave&&(this._resolveLeave(),this._resolveLeave=null),this.emitDailyJSEvent(u);break;case"selected-devices-updated":u.devices&&this.emitDailyJSEvent(u);break;case Q0:var an=u.state,$r=u.threshold,No=u.quality,je=an.state,Rt=an.reasons;je===this._network.networkState&&et(Rt,this._network.networkStateReasons)&&$r===this._network.threshold&&No===this._network.quality||(this._network.networkState=je,this._network.networkStateReasons=Rt,this._network.quality=No,this._network.threshold=$r,u.networkState=je,Rt.length&&(u.networkStateReasons=Rt),delete u.state,this.emitDailyJSEvent(u));break;case X0:u&&u.cpuLoadState&&this.emitDailyJSEvent(u);break;case Z0:u&&u.faceCounts!==void 0&&this.emitDailyJSEvent(u);break;case J0:var Fr=u.activeSpeaker;this._activeSpeaker.peerId!==Fr.peerId&&(this._activeSpeaker.peerId=Fr.peerId,this.emitDailyJSEvent({action:u.action,activeSpeaker:this._activeSpeaker}));break;case"show-local-video-changed":if(this._callObjectMode)return;var $o=u.show;this._showLocalVideo=$o,this.emitDailyJSEvent({action:u.action,show:$o});break;case G0:var za=u.enabled;this._activeSpeakerMode!==za&&(this._activeSpeakerMode=za,this.emitDailyJSEvent({action:u.action,enabled:this._activeSpeakerMode}));break;case M0:case A0:case O0:this._waitingParticipants=u.allWaitingParticipants,this.emitDailyJSEvent({action:u.action,participant:u.participant});break;case ow:et(this._receiveSettings,u.receiveSettings)||(this._receiveSettings=u.receiveSettings,this.emitDailyJSEvent({action:u.action,receiveSettings:u.receiveSettings}));break;case Ch:this._maybeUpdateInputSettings(u.inputSettings);break;case"send-settings-updated":et(this._sendSettings,u.sendSettings)||(this._sendSettings=u.sendSettings,this._preloadCache.sendSettings=null,this.emitDailyJSEvent({action:u.action,sendSettings:u.sendSettings}));break;case"local-audio-level":this._localAudioLevel=u.audioLevel,this._preloadCache.localAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case"remote-participants-audio-level":this._remoteParticipantsAudioLevel=u.participantsAudioLevel,this._preloadCache.remoteParticipantsAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case z0:var Fo=u.session_id;this._rmpPlayerState[Fo]=u.playerState,this.emitDailyJSEvent(u);break;case V0:delete this._rmpPlayerState[u.session_id],this.emitDailyJSEvent(u);break;case H0:var Bo=u.session_id,gy=this._rmpPlayerState[Bo];gy&&this.compareEqualForRMPUpdateEvent(gy,u.remoteMediaPlayerState)||(this._rmpPlayerState[Bo]=u.remoteMediaPlayerState,this.emitDailyJSEvent(u));break;case"custom-button-click":case"sidebar-view-changed":case"pip-started":case"pip-stopped":this.emitDailyJSEvent(u);break;case T0:var jx=this._meetingSessionState.topology!==(u.meetingSessionState&&u.meetingSessionState.topology);this._meetingSessionState=Zl(u.meetingSessionState,this._callObjectMode),(this._callObjectMode||jx)&&this.emitDailyJSEvent(u);break;case W0:this._isScreenSharing=!0,this.emitDailyJSEvent(u);break;case K0:case q0:this._isScreenSharing=!1,this.emitDailyJSEvent(u);break;case xh:case _h:case N0:case $0:case F0:case L0:case I0:case R0:case m0:case v0:case j0:case U0:case"test-completed":case Y0:case B0:case ew:case tw:case nw:case rw:case Eh:case iw:case"dialin-ready":case"dialin-connected":case"dialin-error":case"dialin-stopped":case"dialin-warning":case"dialout-connected":case"dialout-answered":case"dialout-error":case"dialout-stopped":case"dialout-warning":this.emitDailyJSEvent(u);break;case"request-fullscreen":this.requestFullscreen();break;case"request-exit-fullscreen":this.exitFullscreen()}}},{key:"maybeEventRecordingStopped",value:function(u,g){var p="record";u&&(g.local||g[p]!==!1||u[p]===g[p]||this.emitDailyJSEvent({action:_h}))}},{key:"maybeEventRecordingStarted",value:function(u,g){var p="record";u&&(g.local||g[p]!==!0||u[p]===g[p]||this.emitDailyJSEvent({action:xh}))}},{key:"_trackStatePlayable",value:function(u){return!(!u||u.state!==s0)}},{key:"_trackChanged",value:function(u,g){return(u==null?void 0:u.id)!==(g==null?void 0:g.id)}},{key:"maybeEventTrackStopped",value:function(u,g,p){var x,_,M=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,R=M==null?void 0:M.track;if(R){var U=this._trackStatePlayable(M),ie=this._trackStatePlayable(I),de=this._trackChanged(R,I==null?void 0:I.track);U&&(ie&&!de||this.emitDailyJSEvent({action:D0,track:R,participant:p??g,type:u}))}}},{key:"maybeEventTrackStarted",value:function(u,g,p){var x,_,M=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,R=I==null?void 0:I.track;if(R){var U=this._trackStatePlayable(M),ie=this._trackStatePlayable(I),de=this._trackChanged(M==null?void 0:M.track,R);ie&&(U&&!de||this.emitDailyJSEvent({action:P0,track:R,participant:p,type:u}))}}},{key:"maybeParticipantTracksStopped",value:function(u,g){if(u)for(var p in u.tracks)this.maybeEventTrackStopped(p,u,g)}},{key:"maybeParticipantTracksStarted",value:function(u,g){if(g)for(var p in g.tracks)this.maybeEventTrackStarted(p,u,g)}},{key:"compareEqualForRMPUpdateEvent",value:function(u,g){var p,x;return u.state===g.state&&((p=u.settings)===null||p===void 0?void 0:p.volume)===((x=g.settings)===null||x===void 0?void 0:x.volume)}},{key:"emitDailyJSEvent",value:function(u){try{u.callClientId=this.callClientId,this.emit(u.action,u)}catch(g){console.log("could not emit",u,g)}}},{key:"compareEqualForParticipantUpdateEvent",value:function(u,g){return!!et(u,g)&&(!u.videoTrack||!g.videoTrack||u.videoTrack.id===g.videoTrack.id&&u.videoTrack.muted===g.videoTrack.muted&&u.videoTrack.enabled===g.videoTrack.enabled)&&(!u.audioTrack||!g.audioTrack||u.audioTrack.id===g.audioTrack.id&&u.audioTrack.muted===g.audioTrack.muted&&u.audioTrack.enabled===g.audioTrack.enabled)}},{key:"nativeUtils",value:function(){return ce()?typeof DailyNativeUtils>"u"?(console.warn("in React Native, DailyNativeUtils is expected to be available"),null):DailyNativeUtils:null}},{key:"updateIsPreparingToJoin",value:function(u){this._updateCallState(this._callState,u)}},{key:"_updateCallState",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._isPreparingToJoin;if(u!==this._callState||g!==this._isPreparingToJoin){var p=this._callState,x=this._isPreparingToJoin;this._callState=u,this._isPreparingToJoin=g;var _=this._callState===gr;this.updateShowAndroidOngoingMeetingNotification(_);var M=_s(p,x),I=_s(this._callState,this._isPreparingToJoin);M!==I&&(this.updateKeepDeviceAwake(I),this.updateDeviceAudioMode(I),this.updateNoOpRecordingEnsuringBackgroundContinuity(I))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=pp,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:Ll},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=Zl(hp,this._callObjectMode),this._isScreenSharing=!1,this._receiveSettings={},this._inputSettings=void 0,this._sendSettings={},this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this._maxAppMessageSize=Il,this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(u){ce()&&this.nativeUtils().setKeepDeviceAwake(u,this.callClientId)}},{key:"updateDeviceAudioMode",value:function(u){if(ce()&&!this.disableReactNativeAutoDeviceManagement("audio")){var g=u?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(g)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(u){if(ce()&&this.nativeUtils().setShowOngoingMeetingNotification){var g,p,x,_;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var M=this.properties.reactNativeConfig.androidInCallNotification;g=M.title,p=M.subtitle,x=M.iconName,_=M.disableForCustomOverride}_&&(u=!1),this.nativeUtils().setShowOngoingMeetingNotification(u,g,p,x,this.callClientId)}}},{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(u){ce()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(u)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var u;if(ce()){var g=(u=this._callMachine())===null||u===void 0||(u=u.store)===null||u===void 0?void 0:u.getState();for(var p in g==null?void 0:g.streams){var x=g.streams[p];x&&x.pendingTrack&&x.pendingTrack.kind==="audio"&&(x.pendingTrack.enabled=this._hasNativeAudioFocus)}}}},{key:"disableReactNativeAutoDeviceManagement",value:function(u){return this.properties.reactNativeConfig&&this.properties.reactNativeConfig.disableAutoDeviceManagement&&this.properties.reactNativeConfig.disableAutoDeviceManagement[u]}},{key:"absoluteUrl",value:function(u){if(u!==void 0){var g=document.createElement("a");return g.href=u,g.href}}},{key:"sayHello",value:function(){var u="hello, world.";return console.log(u),u}},{key:"_logUseAfterDestroy",value:function(){var u=Object.values(yr)[0];if(this.needsLoad())if(u&&!u.needsLoad()){var g={action:vs,level:"error",code:this.strictMode?9995:9997};u.sendMessageToCallMachine(g)}else this.strictMode||console.error("You are are attempting to use a call instance that was previously destroyed, which is unsupported. Please remove `strictMode: false` from your constructor properties to enable strict mode to track down and fix this unsupported usage.");else{var p={action:vs,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(p,null,this.callClientId,this._iframe)}}},{key:"_logDuplicateInstanceAttempt",value:function(){for(var u=0,g=Object.values(yr);u<g.length;u++){var p=g[u];p._callMachineInitialized?(p.sendMessageToCallMachine({action:vs,level:"warn",code:this.allowMultipleCallInstances?9993:9992}),p._delayDuplicateInstanceLog=!1):p._delayDuplicateInstanceLog=!0}}},{key:"_maybeSendToSentry",value:function(u){var g,p,x,_;if(!((g=u.error)!==null&&g!==void 0&&g.type&&(![u0,c0,Sh].includes(u.error.type)||u.error.type===Sh&&u.error.msg.includes("deleted")))){var M=(p=this.properties)!==null&&p!==void 0&&p.url?new URL(this.properties.url):void 0,I="production";M&&M.host.includes(".staging.daily")&&(I="staging");var R,U,ie,de,an,$r=function(Fo){const Bo=[Eb(),_b(),Xb(),Qb(),r0(),o0(),Ob(),i0()];return Fo.autoSessionTracking!==!1&&Bo.push(n0()),Bo}({}).filter(function(Fo){return!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(Fo.name)}),No=new Fb({dsn:"https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844",transport:Hb,stackParser:Gb,integrations:$r,environment:I}),je=new Ln;if(je.setClient(No),No.init(),this.session_id&&je.setExtra("sessionId",this.session_id),this.properties){var Rt=H({},this.properties);Rt.userName=Rt.userName?"[Filtered]":void 0,Rt.userData=Rt.userData?"[Filtered]":void 0,Rt.token=Rt.token?"[Filtered]":void 0,je.setExtra("properties",Rt)}if(M){var Fr=M.searchParams.get("domain");if(!Fr){var $o=M.host.match(/(.*?)\./);Fr=$o&&$o[1]||""}Fr&&je.setTag("domain",Fr)}u.error&&(je.setTag("fatalErrorType",u.error.type),je.setExtra("errorDetails",u.error.details),!((R=u.error.details)===null||R===void 0)&&R.uri&&je.setTag("serverAddress",u.error.details.uri),!((U=u.error.details)===null||U===void 0)&&U.workerGroup&&je.setTag("workerGroup",u.error.details.workerGroup),!((ie=u.error.details)===null||ie===void 0)&&ie.geoGroup&&je.setTag("geoGroup",u.error.details.geoGroup),!((de=u.error.details)===null||de===void 0)&&de.on&&je.setTag("connectionAttempt",u.error.details.on),(an=u.error.details)!==null&&an!==void 0&&an.bundleUrl&&(je.setTag("bundleUrl",u.error.details.bundleUrl),je.setTag("bundleError",u.error.details.sourceError.type))),je.setTags({callMode:this._callObjectMode?ce()?"reactNative":(x=this.properties)!==null&&x!==void 0&&(x=x.dailyConfig)!==null&&x!==void 0&&(x=x.callMode)!==null&&x!==void 0&&x.includes("prebuilt")?this.properties.dailyConfig.callMode:"custom":"prebuilt-frame",version:t.version()});var za=((_=u.error)===null||_===void 0?void 0:_.msg)||u.errorMsg;je.captureException(new Error(za))}}},{key:"_callMachine",value:function(){var u;return(u=window._daily)===null||u===void 0||(u=u.instances)===null||u===void 0||(u=u[this.callClientId])===null||u===void 0?void 0:u.callMachine}},{key:"_maybeUpdateInputSettings",value:function(u){if(!et(this._inputSettings,u)){var g=this._getInputSettings();this._inputSettings=u;var p=this._getInputSettings();et(g,p)||this.emitDailyJSEvent({action:Ch,inputSettings:p})}}}],[{key:"supportedBrowser",value:function(){if(ce())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var u=Ky.getParser(Mt());return{supported:!!Bl(),mobile:u.getPlatformType()==="mobile",name:u.getBrowserName(),version:u.getBrowserVersion(),supportsFullscreen:!!Ih(),supportsScreenShare:!!lw(),supportsSfu:!!Bl(),supportsVideoProcessing:Rh(),supportsAudioProcessing:Nh()}}},{key:"version",value:function(){return"0.84.0"}},{key:"createCallObject",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return u.layout="none",new t(null,u)}},{key:"wrap",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ue(),!u||!u.contentWindow||typeof u.src!="string")throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return g.layout||(g.customLayout?g.layout="custom-v1":g.layout="browser"),new t(u,g)}},{key:"createFrame",value:function(u,g){var p,x;ue(),u&&g?(p=u,x=g):u&&u.append?(p=u,x={}):(p=document.body,x=u||{});var _=x.iframeStyle;_||(_=p===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:"375px",height:"450px",right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});var M=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?M.allow="microphone, camera":M.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",M.style.visibility="hidden",p.appendChild(M),M.style.visibility=null,Object.keys(_).forEach(function(I){return M.style[I]=_[I]}),x.layout||(x.customLayout?x.layout="custom-v1":x.layout="browser");try{return new t(M,x)}catch(I){throw p.removeChild(M),I}}},{key:"createTransparentFrame",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ue();var g=document.createElement("iframe");return g.allow="microphone; camera; autoplay",g.style.cssText=`
|
|
35
|
+
{ settings?: {state: "play"|"pause"} }`),_}return new Promise(function(_,M){m.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:p,settings:x},function(I){I.error?M({error:I.error,errorMsg:I.errorMsg}):_({session_id:I.session_id,remoteMediaPlayerState:{state:I.state,settings:I.settings}})})})}),function(u){return v.apply(this,arguments)})},{key:"startTranscription",value:function(u){we(this._callState,"startTranscription()"),this.sendMessageToCallMachine(H({action:"daily-method-start-transcription"},u))}},{key:"updateTranscription",value:function(u){if(we(this._callState,"updateTranscription()"),!u)throw new Error("updateTranscription Error: options is mandatory");if(fe(u)!=="object")throw new Error("updateTranscription Error: options must be object type");if(u.participants&&!Array.isArray(u.participants))throw new Error("updateTranscription Error: participants must be an array");this.sendMessageToCallMachine(H({action:"daily-method-update-transcription"},u))}},{key:"stopTranscription",value:function(u){if(we(this._callState,"stopTranscription()"),u&&fe(u)!=="object")throw new Error("stopTranscription Error: options must be object type");if(u&&!u.instanceId)throw new Error('"instanceId" not provided');this.sendMessageToCallMachine(H({action:"daily-method-stop-transcription"},u))}},{key:"startDialOut",value:(S=Z(function*(u){var m=this;we(this._callState,"startDialOut()");var p=function(I){if(I){if(!Array.isArray(I))throw new Error("Error starting dial out: audio codec must be an array");if(I.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");I.forEach(function(R){if(typeof R!="string")throw new Error("Error starting dial out: audio codec must be a string");if(R!=="OPUS"&&R!=="PCMU"&&R!=="PCMA"&&R!=="G722")throw new Error("Error starting dial out: audio codec must be one of OPUS, PCMU, PCMA, G722")})}};if(!u.sipUri&&!u.phoneNumber)throw new Error("Error starting dial out: either a sip uri or phone number must be provided");if(u.sipUri&&u.phoneNumber)throw new Error("Error starting dial out: only one of sip uri or phone number must be provided");if(u.sipUri){if(typeof u.sipUri!="string")throw new Error("Error starting dial out: sipUri must be a string");if(!u.sipUri.startsWith("sip:"))throw new Error("Error starting dial out: Invalid SIP URI, must start with 'sip:'");if(u.video&&typeof u.video!="boolean")throw new Error("Error starting dial out: video must be a boolean value");(function(I){if(I&&(p(I.audio),I.video)){if(!Array.isArray(I.video))throw new Error("Error starting dial out: video codec must be an array");if(I.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");I.video.forEach(function(R){if(typeof R!="string")throw new Error("Error starting dial out: video codec must be a string");if(R!=="H264"&&R!=="VP8")throw new Error("Error starting dial out: video codec must be H264 or VP8")})}})(u.codecs)}if(u.phoneNumber){if(typeof u.phoneNumber!="string")throw new Error("Error starting dial out: phoneNumber must be a string");if(!/^\+\d{1,}$/.test(u.phoneNumber))throw new Error("Error starting dial out: Invalid phone number, must be valid phone number as per E.164");u.codecs&&p(u.codecs.audio)}if(u.callerId){if(typeof u.callerId!="string")throw new Error("Error starting dial out: callerId must be a string");if(u.sipUri)throw new Error("Error starting dial out: callerId not allowed with sipUri")}if(u.displayName){if(typeof u.displayName!="string")throw new Error("Error starting dial out: displayName must be a string");if(u.displayName.length>=200)throw new Error("Error starting dial out: displayName length must be less than 200")}if(u.userId){if(typeof u.userId!="string")throw new Error("Error starting dial out: userId must be a string");if(u.userId.length>36)throw new Error("Error starting dial out: userId length must be less than or equal to 36")}if(bp(u),u.permissions&&u.permissions.canReceive){var x=qe(lp.validateJSONObject(u.permissions.canReceive),2),_=x[0],M=x[1];if(!_)throw new Error(M)}return new Promise(function(I,R){m.sendMessageToCallMachine(H({action:"dialout-start"},u),function(U){U.error?R(U.error):I(U)})})}),function(u){return S.apply(this,arguments)})},{key:"stopDialOut",value:function(u){var m=this;return we(this._callState,"stopDialOut()"),new Promise(function(p,x){m.sendMessageToCallMachine(H({action:"dialout-stop"},u),function(_){_.error?x(_.error):p(_)})})}},{key:"sipCallTransfer",value:(g=Z(function*(u){var m=this;if(we(this._callState,"sipCallTransfer()"),!u)throw new Error("sipCallTransfer() requires a sessionId and toEndPoint");return u.useSipRefer=!1,Op(u,"sipCallTransfer"),bp(u),new Promise(function(p,x){m.sendMessageToCallMachine(H({action:Lh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return g.apply(this,arguments)})},{key:"sipRefer",value:(y=Z(function*(u){var m=this;if(we(this._callState,"sipRefer()"),!u)throw new Error("sessionId and toEndPoint are mandatory parameter");return u.useSipRefer=!0,Op(u,"sipRefer"),new Promise(function(p,x){m.sendMessageToCallMachine(H({action:Lh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return y.apply(this,arguments)})},{key:"sendDTMF",value:(b=Z(function*(u){var m=this;return we(this._callState,"sendDTMF()"),function(p){var x=p.sessionId,_=p.tones;if(!x||!_)throw new Error("sessionId and tones are mandatory parameter");if(typeof x!="string"||typeof _!="string")throw new Error("sessionId and tones should be of string type");if(_.length>20)throw new Error("tones string must be upto 20 characters");var M=/[^0-9A-D*#]/g,I=_.match(M);if(I&&I[0])throw new Error("".concat(I[0]," is not valid DTMF tone"))}(u),new Promise(function(p,x){m.sendMessageToCallMachine(H({action:"send-dtmf"},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return b.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var u=this;return this._callState!==mr?Promise.resolve(H({stats:{latest:{}}},this._network)):new Promise(function(m){u.sendMessageToCallMachine({action:"get-calc-stats"},function(p){m(H(H({},u._network),{},{stats:p.stats}))})})}},{key:"testWebsocketConnectivity",value:(h=Z(function*(){var u=this;if(Xl(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(m){return Promise.reject(m)}return new Promise(function(m,p){u.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(x){x.error?p(x.error):m(x.results)})})}),function(){return h.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(u){return u?u instanceof MediaStreamTrack?!!Ow(u)||(console.error("Video track is not playable. This test needs a live video track."),!1):(console.error("Video track needs to be of type `MediaStreamTrack`."),!1):(console.error("Missing video track. You must provide a video track in order to run this test."),!1)}},{key:"testCallQuality",value:(f=Z(function*(){var u=this;ue(),jt(this._callObjectMode,"testCallQuality()"),Cs(this._callMachineInitialized,"testCallQuality()",null,!0),Yl(this._callState,this._isPreparingToJoin,"testCallQuality()");var m=this._testCallAlreadyInProgress,p=function(_){m||(u._testCallInProgress=_)};if(p(!0),this.needsLoad())try{var x=this._callState;yield this.load(),this._callState=x}catch(_){return p(!1),Promise.reject(_)}return new Promise(function(_){u.sendMessageToCallMachine({action:"test-call-quality",dailyJsVersion:u.properties.dailyJsVersion},function(M){var I=M.results,R=I.result,U=Gd(I,Lw);if(R==="failed"){var ie,de=H({},U);(ie=U.error)!==null&&ie!==void 0&&ie.details?(U.error.details=JSON.parse(U.error.details),de.error=H(H({},de.error),{},{details:H({},de.error.details)}),de.error.details.duringTest="testCallQuality"):(de.error=de.error?H({},de.error):{},de.error.details={duringTest:"testCallQuality"}),u._maybeSendToSentry(de)}p(!1),_(H({result:R},U))})})}),function(){return f.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(d=Z(function*(u){var m;ce()?(console.warn("testConnectionQuality() is deprecated: use testPeerToPeerCallQuality() instead"),m=yield this.testPeerToPeerCallQuality(u)):(console.warn("testConnectionQuality() is deprecated: use testCallQuality() instead"),m=yield this.testCallQuality());var p={result:m.result,secondsElapsed:m.secondsElapsed};return m.data&&(p.data={maxRTT:m.data.maxRoundTripTime,packetLoss:m.data.avgRecvPacketLoss}),p}),function(u){return d.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(c=Z(function*(u){var m=this;if(Xl(this._testCallInProgress,"testPeerToPeerCallQuality()"),this.needsLoad())try{yield this.load()}catch(_){return Promise.reject(_)}var p=u.videoTrack,x=u.duration;if(!this._validateVideoTrackForNetworkTests(p))throw new Error("Video track error");return this._sharedTracks.videoTrackForConnectionQualityTest=p,new Promise(function(_,M){m.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:x},function(I){I.error?M(I.error):_(I.results)})})}),function(u){return c.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){ce()?(console.warn("stopTestConnectionQuality() is deprecated: use testPeerToPeerCallQuality() and stopTestPeerToPeerCallQuality() instead"),this.stopTestPeerToPeerCallQuality()):(console.warn("stopTestConnectionQuality() is deprecated: use testCallQuality() and stopTestCallQuality() instead"),this.stopTestCallQuality())}},{key:"stopTestPeerToPeerCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-p2p-call-quality"})}},{key:"testNetworkConnectivity",value:(l=Z(function*(u){var m=this;if(Xl(this._testCallInProgress,"testNetworkConnectivity()"),this.needsLoad())try{yield this.load()}catch(p){return Promise.reject(p)}if(!this._validateVideoTrackForNetworkTests(u))throw new Error("Video track error");return this._sharedTracks.videoTrackForNetworkConnectivityTest=u,new Promise(function(p,x){m.sendMessageToCallMachine({action:"test-network-connectivity"},function(_){_.error?x(_.error):p(_.results)})})}),function(u){return l.apply(this,arguments)})},{key:"abortTestNetworkConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-network-connectivity"})}},{key:"getCpuLoadStats",value:function(){var u=this;return new Promise(function(m){u._callState===mr?u.sendMessageToCallMachine({action:"get-cpu-load-stats"},function(p){m(p.cpuStats)}):m({cpuLoadState:void 0,cpuLoadStateReason:void 0,stats:{}})})}},{key:"_validateEncodingLayerHasValidProperties",value:function(u){var m;if(!(((m=Object.keys(u))===null||m===void 0?void 0:m.length)>0))throw new Error("Empty encoding is not allowed. At least one of these valid keys should be specified:"+Object.values(Gl))}},{key:"_validateVideoSendSettings",value:function(u,m){var p=u==="screenVideo"?["default-screen-video","detail-optimized","motion-optimized","motion-and-detail-balanced"]:["default-video","bandwidth-optimized","bandwidth-and-quality-balanced","quality-optimized","adaptive-2-layers","adaptive-3-layers"],x="Video send settings should be either an object or one of the supported presets: ".concat(p.join());if(typeof m=="string"){if(!p.includes(m))throw new Error(x)}else{if(fe(m)!=="object")throw new Error(x);if(!m.maxQuality&&!m.encodings&&m.allowAdaptiveLayers===void 0)throw new Error("Video send settings must contain at least maxQuality, allowAdaptiveLayers or encodings attribute");if(m.maxQuality&&["low","medium","high"].indexOf(m.maxQuality)===-1)throw new Error("maxQuality must be either low, medium or high");if(m.encodings){var _=!1;switch(Object.keys(m.encodings).length){case 1:_=!m.encodings.low;break;case 2:_=!m.encodings.low||!m.encodings.medium;break;case 3:_=!m.encodings.low||!m.encodings.medium||!m.encodings.high;break;default:_=!0}if(_)throw new Error("Encodings must be defined as: low, low and medium, or low, medium and high.");m.encodings.low&&this._validateEncodingLayerHasValidProperties(m.encodings.low),m.encodings.medium&&this._validateEncodingLayerHasValidProperties(m.encodings.medium),m.encodings.high&&this._validateEncodingLayerHasValidProperties(m.encodings.high)}}}},{key:"validateUpdateSendSettings",value:function(u){var m=this;if(!u||Object.keys(u).length===0)throw new Error("Send settings must contain at least information for one track!");Object.entries(u).forEach(function(p){var x=qe(p,2),_=x[0],M=x[1];m._validateVideoSendSettings(_,M)})}},{key:"updateSendSettings",value:function(u){var m=this;return this.validateUpdateSendSettings(u),this.needsLoad()?(this._preloadCache.sendSettings=u,{sendSettings:this._preloadCache.sendSettings}):new Promise(function(p,x){m.sendMessageToCallMachine({action:"update-send-settings",sendSettings:u},function(_){_.error?x(_.error):p(_.sendSettings)})})}},{key:"getSendSettings",value:function(){return this._sendSettings||this._preloadCache.sendSettings}},{key:"getLocalAudioLevel",value:function(){return this._localAudioLevel}},{key:"getRemoteParticipantsAudioLevel",value:function(){return this._remoteParticipantsAudioLevel}},{key:"getActiveSpeaker",value:function(){return ue(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(u){return ue(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:u}),this}},{key:"activeSpeakerMode",value:function(){return ue(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(u){return we(this._callState,"setSubscribeToTracksAutomatically()","Use the subscribeToTracksAutomatically configuration property."),this._preloadCache.subscribeToTracksAutomatically=u,this.sendMessageToCallMachine({action:"daily-method-subscribe-to-tracks-automatically",enabled:u}),this}},{key:"enumerateDevices",value:(a=Z(function*(){var u=this;if(this._callObjectMode){var m=yield navigator.mediaDevices.enumerateDevices();return yr()==="Firefox"&&bs().major>115&&bs().major<123&&(m=m.filter(function(p){return p.kind!=="audiooutput"})),{devices:m.map(function(p){var x=JSON.parse(JSON.stringify(p));if(!ce()&&p.kind==="videoinput"&&p.getCapabilities){var _,M=p.getCapabilities();x.facing=(M==null||(_=M.facingMode)===null||_===void 0?void 0:_.length)>=1?M.facingMode[0]:void 0}return x})}}return new Promise(function(p){u.sendMessageToCallMachine({action:"enumerate-devices"},function(x){p({devices:x.devices})})})}),function(){return a.apply(this,arguments)})},{key:"sendAppMessage",value:function(u){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"*";if(we(this._callState,"sendAppMessage()"),JSON.stringify(u).length>this._maxAppMessageSize)throw new Error("Message data too large. Max size is "+this._maxAppMessageSize);return this.sendMessageToCallMachine({action:"app-msg",data:u,to:m}),this}},{key:"addFakeParticipant",value:function(u){return ue(),we(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(H({action:"add-fake-participant"},u)),this}},{key:"setShowNamesMode",value:function(u){return mt(this._callObjectMode,"setShowNamesMode()"),ue(),u&&u!=="always"&&u!=="never"?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this.sendMessageToCallMachine({action:"set-show-names",mode:u}),this)}},{key:"setShowLocalVideo",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return mt(this._callObjectMode,"setShowLocalVideo()"),ue(),we(this._callState,"setShowLocalVideo()"),typeof u!="boolean"?(console.error("setShowLocalVideo only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-local-video",show:u}),this._showLocalVideo=u,this)}},{key:"showLocalVideo",value:function(){return mt(this._callObjectMode,"showLocalVideo()"),ue(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return mt(this._callObjectMode,"setShowParticipantsBar()"),ue(),we(this._callState,"setShowParticipantsBar()"),typeof u!="boolean"?(console.error("setShowParticipantsBar only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-participants-bar",show:u}),this._showParticipantsBar=u,this)}},{key:"showParticipantsBar",value:function(){return mt(this._callObjectMode,"showParticipantsBar()"),ue(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return ue(),mt(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(u){return ue(),mt(this._callObjectMode,"setCustomIntegrations()"),we(this._callState,"setCustomIntegrations()"),Mp(u)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:u}),this._customIntegrations=u,this):this}},{key:"startCustomIntegrations",value:function(u){var m=this;if(ue(),mt(this._callObjectMode,"startCustomIntegrations()"),we(this._callState,"startCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("startCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in m._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"start-custom-integrations",ids:p}),this)}},{key:"stopCustomIntegrations",value:function(u){var m=this;if(ue(),mt(this._callObjectMode,"stopCustomIntegrations()"),we(this._callState,"stopCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("stopCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in m._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"stop-custom-integrations",ids:p}),this)}},{key:"customTrayButtons",value:function(){return mt(this._callObjectMode,"customTrayButtons()"),ue(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(u){return mt(this._callObjectMode,"updateCustomTrayButtons()"),ue(),we(this._callState,"updateCustomTrayButtons()"),Tp(u)?(this.sendMessageToCallMachine({action:"update-custom-tray-buttons",btns:u}),this._customTrayButtons=u,this):(console.error("updateCustomTrayButtons only accepts a dictionary of the type ".concat(JSON.stringify(ks))),this)}},{key:"theme",value:function(){return mt(this._callObjectMode,"theme()"),this.properties.theme}},{key:"setTheme",value:function(u){var m=this;return mt(this._callObjectMode,"setTheme()"),new Promise(function(p,x){try{m.validateProperties({theme:u}),m.properties.theme=H({},u),m.sendMessageToCallMachine({action:"set-theme",theme:m.properties.theme});try{m.emitDailyJSEvent({action:p0,theme:m.properties.theme})}catch(_){console.log("could not emit 'theme-updated'",_)}p(m.properties.theme)}catch(_){x(_)}})}},{key:"requestFullscreen",value:(s=Z(function*(){if(ue(),this._iframe&&!document.fullscreenElement&&Rh())try{(yield this._iframe.requestFullscreen)?this._iframe.requestFullscreen():this._iframe.webkitRequestFullscreen()}catch(u){console.log("could not make video call fullscreen",u)}}),function(){return s.apply(this,arguments)})},{key:"exitFullscreen",value:function(){ue(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(o=Z(function*(){var u=this;return this._callObjectMode?(console.error("getSidebarView is not available in callObject mode"),Promise.resolve(null)):new Promise(function(m){u.sendMessageToCallMachine({action:"get-sidebar-view"},function(p){m(p.view)})})}),function(){return o.apply(this,arguments)})},{key:"setSidebarView",value:function(u){return this._callObjectMode?(console.error("setSidebarView is not available in callObject mode"),this):(this.sendMessageToCallMachine({action:"set-sidebar-view",view:u}),this)}},{key:"room",value:(i=Z(function*(){var u=this,m=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,p=m===void 0||m;return this._accessState.access===Il||this.needsLoad()?this.properties.url?{roomUrlPendingJoin:this.properties.url}:null:new Promise(function(x){u.sendMessageToCallMachine({action:"lib-room-info",includeRoomConfigDefaults:p},function(_){delete _.action,delete _.callbackStamp,x(_)})})}),function(){return i.apply(this,arguments)})},{key:"geo",value:(r=Z(function*(){try{var u=yield fetch("https://gs.daily.co/_ks_/x-swsl/:");return{current:(yield u.json()).geo}}catch(m){return console.error("geo lookup failed",m),{current:""}}}),function(){return r.apply(this,arguments)})},{key:"setNetworkTopology",value:(n=Z(function*(u){var m=this;return ue(),we(this._callState,"setNetworkTopology()"),new Promise(function(p,x){m.sendMessageToCallMachine({action:"set-network-topology",opts:u},function(_){_.error?x({error:_.error}):p({workerId:_.workerId})})})}),function(u){return n.apply(this,arguments)})},{key:"getNetworkTopology",value:(e=Z(function*(){var u=this;return new Promise(function(m,p){u.needsLoad()&&m({topology:"none"}),u.sendMessageToCallMachine({action:"get-network-topology"},function(x){x.error?p({error:x.error}):m({topology:x.topology})})})}),function(){return e.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(u){if(ue(),typeof u!="number"&&u!==!0&&u!==!1)throw new Error("argument to setShouldPlayNewParticipantSound should be true, false, or a number, but is ".concat(u));this.sendMessageToCallMachine({action:"daily-method-set-play-ding",arg:u})}},{key:"on",value:function(u,m){return qo.prototype.on.call(this,u,m)}},{key:"once",value:function(u,m){return qo.prototype.once.call(this,u,m)}},{key:"off",value:function(u,m){return qo.prototype.off.call(this,u,m)}},{key:"validateProperties",value:function(u){var m,p;if(u!=null&&(m=u.dailyConfig)!==null&&m!==void 0&&m.userMediaAudioConstraints){var x,_;ce()||console.warn("userMediaAudioConstraints is deprecated. You can override constraints with inputSettings.audio.settings, found in DailyCallOptions.");var M=u.inputSettings||{};M.audio=((x=u.inputSettings)===null||x===void 0?void 0:x.audio)||{},M.audio.settings=((_=u.inputSettings)===null||_===void 0||(_=_.audio)===null||_===void 0?void 0:_.settings)||{},M.audio.settings=H(H({},M.audio.settings),u.dailyConfig.userMediaAudioConstraints),u.inputSettings=M,delete u.dailyConfig.userMediaAudioConstraints}if(u!=null&&(p=u.dailyConfig)!==null&&p!==void 0&&p.userMediaVideoConstraints){var I,R;ce()||console.warn("userMediaVideoConstraints is deprecated. You can override constraints with inputSettings.video.settings, found in DailyCallOptions.");var U=u.inputSettings||{};U.video=((I=u.inputSettings)===null||I===void 0?void 0:I.video)||{},U.video.settings=((R=u.inputSettings)===null||R===void 0||(R=R.video)===null||R===void 0?void 0:R.settings)||{},U.video.settings=H(H({},U.video.settings),u.dailyConfig.userMediaVideoConstraints),u.inputSettings=U,delete u.dailyConfig.userMediaVideoConstraints}for(var ie in u)if(wr[ie]){if(wr[ie].validate&&!wr[ie].validate(u[ie],this))throw new Error("property '".concat(ie,"': ").concat(wr[ie].help))}else console.warn("Ignoring unrecognized property '".concat(ie,"'")),delete u[ie]}},{key:"assembleMeetingUrl",value:function(){var u,m,p=H(H({},this.properties),{},{emb:this.callClientId,embHref:encodeURIComponent(window.location.href),proxy:(u=this.properties.dailyConfig)!==null&&u!==void 0&&u.proxyUrl?encodeURIComponent((m=this.properties.dailyConfig)===null||m===void 0?void 0:m.proxyUrl):void 0}),x=p.url.match(/\?/)?"&":"?";return p.url+x+Object.keys(wr).filter(function(_){return wr[_].queryString&&p[_]!==void 0}).map(function(_){return"".concat(wr[_].queryString,"=").concat(p[_])}).join("&")}},{key:"needsLoad",value:function(){return[bh,wh,vr,Rn].includes(this._callState)}},{key:"sendMessageToCallMachine",value:function(u,m){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");this._messageChannel.sendMessageToCallMachine(u,m,this.callClientId,this._iframe)}},{key:"forwardPackagedMessageToCallMachine",value:function(u){this._messageChannel.forwardPackagedMessageToCallMachine(u,this._iframe,this.callClientId)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(u){return this._messageChannel.addListenerForPackagedMessagesFromCallMachine(u,this.callClientId)}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(u){this._messageChannel.removeListenerForPackagedMessagesFromCallMachine(u)}},{key:"handleMessageFromCallMachine",value:function(u){switch(u.action){case f0:this.sendMessageToCallMachine(H({action:h0},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var m={action:vs,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:Go(this.properties.dailyConfig)}};this.sendMessageToCallMachine(m),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case xh:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emitDailyJSEvent(u);break;case w0:var p,x=H({},u);delete x.internal,this._maxAppMessageSize=((p=u.internal)===null||p===void 0?void 0:p._maxAppMessageSize)||Rl,this._joinedCallback&&(this._joinedCallback(u.participants),this._joinedCallback=null),this.emitDailyJSEvent(x);break;case k0:case x0:if(this._callState===vr)return;if(u.participant&&u.participant.session_id){var _=u.participant.local?"local":u.participant.session_id;if(this._callObjectMode){var M=this._callMachine().store;Xh(u.participant,M),Zh(u.participant,M),ep(u.participant,this._participants[_],M)}try{this.maybeParticipantTracksStopped(this._participants[_],u.participant),this.maybeParticipantTracksStarted(this._participants[_],u.participant),this.maybeEventRecordingStopped(this._participants[_],u.participant),this.maybeEventRecordingStarted(this._participants[_],u.participant)}catch(Ux){console.error("track events error",Ux)}this.compareEqualForParticipantUpdateEvent(u.participant,this._participants[_])||(this._participants[_]=H({},u.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus(),this.emitDailyJSEvent(u))}break;case _0:if(u.participant&&u.participant.session_id){var I=this._participants[u.participant.session_id];I&&this.maybeParticipantTracksStopped(I,null),delete this._participants[u.participant.session_id],this.emitDailyJSEvent(u)}break;case C0:et(this._participantCounts,u.participantCounts)||(this._participantCounts=u.participantCounts,this.emitDailyJSEvent(u));break;case E0:var R={access:u.access};u.awaitingAccess&&(R.awaitingAccess=u.awaitingAccess),et(this._accessState,R)||(this._accessState=R,this.emitDailyJSEvent(u));break;case T0:if(u.meetingSession){this._meetingSessionSummary=u.meetingSession,this.emitDailyJSEvent(u);var U=H(H({},u),{},{action:"meeting-session-updated"});this.emitDailyJSEvent(U)}break;case Mh:var ie;this._iframe&&!u.preserveIframe&&(this._iframe.src=""),this._updateCallState(Rn),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(u.errorMsg),this._loadedCallback=null),u.preserveIframe;var de=Gd(u,Iw);de!=null&&(ie=de.error)!==null&&ie!==void 0&&ie.details&&(de.error.details=JSON.parse(de.error.details)),this._maybeSendToSentry(u),this._joinedCallback&&(this._joinedCallback(null,de),this._joinedCallback=null),this.emitDailyJSEvent(de);break;case S0:this._callState!==Rn&&this._updateCallState(vr),this.resetMeetingDependentVars(),this._resolveLeave&&(this._resolveLeave(),this._resolveLeave=null),this.emitDailyJSEvent(u);break;case"selected-devices-updated":u.devices&&this.emitDailyJSEvent(u);break;case Y0:var an=u.state,$r=u.threshold,No=u.quality,je=an.state,Rt=an.reasons;je===this._network.networkState&&et(Rt,this._network.networkStateReasons)&&$r===this._network.threshold&&No===this._network.quality||(this._network.networkState=je,this._network.networkStateReasons=Rt,this._network.quality=No,this._network.threshold=$r,u.networkState=je,Rt.length&&(u.networkStateReasons=Rt),delete u.state,this.emitDailyJSEvent(u));break;case Z0:u&&u.cpuLoadState&&this.emitDailyJSEvent(u);break;case ew:u&&u.faceCounts!==void 0&&this.emitDailyJSEvent(u);break;case G0:var Fr=u.activeSpeaker;this._activeSpeaker.peerId!==Fr.peerId&&(this._activeSpeaker.peerId=Fr.peerId,this.emitDailyJSEvent({action:u.action,activeSpeaker:this._activeSpeaker}));break;case"show-local-video-changed":if(this._callObjectMode)return;var $o=u.show;this._showLocalVideo=$o,this.emitDailyJSEvent({action:u.action,show:$o});break;case Q0:var Ha=u.enabled;this._activeSpeakerMode!==Ha&&(this._activeSpeakerMode=Ha,this.emitDailyJSEvent({action:u.action,enabled:this._activeSpeakerMode}));break;case A0:case O0:case D0:this._waitingParticipants=u.allWaitingParticipants,this.emitDailyJSEvent({action:u.action,participant:u.participant});break;case sw:et(this._receiveSettings,u.receiveSettings)||(this._receiveSettings=u.receiveSettings,this.emitDailyJSEvent({action:u.action,receiveSettings:u.receiveSettings}));break;case Eh:this._maybeUpdateInputSettings(u.inputSettings);break;case"send-settings-updated":et(this._sendSettings,u.sendSettings)||(this._sendSettings=u.sendSettings,this._preloadCache.sendSettings=null,this.emitDailyJSEvent({action:u.action,sendSettings:u.sendSettings}));break;case"local-audio-level":this._localAudioLevel=u.audioLevel,this._preloadCache.localAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case"remote-participants-audio-level":this._remoteParticipantsAudioLevel=u.participantsAudioLevel,this._preloadCache.remoteParticipantsAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case H0:var Fo=u.session_id;this._rmpPlayerState[Fo]=u.playerState,this.emitDailyJSEvent(u);break;case K0:delete this._rmpPlayerState[u.session_id],this.emitDailyJSEvent(u);break;case V0:var Bo=u.session_id,my=this._rmpPlayerState[Bo];my&&this.compareEqualForRMPUpdateEvent(my,u.remoteMediaPlayerState)||(this._rmpPlayerState[Bo]=u.remoteMediaPlayerState,this.emitDailyJSEvent(u));break;case"custom-button-click":case"sidebar-view-changed":case"pip-started":case"pip-stopped":this.emitDailyJSEvent(u);break;case M0:var jx=this._meetingSessionState.topology!==(u.meetingSessionState&&u.meetingSessionState.topology);this._meetingSessionState=ec(u.meetingSessionState,this._callObjectMode),(this._callObjectMode||jx)&&this.emitDailyJSEvent(u);break;case W0:this._isScreenSharing=!0,this.emitDailyJSEvent(u);break;case q0:case J0:this._isScreenSharing=!1,this.emitDailyJSEvent(u);break;case _h:case Ch:case $0:case F0:case B0:case I0:case R0:case N0:case v0:case y0:case U0:case z0:case"test-completed":case X0:case j0:case tw:case nw:case rw:case iw:case Th:case ow:case"dialin-ready":case"dialin-connected":case"dialin-error":case"dialin-stopped":case"dialin-warning":case"dialout-connected":case"dialout-answered":case"dialout-error":case"dialout-stopped":case"dialout-warning":this.emitDailyJSEvent(u);break;case"request-fullscreen":this.requestFullscreen();break;case"request-exit-fullscreen":this.exitFullscreen()}}},{key:"maybeEventRecordingStopped",value:function(u,m){var p="record";u&&(m.local||m[p]!==!1||u[p]===m[p]||this.emitDailyJSEvent({action:Ch}))}},{key:"maybeEventRecordingStarted",value:function(u,m){var p="record";u&&(m.local||m[p]!==!0||u[p]===m[p]||this.emitDailyJSEvent({action:_h}))}},{key:"_trackStatePlayable",value:function(u){return!(!u||u.state!==a0)}},{key:"_trackChanged",value:function(u,m){return(u==null?void 0:u.id)!==(m==null?void 0:m.id)}},{key:"maybeEventTrackStopped",value:function(u,m,p){var x,_,M=(x=m==null?void 0:m.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,R=M==null?void 0:M.track;if(R){var U=this._trackStatePlayable(M),ie=this._trackStatePlayable(I),de=this._trackChanged(R,I==null?void 0:I.track);U&&(ie&&!de||this.emitDailyJSEvent({action:L0,track:R,participant:p??m,type:u}))}}},{key:"maybeEventTrackStarted",value:function(u,m,p){var x,_,M=(x=m==null?void 0:m.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,R=I==null?void 0:I.track;if(R){var U=this._trackStatePlayable(M),ie=this._trackStatePlayable(I),de=this._trackChanged(M==null?void 0:M.track,R);ie&&(U&&!de||this.emitDailyJSEvent({action:P0,track:R,participant:p,type:u}))}}},{key:"maybeParticipantTracksStopped",value:function(u,m){if(u)for(var p in u.tracks)this.maybeEventTrackStopped(p,u,m)}},{key:"maybeParticipantTracksStarted",value:function(u,m){if(m)for(var p in m.tracks)this.maybeEventTrackStarted(p,u,m)}},{key:"compareEqualForRMPUpdateEvent",value:function(u,m){var p,x;return u.state===m.state&&((p=u.settings)===null||p===void 0?void 0:p.volume)===((x=m.settings)===null||x===void 0?void 0:x.volume)}},{key:"emitDailyJSEvent",value:function(u){try{u.callClientId=this.callClientId,this.emit(u.action,u)}catch(m){console.log("could not emit",u,m)}}},{key:"compareEqualForParticipantUpdateEvent",value:function(u,m){return!!et(u,m)&&(!u.videoTrack||!m.videoTrack||u.videoTrack.id===m.videoTrack.id&&u.videoTrack.muted===m.videoTrack.muted&&u.videoTrack.enabled===m.videoTrack.enabled)&&(!u.audioTrack||!m.audioTrack||u.audioTrack.id===m.audioTrack.id&&u.audioTrack.muted===m.audioTrack.muted&&u.audioTrack.enabled===m.audioTrack.enabled)}},{key:"nativeUtils",value:function(){return ce()?typeof DailyNativeUtils>"u"?(console.warn("in React Native, DailyNativeUtils is expected to be available"),null):DailyNativeUtils:null}},{key:"updateIsPreparingToJoin",value:function(u){this._updateCallState(this._callState,u)}},{key:"_updateCallState",value:function(u){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._isPreparingToJoin;if(u!==this._callState||m!==this._isPreparingToJoin){var p=this._callState,x=this._isPreparingToJoin;this._callState=u,this._isPreparingToJoin=m;var _=this._callState===mr;this.updateShowAndroidOngoingMeetingNotification(_);var M=_s(p,x),I=_s(this._callState,this._isPreparingToJoin);M!==I&&(this.updateKeepDeviceAwake(I),this.updateDeviceAudioMode(I),this.updateNoOpRecordingEnsuringBackgroundContinuity(I))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=gp,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:Il},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=ec(pp,this._callObjectMode),this._isScreenSharing=!1,this._receiveSettings={},this._inputSettings=void 0,this._sendSettings={},this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this._maxAppMessageSize=Rl,this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(u){ce()&&this.nativeUtils().setKeepDeviceAwake(u,this.callClientId)}},{key:"updateDeviceAudioMode",value:function(u){if(ce()&&!this.disableReactNativeAutoDeviceManagement("audio")){var m=u?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(m)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(u){if(ce()&&this.nativeUtils().setShowOngoingMeetingNotification){var m,p,x,_;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var M=this.properties.reactNativeConfig.androidInCallNotification;m=M.title,p=M.subtitle,x=M.iconName,_=M.disableForCustomOverride}_&&(u=!1),this.nativeUtils().setShowOngoingMeetingNotification(u,m,p,x,this.callClientId)}}},{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(u){ce()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(u)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var u;if(ce()){var m=(u=this._callMachine())===null||u===void 0||(u=u.store)===null||u===void 0?void 0:u.getState();for(var p in m==null?void 0:m.streams){var x=m.streams[p];x&&x.pendingTrack&&x.pendingTrack.kind==="audio"&&(x.pendingTrack.enabled=this._hasNativeAudioFocus)}}}},{key:"disableReactNativeAutoDeviceManagement",value:function(u){return this.properties.reactNativeConfig&&this.properties.reactNativeConfig.disableAutoDeviceManagement&&this.properties.reactNativeConfig.disableAutoDeviceManagement[u]}},{key:"absoluteUrl",value:function(u){if(u!==void 0){var m=document.createElement("a");return m.href=u,m.href}}},{key:"sayHello",value:function(){var u="hello, world.";return console.log(u),u}},{key:"_logUseAfterDestroy",value:function(){var u=Object.values(br)[0];if(this.needsLoad())if(u&&!u.needsLoad()){var m={action:vs,level:"error",code:this.strictMode?9995:9997};u.sendMessageToCallMachine(m)}else this.strictMode||console.error("You are are attempting to use a call instance that was previously destroyed, which is unsupported. Please remove `strictMode: false` from your constructor properties to enable strict mode to track down and fix this unsupported usage.");else{var p={action:vs,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(p,null,this.callClientId,this._iframe)}}},{key:"_logDuplicateInstanceAttempt",value:function(){for(var u=0,m=Object.values(br);u<m.length;u++){var p=m[u];p._callMachineInitialized?(p.sendMessageToCallMachine({action:vs,level:"warn",code:this.allowMultipleCallInstances?9993:9992}),p._delayDuplicateInstanceLog=!1):p._delayDuplicateInstanceLog=!0}}},{key:"_maybeSendToSentry",value:function(u){var m,p,x,_;if(!((m=u.error)!==null&&m!==void 0&&m.type&&(![d0,u0,kh].includes(u.error.type)||u.error.type===kh&&u.error.msg.includes("deleted")))){var M=(p=this.properties)!==null&&p!==void 0&&p.url?new URL(this.properties.url):void 0,I="production";M&&M.host.includes(".staging.daily")&&(I="staging");var R,U,ie,de,an,$r=function(Fo){const Bo=[Tb(),Cb(),Zb(),Yb(),i0(),s0(),Db(),o0()];return Fo.autoSessionTracking!==!1&&Bo.push(r0()),Bo}({}).filter(function(Fo){return!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(Fo.name)}),No=new Bb({dsn:"https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844",transport:Vb,stackParser:Qb,integrations:$r,environment:I}),je=new In;if(je.setClient(No),No.init(),this.session_id&&je.setExtra("sessionId",this.session_id),this.properties){var Rt=H({},this.properties);Rt.userName=Rt.userName?"[Filtered]":void 0,Rt.userData=Rt.userData?"[Filtered]":void 0,Rt.token=Rt.token?"[Filtered]":void 0,je.setExtra("properties",Rt)}if(M){var Fr=M.searchParams.get("domain");if(!Fr){var $o=M.host.match(/(.*?)\./);Fr=$o&&$o[1]||""}Fr&&je.setTag("domain",Fr)}u.error&&(je.setTag("fatalErrorType",u.error.type),je.setExtra("errorDetails",u.error.details),!((R=u.error.details)===null||R===void 0)&&R.uri&&je.setTag("serverAddress",u.error.details.uri),!((U=u.error.details)===null||U===void 0)&&U.workerGroup&&je.setTag("workerGroup",u.error.details.workerGroup),!((ie=u.error.details)===null||ie===void 0)&&ie.geoGroup&&je.setTag("geoGroup",u.error.details.geoGroup),!((de=u.error.details)===null||de===void 0)&&de.on&&je.setTag("connectionAttempt",u.error.details.on),(an=u.error.details)!==null&&an!==void 0&&an.bundleUrl&&(je.setTag("bundleUrl",u.error.details.bundleUrl),je.setTag("bundleError",u.error.details.sourceError.type))),je.setTags({callMode:this._callObjectMode?ce()?"reactNative":(x=this.properties)!==null&&x!==void 0&&(x=x.dailyConfig)!==null&&x!==void 0&&(x=x.callMode)!==null&&x!==void 0&&x.includes("prebuilt")?this.properties.dailyConfig.callMode:"custom":"prebuilt-frame",version:t.version()});var Ha=((_=u.error)===null||_===void 0?void 0:_.msg)||u.errorMsg;je.captureException(new Error(Ha))}}},{key:"_callMachine",value:function(){var u;return(u=window._daily)===null||u===void 0||(u=u.instances)===null||u===void 0||(u=u[this.callClientId])===null||u===void 0?void 0:u.callMachine}},{key:"_maybeUpdateInputSettings",value:function(u){if(!et(this._inputSettings,u)){var m=this._getInputSettings();this._inputSettings=u;var p=this._getInputSettings();et(m,p)||this.emitDailyJSEvent({action:Eh,inputSettings:p})}}}],[{key:"supportedBrowser",value:function(){if(ce())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var u=qy.getParser(Mt());return{supported:!!jl(),mobile:u.getPlatformType()==="mobile",name:u.getBrowserName(),version:u.getBrowserVersion(),supportsFullscreen:!!Rh(),supportsScreenShare:!!cw(),supportsSfu:!!jl(),supportsVideoProcessing:Nh(),supportsAudioProcessing:$h()}}},{key:"version",value:function(){return"0.84.0"}},{key:"createCallObject",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return u.layout="none",new t(null,u)}},{key:"wrap",value:function(u){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ue(),!u||!u.contentWindow||typeof u.src!="string")throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return m.layout||(m.customLayout?m.layout="custom-v1":m.layout="browser"),new t(u,m)}},{key:"createFrame",value:function(u,m){var p,x;ue(),u&&m?(p=u,x=m):u&&u.append?(p=u,x={}):(p=document.body,x=u||{});var _=x.iframeStyle;_||(_=p===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:"375px",height:"450px",right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});var M=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?M.allow="microphone, camera":M.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",M.style.visibility="hidden",p.appendChild(M),M.style.visibility=null,Object.keys(_).forEach(function(I){return M.style[I]=_[I]}),x.layout||(x.customLayout?x.layout="custom-v1":x.layout="browser");try{return new t(M,x)}catch(I){throw p.removeChild(M),I}}},{key:"createTransparentFrame",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ue();var m=document.createElement("iframe");return m.allow="microphone; camera; autoplay",m.style.cssText=`
|
|
36
36
|
position: fixed;
|
|
37
37
|
top: 0;
|
|
38
38
|
left: 0;
|
|
@@ -40,7 +40,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
40
40
|
height: 100%;
|
|
41
41
|
border: 0;
|
|
42
42
|
pointer-events: none;
|
|
43
|
-
`,document.body.appendChild(g),u.layout||(u.layout="custom-v1"),t.wrap(g,u)}},{key:"getCallInstance",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return u?yr[u]:Object.values(yr)[0]}}]);var e,n,r,i,o,s,a,l,c,d,f,h,b,y,m,S,v,w,k,C,T,O,P,$,X,V,B,W,K,se,J,G,ne,F,z,q,re,me}();function yp(t){if(t.extension){if(typeof t.extension!="string")throw new Error("Error starting dial out: extension must be a string");if(t.extension.length>20)throw new Error("Error starting dial out: extension length must be less than or equal to 20")}if(t.waitBeforeExtensionDialSec){if(typeof t.waitBeforeExtensionDialSec!="number")throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be a number");if(t.waitBeforeExtensionDialSec>60)throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be less than or equal to 60");if(!t.extension)throw new Error("Error starting dial out: waitBeforeExtensionDialSec requires a phoneNumber and extension")}}function Xr(t,e){var n={};for(var r in t)if(t[r]instanceof MediaStreamTrack)console.warn("MediaStreamTrack found in props or cache.",r),n[r]=pn;else if(r==="dailyConfig"){if(t[r].modifyLocalSdpHook){var i=window._daily.instances[e].customCallbacks||{};i.modifyLocalSdpHook=t[r].modifyLocalSdpHook,window._daily.instances[e].customCallbacks=i,delete t[r].modifyLocalSdpHook}if(t[r].modifyRemoteSdpHook){var o=window._daily.instances[e].customCallbacks||{};o.modifyRemoteSdpHook=t[r].modifyRemoteSdpHook,window._daily.instances[e].customCallbacks=o,delete t[r].modifyRemoteSdpHook}n[r]=t[r]}else n[r]=t[r];return n}function we(t){var e=arguments.length>2?arguments[2]:void 0;if(t!==gr){var n="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," only supported after join.");throw e&&(n+=" ".concat(e)),console.error(n),new Error(n)}}function _s(t,e){return[Dl,gr].includes(t)||e}function Ql(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"This daily-js method",r=arguments.length>3?arguments[3]:void 0;if(_s(t,e)){var i="".concat(n," not supported after joining a meeting.");throw r&&(i+=" ".concat(r)),console.error(i),new Error(i)}}function Cs(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method",n=arguments.length>2?arguments[2]:void 0;if(!t){var r="".concat(e,arguments.length>3&&arguments[3]!==void 0&&arguments[3]?" requires preAuth() or startCamera() to initialize call state.":" requires preAuth(), startCamera(), or join() to initialize call state.");throw n&&(r+=" ".concat(n)),console.error(r),new Error(r)}}function Yl(t){if(t){var e="A pre-call quality test is in progress. Please try ".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," again once testing has completed. Use stopTestCallQuality() to end it early.");throw console.error(e),new Error(e)}}function jt(t){if(!t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported on custom callObject instances");throw console.error(e),new Error(e)}}function mt(t){if(t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported as part of Daily's Prebuilt");throw console.error(e),new Error(e)}}function ue(){if(ce())throw new Error("This daily-js method is not currently supported in React Native")}function Hi(){if(!ce())throw new Error("This daily-js method is only supported in React Native")}function bp(t){if(t===void 0)return!0;var e;if(typeof t=="string")e=t;else try{e=JSON.stringify(t),et(JSON.parse(e),t)||console.warn("The userData provided will be modified when serialized.")}catch(n){throw Error("userData must be serializable to JSON: ".concat(n))}if(e.length>4096)throw Error("userData is too large (".concat(e.length," characters). Maximum size suppported is ").concat(4096,"."));return!0}function wp(t,e){for(var n=e.allowAllParticipantsKey,r=function(f){var h=["local"];return n||h.push("*"),f&&!h.includes(f)},i=function(f){return!!(f.layer===void 0||Number.isInteger(f.layer)&&f.layer>=0||f.layer==="inherit")},o=function(f){return!!f&&!(f.video&&!i(f.video))&&!(f.screenVideo&&!i(f.screenVideo))},s=0,a=Object.entries(t);s<a.length;s++){var l=qe(a[s],2),c=l[0],d=l[1];if(!r(c)||!o(d))return!1}return!0}function Sp(t){if(fe(t)!=="object")return!1;for(var e=0,n=Object.entries(t);e<n.length;e++){var r=qe(n[e],2),i=r[0],o=r[1];switch(i){case"video":if(fe(o)!=="object")return!1;for(var s=0,a=Object.entries(o);s<a.length;s++){var l=qe(a[s],2),c=l[0],d=l[1];switch(c){case"processor":if(!$w(d))return!1;break;case"settings":if(!xp(d))return!1;break;default:return!1}}break;case"audio":if(fe(o)!=="object")return!1;for(var f=0,h=Object.entries(o);f<h.length;f++){var b=qe(h[f],2),y=b[0],m=b[1];switch(y){case"processor":if(!Nw(m))return!1;break;case"settings":if(!xp(m))return!1;break;default:return!1}}break;default:return!1}}return!0}function kp(t,e,n){var r,i=[];t.video&&t.video.processor&&(Rh((r=e==null?void 0:e.useLegacyVideoProcessor)!==null&&r!==void 0&&r)||(t.video.settings?delete t.video.processor:delete t.video,i.push("video"))),t.audio&&t.audio.processor&&(Nh()||(t.audio.settings?delete t.audio.processor:delete t.audio,i.push("audio"))),i.length>0&&console.error("Ignoring settings for browser- or platform-unsupported input processor(s): ".concat(i.join(", "))),t.audio&&t.audio.settings&&(t.audio.settings.customTrack?(n.audioTrack=t.audio.settings.customTrack,t.audio.settings={customTrack:pn}):delete n.audioTrack),t.video&&t.video.settings&&(t.video.settings.customTrack?(n.videoTrack=t.video.settings.customTrack,t.video.settings={customTrack:pn}):delete n.videoTrack)}function Nw(t){if(ce())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type"];return!!t&&fe(t)==="object"&&(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> audio -> processor : ".concat(n)),delete t[n]}),!!function(n){return typeof n!="string"?!1:Object.values(Ph).includes(n)?!0:(console.error("inputSettings audio processor type invalid"),!1)}(t.type))}function $w(t){if(ce())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type","config"];return!t||fe(t)!=="object"||!function(n){return typeof n!="string"?!1:Object.values(ys).includes(n)?!0:(console.error("inputSettings video processor type invalid"),!1)}(t.type)||t.config&&(fe(t.config)!=="object"||!function(n,r){var i=Object.keys(r);if(i.length===0)return!0;var o="invalid object in inputSettings -> video -> processor -> config";switch(n){case ys.BGBLUR:return i.length>1||i[0]!=="strength"?(console.error(o),!1):!(typeof r.strength!="number"||r.strength<=0||r.strength>1||isNaN(r.strength))||(console.error("".concat(o,"; expected: {0 < strength <= 1}, got: ").concat(r.strength)),!1);case ys.BGIMAGE:return!(r.source!==void 0&&!function(s){if(s.source==="default")return s.type="default",!0;if(s.source instanceof ArrayBuffer)return!0;if(Qo(s.source))return s.type="url",!!function(c){var d=new URL(c),f=d.pathname;if(d.protocol==="data:")try{var h=f.substring(f.indexOf(":")+1,f.indexOf(";")).split("/")[1];return $l.includes(h)}catch(y){return console.error("failed to deduce blob content type",y),!1}var b=f.split(".").at(-1).toLowerCase().trim();return $l.includes(b)}(s.source)||(console.error("invalid image type; supported types: [".concat($l.join(", "),"]")),!1);return a=s.source,l=Number(a),isNaN(l)||!Number.isInteger(l)||l<=0||l>10?(console.error("invalid image selection; must be an int, > 0, <= ".concat(10)),!1):(s.type="daily-preselect",!0);var a,l}(r));default:return!0}}(t.type,t.config))?!1:(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> video -> processor : ".concat(n)),delete t[n]}),!0)}function xp(t){return fe(t)==="object"&&(!t.customTrack||t.customTrack instanceof MediaStreamTrack)}function Xl(){var t=Object.values(ys).join(" | "),e=Object.values(Ph).join(" | ");return"inputSettings must be of the form: { video?: { processor?: { type: [ ".concat(t," ], config?: {} } }, audio?: { processor: {type: [ ").concat(e," ] } } }")}function _p(t){var e=t.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(l0).concat(e?' | "'.concat("*",'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function Cp(){return"customIntegrations should be an object of type ".concat(JSON.stringify(Gl),".")}function Ep(t){if(t&&fe(t)!=="object"||Array.isArray(t))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(ks),".")),!1;if(t)for(var e=0,n=Object.entries(t);e<n.length;e++)for(var r=qe(n[e],1)[0],i=0,o=Object.entries(t[r]);i<o.length;i++){var s=qe(o[i],2),a=s[0],l=s[1],c=ks.id[a];if(!c)return console.error("customTrayButton does not support key ".concat(a)),!1;switch(a){case"iconPath":case"iconPathDarkMode":if(!Qo(l))return console.error("customTrayButton ".concat(a," should be a url.")),!1;break;case"visualState":if(!["default","sidebar-open","active"].includes(l))return console.error("customTrayButton ".concat(a," should be ").concat(c,". Got: ").concat(l)),!1;break;default:if(fe(l)!==c)return console.error("customTrayButton ".concat(a," should be a ").concat(c,".")),!1}}return!0}function Tp(t){if(!t||t&&fe(t)!=="object"||Array.isArray(t))return console.error(Cp()),!1;for(var e=function(f){return"".concat(f," should be ").concat(Gl.id[f])},n=function(f,h){return console.error("customIntegration ".concat(f,": ").concat(h))},r=0,i=Object.entries(t);r<i.length;r++){var o=qe(i[r],1)[0];if(!("label"in t[o]))return n(o,"label is required"),!1;if(!("location"in t[o]))return n(o,"location is required"),!1;if(!("src"in t[o])&&!("srcdoc"in t[o]))return n(o,"src or srcdoc is required"),!1;for(var s=0,a=Object.entries(t[o]);s<a.length;s++){var l=qe(a[s],2),c=l[0],d=l[1];switch(c){case"allow":case"csp":case"name":case"referrerPolicy":case"sandbox":if(typeof d!="string")return n(o,e(c)),!1;break;case"iconURL":if(!Qo(d))return n(o,"".concat(c," should be a url")),!1;break;case"src":if("srcdoc"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(!Qo(d))return n(o,'src "'.concat(d,'" is not a valid URL')),!1;break;case"srcdoc":if("src"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(typeof d!="string")return n(o,e(c)),!1;break;case"location":if(!["main","sidebar"].includes(d))return n(o,e(c)),!1;break;case"controlledBy":if(d!=="*"&&d!=="owners"&&(!Array.isArray(d)||d.some(function(f){return typeof f!="string"})))return n(o,e(c)),!1;break;case"shared":if((!Array.isArray(d)||d.some(function(f){return typeof f!="string"}))&&d!=="owners"&&typeof d!="boolean")return n(o,e(c)),!1;break;default:if(!Gl.id[c])return console.error("customIntegration does not support key ".concat(c)),!1}}}return!0}function Mp(t,e){if(e===void 0)return!1;switch(fe(e)){case"string":return fe(t)===e;case"object":if(fe(t)!=="object")return!1;for(var n in t)if(!Mp(t[n],e[n]))return!1;return!0;default:return!1}}function Ap(t,e){var n=t.sessionId,r=t.toEndPoint,i=t.callerId,o=t.useSipRefer;if(!n||!r)throw new Error("".concat(e,"() requires a sessionId and toEndPoint"));if(typeof n!="string"||typeof r!="string")throw new Error("Invalid paramater: sessionId and toEndPoint must be of type string");if(o&&!r.startsWith("sip:"))throw new Error('"toEndPoint" must be a "sip" address');if(!r.startsWith("sip:")&&!r.startsWith("+"))throw new Error("toEndPoint: ".concat(r,' must starts with either "sip:" or "+"'));if(i&&typeof i!="string")throw new Error("callerId must be of type string");if(i&&!r.startsWith("+"))throw new Error("callerId is only valid when transferring to a PSTN number")}function Op(t){if(fe(t)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(t.state&&!Object.values(Nl).includes(t.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify(Nl));if(t.volume){if(typeof t.volume!="number")throw new Error('RemoteMediaPlayerSettings.volume: must be "number" type');if(t.volume<0||t.volume>2)throw new Error("RemoteMediaPlayerSettings.volume: must be between 0.0 - 2.0")}}function Pp(t,e,n){return!(typeof t!="number"||t<e||t>n)}function Zl(t,e){return t&&!e&&delete t.data,t}function Fw(t){return t&&t.__esModule?t.default:t}function Dp(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Lp={};Dp(Lp,"DailyRTVIMessageType",()=>tc),Dp(Lp,"DailyTransport",()=>gn);class Ut{static floatTo16BitPCM(e){const n=new ArrayBuffer(e.length*2),r=new DataView(n);let i=0;for(let o=0;o<e.length;o++,i+=2){let s=Math.max(-1,Math.min(1,e[o]));r.setInt16(i,s<0?s*32768:s*32767,!0)}return n}static mergeBuffers(e,n){const r=new Uint8Array(e.byteLength+n.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(n),e.byteLength),r.buffer}_packData(e,n){return[new Uint8Array([n,n>>8]),new Uint8Array([n,n>>8,n>>16,n>>24])][e]}pack(e,n){if(n!=null&&n.bitsPerSample)if(n!=null&&n.channels){if(!(n!=null&&n.data))throw new Error('Missing "data"')}else throw new Error('Missing "channels"');else throw new Error('Missing "bitsPerSample"');const{bitsPerSample:r,channels:i,data:o}=n,s=["RIFF",this._packData(1,52),"WAVE","fmt ",this._packData(1,16),this._packData(0,1),this._packData(0,i.length),this._packData(1,e),this._packData(1,e*i.length*r/8),this._packData(0,i.length*r/8),this._packData(0,r),"data",this._packData(1,i[0].length*i.length*r/8),o],a=new Blob(s,{type:"audio/mpeg"}),l=URL.createObjectURL(a);return{blob:a,url:l,channelCount:i.length,sampleRate:e,duration:o.byteLength/(i.length*e*2)}}}globalThis.WavPacker=Ut;const Ip=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],Bw=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Nn=[],ec=[];for(let t=1;t<=8;t++)for(let e=0;e<Ip.length;e++){const n=Ip[e];Nn.push(n/Math.pow(2,8-t)),ec.push(Bw[e]+t)}const Es=[32,2e3],Rp=Nn.filter((t,e)=>Nn[e]>Es[0]&&Nn[e]<Es[1]),jw=ec.filter((t,e)=>Nn[e]>Es[0]&&Nn[e]<Es[1]);class Zr{static getFrequencies(e,n,r,i="frequency",o=-100,s=-30){r||(r=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(r));const a=n/2,l=1/r.length*a;let c,d,f;if(i==="music"||i==="voice"){const y=i==="voice"?Rp:Nn,m=Array(y.length).fill(o);for(let S=0;S<r.length;S++){const v=S*l,w=r[S];for(let k=y.length-1;k>=0;k--)if(v>y[k]){m[k]=Math.max(m[k],w);break}}c=m,d=i==="voice"?Rp:Nn,f=i==="voice"?jw:ec}else c=Array.from(r),d=c.map((y,m)=>l*m),f=d.map(y=>`${y.toFixed(2)} Hz`);const h=c.map(y=>Math.max(0,Math.min((y-o)/(s-o),1)));return{values:new Float32Array(h),frequencies:d,labels:f}}constructor(e,n=null){if(this.fftResults=[],n){const{length:r,sampleRate:i}=n,o=new OfflineAudioContext({length:r,sampleRate:i}),s=o.createBufferSource();s.buffer=n;const a=o.createAnalyser();a.fftSize=8192,a.smoothingTimeConstant=.1,s.connect(a);const l=1/60,c=r/i,d=f=>{const h=l*f;h<c&&o.suspend(h).then(()=>{const b=new Float32Array(a.frequencyBinCount);a.getFloatFrequencyData(b),this.fftResults.push(b),d(f+1)}),f===1?o.startRendering():o.resume()};s.start(0),d(1),this.audio=e,this.context=o,this.analyser=a,this.sampleRate=i,this.audioBuffer=n}else{const r=new AudioContext,i=r.createMediaElementSource(e),o=r.createAnalyser();o.fftSize=8192,o.smoothingTimeConstant=.1,i.connect(o),o.connect(r.destination),this.audio=e,this.context=r,this.analyser=o,this.sampleRate=this.context.sampleRate,this.audioBuffer=null}}getFrequencies(e="frequency",n=-100,r=-30){let i=null;if(this.audioBuffer&&this.fftResults.length){const o=this.audio.currentTime/this.audio.duration,s=Math.min(o*this.fftResults.length|0,this.fftResults.length-1);i=this.fftResults[s]}return Zr.getFrequencies(this.analyser,this.sampleRate,i,e,n,r)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}}globalThis.AudioAnalysis=Zr;const Uw=`
|
|
43
|
+
`,document.body.appendChild(m),u.layout||(u.layout="custom-v1"),t.wrap(m,u)}},{key:"getCallInstance",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return u?br[u]:Object.values(br)[0]}}]);var e,n,r,i,o,s,a,l,c,d,f,h,b,y,g,S,v,w,k,C,E,A,D,$,X,V,B,K,W,se,J,G,ne,F,z,q,re,me}();function bp(t){if(t.extension){if(typeof t.extension!="string")throw new Error("Error starting dial out: extension must be a string");if(t.extension.length>20)throw new Error("Error starting dial out: extension length must be less than or equal to 20")}if(t.waitBeforeExtensionDialSec){if(typeof t.waitBeforeExtensionDialSec!="number")throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be a number");if(t.waitBeforeExtensionDialSec>60)throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be less than or equal to 60");if(!t.extension)throw new Error("Error starting dial out: waitBeforeExtensionDialSec requires a phoneNumber and extension")}}function Xr(t,e){var n={};for(var r in t)if(t[r]instanceof MediaStreamTrack)console.warn("MediaStreamTrack found in props or cache.",r),n[r]=pn;else if(r==="dailyConfig"){if(t[r].modifyLocalSdpHook){var i=window._daily.instances[e].customCallbacks||{};i.modifyLocalSdpHook=t[r].modifyLocalSdpHook,window._daily.instances[e].customCallbacks=i,delete t[r].modifyLocalSdpHook}if(t[r].modifyRemoteSdpHook){var o=window._daily.instances[e].customCallbacks||{};o.modifyRemoteSdpHook=t[r].modifyRemoteSdpHook,window._daily.instances[e].customCallbacks=o,delete t[r].modifyRemoteSdpHook}n[r]=t[r]}else n[r]=t[r];return n}function we(t){var e=arguments.length>2?arguments[2]:void 0;if(t!==mr){var n="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," only supported after join.");throw e&&(n+=" ".concat(e)),console.error(n),new Error(n)}}function _s(t,e){return[Ll,mr].includes(t)||e}function Yl(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"This daily-js method",r=arguments.length>3?arguments[3]:void 0;if(_s(t,e)){var i="".concat(n," not supported after joining a meeting.");throw r&&(i+=" ".concat(r)),console.error(i),new Error(i)}}function Cs(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method",n=arguments.length>2?arguments[2]:void 0;if(!t){var r="".concat(e,arguments.length>3&&arguments[3]!==void 0&&arguments[3]?" requires preAuth() or startCamera() to initialize call state.":" requires preAuth(), startCamera(), or join() to initialize call state.");throw n&&(r+=" ".concat(n)),console.error(r),new Error(r)}}function Xl(t){if(t){var e="A pre-call quality test is in progress. Please try ".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," again once testing has completed. Use stopTestCallQuality() to end it early.");throw console.error(e),new Error(e)}}function jt(t){if(!t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported on custom callObject instances");throw console.error(e),new Error(e)}}function mt(t){if(t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported as part of Daily's Prebuilt");throw console.error(e),new Error(e)}}function ue(){if(ce())throw new Error("This daily-js method is not currently supported in React Native")}function Hi(){if(!ce())throw new Error("This daily-js method is only supported in React Native")}function wp(t){if(t===void 0)return!0;var e;if(typeof t=="string")e=t;else try{e=JSON.stringify(t),et(JSON.parse(e),t)||console.warn("The userData provided will be modified when serialized.")}catch(n){throw Error("userData must be serializable to JSON: ".concat(n))}if(e.length>4096)throw Error("userData is too large (".concat(e.length," characters). Maximum size suppported is ").concat(4096,"."));return!0}function Sp(t,e){for(var n=e.allowAllParticipantsKey,r=function(f){var h=["local"];return n||h.push("*"),f&&!h.includes(f)},i=function(f){return!!(f.layer===void 0||Number.isInteger(f.layer)&&f.layer>=0||f.layer==="inherit")},o=function(f){return!!f&&!(f.video&&!i(f.video))&&!(f.screenVideo&&!i(f.screenVideo))},s=0,a=Object.entries(t);s<a.length;s++){var l=qe(a[s],2),c=l[0],d=l[1];if(!r(c)||!o(d))return!1}return!0}function kp(t){if(fe(t)!=="object")return!1;for(var e=0,n=Object.entries(t);e<n.length;e++){var r=qe(n[e],2),i=r[0],o=r[1];switch(i){case"video":if(fe(o)!=="object")return!1;for(var s=0,a=Object.entries(o);s<a.length;s++){var l=qe(a[s],2),c=l[0],d=l[1];switch(c){case"processor":if(!Fw(d))return!1;break;case"settings":if(!_p(d))return!1;break;default:return!1}}break;case"audio":if(fe(o)!=="object")return!1;for(var f=0,h=Object.entries(o);f<h.length;f++){var b=qe(h[f],2),y=b[0],g=b[1];switch(y){case"processor":if(!$w(g))return!1;break;case"settings":if(!_p(g))return!1;break;default:return!1}}break;default:return!1}}return!0}function xp(t,e,n){var r,i=[];t.video&&t.video.processor&&(Nh((r=e==null?void 0:e.useLegacyVideoProcessor)!==null&&r!==void 0&&r)||(t.video.settings?delete t.video.processor:delete t.video,i.push("video"))),t.audio&&t.audio.processor&&($h()||(t.audio.settings?delete t.audio.processor:delete t.audio,i.push("audio"))),i.length>0&&console.error("Ignoring settings for browser- or platform-unsupported input processor(s): ".concat(i.join(", "))),t.audio&&t.audio.settings&&(t.audio.settings.customTrack?(n.audioTrack=t.audio.settings.customTrack,t.audio.settings={customTrack:pn}):delete n.audioTrack),t.video&&t.video.settings&&(t.video.settings.customTrack?(n.videoTrack=t.video.settings.customTrack,t.video.settings={customTrack:pn}):delete n.videoTrack)}function $w(t){if(ce())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type"];return!!t&&fe(t)==="object"&&(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> audio -> processor : ".concat(n)),delete t[n]}),!!function(n){return typeof n!="string"?!1:Object.values(Ph).includes(n)?!0:(console.error("inputSettings audio processor type invalid"),!1)}(t.type))}function Fw(t){if(ce())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type","config"];return!t||fe(t)!=="object"||!function(n){return typeof n!="string"?!1:Object.values(ys).includes(n)?!0:(console.error("inputSettings video processor type invalid"),!1)}(t.type)||t.config&&(fe(t.config)!=="object"||!function(n,r){var i=Object.keys(r);if(i.length===0)return!0;var o="invalid object in inputSettings -> video -> processor -> config";switch(n){case ys.BGBLUR:return i.length>1||i[0]!=="strength"?(console.error(o),!1):!(typeof r.strength!="number"||r.strength<=0||r.strength>1||isNaN(r.strength))||(console.error("".concat(o,"; expected: {0 < strength <= 1}, got: ").concat(r.strength)),!1);case ys.BGIMAGE:return!(r.source!==void 0&&!function(s){if(s.source==="default")return s.type="default",!0;if(s.source instanceof ArrayBuffer)return!0;if(Qo(s.source))return s.type="url",!!function(c){var d=new URL(c),f=d.pathname;if(d.protocol==="data:")try{var h=f.substring(f.indexOf(":")+1,f.indexOf(";")).split("/")[1];return Fl.includes(h)}catch(y){return console.error("failed to deduce blob content type",y),!1}var b=f.split(".").at(-1).toLowerCase().trim();return Fl.includes(b)}(s.source)||(console.error("invalid image type; supported types: [".concat(Fl.join(", "),"]")),!1);return a=s.source,l=Number(a),isNaN(l)||!Number.isInteger(l)||l<=0||l>10?(console.error("invalid image selection; must be an int, > 0, <= ".concat(10)),!1):(s.type="daily-preselect",!0);var a,l}(r));default:return!0}}(t.type,t.config))?!1:(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> video -> processor : ".concat(n)),delete t[n]}),!0)}function _p(t){return fe(t)==="object"&&(!t.customTrack||t.customTrack instanceof MediaStreamTrack)}function Zl(){var t=Object.values(ys).join(" | "),e=Object.values(Ph).join(" | ");return"inputSettings must be of the form: { video?: { processor?: { type: [ ".concat(t," ], config?: {} } }, audio?: { processor: {type: [ ").concat(e," ] } } }")}function Cp(t){var e=t.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(c0).concat(e?' | "'.concat("*",'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function Ep(){return"customIntegrations should be an object of type ".concat(JSON.stringify(Ql),".")}function Tp(t){if(t&&fe(t)!=="object"||Array.isArray(t))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(ks),".")),!1;if(t)for(var e=0,n=Object.entries(t);e<n.length;e++)for(var r=qe(n[e],1)[0],i=0,o=Object.entries(t[r]);i<o.length;i++){var s=qe(o[i],2),a=s[0],l=s[1],c=ks.id[a];if(!c)return console.error("customTrayButton does not support key ".concat(a)),!1;switch(a){case"iconPath":case"iconPathDarkMode":if(!Qo(l))return console.error("customTrayButton ".concat(a," should be a url.")),!1;break;case"visualState":if(!["default","sidebar-open","active"].includes(l))return console.error("customTrayButton ".concat(a," should be ").concat(c,". Got: ").concat(l)),!1;break;default:if(fe(l)!==c)return console.error("customTrayButton ".concat(a," should be a ").concat(c,".")),!1}}return!0}function Mp(t){if(!t||t&&fe(t)!=="object"||Array.isArray(t))return console.error(Ep()),!1;for(var e=function(f){return"".concat(f," should be ").concat(Ql.id[f])},n=function(f,h){return console.error("customIntegration ".concat(f,": ").concat(h))},r=0,i=Object.entries(t);r<i.length;r++){var o=qe(i[r],1)[0];if(!("label"in t[o]))return n(o,"label is required"),!1;if(!("location"in t[o]))return n(o,"location is required"),!1;if(!("src"in t[o])&&!("srcdoc"in t[o]))return n(o,"src or srcdoc is required"),!1;for(var s=0,a=Object.entries(t[o]);s<a.length;s++){var l=qe(a[s],2),c=l[0],d=l[1];switch(c){case"allow":case"csp":case"name":case"referrerPolicy":case"sandbox":if(typeof d!="string")return n(o,e(c)),!1;break;case"iconURL":if(!Qo(d))return n(o,"".concat(c," should be a url")),!1;break;case"src":if("srcdoc"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(!Qo(d))return n(o,'src "'.concat(d,'" is not a valid URL')),!1;break;case"srcdoc":if("src"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(typeof d!="string")return n(o,e(c)),!1;break;case"location":if(!["main","sidebar"].includes(d))return n(o,e(c)),!1;break;case"controlledBy":if(d!=="*"&&d!=="owners"&&(!Array.isArray(d)||d.some(function(f){return typeof f!="string"})))return n(o,e(c)),!1;break;case"shared":if((!Array.isArray(d)||d.some(function(f){return typeof f!="string"}))&&d!=="owners"&&typeof d!="boolean")return n(o,e(c)),!1;break;default:if(!Ql.id[c])return console.error("customIntegration does not support key ".concat(c)),!1}}}return!0}function Ap(t,e){if(e===void 0)return!1;switch(fe(e)){case"string":return fe(t)===e;case"object":if(fe(t)!=="object")return!1;for(var n in t)if(!Ap(t[n],e[n]))return!1;return!0;default:return!1}}function Op(t,e){var n=t.sessionId,r=t.toEndPoint,i=t.callerId,o=t.useSipRefer;if(!n||!r)throw new Error("".concat(e,"() requires a sessionId and toEndPoint"));if(typeof n!="string"||typeof r!="string")throw new Error("Invalid paramater: sessionId and toEndPoint must be of type string");if(o&&!r.startsWith("sip:"))throw new Error('"toEndPoint" must be a "sip" address');if(!r.startsWith("sip:")&&!r.startsWith("+"))throw new Error("toEndPoint: ".concat(r,' must starts with either "sip:" or "+"'));if(i&&typeof i!="string")throw new Error("callerId must be of type string");if(i&&!r.startsWith("+"))throw new Error("callerId is only valid when transferring to a PSTN number")}function Dp(t){if(fe(t)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(t.state&&!Object.values($l).includes(t.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify($l));if(t.volume){if(typeof t.volume!="number")throw new Error('RemoteMediaPlayerSettings.volume: must be "number" type');if(t.volume<0||t.volume>2)throw new Error("RemoteMediaPlayerSettings.volume: must be between 0.0 - 2.0")}}function Pp(t,e,n){return!(typeof t!="number"||t<e||t>n)}function ec(t,e){return t&&!e&&delete t.data,t}function Bw(t){return t&&t.__esModule?t.default:t}function Lp(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Ip={};Lp(Ip,"DailyRTVIMessageType",()=>nc),Lp(Ip,"DailyTransport",()=>gn);class Ut{static floatTo16BitPCM(e){const n=new ArrayBuffer(e.length*2),r=new DataView(n);let i=0;for(let o=0;o<e.length;o++,i+=2){let s=Math.max(-1,Math.min(1,e[o]));r.setInt16(i,s<0?s*32768:s*32767,!0)}return n}static mergeBuffers(e,n){const r=new Uint8Array(e.byteLength+n.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(n),e.byteLength),r.buffer}_packData(e,n){return[new Uint8Array([n,n>>8]),new Uint8Array([n,n>>8,n>>16,n>>24])][e]}pack(e,n){if(n!=null&&n.bitsPerSample)if(n!=null&&n.channels){if(!(n!=null&&n.data))throw new Error('Missing "data"')}else throw new Error('Missing "channels"');else throw new Error('Missing "bitsPerSample"');const{bitsPerSample:r,channels:i,data:o}=n,s=["RIFF",this._packData(1,52),"WAVE","fmt ",this._packData(1,16),this._packData(0,1),this._packData(0,i.length),this._packData(1,e),this._packData(1,e*i.length*r/8),this._packData(0,i.length*r/8),this._packData(0,r),"data",this._packData(1,i[0].length*i.length*r/8),o],a=new Blob(s,{type:"audio/mpeg"}),l=URL.createObjectURL(a);return{blob:a,url:l,channelCount:i.length,sampleRate:e,duration:o.byteLength/(i.length*e*2)}}}globalThis.WavPacker=Ut;const Rp=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],jw=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],$n=[],tc=[];for(let t=1;t<=8;t++)for(let e=0;e<Rp.length;e++){const n=Rp[e];$n.push(n/Math.pow(2,8-t)),tc.push(jw[e]+t)}const Es=[32,2e3],Np=$n.filter((t,e)=>$n[e]>Es[0]&&$n[e]<Es[1]),Uw=tc.filter((t,e)=>$n[e]>Es[0]&&$n[e]<Es[1]);class Zr{static getFrequencies(e,n,r,i="frequency",o=-100,s=-30){r||(r=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(r));const a=n/2,l=1/r.length*a;let c,d,f;if(i==="music"||i==="voice"){const y=i==="voice"?Np:$n,g=Array(y.length).fill(o);for(let S=0;S<r.length;S++){const v=S*l,w=r[S];for(let k=y.length-1;k>=0;k--)if(v>y[k]){g[k]=Math.max(g[k],w);break}}c=g,d=i==="voice"?Np:$n,f=i==="voice"?Uw:tc}else c=Array.from(r),d=c.map((y,g)=>l*g),f=d.map(y=>`${y.toFixed(2)} Hz`);const h=c.map(y=>Math.max(0,Math.min((y-o)/(s-o),1)));return{values:new Float32Array(h),frequencies:d,labels:f}}constructor(e,n=null){if(this.fftResults=[],n){const{length:r,sampleRate:i}=n,o=new OfflineAudioContext({length:r,sampleRate:i}),s=o.createBufferSource();s.buffer=n;const a=o.createAnalyser();a.fftSize=8192,a.smoothingTimeConstant=.1,s.connect(a);const l=1/60,c=r/i,d=f=>{const h=l*f;h<c&&o.suspend(h).then(()=>{const b=new Float32Array(a.frequencyBinCount);a.getFloatFrequencyData(b),this.fftResults.push(b),d(f+1)}),f===1?o.startRendering():o.resume()};s.start(0),d(1),this.audio=e,this.context=o,this.analyser=a,this.sampleRate=i,this.audioBuffer=n}else{const r=new AudioContext,i=r.createMediaElementSource(e),o=r.createAnalyser();o.fftSize=8192,o.smoothingTimeConstant=.1,i.connect(o),o.connect(r.destination),this.audio=e,this.context=r,this.analyser=o,this.sampleRate=this.context.sampleRate,this.audioBuffer=null}}getFrequencies(e="frequency",n=-100,r=-30){let i=null;if(this.audioBuffer&&this.fftResults.length){const o=this.audio.currentTime/this.audio.duration,s=Math.min(o*this.fftResults.length|0,this.fftResults.length-1);i=this.fftResults[s]}return Zr.getFrequencies(this.analyser,this.sampleRate,i,e,n,r)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}}globalThis.AudioAnalysis=Zr;const zw=`
|
|
44
44
|
class StreamProcessor extends AudioWorkletProcessor {
|
|
45
45
|
constructor() {
|
|
46
46
|
super();
|
|
@@ -129,7 +129,7 @@ class StreamProcessor extends AudioWorkletProcessor {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
registerProcessor('stream_processor', StreamProcessor);
|
|
132
|
-
`,
|
|
132
|
+
`,Hw=new Blob([zw],{type:"application/javascript"}),Vw=URL.createObjectURL(Hw);class Kw{constructor({sampleRate:e=44100}={}){this.scriptSrc=Vw,this.sampleRate=e,this.context=null,this.stream=null,this.analyser=null,this.trackSampleOffsets={},this.interruptedTrackIds={}}async connect(){this.context=new AudioContext({sampleRate:this.sampleRate}),this._speakerID&&this.context.setSinkId(this._speakerID),this.context.state==="suspended"&&await this.context.resume();try{await this.context.audioWorklet.addModule(this.scriptSrc)}catch(n){throw console.error(n),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const e=this.context.createAnalyser();return e.fftSize=8192,e.smoothingTimeConstant=.1,this.analyser=e,!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return Zr.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async updateSpeaker(e){const n=this._speakerID;if(this._speakerID=e,this.context)try{e==="default"?await this.context.setSinkId():await this.context.setSinkId(e)}catch(r){console.error(`Could not set sinkId to ${e}: ${r}`),this._speakerID=n}}_start(){const e=new AudioWorkletNode(this.context,"stream_processor");return e.connect(this.context.destination),e.port.onmessage=n=>{const{event:r}=n.data;if(r==="stop")e.disconnect(),this.stream=null;else if(r==="offset"){const{requestId:i,trackId:o,offset:s}=n.data,a=s/this.sampleRate;this.trackSampleOffsets[i]={trackId:o,offset:s,currentTime:a}}},this.analyser.disconnect(),e.connect(this.analyser),this.stream=e,!0}add16BitPCM(e,n="default"){if(typeof n!="string")throw new Error("trackId must be a string");if(this.interruptedTrackIds[n])return;this.stream||this._start();let r;if(e instanceof Int16Array)r=e;else if(e instanceof ArrayBuffer)r=new Int16Array(e);else throw new Error("argument must be Int16Array or ArrayBuffer");return this.stream.port.postMessage({event:"write",buffer:r,trackId:n}),r}async getTrackSampleOffset(e=!1){if(!this.stream)return null;const n=crypto.randomUUID();this.stream.port.postMessage({event:e?"interrupt":"offset",requestId:n});let r;for(;!r;)r=this.trackSampleOffsets[n],await new Promise(o=>setTimeout(()=>o(),1));const{trackId:i}=r;return e&&i&&(this.interruptedTrackIds[i]=!0),r}async interrupt(){return this.getTrackSampleOffset(!0)}}globalThis.WavStreamPlayer=Kw;const Ww=`
|
|
133
133
|
class AudioProcessor extends AudioWorkletProcessor {
|
|
134
134
|
|
|
135
135
|
constructor() {
|
|
@@ -336,11 +336,11 @@ class AudioProcessor extends AudioWorkletProcessor {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
registerProcessor('audio_processor', AudioProcessor);
|
|
339
|
-
`,
|
|
339
|
+
`,qw=new Blob([Ww],{type:"application/javascript"}),$p=URL.createObjectURL(qw);class Jw{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=$p,this.sampleRate=e,this.outputToSpeakers=n,this.debug=!!r,this._deviceChangeCallback=null,this._deviceErrorCallback=null,this._devices=[],this.deviceSelection=null,this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}static async decode(e,n=44100,r=-1){const i=new AudioContext({sampleRate:n});let o,s;if(e instanceof Blob){if(r!==-1)throw new Error('Can not specify "fromSampleRate" when reading from Blob');s=e,o=await s.arrayBuffer()}else if(e instanceof ArrayBuffer){if(r!==-1)throw new Error('Can not specify "fromSampleRate" when reading from ArrayBuffer');o=e,s=new Blob([o],{type:"audio/wav"})}else{let d,f;if(e instanceof Int16Array){f=e,d=new Float32Array(e.length);for(let g=0;g<e.length;g++)d[g]=e[g]/32768}else if(e instanceof Float32Array)d=e;else if(e instanceof Array)d=new Float32Array(e);else throw new Error('"audioData" must be one of: Blob, Float32Arrray, Int16Array, ArrayBuffer, Array<number>');if(r===-1)throw new Error('Must specify "fromSampleRate" when reading from Float32Array, In16Array or Array');if(r<3e3)throw new Error('Minimum "fromSampleRate" is 3000 (3kHz)');f||(f=Ut.floatTo16BitPCM(d));const h={bitsPerSample:16,channels:[d],data:f};s=new Ut().pack(r,h).blob,o=await s.arrayBuffer()}const a=await i.decodeAudioData(o),l=a.getChannelData(0),c=URL.createObjectURL(s);return{blob:s,url:c,values:l,audioBuffer:a}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,n={},r=null){if(r=r||this.processor,!r)throw new Error("Can not send events without recording first");const i={event:e,id:this._lastEventId++,data:n};r.port.postMessage(i);const o=new Date().valueOf();for(;!this.eventReceipts[i.id];){if(new Date().valueOf()-o>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(a=>setTimeout(()=>a(!0),1))}const s=this.eventReceipts[i.id];return delete this.eventReceipts[i.id],s}listenForDeviceChange(e){if(e===null&&this._deviceChangeCallback)navigator.mediaDevices.removeEventListener("devicechange",this._deviceChangeCallback),this._deviceChangeCallback=null;else if(e!==null){let n=0,r=[];const i=s=>s.map(a=>a.deviceId).sort().join(","),o=async()=>{let s=++n;const a=await this.listDevices();s===n&&i(r)!==i(a)&&(r=a,e(a.slice()))};navigator.mediaDevices.addEventListener("devicechange",o),o(),this._deviceChangeCallback=o}return!0}listenForDeviceErrors(e){this._deviceErrorCallback=e}async requestPermission(){const e=await navigator.permissions.query({name:"microphone"});if(e.state==="denied")this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:new Error("Microphone access denied")});else if(e.state==="prompt")try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(i=>i.stop())}catch(n){console.error("Error accessing microphone."),this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:n})}return!0}async listDevices(){if(!navigator.mediaDevices||!("enumerateDevices"in navigator.mediaDevices))throw new Error("Could not request user devices");return await this.requestPermission(),(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput")}async begin(e){var a;if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!navigator.mediaDevices||!("getUserMedia"in navigator.mediaDevices))throw this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic","cam"],type:"undefined-mediadevices"}),new Error("Could not request user media");e=e??((a=this.deviceSelection)==null?void 0:a.deviceId);try{const l={audio:!0};e&&(l.audio={deviceId:{exact:e}}),this.stream=await navigator.mediaDevices.getUserMedia(l)}catch(l){throw this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:l}),new Error("Could not start media stream")}this.listDevices().then(l=>{e=this.stream.getAudioTracks()[0].getSettings().deviceId,console.log("find current device",l,e,this.stream.getAudioTracks()[0].getSettings()),this.deviceSelection=l.find(c=>c.deviceId===e),console.log("current device",this.deviceSelection)});const n=new AudioContext({sampleRate:this.sampleRate}),r=n.createMediaStreamSource(this.stream);try{await n.audioWorklet.addModule(this.scriptSrc)}catch(l){throw console.error(l),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const i=new AudioWorkletNode(n,"audio_processor");i.port.onmessage=l=>{const{event:c,id:d,data:f}=l.data;if(c==="receipt")this.eventReceipts[d]=f;else if(c==="chunk")if(this._chunkProcessorSize){const h=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Ut.mergeBuffers(h.raw,f.raw),mono:Ut.mergeBuffers(h.mono,f.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(f)};const o=r.connect(i),s=n.createAnalyser();return s.fftSize=8192,s.smoothingTimeConstant=.1,o.connect(s),this.outputToSpeakers&&(console.warn(`Warning: Output to speakers may affect sound quality,
|
|
340
340
|
especially due to system audio feedback preventative measures.
|
|
341
|
-
use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,this.analyser=s,this.processor=i,console.log("begin completed"),!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return Zr.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Ut().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.stream.getTracks().forEach(s=>s.stop()),this.log("Exporting ...");const r=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Ut().pack(this.sampleRate,r.audio)}async quit(){return this.listenForDeviceChange(null),this.deviceSelection=null,this.processor&&await this.end(),!0}}globalThis.WavRecorder=
|
|
341
|
+
use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,this.analyser=s,this.processor=i,console.log("begin completed"),!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return Zr.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Ut().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.stream.getTracks().forEach(s=>s.stop()),this.log("Exporting ...");const r=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Ut().pack(this.sampleRate,r.audio)}async quit(){return this.listenForDeviceChange(null),this.deviceSelection=null,this.processor&&await this.end(),!0}}globalThis.WavRecorder=Jw;class Gw{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=$p,this.sampleRate=e,this.outputToSpeakers=n,this.debug=!!r,this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,n={},r=null){if(r=r||this.processor,!r)throw new Error("Can not send events without recording first");const i={event:e,id:this._lastEventId++,data:n};r.port.postMessage(i);const o=new Date().valueOf();for(;!this.eventReceipts[i.id];){if(new Date().valueOf()-o>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(a=>setTimeout(()=>a(!0),1))}const s=this.eventReceipts[i.id];return delete this.eventReceipts[i.id],s}async begin(e){if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!e||e.kind!=="audio")throw new Error("No audio track provided");this.stream=new MediaStream([e]);const n=new AudioContext({sampleRate:this.sampleRate}),r=n.createMediaStreamSource(this.stream);try{await n.audioWorklet.addModule(this.scriptSrc)}catch(a){throw console.error(a),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const i=new AudioWorkletNode(n,"audio_processor");i.port.onmessage=a=>{const{event:l,id:c,data:d}=a.data;if(l==="receipt")this.eventReceipts[c]=d;else if(l==="chunk")if(this._chunkProcessorSize){const f=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Ut.mergeBuffers(f.raw,d.raw),mono:Ut.mergeBuffers(f.mono,d.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(d)};const o=r.connect(i),s=n.createAnalyser();return s.fftSize=8192,s.smoothingTimeConstant=.1,o.connect(s),this.outputToSpeakers&&(console.warn(`Warning: Output to speakers may affect sound quality,
|
|
342
342
|
especially due to system audio feedback preventative measures.
|
|
343
|
-
use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,this.analyser=s,this.processor=i,!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return Zr.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: HELLO please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Ut().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.log("Exporting ...");const n=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Ut().pack(this.sampleRate,n.audio)}async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}}globalThis.WavRecorder=WavRecorder;var $p={};$p=JSON.parse('{"name":"@pipecat-ai/daily-transport","version":"1.5.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"src/index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web-transports.git"},"files":["dist","package.json","README.md"],"scripts":{"build":"parcel build --no-cache","dev":"parcel watch","lint":"eslint . --ext ts --report-unused-disable-directives --max-warnings 0"},"devDependencies":{"@pipecat-ai/client-js":"^1.5.0","eslint":"9.39.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1"},"peerDependencies":{"@pipecat-ai/client-js":"~1.5.0"},"dependencies":{"@daily-co/daily-js":"^0.84.0"},"description":"Pipecat Daily Transport Package","author":"Daily.co","bugs":{"url":"https://github.com/pipecat-ai/pipecat-client-web-transports/issues"},"homepage":"https://github.com/pipecat-ai/pipecat-client-web-transports/blob/main/transports/daily-webrtc/README.md"}');var tc;(function(t){t.AUDIO_BUFFERING_STARTED="audio-buffering-started",t.AUDIO_BUFFERING_STOPPED="audio-buffering-stopped"})(tc||(tc={}));class Gw{constructor(e){this._daily=e,this._proxy=new Proxy(this._daily,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"preAuth":o="Calls to preAuth() are disabled. Please use Transport.preAuth()";break;case"startCamera":o="Calls to startCamera() are disabled. Please use PipecatClient.initDevices()";break;case"join":o="Calls to join() are disabled. Please use PipecatClient.connect()";break;case"leave":o="Calls to leave() are disabled. Please use PipecatClient.disconnect()";break;case"destroy":o="Calls to destroy() are disabled.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}class gn extends Vd{constructor(e={}){var i;super(),this._botId="",this._selectedCam={},this._selectedMic={},this._selectedSpeaker={},this._currentAudioTrack=null,this._audioQueue=[],this._callbacks={};const{bufferLocalAudioUntilBotReady:n,...r}=e;this._dailyFactoryOptions=r,typeof((i=this._dailyFactoryOptions.dailyConfig)==null?void 0:i.useDevicePreferenceCookies)>"u"&&(this._dailyFactoryOptions.dailyConfig==null&&(this._dailyFactoryOptions.dailyConfig={}),this._dailyFactoryOptions.dailyConfig.useDevicePreferenceCookies=!0),this._bufferLocalAudioUntilBotReady=n||!1,this._daily=Rw.createCallObject({...this._dailyFactoryOptions,allowMultipleCallInstances:!0}),this._dailyWrapper=new Gw(this._daily)}setupRecorder(){this._mediaStreamRecorder=new Jw({sampleRate:gn.RECORDER_SAMPLE_RATE})}handleUserAudioStream(e){this._audioQueue.push(e)}flushAudioQueue(){if(this._audioQueue.length!==0)for(pe.debug(`Will flush audio queue: ${this._audioQueue.length}`);this._audioQueue.length>0;){const n=[];for(;n.length<10&&this._audioQueue.length>0;){const r=this._audioQueue.shift();r&&n.push(r)}n.length>0&&this._sendAudioBatch(n)}}_sendAudioBatch(e){const r={id:"raw-audio-batch",label:"rtvi-ai",type:"raw-audio-batch",data:{base64AudioBatch:e.map(i=>{const o=new Uint8Array(i);return btoa(String.fromCharCode(...o))}),sampleRate:gn.RECORDER_SAMPLE_RATE,numChannels:1}};this.sendMessage(r)}initialize(e,n){this._bufferLocalAudioUntilBotReady&&this.setupRecorder(),this._callbacks=e.callbacks??{},this._onMessage=n,(this._dailyFactoryOptions.startVideoOff==null||e.enableCam!=null)&&(this._dailyFactoryOptions.startVideoOff=!(e.enableCam??!1)),(this._dailyFactoryOptions.startAudioOff==null||e.enableMic!=null)&&(this._dailyFactoryOptions.startAudioOff=!(e.enableMic??!0)),this.attachEventListeners(),this.state="disconnected",pe.debug("[Daily Transport] Initialized",Fw($p).version)}get dailyCallClient(){return this._dailyWrapper.proxy}get state(){return this._state}set state(e){var n,r;this._state!==e&&(this._state=e,(r=(n=this._callbacks).onTransportStateChanged)==null||r.call(n,e))}getSessionInfo(){return this._daily.meetingSessionSummary()}async getAllCams(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="videoinput")}updateCam(e){this._daily.setInputDevicesAsync({videoDeviceId:e}).then(n=>{this._selectedCam=n.camera})}get selectedCam(){return this._selectedCam}async getAllMics(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audioinput")}updateMic(e){this._daily.setInputDevicesAsync({audioDeviceId:e}).then(n=>{this._selectedMic=n.mic})}get selectedMic(){return this._selectedMic}async getAllSpeakers(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audiooutput")}updateSpeaker(e){this._daily.setOutputDeviceAsync({outputDeviceId:e}).then(n=>{this._selectedSpeaker=n.speaker}).catch(n=>{var r,i;(i=(r=this._callbacks).onDeviceError)==null||i.call(r,new cn(["speaker"],n.type??"unknown",n.message))})}get selectedSpeaker(){return this._selectedSpeaker}enableMic(e){this._daily.setLocalAudio(e)}get isMicEnabled(){return this._daily.localAudio()}enableCam(e){this._daily.setLocalVideo(e)}get isCamEnabled(){return this._daily.localVideo()}enableScreenShare(e){e?this._daily.startScreenShare():this._daily.stopScreenShare()}get isSharingScreen(){return this._daily.localScreenAudio()||this._daily.localScreenVideo()}tracks(){var i,o,s,a,l,c,d,f,h,b,y,m,S,v,w,k;const e=this._daily.participants()??{},n=e==null?void 0:e[this._botId],r={local:{audio:(s=(o=(i=e==null?void 0:e.local)==null?void 0:i.tracks)==null?void 0:o.audio)==null?void 0:s.persistentTrack,screenAudio:(c=(l=(a=e==null?void 0:e.local)==null?void 0:a.tracks)==null?void 0:l.screenAudio)==null?void 0:c.persistentTrack,screenVideo:(h=(f=(d=e==null?void 0:e.local)==null?void 0:d.tracks)==null?void 0:f.screenVideo)==null?void 0:h.persistentTrack,video:(m=(y=(b=e==null?void 0:e.local)==null?void 0:b.tracks)==null?void 0:y.video)==null?void 0:m.persistentTrack}};return n&&(r.bot={audio:(v=(S=n==null?void 0:n.tracks)==null?void 0:S.audio)==null?void 0:v.persistentTrack,video:(k=(w=n==null?void 0:n.tracks)==null?void 0:w.video)==null?void 0:k.persistentTrack}),r}async startRecording(){var e,n;try{pe.info("[Daily Transport] Initializing recording"),await this._mediaStreamRecorder.record(r=>{this.handleUserAudioStream(r.mono)},gn.RECORDER_CHUNK_SIZE),(n=(e=this._callbacks).onAudioBufferingStarted)==null||n.call(e),pe.info("[Daily Transport] Recording Initialized")}catch(r){r.message.includes("Already recording")||pe.error("Error starting recording",r)}}async preAuth(e){this._dailyFactoryOptions=e,await this._daily.preAuth(e)}async initDevices(){var s,a,l,c,d,f,h,b,y,m,S,v;if(!this._daily)throw new ft("Transport instance not initialized");this.state="initializing";const e=await this._daily.startCamera(this._dailyFactoryOptions),{devices:n}=await this._daily.enumerateDevices(),r=n.filter(w=>w.kind==="videoinput"),i=n.filter(w=>w.kind==="audioinput"),o=n.filter(w=>w.kind==="audiooutput");this._selectedCam=e.camera,this._selectedMic=e.mic,this._selectedSpeaker=e.speaker,(a=(s=this._callbacks).onAvailableCamsUpdated)==null||a.call(s,r),(c=(l=this._callbacks).onAvailableMicsUpdated)==null||c.call(l,i),(f=(d=this._callbacks).onAvailableSpeakersUpdated)==null||f.call(d,o),(b=(h=this._callbacks).onCamUpdated)==null||b.call(h,e.camera),(m=(y=this._callbacks).onMicUpdated)==null||m.call(y,e.mic),(v=(S=this._callbacks).onSpeakerUpdated)==null||v.call(S,e.speaker),this._daily.isLocalAudioLevelObserverRunning()||await this._daily.startLocalAudioLevelObserver(100),this._daily.isRemoteParticipantsAudioLevelObserverRunning()||await this._daily.startRemoteParticipantsAudioLevelObserver(100),this.state="initialized"}_validateConnectionParams(e){if(e==null)return;if(typeof e!="object")throw new ft("Invalid connection parameters");const n=e;return n.room_url?(n.url=n.room_url,delete n.room_url):n.dailyRoom&&(n.url=n.dailyRoom,delete n.dailyRoom),n.dailyToken&&(n.token=n.dailyToken,delete n.dailyToken),n.token||delete n.token,n}async _connect(e){var n,r,i;if(!this._daily)throw new ft("Transport instance not initialized");e&&(this._dailyFactoryOptions={...this._dailyFactoryOptions,...e}),this.state="connecting";try{await this._daily.join(this._dailyFactoryOptions)}catch(o){throw pe.error("Failed to join room",o),this.state="error",new Ld}(n=this._abortController)!=null&&n.signal.aborted||(this.state="connected",(i=(r=this._callbacks).onConnected)==null||i.call(r))}async sendReadyMessage(){return new Promise(e=>{var o,s;const n=()=>{const a=navigator.userAgent;return/iPad|iPhone|iPod/.test(a)||/Macintosh/.test(a)&&"ontouchend"in document},r=()=>{this.state="ready",this.flushAudioQueue(),this.sendMessage(Ze.clientReady()),this.stopRecording(),e()};for(const a in this._daily.participants()){const l=this._daily.participants()[a];if(!l.local&&((s=(o=l.tracks)==null?void 0:o.audio)!=null&&s.persistentTrack)){r(),e();return}}const i=a=>{var l;(l=a.participant)!=null&&l.local||(this._daily.off("track-started",i),n()?(pe.debug("[Daily Transport] iOS device detected, adding 0.5 second delay before sending ready message"),setTimeout(r,500)):r())};this._daily.on("track-started",i)})}stopRecording(){var e,n;this._mediaStreamRecorder&&this._mediaStreamRecorder.getStatus()!=="ended"&&(this._mediaStreamRecorder.end(),(n=(e=this._callbacks).onAudioBufferingStopped)==null||n.call(e))}attachEventListeners(){this._daily.on("available-devices-updated",this.handleAvailableDevicesUpdated.bind(this)),this._daily.on("selected-devices-updated",this.handleSelectedDevicesUpdated.bind(this)),this._daily.on("camera-error",this.handleDeviceError.bind(this)),this._daily.on("track-started",this.handleTrackStarted.bind(this)),this._daily.on("track-stopped",this.handleTrackStopped.bind(this)),this._daily.on("participant-joined",this.handleParticipantJoined.bind(this)),this._daily.on("participant-left",this.handleParticipantLeft.bind(this)),this._daily.on("local-audio-level",this.handleLocalAudioLevel.bind(this)),this._daily.on("remote-participants-audio-level",this.handleRemoteAudioLevel.bind(this)),this._daily.on("app-message",this.handleAppMessage.bind(this)),this._daily.on("left-meeting",this.handleLeftMeeting.bind(this)),this._daily.on("error",this.handleFatalError.bind(this)),this._daily.on("nonfatal-error",this.handleNonFatalError.bind(this))}async _disconnect(){this.state="disconnecting",this._daily.stopLocalAudioLevelObserver(),this._daily.stopRemoteParticipantsAudioLevelObserver(),this._audioQueue=[],this._currentAudioTrack=null,this.stopRecording(),await this._daily.leave()}sendMessage(e){this._daily.sendAppMessage(e,"*")}handleAppMessage(e){e.data.label==="rtvi-ai"&&this._onMessage({id:e.data.id,type:e.data.type,data:e.data.data})}handleAvailableDevicesUpdated(e){var n,r,i,o,s,a;(r=(n=this._callbacks).onAvailableCamsUpdated)==null||r.call(n,e.availableDevices.filter(l=>l.kind==="videoinput")),(o=(i=this._callbacks).onAvailableMicsUpdated)==null||o.call(i,e.availableDevices.filter(l=>l.kind==="audioinput")),(a=(s=this._callbacks).onAvailableSpeakersUpdated)==null||a.call(s,e.availableDevices.filter(l=>l.kind==="audiooutput"))}handleSelectedDevicesUpdated(e){var n,r,i,o,s,a,l,c,d;((n=this._selectedCam)==null?void 0:n.deviceId)!==e.devices.camera&&(this._selectedCam=e.devices.camera,(i=(r=this._callbacks).onCamUpdated)==null||i.call(r,e.devices.camera)),((o=this._selectedMic)==null?void 0:o.deviceId)!==e.devices.mic&&(this._selectedMic=e.devices.mic,(a=(s=this._callbacks).onMicUpdated)==null||a.call(s,e.devices.mic)),((l=this._selectedSpeaker)==null?void 0:l.deviceId)!==e.devices.speaker&&(this._selectedSpeaker=e.devices.speaker,(d=(c=this._callbacks).onSpeakerUpdated)==null||d.call(c,e.devices.speaker))}handleDeviceError(e){var r,i;const n=o=>{const s=[];switch(o.type){case"permissions":return o.blockedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new cn(s,o.type,o.msg,{blockedBy:o.blockedBy});case"not-found":return o.missingMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new cn(s,o.type,o.msg);case"constraints":return o.failedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new cn(s,o.type,o.msg,{reason:o.reason});case"cam-in-use":return s.push("cam"),new cn(s,"in-use",o.msg);case"mic-in-use":return s.push("mic"),new cn(s,"in-use",o.msg);case"cam-mic-in-use":return s.push("cam"),s.push("mic"),new cn(s,"in-use",o.msg);case"undefined-mediadevices":case"unknown":default:return s.push("cam"),s.push("mic"),new cn(s,o.type,o.msg)}};(i=(r=this._callbacks).onDeviceError)==null||i.call(r,n(e.error))}async handleLocalAudioTrack(e){if(this.state=="ready"||!this._bufferLocalAudioUntilBotReady)return;switch(this._mediaStreamRecorder.getStatus()){case"ended":try{await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}break;case"paused":await this.startRecording();break;case"recording":default:if(this._currentAudioTrack!==e)try{await this._mediaStreamRecorder.end(),await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}else pe.warn("track-started event received for current track and already recording");break}this._currentAudioTrack=e}handleTrackStarted(e){var n,r,i,o,s;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStarted)==null||r.call(n,e.track,e.participant?wr(e.participant):void 0):((i=e.participant)!=null&&i.local&&e.track.kind==="audio"&&this.handleLocalAudioTrack(e.track),(s=(o=this._callbacks).onTrackStarted)==null||s.call(o,e.track,e.participant?wr(e.participant):void 0))}handleTrackStopped(e){var n,r,i,o;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStopped)==null||r.call(n,e.track,e.participant?wr(e.participant):void 0):(o=(i=this._callbacks).onTrackStopped)==null||o.call(i,e.track,e.participant?wr(e.participant):void 0)}handleParticipantJoined(e){var r,i,o,s;const n=wr(e.participant);(i=(r=this._callbacks).onParticipantJoined)==null||i.call(r,n),!n.local&&(this._botId=e.participant.session_id,(s=(o=this._callbacks).onBotConnected)==null||s.call(o,n))}handleParticipantLeft(e){var r,i,o,s;const n=wr(e.participant);(i=(r=this._callbacks).onParticipantLeft)==null||i.call(r,n),!n.local&&(this._botId="",(s=(o=this._callbacks).onBotDisconnected)==null||s.call(o,n))}handleLocalAudioLevel(e){var n,r;(r=(n=this._callbacks).onLocalAudioLevel)==null||r.call(n,e.audioLevel)}handleRemoteAudioLevel(e){var i,o;const n=this._daily.participants(),r=Object.keys(e.participantsAudioLevel);for(let s=0;s<r.length;s++){const a=r[s],l=e.participantsAudioLevel[a];(o=(i=this._callbacks).onRemoteAudioLevel)==null||o.call(i,l,wr(n[a]))}}handleLeftMeeting(){var e,n;this.state="disconnected",this._botId="",(n=(e=this._callbacks).onDisconnected)==null||n.call(e)}handleFatalError(e){var n,r;pe.error("Daily fatal error",e.errorMsg),this.state="error",this._botId="",(r=(n=this._callbacks).onError)==null||r.call(n,Ze.error(e.errorMsg,!0))}handleNonFatalError(e){var n,r;switch(e.type){case"screen-share-error":(r=(n=this._callbacks).onScreenShareError)==null||r.call(n,e.errorMsg);break}}}gn.RECORDER_SAMPLE_RATE=16e3,gn.RECORDER_CHUNK_SIZE=512;const wr=t=>({id:t.user_id,local:t.local,name:t.user_name});var Fp={exports:{}},le={};/**
|
|
343
|
+
use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,this.analyser=s,this.processor=i,!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return Zr.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: HELLO please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Ut().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.log("Exporting ...");const n=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Ut().pack(this.sampleRate,n.audio)}async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}}globalThis.WavRecorder=WavRecorder;var Fp={};Fp=JSON.parse('{"name":"@pipecat-ai/daily-transport","version":"1.5.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"src/index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web-transports.git"},"files":["dist","package.json","README.md"],"scripts":{"build":"parcel build --no-cache","dev":"parcel watch","lint":"eslint . --ext ts --report-unused-disable-directives --max-warnings 0"},"devDependencies":{"@pipecat-ai/client-js":"^1.5.0","eslint":"9.39.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1"},"peerDependencies":{"@pipecat-ai/client-js":"~1.5.0"},"dependencies":{"@daily-co/daily-js":"^0.84.0"},"description":"Pipecat Daily Transport Package","author":"Daily.co","bugs":{"url":"https://github.com/pipecat-ai/pipecat-client-web-transports/issues"},"homepage":"https://github.com/pipecat-ai/pipecat-client-web-transports/blob/main/transports/daily-webrtc/README.md"}');var nc;(function(t){t.AUDIO_BUFFERING_STARTED="audio-buffering-started",t.AUDIO_BUFFERING_STOPPED="audio-buffering-stopped"})(nc||(nc={}));class Qw{constructor(e){this._daily=e,this._proxy=new Proxy(this._daily,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"preAuth":o="Calls to preAuth() are disabled. Please use Transport.preAuth()";break;case"startCamera":o="Calls to startCamera() are disabled. Please use PipecatClient.initDevices()";break;case"join":o="Calls to join() are disabled. Please use PipecatClient.connect()";break;case"leave":o="Calls to leave() are disabled. Please use PipecatClient.disconnect()";break;case"destroy":o="Calls to destroy() are disabled.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}class gn extends Kd{constructor(e={}){var i;super(),this._botId="",this._selectedCam={},this._selectedMic={},this._selectedSpeaker={},this._currentAudioTrack=null,this._audioQueue=[],this._callbacks={};const{bufferLocalAudioUntilBotReady:n,...r}=e;this._dailyFactoryOptions=r,typeof((i=this._dailyFactoryOptions.dailyConfig)==null?void 0:i.useDevicePreferenceCookies)>"u"&&(this._dailyFactoryOptions.dailyConfig==null&&(this._dailyFactoryOptions.dailyConfig={}),this._dailyFactoryOptions.dailyConfig.useDevicePreferenceCookies=!0),this._bufferLocalAudioUntilBotReady=n||!1,this._daily=Nw.createCallObject({...this._dailyFactoryOptions,allowMultipleCallInstances:!0}),this._dailyWrapper=new Qw(this._daily)}setupRecorder(){this._mediaStreamRecorder=new Gw({sampleRate:gn.RECORDER_SAMPLE_RATE})}handleUserAudioStream(e){this._audioQueue.push(e)}flushAudioQueue(){if(this._audioQueue.length!==0)for(pe.debug(`Will flush audio queue: ${this._audioQueue.length}`);this._audioQueue.length>0;){const n=[];for(;n.length<10&&this._audioQueue.length>0;){const r=this._audioQueue.shift();r&&n.push(r)}n.length>0&&this._sendAudioBatch(n)}}_sendAudioBatch(e){const r={id:"raw-audio-batch",label:"rtvi-ai",type:"raw-audio-batch",data:{base64AudioBatch:e.map(i=>{const o=new Uint8Array(i);return btoa(String.fromCharCode(...o))}),sampleRate:gn.RECORDER_SAMPLE_RATE,numChannels:1}};this.sendMessage(r)}initialize(e,n){this._bufferLocalAudioUntilBotReady&&this.setupRecorder(),this._callbacks=e.callbacks??{},this._onMessage=n,(this._dailyFactoryOptions.startVideoOff==null||e.enableCam!=null)&&(this._dailyFactoryOptions.startVideoOff=!(e.enableCam??!1)),(this._dailyFactoryOptions.startAudioOff==null||e.enableMic!=null)&&(this._dailyFactoryOptions.startAudioOff=!(e.enableMic??!0)),this.attachEventListeners(),this.state="disconnected",pe.debug("[Daily Transport] Initialized",Bw(Fp).version)}get dailyCallClient(){return this._dailyWrapper.proxy}get state(){return this._state}set state(e){var n,r;this._state!==e&&(this._state=e,(r=(n=this._callbacks).onTransportStateChanged)==null||r.call(n,e))}getSessionInfo(){return this._daily.meetingSessionSummary()}async getAllCams(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="videoinput")}updateCam(e){this._daily.setInputDevicesAsync({videoDeviceId:e}).then(n=>{this._selectedCam=n.camera})}get selectedCam(){return this._selectedCam}async getAllMics(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audioinput")}updateMic(e){this._daily.setInputDevicesAsync({audioDeviceId:e}).then(n=>{this._selectedMic=n.mic})}get selectedMic(){return this._selectedMic}async getAllSpeakers(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audiooutput")}updateSpeaker(e){this._daily.setOutputDeviceAsync({outputDeviceId:e}).then(n=>{this._selectedSpeaker=n.speaker}).catch(n=>{var r,i;(i=(r=this._callbacks).onDeviceError)==null||i.call(r,new cn(["speaker"],n.type??"unknown",n.message))})}get selectedSpeaker(){return this._selectedSpeaker}enableMic(e){this._daily.setLocalAudio(e)}get isMicEnabled(){return this._daily.localAudio()}enableCam(e){this._daily.setLocalVideo(e)}get isCamEnabled(){return this._daily.localVideo()}enableScreenShare(e){e?this._daily.startScreenShare():this._daily.stopScreenShare()}get isSharingScreen(){return this._daily.localScreenAudio()||this._daily.localScreenVideo()}tracks(){var i,o,s,a,l,c,d,f,h,b,y,g,S,v,w,k;const e=this._daily.participants()??{},n=e==null?void 0:e[this._botId],r={local:{audio:(s=(o=(i=e==null?void 0:e.local)==null?void 0:i.tracks)==null?void 0:o.audio)==null?void 0:s.persistentTrack,screenAudio:(c=(l=(a=e==null?void 0:e.local)==null?void 0:a.tracks)==null?void 0:l.screenAudio)==null?void 0:c.persistentTrack,screenVideo:(h=(f=(d=e==null?void 0:e.local)==null?void 0:d.tracks)==null?void 0:f.screenVideo)==null?void 0:h.persistentTrack,video:(g=(y=(b=e==null?void 0:e.local)==null?void 0:b.tracks)==null?void 0:y.video)==null?void 0:g.persistentTrack}};return n&&(r.bot={audio:(v=(S=n==null?void 0:n.tracks)==null?void 0:S.audio)==null?void 0:v.persistentTrack,video:(k=(w=n==null?void 0:n.tracks)==null?void 0:w.video)==null?void 0:k.persistentTrack}),r}async startRecording(){var e,n;try{pe.info("[Daily Transport] Initializing recording"),await this._mediaStreamRecorder.record(r=>{this.handleUserAudioStream(r.mono)},gn.RECORDER_CHUNK_SIZE),(n=(e=this._callbacks).onAudioBufferingStarted)==null||n.call(e),pe.info("[Daily Transport] Recording Initialized")}catch(r){r.message.includes("Already recording")||pe.error("Error starting recording",r)}}async preAuth(e){this._dailyFactoryOptions=e,await this._daily.preAuth(e)}async initDevices(){var s,a,l,c,d,f,h,b,y,g,S,v;if(!this._daily)throw new ft("Transport instance not initialized");this.state="initializing";const e=await this._daily.startCamera(this._dailyFactoryOptions),{devices:n}=await this._daily.enumerateDevices(),r=n.filter(w=>w.kind==="videoinput"),i=n.filter(w=>w.kind==="audioinput"),o=n.filter(w=>w.kind==="audiooutput");this._selectedCam=e.camera,this._selectedMic=e.mic,this._selectedSpeaker=e.speaker,(a=(s=this._callbacks).onAvailableCamsUpdated)==null||a.call(s,r),(c=(l=this._callbacks).onAvailableMicsUpdated)==null||c.call(l,i),(f=(d=this._callbacks).onAvailableSpeakersUpdated)==null||f.call(d,o),(b=(h=this._callbacks).onCamUpdated)==null||b.call(h,e.camera),(g=(y=this._callbacks).onMicUpdated)==null||g.call(y,e.mic),(v=(S=this._callbacks).onSpeakerUpdated)==null||v.call(S,e.speaker),this._daily.isLocalAudioLevelObserverRunning()||await this._daily.startLocalAudioLevelObserver(100),this._daily.isRemoteParticipantsAudioLevelObserverRunning()||await this._daily.startRemoteParticipantsAudioLevelObserver(100),this.state="initialized"}_validateConnectionParams(e){if(e==null)return;if(typeof e!="object")throw new ft("Invalid connection parameters");const n=e;return n.room_url?(n.url=n.room_url,delete n.room_url):n.dailyRoom&&(n.url=n.dailyRoom,delete n.dailyRoom),n.dailyToken&&(n.token=n.dailyToken,delete n.dailyToken),n.token||delete n.token,n}async _connect(e){var n,r,i;if(!this._daily)throw new ft("Transport instance not initialized");e&&(this._dailyFactoryOptions={...this._dailyFactoryOptions,...e}),this.state="connecting";try{await this._daily.join(this._dailyFactoryOptions)}catch(o){throw pe.error("Failed to join room",o),this.state="error",new Id}(n=this._abortController)!=null&&n.signal.aborted||(this.state="connected",(i=(r=this._callbacks).onConnected)==null||i.call(r))}async sendReadyMessage(){return new Promise(e=>{var o,s;const n=()=>{const a=navigator.userAgent;return/iPad|iPhone|iPod/.test(a)||/Macintosh/.test(a)&&"ontouchend"in document},r=()=>{this.state="ready",this.flushAudioQueue(),this.sendMessage(Ze.clientReady()),this.stopRecording(),e()};for(const a in this._daily.participants()){const l=this._daily.participants()[a];if(!l.local&&((s=(o=l.tracks)==null?void 0:o.audio)!=null&&s.persistentTrack)){r(),e();return}}const i=a=>{var l;(l=a.participant)!=null&&l.local||(this._daily.off("track-started",i),n()?(pe.debug("[Daily Transport] iOS device detected, adding 0.5 second delay before sending ready message"),setTimeout(r,500)):r())};this._daily.on("track-started",i)})}stopRecording(){var e,n;this._mediaStreamRecorder&&this._mediaStreamRecorder.getStatus()!=="ended"&&(this._mediaStreamRecorder.end(),(n=(e=this._callbacks).onAudioBufferingStopped)==null||n.call(e))}attachEventListeners(){this._daily.on("available-devices-updated",this.handleAvailableDevicesUpdated.bind(this)),this._daily.on("selected-devices-updated",this.handleSelectedDevicesUpdated.bind(this)),this._daily.on("camera-error",this.handleDeviceError.bind(this)),this._daily.on("track-started",this.handleTrackStarted.bind(this)),this._daily.on("track-stopped",this.handleTrackStopped.bind(this)),this._daily.on("participant-joined",this.handleParticipantJoined.bind(this)),this._daily.on("participant-left",this.handleParticipantLeft.bind(this)),this._daily.on("local-audio-level",this.handleLocalAudioLevel.bind(this)),this._daily.on("remote-participants-audio-level",this.handleRemoteAudioLevel.bind(this)),this._daily.on("app-message",this.handleAppMessage.bind(this)),this._daily.on("left-meeting",this.handleLeftMeeting.bind(this)),this._daily.on("error",this.handleFatalError.bind(this)),this._daily.on("nonfatal-error",this.handleNonFatalError.bind(this))}async _disconnect(){this.state="disconnecting",this._daily.stopLocalAudioLevelObserver(),this._daily.stopRemoteParticipantsAudioLevelObserver(),this._audioQueue=[],this._currentAudioTrack=null,this.stopRecording(),await this._daily.leave()}sendMessage(e){this._daily.sendAppMessage(e,"*")}handleAppMessage(e){e.data.label==="rtvi-ai"&&this._onMessage({id:e.data.id,type:e.data.type,data:e.data.data})}handleAvailableDevicesUpdated(e){var n,r,i,o,s,a;(r=(n=this._callbacks).onAvailableCamsUpdated)==null||r.call(n,e.availableDevices.filter(l=>l.kind==="videoinput")),(o=(i=this._callbacks).onAvailableMicsUpdated)==null||o.call(i,e.availableDevices.filter(l=>l.kind==="audioinput")),(a=(s=this._callbacks).onAvailableSpeakersUpdated)==null||a.call(s,e.availableDevices.filter(l=>l.kind==="audiooutput"))}handleSelectedDevicesUpdated(e){var n,r,i,o,s,a,l,c,d;((n=this._selectedCam)==null?void 0:n.deviceId)!==e.devices.camera&&(this._selectedCam=e.devices.camera,(i=(r=this._callbacks).onCamUpdated)==null||i.call(r,e.devices.camera)),((o=this._selectedMic)==null?void 0:o.deviceId)!==e.devices.mic&&(this._selectedMic=e.devices.mic,(a=(s=this._callbacks).onMicUpdated)==null||a.call(s,e.devices.mic)),((l=this._selectedSpeaker)==null?void 0:l.deviceId)!==e.devices.speaker&&(this._selectedSpeaker=e.devices.speaker,(d=(c=this._callbacks).onSpeakerUpdated)==null||d.call(c,e.devices.speaker))}handleDeviceError(e){var r,i;const n=o=>{const s=[];switch(o.type){case"permissions":return o.blockedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new cn(s,o.type,o.msg,{blockedBy:o.blockedBy});case"not-found":return o.missingMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new cn(s,o.type,o.msg);case"constraints":return o.failedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new cn(s,o.type,o.msg,{reason:o.reason});case"cam-in-use":return s.push("cam"),new cn(s,"in-use",o.msg);case"mic-in-use":return s.push("mic"),new cn(s,"in-use",o.msg);case"cam-mic-in-use":return s.push("cam"),s.push("mic"),new cn(s,"in-use",o.msg);case"undefined-mediadevices":case"unknown":default:return s.push("cam"),s.push("mic"),new cn(s,o.type,o.msg)}};(i=(r=this._callbacks).onDeviceError)==null||i.call(r,n(e.error))}async handleLocalAudioTrack(e){if(this.state=="ready"||!this._bufferLocalAudioUntilBotReady)return;switch(this._mediaStreamRecorder.getStatus()){case"ended":try{await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}break;case"paused":await this.startRecording();break;case"recording":default:if(this._currentAudioTrack!==e)try{await this._mediaStreamRecorder.end(),await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}else pe.warn("track-started event received for current track and already recording");break}this._currentAudioTrack=e}handleTrackStarted(e){var n,r,i,o,s;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStarted)==null||r.call(n,e.track,e.participant?Sr(e.participant):void 0):((i=e.participant)!=null&&i.local&&e.track.kind==="audio"&&this.handleLocalAudioTrack(e.track),(s=(o=this._callbacks).onTrackStarted)==null||s.call(o,e.track,e.participant?Sr(e.participant):void 0))}handleTrackStopped(e){var n,r,i,o;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStopped)==null||r.call(n,e.track,e.participant?Sr(e.participant):void 0):(o=(i=this._callbacks).onTrackStopped)==null||o.call(i,e.track,e.participant?Sr(e.participant):void 0)}handleParticipantJoined(e){var r,i,o,s;const n=Sr(e.participant);(i=(r=this._callbacks).onParticipantJoined)==null||i.call(r,n),!n.local&&(this._botId=e.participant.session_id,(s=(o=this._callbacks).onBotConnected)==null||s.call(o,n))}handleParticipantLeft(e){var r,i,o,s;const n=Sr(e.participant);(i=(r=this._callbacks).onParticipantLeft)==null||i.call(r,n),!n.local&&(this._botId="",(s=(o=this._callbacks).onBotDisconnected)==null||s.call(o,n))}handleLocalAudioLevel(e){var n,r;(r=(n=this._callbacks).onLocalAudioLevel)==null||r.call(n,e.audioLevel)}handleRemoteAudioLevel(e){var i,o;const n=this._daily.participants(),r=Object.keys(e.participantsAudioLevel);for(let s=0;s<r.length;s++){const a=r[s],l=e.participantsAudioLevel[a];(o=(i=this._callbacks).onRemoteAudioLevel)==null||o.call(i,l,Sr(n[a]))}}handleLeftMeeting(){var e,n;this.state="disconnected",this._botId="",(n=(e=this._callbacks).onDisconnected)==null||n.call(e)}handleFatalError(e){var n,r;pe.error("Daily fatal error",e.errorMsg),this.state="error",this._botId="",(r=(n=this._callbacks).onError)==null||r.call(n,Ze.error(e.errorMsg,!0))}handleNonFatalError(e){var n,r;switch(e.type){case"screen-share-error":(r=(n=this._callbacks).onScreenShareError)==null||r.call(n,e.errorMsg);break}}}gn.RECORDER_SAMPLE_RATE=16e3,gn.RECORDER_CHUNK_SIZE=512;const Sr=t=>({id:t.user_id,local:t.local,name:t.user_name});var Bp={exports:{}},le={};/**
|
|
344
344
|
* @license React
|
|
345
345
|
* react.production.min.js
|
|
346
346
|
*
|
|
@@ -348,7 +348,7 @@ use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,thi
|
|
|
348
348
|
*
|
|
349
349
|
* This source code is licensed under the MIT license found in the
|
|
350
350
|
* LICENSE file in the root directory of this source tree.
|
|
351
|
-
*/var Vi=Symbol.for("react.element"),
|
|
351
|
+
*/var Vi=Symbol.for("react.element"),Yw=Symbol.for("react.portal"),Xw=Symbol.for("react.fragment"),Zw=Symbol.for("react.strict_mode"),eS=Symbol.for("react.profiler"),tS=Symbol.for("react.provider"),nS=Symbol.for("react.context"),rS=Symbol.for("react.forward_ref"),iS=Symbol.for("react.suspense"),oS=Symbol.for("react.memo"),sS=Symbol.for("react.lazy"),jp=Symbol.iterator;function aS(t){return t===null||typeof t!="object"?null:(t=jp&&t[jp]||t["@@iterator"],typeof t=="function"?t:null)}var Up={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zp=Object.assign,Hp={};function ei(t,e,n){this.props=t,this.context=e,this.refs=Hp,this.updater=n||Up}ei.prototype.isReactComponent={},ei.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")},ei.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Vp(){}Vp.prototype=ei.prototype;function rc(t,e,n){this.props=t,this.context=e,this.refs=Hp,this.updater=n||Up}var ic=rc.prototype=new Vp;ic.constructor=rc,zp(ic,ei.prototype),ic.isPureReactComponent=!0;var Kp=Array.isArray,Wp=Object.prototype.hasOwnProperty,oc={current:null},qp={key:!0,ref:!0,__self:!0,__source:!0};function Jp(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)Wp.call(e,r)&&!qp.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:Vi,type:t,key:o,ref:s,props:i,_owner:oc.current}}function lS(t,e){return{$$typeof:Vi,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function sc(t){return typeof t=="object"&&t!==null&&t.$$typeof===Vi}function cS(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Gp=/\/+/g;function ac(t,e){return typeof t=="object"&&t!==null&&t.key!=null?cS(""+t.key):e.toString(36)}function Ts(t,e,n,r,i){var o=typeof t;(o==="undefined"||o==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(o){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case Vi:case Yw:s=!0}}if(s)return s=t,i=i(s),t=r===""?"."+ac(s,0):r,Kp(i)?(n="",t!=null&&(n=t.replace(Gp,"$&/")+"/"),Ts(i,e,n,"",function(c){return c})):i!=null&&(sc(i)&&(i=lS(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(Gp,"$&/")+"/")+t)),e.push(i)),1;if(s=0,r=r===""?".":r+":",Kp(t))for(var a=0;a<t.length;a++){o=t[a];var l=r+ac(o,a);s+=Ts(o,e,n,l,i)}else if(l=aS(t),typeof l=="function")for(t=l.call(t),a=0;!(o=t.next()).done;)o=o.value,l=r+ac(o,a++),s+=Ts(o,e,n,l,i);else if(o==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function Ms(t,e,n){if(t==null)return t;var r=[],i=0;return Ts(t,r,"","",function(o){return e.call(n,o,i++)}),r}function uS(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var rt={current:null},As={transition:null},dS={ReactCurrentDispatcher:rt,ReactCurrentBatchConfig:As,ReactCurrentOwner:oc};function Qp(){throw Error("act(...) is not supported in production builds of React.")}le.Children={map:Ms,forEach:function(t,e,n){Ms(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Ms(t,function(){e++}),e},toArray:function(t){return Ms(t,function(e){return e})||[]},only:function(t){if(!sc(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},le.Component=ei,le.Fragment=Xw,le.Profiler=eS,le.PureComponent=rc,le.StrictMode=Zw,le.Suspense=iS,le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dS,le.act=Qp,le.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=zp({},t.props),i=t.key,o=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,s=oc.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)Wp.call(e,l)&&!qp.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Vi,type:t.type,key:i,ref:o,props:r,_owner:s}},le.createContext=function(t){return t={$$typeof:nS,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:tS,_context:t},t.Consumer=t},le.createElement=Jp,le.createFactory=function(t){var e=Jp.bind(null,t);return e.type=t,e},le.createRef=function(){return{current:null}},le.forwardRef=function(t){return{$$typeof:rS,render:t}},le.isValidElement=sc,le.lazy=function(t){return{$$typeof:sS,_payload:{_status:-1,_result:t},_init:uS}},le.memo=function(t,e){return{$$typeof:oS,type:t,compare:e===void 0?null:e}},le.startTransition=function(t){var e=As.transition;As.transition={};try{t()}finally{As.transition=e}},le.unstable_act=Qp,le.useCallback=function(t,e){return rt.current.useCallback(t,e)},le.useContext=function(t){return rt.current.useContext(t)},le.useDebugValue=function(){},le.useDeferredValue=function(t){return rt.current.useDeferredValue(t)},le.useEffect=function(t,e){return rt.current.useEffect(t,e)},le.useId=function(){return rt.current.useId()},le.useImperativeHandle=function(t,e,n){return rt.current.useImperativeHandle(t,e,n)},le.useInsertionEffect=function(t,e){return rt.current.useInsertionEffect(t,e)},le.useLayoutEffect=function(t,e){return rt.current.useLayoutEffect(t,e)},le.useMemo=function(t,e){return rt.current.useMemo(t,e)},le.useReducer=function(t,e,n){return rt.current.useReducer(t,e,n)},le.useRef=function(t){return rt.current.useRef(t)},le.useState=function(t){return rt.current.useState(t)},le.useSyncExternalStore=function(t,e,n){return rt.current.useSyncExternalStore(t,e,n)},le.useTransition=function(){return rt.current.useTransition()},le.version="18.3.1",Bp.exports=le;var oe=Bp.exports;const Yp=Gt(oe);var lc={},Xp={exports:{}},vt={},Zp={exports:{}},eg={};/**
|
|
352
352
|
* @license React
|
|
353
353
|
* scheduler.production.min.js
|
|
354
354
|
*
|
|
@@ -356,7 +356,7 @@ use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,thi
|
|
|
356
356
|
*
|
|
357
357
|
* This source code is licensed under the MIT license found in the
|
|
358
358
|
* LICENSE file in the root directory of this source tree.
|
|
359
|
-
*/(function(t){function e(F,z){var q=F.length;F.push(z);e:for(;0<q;){var re=q-1>>>1,me=F[re];if(0<i(me,z))F[re]=z,F[q]=me,q=re;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var z=F[0],q=F.pop();if(q!==z){F[0]=q;e:for(var re=0,me=F.length,u=me>>>1;re<u;){var
|
|
359
|
+
*/(function(t){function e(F,z){var q=F.length;F.push(z);e:for(;0<q;){var re=q-1>>>1,me=F[re];if(0<i(me,z))F[re]=z,F[q]=me,q=re;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var z=F[0],q=F.pop();if(q!==z){F[0]=q;e:for(var re=0,me=F.length,u=me>>>1;re<u;){var m=2*(re+1)-1,p=F[m],x=m+1,_=F[x];if(0>i(p,q))x<me&&0>i(_,p)?(F[re]=_,F[x]=q,re=x):(F[re]=p,F[m]=q,re=m);else if(x<me&&0>i(_,q))F[re]=_,F[x]=q,re=x;else break e}}return z}function i(F,z){var q=F.sortIndex-z.sortIndex;return q!==0?q:F.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var l=[],c=[],d=1,f=null,h=3,b=!1,y=!1,g=!1,S=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(F){for(var z=n(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=F)r(c),z.sortIndex=z.expirationTime,e(l,z);else break;z=n(c)}}function C(F){if(g=!1,k(F),!y)if(n(l)!==null)y=!0,G(E);else{var z=n(c);z!==null&&ne(C,z.startTime-F)}}function E(F,z){y=!1,g&&(g=!1,v($),$=-1),b=!0;var q=h;try{for(k(z),f=n(l);f!==null&&(!(f.expirationTime>z)||F&&!B());){var re=f.callback;if(typeof re=="function"){f.callback=null,h=f.priorityLevel;var me=re(f.expirationTime<=z);z=t.unstable_now(),typeof me=="function"?f.callback=me:f===n(l)&&r(l),k(z)}else r(l);f=n(l)}if(f!==null)var u=!0;else{var m=n(c);m!==null&&ne(C,m.startTime-z),u=!1}return u}finally{f=null,h=q,b=!1}}var A=!1,D=null,$=-1,X=5,V=-1;function B(){return!(t.unstable_now()-V<X)}function K(){if(D!==null){var F=t.unstable_now();V=F;var z=!0;try{z=D(!0,F)}finally{z?W():(A=!1,D=null)}}else A=!1}var W;if(typeof w=="function")W=function(){w(K)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,J=se.port2;se.port1.onmessage=K,W=function(){J.postMessage(null)}}else W=function(){S(K,0)};function G(F){D=F,A||(A=!0,W())}function ne(F,z){$=S(function(){F(t.unstable_now())},z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){y||b||(y=!0,G(E))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(F){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var q=h;h=z;try{return F()}finally{h=q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,z){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var q=h;h=F;try{return z()}finally{h=q}},t.unstable_scheduleCallback=function(F,z,q){var re=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?re+q:re):q=re,F){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=q+me,F={id:d++,callback:z,priorityLevel:F,startTime:q,expirationTime:me,sortIndex:-1},q>re?(F.sortIndex=q,e(c,F),n(l)===null&&F===n(c)&&(g?(v($),$=-1):g=!0,ne(C,q-re))):(F.sortIndex=me,e(l,F),y||b||(y=!0,G(E))),F},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(F){var z=h;return function(){var q=h;h=z;try{return F.apply(this,arguments)}finally{h=q}}}})(eg),Zp.exports=eg;var fS=Zp.exports;/**
|
|
360
360
|
* @license React
|
|
361
361
|
* react-dom.production.min.js
|
|
362
362
|
*
|
|
@@ -364,14 +364,14 @@ use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,thi
|
|
|
364
364
|
*
|
|
365
365
|
* This source code is licensed under the MIT license found in the
|
|
366
366
|
* LICENSE file in the root directory of this source tree.
|
|
367
|
-
*/var
|
|
368
|
-
`+
|
|
367
|
+
*/var hS=oe,yt=fS;function N(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var tg=new Set,Ki={};function kr(t,e){ti(t,e),ti(t+"Capture",e)}function ti(t,e){for(Ki[t]=e,t=0;t<e.length;t++)tg.add(e[t])}var mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cc=Object.prototype.hasOwnProperty,pS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ng={},rg={};function gS(t){return cc.call(rg,t)?!0:cc.call(ng,t)?!1:pS.test(t)?rg[t]=!0:(ng[t]=!0,!1)}function mS(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function vS(t,e,n,r){if(e===null||typeof e>"u"||mS(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function it(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var He={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){He[t]=new it(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];He[e]=new it(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){He[t]=new it(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){He[t]=new it(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){He[t]=new it(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){He[t]=new it(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){He[t]=new it(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){He[t]=new it(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){He[t]=new it(t,5,!1,t.toLowerCase(),null,!1,!1)});var uc=/[\-:]([a-z])/g;function dc(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(uc,dc);He[e]=new it(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(uc,dc);He[e]=new it(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(uc,dc);He[e]=new it(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){He[t]=new it(t,1,!1,t.toLowerCase(),null,!1,!1)}),He.xlinkHref=new it("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){He[t]=new it(t,1,!1,t.toLowerCase(),null,!0,!0)});function fc(t,e,n,r){var i=He.hasOwnProperty(e)?He[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(vS(e,n,i,r)&&(n=null),r||i===null?gS(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var vn=hS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Os=Symbol.for("react.element"),ni=Symbol.for("react.portal"),ri=Symbol.for("react.fragment"),hc=Symbol.for("react.strict_mode"),pc=Symbol.for("react.profiler"),ig=Symbol.for("react.provider"),og=Symbol.for("react.context"),gc=Symbol.for("react.forward_ref"),mc=Symbol.for("react.suspense"),vc=Symbol.for("react.suspense_list"),yc=Symbol.for("react.memo"),Fn=Symbol.for("react.lazy"),sg=Symbol.for("react.offscreen"),ag=Symbol.iterator;function Wi(t){return t===null||typeof t!="object"?null:(t=ag&&t[ag]||t["@@iterator"],typeof t=="function"?t:null)}var Me=Object.assign,bc;function qi(t){if(bc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);bc=e&&e[1]||""}return`
|
|
368
|
+
`+bc+t}var wc=!1;function Sc(t,e){if(!t||wc)return"";wc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
|
|
369
369
|
`),o=r.stack.split(`
|
|
370
370
|
`),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(s!==1||a!==1)do if(s--,a--,0>a||i[s]!==o[a]){var l=`
|
|
371
|
-
`+i[s].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{bc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?qi(t):""}function vS(t){switch(t.tag){case 5:return qi(t.type);case 16:return qi("Lazy");case 13:return qi("Suspense");case 19:return qi("SuspenseList");case 0:case 2:case 15:return t=wc(t.type,!1),t;case 11:return t=wc(t.type.render,!1),t;case 1:return t=wc(t.type,!0),t;default:return""}}function Sc(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ri:return"Fragment";case ni:return"Portal";case hc:return"Profiler";case fc:return"StrictMode";case gc:return"Suspense";case mc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ig:return(t.displayName||"Context")+".Consumer";case rg:return(t._context.displayName||"Context")+".Provider";case pc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case vc:return e=t.displayName||null,e!==null?e:Sc(t.type)||"Memo";case $n:e=t._payload,t=t._init;try{return Sc(t(e))}catch{}}return null}function yS(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Sc(e);case 8:return e===fc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Fn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ag(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function bS(t){var e=ag(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ps(t){t._valueTracker||(t._valueTracker=bS(t))}function lg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=ag(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ds(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function kc(t,e){var n=e.checked;return Me({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function cg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Fn(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function ug(t,e){e=e.checked,e!=null&&dc(t,"checked",e,!1)}function xc(t,e){ug(t,e);var n=Fn(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?_c(t,e.type,n):e.hasOwnProperty("defaultValue")&&_c(t,e.type,Fn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function dg(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function _c(t,e,n){(e!=="number"||Ds(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ji=Array.isArray;function ii(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Fn(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Cc(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(N(91));return Me({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function fg(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(N(92));if(Ji(n)){if(1<n.length)throw Error(N(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Fn(n)}}function hg(t,e){var n=Fn(e.value),r=Fn(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function pg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function gg(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ec(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?gg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ls,mg=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Ls=Ls||document.createElement("div"),Ls.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Ls.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Gi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Qi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wS=["Webkit","ms","Moz","O"];Object.keys(Qi).forEach(function(t){wS.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Qi[e]=Qi[t]})});function vg(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Qi.hasOwnProperty(t)&&Qi[t]?(""+e).trim():e+"px"}function yg(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=vg(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var SS=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Tc(t,e){if(e){if(SS[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(N(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(N(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(N(61))}if(e.style!=null&&typeof e.style!="object")throw Error(N(62))}}function Mc(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ac=null;function Oc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Pc=null,oi=null,si=null;function bg(t){if(t=bo(t)){if(typeof Pc!="function")throw Error(N(280));var e=t.stateNode;e&&(e=na(e),Pc(t.stateNode,t.type,e))}}function wg(t){oi?si?si.push(t):si=[t]:oi=t}function Sg(){if(oi){var t=oi,e=si;if(si=oi=null,bg(t),e)for(t=0;t<e.length;t++)bg(e[t])}}function kg(t,e){return t(e)}function xg(){}var Dc=!1;function _g(t,e,n){if(Dc)return t(e,n);Dc=!0;try{return kg(t,e,n)}finally{Dc=!1,(oi!==null||si!==null)&&(xg(),Sg())}}function Yi(t,e){var n=t.stateNode;if(n===null)return null;var r=na(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(N(231,e,typeof n));return n}var Lc=!1;if(mn)try{var Xi={};Object.defineProperty(Xi,"passive",{get:function(){Lc=!0}}),window.addEventListener("test",Xi,Xi),window.removeEventListener("test",Xi,Xi)}catch{Lc=!1}function kS(t,e,n,r,i,o,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(d){this.onError(d)}}var Zi=!1,Is=null,Rs=!1,Ic=null,xS={onError:function(t){Zi=!0,Is=t}};function _S(t,e,n,r,i,o,s,a,l){Zi=!1,Is=null,kS.apply(xS,arguments)}function CS(t,e,n,r,i,o,s,a,l){if(_S.apply(this,arguments),Zi){if(Zi){var c=Is;Zi=!1,Is=null}else throw Error(N(198));Rs||(Rs=!0,Ic=c)}}function kr(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function Cg(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Eg(t){if(kr(t)!==t)throw Error(N(188))}function ES(t){var e=t.alternate;if(!e){if(e=kr(t),e===null)throw Error(N(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Eg(i),t;if(o===r)return Eg(i),e;o=o.sibling}throw Error(N(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s){for(a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s)throw Error(N(189))}}if(n.alternate!==r)throw Error(N(190))}if(n.tag!==3)throw Error(N(188));return n.stateNode.current===n?t:e}function Tg(t){return t=ES(t),t!==null?Mg(t):null}function Mg(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Mg(t);if(e!==null)return e;t=t.sibling}return null}var Ag=yt.unstable_scheduleCallback,Og=yt.unstable_cancelCallback,TS=yt.unstable_shouldYield,MS=yt.unstable_requestPaint,Le=yt.unstable_now,AS=yt.unstable_getCurrentPriorityLevel,Rc=yt.unstable_ImmediatePriority,Pg=yt.unstable_UserBlockingPriority,Ns=yt.unstable_NormalPriority,OS=yt.unstable_LowPriority,Dg=yt.unstable_IdlePriority,$s=null,tn=null;function PS(t){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot($s,t,void 0,(t.current.flags&128)===128)}catch{}}var zt=Math.clz32?Math.clz32:IS,DS=Math.log,LS=Math.LN2;function IS(t){return t>>>=0,t===0?32:31-(DS(t)/LS|0)|0}var Fs=64,Bs=4194304;function eo(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function js(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=eo(a):(o&=s,o!==0&&(r=eo(o)))}else s=n&~i,s!==0?r=eo(s):o!==0&&(r=eo(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-zt(e),i=1<<n,r|=t[n],e&=~i;return r}function RS(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function NS(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-zt(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=RS(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}function Nc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Lg(){var t=Fs;return Fs<<=1,!(Fs&4194240)&&(Fs=64),t}function $c(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function to(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-zt(e),t[e]=n}function $S(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-zt(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function Fc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-zt(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var ve=0;function Ig(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Rg,Bc,Ng,$g,Fg,jc=!1,Us=[],Bn=null,jn=null,Un=null,no=new Map,ro=new Map,zn=[],FS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Bg(t,e){switch(t){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":jn=null;break;case"mouseover":case"mouseout":Un=null;break;case"pointerover":case"pointerout":no.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":ro.delete(e.pointerId)}}function io(t,e,n,r,i,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},e!==null&&(e=bo(e),e!==null&&Bc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function BS(t,e,n,r,i){switch(e){case"focusin":return Bn=io(Bn,t,e,n,r,i),!0;case"dragenter":return jn=io(jn,t,e,n,r,i),!0;case"mouseover":return Un=io(Un,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return no.set(o,io(no.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,ro.set(o,io(ro.get(o)||null,t,e,n,r,i)),!0}return!1}function jg(t){var e=xr(t.target);if(e!==null){var n=kr(e);if(n!==null){if(e=n.tag,e===13){if(e=Cg(n),e!==null){t.blockedOn=e,Fg(t.priority,function(){Ng(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function zs(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=zc(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Ac=r,n.target.dispatchEvent(r),Ac=null}else return e=bo(n),e!==null&&Bc(e),t.blockedOn=n,!1;e.shift()}return!0}function Ug(t,e,n){zs(t)&&n.delete(e)}function jS(){jc=!1,Bn!==null&&zs(Bn)&&(Bn=null),jn!==null&&zs(jn)&&(jn=null),Un!==null&&zs(Un)&&(Un=null),no.forEach(Ug),ro.forEach(Ug)}function oo(t,e){t.blockedOn===e&&(t.blockedOn=null,jc||(jc=!0,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,jS)))}function so(t){function e(i){return oo(i,t)}if(0<Us.length){oo(Us[0],t);for(var n=1;n<Us.length;n++){var r=Us[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Bn!==null&&oo(Bn,t),jn!==null&&oo(jn,t),Un!==null&&oo(Un,t),no.forEach(e),ro.forEach(e),n=0;n<zn.length;n++)r=zn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<zn.length&&(n=zn[0],n.blockedOn===null);)jg(n),n.blockedOn===null&&zn.shift()}var ai=vn.ReactCurrentBatchConfig,Hs=!0;function US(t,e,n,r){var i=ve,o=ai.transition;ai.transition=null;try{ve=1,Uc(t,e,n,r)}finally{ve=i,ai.transition=o}}function zS(t,e,n,r){var i=ve,o=ai.transition;ai.transition=null;try{ve=4,Uc(t,e,n,r)}finally{ve=i,ai.transition=o}}function Uc(t,e,n,r){if(Hs){var i=zc(t,e,n,r);if(i===null)ou(t,e,r,Vs,n),Bg(t,r);else if(BS(i,t,e,n,r))r.stopPropagation();else if(Bg(t,r),e&4&&-1<FS.indexOf(t)){for(;i!==null;){var o=bo(i);if(o!==null&&Rg(o),o=zc(t,e,n,r),o===null&&ou(t,e,r,Vs,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else ou(t,e,r,null,n)}}var Vs=null;function zc(t,e,n,r){if(Vs=null,t=Oc(r),t=xr(t),t!==null)if(e=kr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Cg(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Vs=t,null}function zg(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(AS()){case Rc:return 1;case Pg:return 4;case Ns:case OS:return 16;case Dg:return 536870912;default:return 16}default:return 16}}var Hn=null,Hc=null,Ws=null;function Hg(){if(Ws)return Ws;var t,e=Hc,n=e.length,r,i="value"in Hn?Hn.value:Hn.textContent,o=i.length;for(t=0;t<n&&e[t]===i[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===i[o-r];r++);return Ws=i.slice(t,1<r?1-r:void 0)}function Ks(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function qs(){return!0}function Vg(){return!1}function bt(t){function e(n,r,i,o,s){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?qs:Vg,this.isPropagationStopped=Vg,this}return Me(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=qs)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=qs)},persist:function(){},isPersistent:qs}),e}var li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vc=bt(li),ao=Me({},li,{view:0,detail:0}),HS=bt(ao),Wc,Kc,lo,Js=Me({},ao,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==lo&&(lo&&t.type==="mousemove"?(Wc=t.screenX-lo.screenX,Kc=t.screenY-lo.screenY):Kc=Wc=0,lo=t),Wc)},movementY:function(t){return"movementY"in t?t.movementY:Kc}}),Wg=bt(Js),VS=Me({},Js,{dataTransfer:0}),WS=bt(VS),KS=Me({},ao,{relatedTarget:0}),qc=bt(KS),qS=Me({},li,{animationName:0,elapsedTime:0,pseudoElement:0}),JS=bt(qS),GS=Me({},li,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),QS=bt(GS),YS=Me({},li,{data:0}),Kg=bt(YS),XS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ZS={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ek={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tk(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=ek[t])?!!e[t]:!1}function Jc(){return tk}var nk=Me({},ao,{key:function(t){if(t.key){var e=XS[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ks(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?ZS[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jc,charCode:function(t){return t.type==="keypress"?Ks(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ks(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),rk=bt(nk),ik=Me({},Js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qg=bt(ik),ok=Me({},ao,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jc}),sk=bt(ok),ak=Me({},li,{propertyName:0,elapsedTime:0,pseudoElement:0}),lk=bt(ak),ck=Me({},Js,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),uk=bt(ck),dk=[9,13,27,32],Gc=mn&&"CompositionEvent"in window,co=null;mn&&"documentMode"in document&&(co=document.documentMode);var fk=mn&&"TextEvent"in window&&!co,Jg=mn&&(!Gc||co&&8<co&&11>=co),Gg=" ",Qg=!1;function Yg(t,e){switch(t){case"keyup":return dk.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ci=!1;function hk(t,e){switch(t){case"compositionend":return Xg(e);case"keypress":return e.which!==32?null:(Qg=!0,Gg);case"textInput":return t=e.data,t===Gg&&Qg?null:t;default:return null}}function pk(t,e){if(ci)return t==="compositionend"||!Gc&&Yg(t,e)?(t=Hg(),Ws=Hc=Hn=null,ci=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Jg&&e.locale!=="ko"?null:e.data;default:return null}}var gk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Zg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!gk[t.type]:e==="textarea"}function em(t,e,n,r){wg(r),e=Zs(e,"onChange"),0<e.length&&(n=new Vc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var uo=null,fo=null;function mk(t){ym(t,0)}function Gs(t){var e=pi(t);if(lg(e))return t}function vk(t,e){if(t==="change")return e}var tm=!1;if(mn){var Qc;if(mn){var Yc="oninput"in document;if(!Yc){var nm=document.createElement("div");nm.setAttribute("oninput","return;"),Yc=typeof nm.oninput=="function"}Qc=Yc}else Qc=!1;tm=Qc&&(!document.documentMode||9<document.documentMode)}function rm(){uo&&(uo.detachEvent("onpropertychange",im),fo=uo=null)}function im(t){if(t.propertyName==="value"&&Gs(fo)){var e=[];em(e,fo,t,Oc(t)),_g(mk,e)}}function yk(t,e,n){t==="focusin"?(rm(),uo=e,fo=n,uo.attachEvent("onpropertychange",im)):t==="focusout"&&rm()}function bk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Gs(fo)}function wk(t,e){if(t==="click")return Gs(e)}function Sk(t,e){if(t==="input"||t==="change")return Gs(e)}function kk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ht=typeof Object.is=="function"?Object.is:kk;function ho(t,e){if(Ht(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!lc.call(e,i)||!Ht(t[i],e[i]))return!1}return!0}function om(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function sm(t,e){var n=om(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=om(n)}}function am(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?am(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function lm(){for(var t=window,e=Ds();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ds(t.document)}return e}function Xc(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function xk(t){var e=lm(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&am(n.ownerDocument.documentElement,n)){if(r!==null&&Xc(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=sm(n,o);var s=sm(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var _k=mn&&"documentMode"in document&&11>=document.documentMode,ui=null,Zc=null,po=null,eu=!1;function cm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;eu||ui==null||ui!==Ds(r)||(r=ui,"selectionStart"in r&&Xc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),po&&ho(po,r)||(po=r,r=Zs(Zc,"onSelect"),0<r.length&&(e=new Vc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ui)))}function Qs(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var di={animationend:Qs("Animation","AnimationEnd"),animationiteration:Qs("Animation","AnimationIteration"),animationstart:Qs("Animation","AnimationStart"),transitionend:Qs("Transition","TransitionEnd")},tu={},um={};mn&&(um=document.createElement("div").style,"AnimationEvent"in window||(delete di.animationend.animation,delete di.animationiteration.animation,delete di.animationstart.animation),"TransitionEvent"in window||delete di.transitionend.transition);function Ys(t){if(tu[t])return tu[t];if(!di[t])return t;var e=di[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in um)return tu[t]=e[n];return t}var dm=Ys("animationend"),fm=Ys("animationiteration"),hm=Ys("animationstart"),pm=Ys("transitionend"),gm=new Map,mm="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Vn(t,e){gm.set(t,e),Sr(e,[t])}for(var nu=0;nu<mm.length;nu++){var ru=mm[nu],Ck=ru.toLowerCase(),Ek=ru[0].toUpperCase()+ru.slice(1);Vn(Ck,"on"+Ek)}Vn(dm,"onAnimationEnd"),Vn(fm,"onAnimationIteration"),Vn(hm,"onAnimationStart"),Vn("dblclick","onDoubleClick"),Vn("focusin","onFocus"),Vn("focusout","onBlur"),Vn(pm,"onTransitionEnd"),ti("onMouseEnter",["mouseout","mouseover"]),ti("onMouseLeave",["mouseout","mouseover"]),ti("onPointerEnter",["pointerout","pointerover"]),ti("onPointerLeave",["pointerout","pointerover"]),Sr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var go="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tk=new Set("cancel close invalid load scroll toggle".split(" ").concat(go));function vm(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,CS(r,e,void 0,t),t.currentTarget=null}function ym(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var o=void 0;if(e)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&i.isPropagationStopped())break e;vm(i,a,c),o=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==o&&i.isPropagationStopped())break e;vm(i,a,c),o=l}}}if(Rs)throw t=Ic,Rs=!1,Ic=null,t}function Ce(t,e){var n=e[du];n===void 0&&(n=e[du]=new Set);var r=t+"__bubble";n.has(r)||(bm(e,t,2,!1),n.add(r))}function iu(t,e,n){var r=0;e&&(r|=4),bm(n,t,r,e)}var Xs="_reactListening"+Math.random().toString(36).slice(2);function mo(t){if(!t[Xs]){t[Xs]=!0,eg.forEach(function(n){n!=="selectionchange"&&(Tk.has(n)||iu(n,!1,t),iu(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Xs]||(e[Xs]=!0,iu("selectionchange",!1,e))}}function bm(t,e,n,r){switch(zg(e)){case 1:var i=US;break;case 4:i=zS;break;default:i=Uc}n=i.bind(null,e,n,t),i=void 0,!Lc||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function ou(t,e,n,r,i){var o=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;s=s.return}for(;a!==null;){if(s=xr(a),s===null)return;if(l=s.tag,l===5||l===6){r=o=s;continue e}a=a.parentNode}}r=r.return}_g(function(){var c=o,d=Oc(n),f=[];e:{var h=gm.get(t);if(h!==void 0){var b=Vc,y=t;switch(t){case"keypress":if(Ks(n)===0)break e;case"keydown":case"keyup":b=rk;break;case"focusin":y="focus",b=qc;break;case"focusout":y="blur",b=qc;break;case"beforeblur":case"afterblur":b=qc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":b=Wg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":b=WS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":b=sk;break;case dm:case fm:case hm:b=JS;break;case pm:b=lk;break;case"scroll":b=HS;break;case"wheel":b=uk;break;case"copy":case"cut":case"paste":b=QS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":b=qg}var m=(e&4)!==0,S=!m&&t==="scroll",v=m?h!==null?h+"Capture":null:h;m=[];for(var w=c,k;w!==null;){k=w;var C=k.stateNode;if(k.tag===5&&C!==null&&(k=C,v!==null&&(C=Yi(w,v),C!=null&&m.push(vo(w,C,k)))),S)break;w=w.return}0<m.length&&(h=new b(h,y,null,n,d),f.push({event:h,listeners:m}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",b=t==="mouseout"||t==="pointerout",h&&n!==Ac&&(y=n.relatedTarget||n.fromElement)&&(xr(y)||y[yn]))break e;if((b||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,b?(y=n.relatedTarget||n.toElement,b=c,y=y?xr(y):null,y!==null&&(S=kr(y),y!==S||y.tag!==5&&y.tag!==6)&&(y=null)):(b=null,y=c),b!==y)){if(m=Wg,C="onMouseLeave",v="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(m=qg,C="onPointerLeave",v="onPointerEnter",w="pointer"),S=b==null?h:pi(b),k=y==null?h:pi(y),h=new m(C,w+"leave",b,n,d),h.target=S,h.relatedTarget=k,C=null,xr(d)===c&&(m=new m(v,w+"enter",y,n,d),m.target=k,m.relatedTarget=S,C=m),S=C,b&&y)t:{for(m=b,v=y,w=0,k=m;k;k=fi(k))w++;for(k=0,C=v;C;C=fi(C))k++;for(;0<w-k;)m=fi(m),w--;for(;0<k-w;)v=fi(v),k--;for(;w--;){if(m===v||v!==null&&m===v.alternate)break t;m=fi(m),v=fi(v)}m=null}else m=null;b!==null&&wm(f,h,b,m,!1),y!==null&&S!==null&&wm(f,S,y,m,!0)}}e:{if(h=c?pi(c):window,b=h.nodeName&&h.nodeName.toLowerCase(),b==="select"||b==="input"&&h.type==="file")var T=vk;else if(Zg(h))if(tm)T=Sk;else{T=bk;var O=yk}else(b=h.nodeName)&&b.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(T=wk);if(T&&(T=T(t,c))){em(f,T,n,d);break e}O&&O(t,h,c),t==="focusout"&&(O=h._wrapperState)&&O.controlled&&h.type==="number"&&_c(h,"number",h.value)}switch(O=c?pi(c):window,t){case"focusin":(Zg(O)||O.contentEditable==="true")&&(ui=O,Zc=c,po=null);break;case"focusout":po=Zc=ui=null;break;case"mousedown":eu=!0;break;case"contextmenu":case"mouseup":case"dragend":eu=!1,cm(f,n,d);break;case"selectionchange":if(_k)break;case"keydown":case"keyup":cm(f,n,d)}var P;if(Gc)e:{switch(t){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else ci?Yg(t,n)&&($="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(Jg&&n.locale!=="ko"&&(ci||$!=="onCompositionStart"?$==="onCompositionEnd"&&ci&&(P=Hg()):(Hn=d,Hc="value"in Hn?Hn.value:Hn.textContent,ci=!0)),O=Zs(c,$),0<O.length&&($=new Kg($,t,null,n,d),f.push({event:$,listeners:O}),P?$.data=P:(P=Xg(n),P!==null&&($.data=P)))),(P=fk?hk(t,n):pk(t,n))&&(c=Zs(c,"onBeforeInput"),0<c.length&&(d=new Kg("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:c}),d.data=P))}ym(f,e)})}function vo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Zs(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=Yi(t,n),o!=null&&r.unshift(vo(t,o,i)),o=Yi(t,e),o!=null&&r.push(vo(t,o,i))),t=t.return}return r}function fi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function wm(t,e,n,r,i){for(var o=e._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=Yi(n,o),l!=null&&s.unshift(vo(n,l,a))):i||(l=Yi(n,o),l!=null&&s.push(vo(n,l,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var Mk=/\r\n?/g,Ak=/\u0000|\uFFFD/g;function Sm(t){return(typeof t=="string"?t:""+t).replace(Mk,`
|
|
372
|
-
`).replace(Ak,"")}function ea(t,e,n){if(e=Sm(e),Sm(t)!==e&&n)throw Error(N(425))}function ta(){}var su=null,au=null;function lu(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var cu=typeof setTimeout=="function"?setTimeout:void 0,Ok=typeof clearTimeout=="function"?clearTimeout:void 0,km=typeof Promise=="function"?Promise:void 0,Pk=typeof queueMicrotask=="function"?queueMicrotask:typeof km<"u"?function(t){return km.resolve(null).then(t).catch(Dk)}:cu;function Dk(t){setTimeout(function(){throw t})}function uu(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),so(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);so(e)}function Wn(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function xm(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var hi=Math.random().toString(36).slice(2),nn="__reactFiber$"+hi,yo="__reactProps$"+hi,yn="__reactContainer$"+hi,du="__reactEvents$"+hi,Lk="__reactListeners$"+hi,Ik="__reactHandles$"+hi;function xr(t){var e=t[nn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[yn]||n[nn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=xm(t);t!==null;){if(n=t[nn])return n;t=xm(t)}return e}t=n,n=t.parentNode}return null}function bo(t){return t=t[nn]||t[yn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function pi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(N(33))}function na(t){return t[yo]||null}var fu=[],gi=-1;function Kn(t){return{current:t}}function Ee(t){0>gi||(t.current=fu[gi],fu[gi]=null,gi--)}function _e(t,e){gi++,fu[gi]=t.current,t.current=e}var qn={},Ge=Kn(qn),at=Kn(!1),_r=qn;function mi(t,e){var n=t.type.contextTypes;if(!n)return qn;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function lt(t){return t=t.childContextTypes,t!=null}function ra(){Ee(at),Ee(Ge)}function _m(t,e,n){if(Ge.current!==qn)throw Error(N(168));_e(Ge,e),_e(at,n)}function Cm(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(N(108,yS(t)||"Unknown",i));return Me({},n,r)}function ia(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||qn,_r=Ge.current,_e(Ge,t),_e(at,at.current),!0}function Em(t,e,n){var r=t.stateNode;if(!r)throw Error(N(169));n?(t=Cm(t,e,_r),r.__reactInternalMemoizedMergedChildContext=t,Ee(at),Ee(Ge),_e(Ge,t)):Ee(at),_e(at,n)}var bn=null,oa=!1,hu=!1;function Tm(t){bn===null?bn=[t]:bn.push(t)}function Rk(t){oa=!0,Tm(t)}function Jn(){if(!hu&&bn!==null){hu=!0;var t=0,e=ve;try{var n=bn;for(ve=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}bn=null,oa=!1}catch(i){throw bn!==null&&(bn=bn.slice(t+1)),Ag(Rc,Jn),i}finally{ve=e,hu=!1}}return null}var vi=[],yi=0,sa=null,aa=0,At=[],Ot=0,Cr=null,wn=1,Sn="";function Er(t,e){vi[yi++]=aa,vi[yi++]=sa,sa=t,aa=e}function Mm(t,e,n){At[Ot++]=wn,At[Ot++]=Sn,At[Ot++]=Cr,Cr=t;var r=wn;t=Sn;var i=32-zt(r)-1;r&=~(1<<i),n+=1;var o=32-zt(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,wn=1<<32-zt(e)+i|n<<i|r,Sn=o+t}else wn=1<<o|n<<i|r,Sn=t}function pu(t){t.return!==null&&(Er(t,1),Mm(t,1,0))}function gu(t){for(;t===sa;)sa=vi[--yi],vi[yi]=null,aa=vi[--yi],vi[yi]=null;for(;t===Cr;)Cr=At[--Ot],At[Ot]=null,Sn=At[--Ot],At[Ot]=null,wn=At[--Ot],At[Ot]=null}var wt=null,St=null,Te=!1,Vt=null;function Am(t,e){var n=It(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Om(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,wt=t,St=Wn(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,wt=t,St=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Cr!==null?{id:wn,overflow:Sn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=It(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,wt=t,St=null,!0):!1;default:return!1}}function mu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function vu(t){if(Te){var e=St;if(e){var n=e;if(!Om(t,e)){if(mu(t))throw Error(N(418));e=Wn(n.nextSibling);var r=wt;e&&Om(t,e)?Am(r,n):(t.flags=t.flags&-4097|2,Te=!1,wt=t)}}else{if(mu(t))throw Error(N(418));t.flags=t.flags&-4097|2,Te=!1,wt=t}}}function Pm(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;wt=t}function la(t){if(t!==wt)return!1;if(!Te)return Pm(t),Te=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!lu(t.type,t.memoizedProps)),e&&(e=St)){if(mu(t))throw Dm(),Error(N(418));for(;e;)Am(t,e),e=Wn(e.nextSibling)}if(Pm(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(N(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){St=Wn(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}St=null}}else St=wt?Wn(t.stateNode.nextSibling):null;return!0}function Dm(){for(var t=St;t;)t=Wn(t.nextSibling)}function bi(){St=wt=null,Te=!1}function yu(t){Vt===null?Vt=[t]:Vt.push(t)}var Nk=vn.ReactCurrentBatchConfig;function wo(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(N(309));var r=n.stateNode}if(!r)throw Error(N(147,t));var i=r,o=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===o?e.ref:(e=function(s){var a=i.refs;s===null?delete a[o]:a[o]=s},e._stringRef=o,e)}if(typeof t!="string")throw Error(N(284));if(!n._owner)throw Error(N(290,t))}return t}function ca(t,e){throw t=Object.prototype.toString.call(e),Error(N(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Lm(t){var e=t._init;return e(t._payload)}function Im(t){function e(v,w){if(t){var k=v.deletions;k===null?(v.deletions=[w],v.flags|=16):k.push(w)}}function n(v,w){if(!t)return null;for(;w!==null;)e(v,w),w=w.sibling;return null}function r(v,w){for(v=new Map;w!==null;)w.key!==null?v.set(w.key,w):v.set(w.index,w),w=w.sibling;return v}function i(v,w){return v=nr(v,w),v.index=0,v.sibling=null,v}function o(v,w,k){return v.index=k,t?(k=v.alternate,k!==null?(k=k.index,k<w?(v.flags|=2,w):k):(v.flags|=2,w)):(v.flags|=1048576,w)}function s(v){return t&&v.alternate===null&&(v.flags|=2),v}function a(v,w,k,C){return w===null||w.tag!==6?(w=cd(k,v.mode,C),w.return=v,w):(w=i(w,k),w.return=v,w)}function l(v,w,k,C){var T=k.type;return T===ri?d(v,w,k.props.children,C,k.key):w!==null&&(w.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===$n&&Lm(T)===w.type)?(C=i(w,k.props),C.ref=wo(v,w,k),C.return=v,C):(C=La(k.type,k.key,k.props,null,v.mode,C),C.ref=wo(v,w,k),C.return=v,C)}function c(v,w,k,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==k.containerInfo||w.stateNode.implementation!==k.implementation?(w=ud(k,v.mode,C),w.return=v,w):(w=i(w,k.children||[]),w.return=v,w)}function d(v,w,k,C,T){return w===null||w.tag!==7?(w=Ir(k,v.mode,C,T),w.return=v,w):(w=i(w,k),w.return=v,w)}function f(v,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=cd(""+w,v.mode,k),w.return=v,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Os:return k=La(w.type,w.key,w.props,null,v.mode,k),k.ref=wo(v,null,w),k.return=v,k;case ni:return w=ud(w,v.mode,k),w.return=v,w;case $n:var C=w._init;return f(v,C(w._payload),k)}if(Ji(w)||Ki(w))return w=Ir(w,v.mode,k,null),w.return=v,w;ca(v,w)}return null}function h(v,w,k,C){var T=w!==null?w.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return T!==null?null:a(v,w,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Os:return k.key===T?l(v,w,k,C):null;case ni:return k.key===T?c(v,w,k,C):null;case $n:return T=k._init,h(v,w,T(k._payload),C)}if(Ji(k)||Ki(k))return T!==null?null:d(v,w,k,C,null);ca(v,k)}return null}function b(v,w,k,C,T){if(typeof C=="string"&&C!==""||typeof C=="number")return v=v.get(k)||null,a(w,v,""+C,T);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Os:return v=v.get(C.key===null?k:C.key)||null,l(w,v,C,T);case ni:return v=v.get(C.key===null?k:C.key)||null,c(w,v,C,T);case $n:var O=C._init;return b(v,w,k,O(C._payload),T)}if(Ji(C)||Ki(C))return v=v.get(k)||null,d(w,v,C,T,null);ca(w,C)}return null}function y(v,w,k,C){for(var T=null,O=null,P=w,$=w=0,X=null;P!==null&&$<k.length;$++){P.index>$?(X=P,P=null):X=P.sibling;var V=h(v,P,k[$],C);if(V===null){P===null&&(P=X);break}t&&P&&V.alternate===null&&e(v,P),w=o(V,w,$),O===null?T=V:O.sibling=V,O=V,P=X}if($===k.length)return n(v,P),Te&&Er(v,$),T;if(P===null){for(;$<k.length;$++)P=f(v,k[$],C),P!==null&&(w=o(P,w,$),O===null?T=P:O.sibling=P,O=P);return Te&&Er(v,$),T}for(P=r(v,P);$<k.length;$++)X=b(P,v,$,k[$],C),X!==null&&(t&&X.alternate!==null&&P.delete(X.key===null?$:X.key),w=o(X,w,$),O===null?T=X:O.sibling=X,O=X);return t&&P.forEach(function(B){return e(v,B)}),Te&&Er(v,$),T}function m(v,w,k,C){var T=Ki(k);if(typeof T!="function")throw Error(N(150));if(k=T.call(k),k==null)throw Error(N(151));for(var O=T=null,P=w,$=w=0,X=null,V=k.next();P!==null&&!V.done;$++,V=k.next()){P.index>$?(X=P,P=null):X=P.sibling;var B=h(v,P,V.value,C);if(B===null){P===null&&(P=X);break}t&&P&&B.alternate===null&&e(v,P),w=o(B,w,$),O===null?T=B:O.sibling=B,O=B,P=X}if(V.done)return n(v,P),Te&&Er(v,$),T;if(P===null){for(;!V.done;$++,V=k.next())V=f(v,V.value,C),V!==null&&(w=o(V,w,$),O===null?T=V:O.sibling=V,O=V);return Te&&Er(v,$),T}for(P=r(v,P);!V.done;$++,V=k.next())V=b(P,v,$,V.value,C),V!==null&&(t&&V.alternate!==null&&P.delete(V.key===null?$:V.key),w=o(V,w,$),O===null?T=V:O.sibling=V,O=V);return t&&P.forEach(function(W){return e(v,W)}),Te&&Er(v,$),T}function S(v,w,k,C){if(typeof k=="object"&&k!==null&&k.type===ri&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Os:e:{for(var T=k.key,O=w;O!==null;){if(O.key===T){if(T=k.type,T===ri){if(O.tag===7){n(v,O.sibling),w=i(O,k.props.children),w.return=v,v=w;break e}}else if(O.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===$n&&Lm(T)===O.type){n(v,O.sibling),w=i(O,k.props),w.ref=wo(v,O,k),w.return=v,v=w;break e}n(v,O);break}else e(v,O);O=O.sibling}k.type===ri?(w=Ir(k.props.children,v.mode,C,k.key),w.return=v,v=w):(C=La(k.type,k.key,k.props,null,v.mode,C),C.ref=wo(v,w,k),C.return=v,v=C)}return s(v);case ni:e:{for(O=k.key;w!==null;){if(w.key===O)if(w.tag===4&&w.stateNode.containerInfo===k.containerInfo&&w.stateNode.implementation===k.implementation){n(v,w.sibling),w=i(w,k.children||[]),w.return=v,v=w;break e}else{n(v,w);break}else e(v,w);w=w.sibling}w=ud(k,v.mode,C),w.return=v,v=w}return s(v);case $n:return O=k._init,S(v,w,O(k._payload),C)}if(Ji(k))return y(v,w,k,C);if(Ki(k))return m(v,w,k,C);ca(v,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,w!==null&&w.tag===6?(n(v,w.sibling),w=i(w,k),w.return=v,v=w):(n(v,w),w=cd(k,v.mode,C),w.return=v,v=w),s(v)):n(v,w)}return S}var wi=Im(!0),Rm=Im(!1),ua=Kn(null),da=null,Si=null,bu=null;function wu(){bu=Si=da=null}function Su(t){var e=ua.current;Ee(ua),t._currentValue=e}function ku(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ki(t,e){da=t,bu=Si=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(ct=!0),t.firstContext=null)}function Pt(t){var e=t._currentValue;if(bu!==t)if(t={context:t,memoizedValue:e,next:null},Si===null){if(da===null)throw Error(N(308));Si=t,da.dependencies={lanes:0,firstContext:t}}else Si=Si.next=t;return e}var Tr=null;function xu(t){Tr===null?Tr=[t]:Tr.push(t)}function Nm(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,xu(e)):(n.next=i.next,i.next=n),e.interleaved=n,kn(t,r)}function kn(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Gn=!1;function _u(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $m(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function xn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Qn(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,he&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,kn(t,n)}return i=r.interleaved,i===null?(e.next=e,xu(r)):(e.next=i.next,i.next=e),r.interleaved=e,kn(t,n)}function fa(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Fc(t,n)}}function Fm(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function ha(t,e,n,r){var i=t.updateQueue;Gn=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?o=c:s.next=c,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,d=c=l=null,a=o;do{var h=a.lane,b=a.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:b,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=t,m=a;switch(h=e,b=n,m.tag){case 1:if(y=m.payload,typeof y=="function"){f=y.call(b,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=m.payload,h=typeof y=="function"?y.call(b,f,h):y,h==null)break e;f=Me({},f,h);break e;case 2:Gn=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else b={eventTime:b,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=b,l=f):d=d.next=b,s|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Or|=s,t.lanes=s,t.memoizedState=f}}function Bm(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(N(191,i));i.call(r)}}}var So={},rn=Kn(So),ko=Kn(So),xo=Kn(So);function Mr(t){if(t===So)throw Error(N(174));return t}function Cu(t,e){switch(_e(xo,e),_e(ko,t),_e(rn,So),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ec(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ec(e,t)}Ee(rn),_e(rn,e)}function xi(){Ee(rn),Ee(ko),Ee(xo)}function jm(t){Mr(xo.current);var e=Mr(rn.current),n=Ec(e,t.type);e!==n&&(_e(ko,t),_e(rn,n))}function Eu(t){ko.current===t&&(Ee(rn),Ee(ko))}var Ae=Kn(0);function pa(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Tu=[];function Mu(){for(var t=0;t<Tu.length;t++)Tu[t]._workInProgressVersionPrimary=null;Tu.length=0}var ga=vn.ReactCurrentDispatcher,Au=vn.ReactCurrentBatchConfig,Ar=0,Oe=null,Re=null,Fe=null,ma=!1,_o=!1,Co=0,$k=0;function Qe(){throw Error(N(321))}function Ou(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Ht(t[n],e[n]))return!1;return!0}function Pu(t,e,n,r,i,o){if(Ar=o,Oe=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ga.current=t===null||t.memoizedState===null?Uk:zk,t=n(r,i),_o){o=0;do{if(_o=!1,Co=0,25<=o)throw Error(N(301));o+=1,Fe=Re=null,e.updateQueue=null,ga.current=Hk,t=n(r,i)}while(_o)}if(ga.current=ba,e=Re!==null&&Re.next!==null,Ar=0,Fe=Re=Oe=null,ma=!1,e)throw Error(N(300));return t}function Du(){var t=Co!==0;return Co=0,t}function on(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fe===null?Oe.memoizedState=Fe=t:Fe=Fe.next=t,Fe}function Dt(){if(Re===null){var t=Oe.alternate;t=t!==null?t.memoizedState:null}else t=Re.next;var e=Fe===null?Oe.memoizedState:Fe.next;if(e!==null)Fe=e,Re=t;else{if(t===null)throw Error(N(310));Re=t,t={memoizedState:Re.memoizedState,baseState:Re.baseState,baseQueue:Re.baseQueue,queue:Re.queue,next:null},Fe===null?Oe.memoizedState=Fe=t:Fe=Fe.next=t}return Fe}function Eo(t,e){return typeof e=="function"?e(t):e}function Lu(t){var e=Dt(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=Re,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var a=s=null,l=null,c=o;do{var d=c.lane;if((Ar&d)===d)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var f={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,s=r):l=l.next=f,Oe.lanes|=d,Or|=d}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,Ht(r,e.memoizedState)||(ct=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do o=i.lane,Oe.lanes|=o,Or|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Iu(t){var e=Dt(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,o=e.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=t(o,s.action),s=s.next;while(s!==i);Ht(o,e.memoizedState)||(ct=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function Um(){}function zm(t,e){var n=Oe,r=Dt(),i=e(),o=!Ht(r.memoizedState,i);if(o&&(r.memoizedState=i,ct=!0),r=r.queue,Ru(Wm.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||Fe!==null&&Fe.memoizedState.tag&1){if(n.flags|=2048,To(9,Vm.bind(null,n,r,i,e),void 0,null),Be===null)throw Error(N(349));Ar&30||Hm(n,e,i)}return i}function Hm(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Oe.updateQueue,e===null?(e={lastEffect:null,stores:null},Oe.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Vm(t,e,n,r){e.value=n,e.getSnapshot=r,Km(e)&&qm(t)}function Wm(t,e,n){return n(function(){Km(e)&&qm(t)})}function Km(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Ht(t,n)}catch{return!0}}function qm(t){var e=kn(t,1);e!==null&&Jt(e,t,1,-1)}function Jm(t){var e=on();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:t},e.queue=t,t=t.dispatch=jk.bind(null,Oe,t),[e.memoizedState,t]}function To(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Oe.updateQueue,e===null?(e={lastEffect:null,stores:null},Oe.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function Gm(){return Dt().memoizedState}function va(t,e,n,r){var i=on();Oe.flags|=t,i.memoizedState=To(1|e,n,void 0,r===void 0?null:r)}function ya(t,e,n,r){var i=Dt();r=r===void 0?null:r;var o=void 0;if(Re!==null){var s=Re.memoizedState;if(o=s.destroy,r!==null&&Ou(r,s.deps)){i.memoizedState=To(e,n,o,r);return}}Oe.flags|=t,i.memoizedState=To(1|e,n,o,r)}function Qm(t,e){return va(8390656,8,t,e)}function Ru(t,e){return ya(2048,8,t,e)}function Ym(t,e){return ya(4,2,t,e)}function Xm(t,e){return ya(4,4,t,e)}function Zm(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function ev(t,e,n){return n=n!=null?n.concat([t]):null,ya(4,4,Zm.bind(null,e,t),n)}function Nu(){}function tv(t,e){var n=Dt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Ou(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function nv(t,e){var n=Dt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Ou(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function rv(t,e,n){return Ar&21?(Ht(n,e)||(n=Lg(),Oe.lanes|=n,Or|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,ct=!0),t.memoizedState=n)}function Fk(t,e){var n=ve;ve=n!==0&&4>n?n:4,t(!0);var r=Au.transition;Au.transition={};try{t(!1),e()}finally{ve=n,Au.transition=r}}function iv(){return Dt().memoizedState}function Bk(t,e,n){var r=er(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ov(t))sv(e,n);else if(n=Nm(t,e,n,r),n!==null){var i=st();Jt(n,t,r,i),av(n,e,r)}}function jk(t,e,n){var r=er(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ov(t))sv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Ht(a,s)){var l=e.interleaved;l===null?(i.next=i,xu(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Nm(t,e,i,r),n!==null&&(i=st(),Jt(n,t,r,i),av(n,e,r))}}function ov(t){var e=t.alternate;return t===Oe||e!==null&&e===Oe}function sv(t,e){_o=ma=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function av(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Fc(t,n)}}var ba={readContext:Pt,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useInsertionEffect:Qe,useLayoutEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useMutableSource:Qe,useSyncExternalStore:Qe,useId:Qe,unstable_isNewReconciler:!1},Uk={readContext:Pt,useCallback:function(t,e){return on().memoizedState=[t,e===void 0?null:e],t},useContext:Pt,useEffect:Qm,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,va(4194308,4,Zm.bind(null,e,t),n)},useLayoutEffect:function(t,e){return va(4194308,4,t,e)},useInsertionEffect:function(t,e){return va(4,2,t,e)},useMemo:function(t,e){var n=on();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=on();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Bk.bind(null,Oe,t),[r.memoizedState,t]},useRef:function(t){var e=on();return t={current:t},e.memoizedState=t},useState:Jm,useDebugValue:Nu,useDeferredValue:function(t){return on().memoizedState=t},useTransition:function(){var t=Jm(!1),e=t[0];return t=Fk.bind(null,t[1]),on().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Oe,i=on();if(Te){if(n===void 0)throw Error(N(407));n=n()}else{if(n=e(),Be===null)throw Error(N(349));Ar&30||Hm(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Qm(Wm.bind(null,r,o,t),[t]),r.flags|=2048,To(9,Vm.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=on(),e=Be.identifierPrefix;if(Te){var n=Sn,r=wn;n=(r&~(1<<32-zt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Co++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=$k++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},zk={readContext:Pt,useCallback:tv,useContext:Pt,useEffect:Ru,useImperativeHandle:ev,useInsertionEffect:Ym,useLayoutEffect:Xm,useMemo:nv,useReducer:Lu,useRef:Gm,useState:function(){return Lu(Eo)},useDebugValue:Nu,useDeferredValue:function(t){var e=Dt();return rv(e,Re.memoizedState,t)},useTransition:function(){var t=Lu(Eo)[0],e=Dt().memoizedState;return[t,e]},useMutableSource:Um,useSyncExternalStore:zm,useId:iv,unstable_isNewReconciler:!1},Hk={readContext:Pt,useCallback:tv,useContext:Pt,useEffect:Ru,useImperativeHandle:ev,useInsertionEffect:Ym,useLayoutEffect:Xm,useMemo:nv,useReducer:Iu,useRef:Gm,useState:function(){return Iu(Eo)},useDebugValue:Nu,useDeferredValue:function(t){var e=Dt();return Re===null?e.memoizedState=t:rv(e,Re.memoizedState,t)},useTransition:function(){var t=Iu(Eo)[0],e=Dt().memoizedState;return[t,e]},useMutableSource:Um,useSyncExternalStore:zm,useId:iv,unstable_isNewReconciler:!1};function Wt(t,e){if(t&&t.defaultProps){e=Me({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function $u(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Me({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var wa={isMounted:function(t){return(t=t._reactInternals)?kr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=st(),i=er(t),o=xn(r,i);o.payload=e,n!=null&&(o.callback=n),e=Qn(t,o,i),e!==null&&(Jt(e,t,i,r),fa(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=st(),i=er(t),o=xn(r,i);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=Qn(t,o,i),e!==null&&(Jt(e,t,i,r),fa(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=st(),r=er(t),i=xn(n,r);i.tag=2,e!=null&&(i.callback=e),e=Qn(t,i,r),e!==null&&(Jt(e,t,r,n),fa(e,t,r))}};function lv(t,e,n,r,i,o,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,o,s):e.prototype&&e.prototype.isPureReactComponent?!ho(n,r)||!ho(i,o):!0}function cv(t,e,n){var r=!1,i=qn,o=e.contextType;return typeof o=="object"&&o!==null?o=Pt(o):(i=lt(e)?_r:Ge.current,r=e.contextTypes,o=(r=r!=null)?mi(t,i):qn),e=new e(n,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=wa,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function uv(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&wa.enqueueReplaceState(e,e.state,null)}function Fu(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},_u(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Pt(o):(o=lt(e)?_r:Ge.current,i.context=mi(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&($u(t,e,o,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&wa.enqueueReplaceState(i,i.state,null),ha(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function _i(t,e){try{var n="",r=e;do n+=vS(r),r=r.return;while(r);var i=n}catch(o){i=`
|
|
371
|
+
`+i[s].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{wc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?qi(t):""}function yS(t){switch(t.tag){case 5:return qi(t.type);case 16:return qi("Lazy");case 13:return qi("Suspense");case 19:return qi("SuspenseList");case 0:case 2:case 15:return t=Sc(t.type,!1),t;case 11:return t=Sc(t.type.render,!1),t;case 1:return t=Sc(t.type,!0),t;default:return""}}function kc(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ri:return"Fragment";case ni:return"Portal";case pc:return"Profiler";case hc:return"StrictMode";case mc:return"Suspense";case vc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case og:return(t.displayName||"Context")+".Consumer";case ig:return(t._context.displayName||"Context")+".Provider";case gc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case yc:return e=t.displayName||null,e!==null?e:kc(t.type)||"Memo";case Fn:e=t._payload,t=t._init;try{return kc(t(e))}catch{}}return null}function bS(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return kc(e);case 8:return e===hc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Bn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function lg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function wS(t){var e=lg(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ds(t){t._valueTracker||(t._valueTracker=wS(t))}function cg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=lg(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ps(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function xc(t,e){var n=e.checked;return Me({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function ug(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Bn(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function dg(t,e){e=e.checked,e!=null&&fc(t,"checked",e,!1)}function _c(t,e){dg(t,e);var n=Bn(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Cc(t,e.type,n):e.hasOwnProperty("defaultValue")&&Cc(t,e.type,Bn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function fg(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Cc(t,e,n){(e!=="number"||Ps(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ji=Array.isArray;function ii(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Bn(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Ec(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(N(91));return Me({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function hg(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(N(92));if(Ji(n)){if(1<n.length)throw Error(N(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Bn(n)}}function pg(t,e){var n=Bn(e.value),r=Bn(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function gg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function mg(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Tc(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?mg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ls,vg=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Ls=Ls||document.createElement("div"),Ls.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Ls.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Gi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Qi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},SS=["Webkit","ms","Moz","O"];Object.keys(Qi).forEach(function(t){SS.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Qi[e]=Qi[t]})});function yg(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Qi.hasOwnProperty(t)&&Qi[t]?(""+e).trim():e+"px"}function bg(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=yg(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var kS=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Mc(t,e){if(e){if(kS[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(N(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(N(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(N(61))}if(e.style!=null&&typeof e.style!="object")throw Error(N(62))}}function Ac(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Oc=null;function Dc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Pc=null,oi=null,si=null;function wg(t){if(t=bo(t)){if(typeof Pc!="function")throw Error(N(280));var e=t.stateNode;e&&(e=na(e),Pc(t.stateNode,t.type,e))}}function Sg(t){oi?si?si.push(t):si=[t]:oi=t}function kg(){if(oi){var t=oi,e=si;if(si=oi=null,wg(t),e)for(t=0;t<e.length;t++)wg(e[t])}}function xg(t,e){return t(e)}function _g(){}var Lc=!1;function Cg(t,e,n){if(Lc)return t(e,n);Lc=!0;try{return xg(t,e,n)}finally{Lc=!1,(oi!==null||si!==null)&&(_g(),kg())}}function Yi(t,e){var n=t.stateNode;if(n===null)return null;var r=na(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(N(231,e,typeof n));return n}var Ic=!1;if(mn)try{var Xi={};Object.defineProperty(Xi,"passive",{get:function(){Ic=!0}}),window.addEventListener("test",Xi,Xi),window.removeEventListener("test",Xi,Xi)}catch{Ic=!1}function xS(t,e,n,r,i,o,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(d){this.onError(d)}}var Zi=!1,Is=null,Rs=!1,Rc=null,_S={onError:function(t){Zi=!0,Is=t}};function CS(t,e,n,r,i,o,s,a,l){Zi=!1,Is=null,xS.apply(_S,arguments)}function ES(t,e,n,r,i,o,s,a,l){if(CS.apply(this,arguments),Zi){if(Zi){var c=Is;Zi=!1,Is=null}else throw Error(N(198));Rs||(Rs=!0,Rc=c)}}function xr(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function Eg(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Tg(t){if(xr(t)!==t)throw Error(N(188))}function TS(t){var e=t.alternate;if(!e){if(e=xr(t),e===null)throw Error(N(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Tg(i),t;if(o===r)return Tg(i),e;o=o.sibling}throw Error(N(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s){for(a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s)throw Error(N(189))}}if(n.alternate!==r)throw Error(N(190))}if(n.tag!==3)throw Error(N(188));return n.stateNode.current===n?t:e}function Mg(t){return t=TS(t),t!==null?Ag(t):null}function Ag(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Ag(t);if(e!==null)return e;t=t.sibling}return null}var Og=yt.unstable_scheduleCallback,Dg=yt.unstable_cancelCallback,MS=yt.unstable_shouldYield,AS=yt.unstable_requestPaint,Le=yt.unstable_now,OS=yt.unstable_getCurrentPriorityLevel,Nc=yt.unstable_ImmediatePriority,Pg=yt.unstable_UserBlockingPriority,Ns=yt.unstable_NormalPriority,DS=yt.unstable_LowPriority,Lg=yt.unstable_IdlePriority,$s=null,tn=null;function PS(t){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot($s,t,void 0,(t.current.flags&128)===128)}catch{}}var zt=Math.clz32?Math.clz32:RS,LS=Math.log,IS=Math.LN2;function RS(t){return t>>>=0,t===0?32:31-(LS(t)/IS|0)|0}var Fs=64,Bs=4194304;function eo(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function js(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=eo(a):(o&=s,o!==0&&(r=eo(o)))}else s=n&~i,s!==0?r=eo(s):o!==0&&(r=eo(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-zt(e),i=1<<n,r|=t[n],e&=~i;return r}function NS(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $S(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-zt(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=NS(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}function $c(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Ig(){var t=Fs;return Fs<<=1,!(Fs&4194240)&&(Fs=64),t}function Fc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function to(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-zt(e),t[e]=n}function FS(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-zt(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function Bc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-zt(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var ve=0;function Rg(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Ng,jc,$g,Fg,Bg,Uc=!1,Us=[],jn=null,Un=null,zn=null,no=new Map,ro=new Map,Hn=[],BS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function jg(t,e){switch(t){case"focusin":case"focusout":jn=null;break;case"dragenter":case"dragleave":Un=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":no.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":ro.delete(e.pointerId)}}function io(t,e,n,r,i,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},e!==null&&(e=bo(e),e!==null&&jc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function jS(t,e,n,r,i){switch(e){case"focusin":return jn=io(jn,t,e,n,r,i),!0;case"dragenter":return Un=io(Un,t,e,n,r,i),!0;case"mouseover":return zn=io(zn,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return no.set(o,io(no.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,ro.set(o,io(ro.get(o)||null,t,e,n,r,i)),!0}return!1}function Ug(t){var e=_r(t.target);if(e!==null){var n=xr(e);if(n!==null){if(e=n.tag,e===13){if(e=Eg(n),e!==null){t.blockedOn=e,Bg(t.priority,function(){$g(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function zs(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Hc(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Oc=r,n.target.dispatchEvent(r),Oc=null}else return e=bo(n),e!==null&&jc(e),t.blockedOn=n,!1;e.shift()}return!0}function zg(t,e,n){zs(t)&&n.delete(e)}function US(){Uc=!1,jn!==null&&zs(jn)&&(jn=null),Un!==null&&zs(Un)&&(Un=null),zn!==null&&zs(zn)&&(zn=null),no.forEach(zg),ro.forEach(zg)}function oo(t,e){t.blockedOn===e&&(t.blockedOn=null,Uc||(Uc=!0,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,US)))}function so(t){function e(i){return oo(i,t)}if(0<Us.length){oo(Us[0],t);for(var n=1;n<Us.length;n++){var r=Us[n];r.blockedOn===t&&(r.blockedOn=null)}}for(jn!==null&&oo(jn,t),Un!==null&&oo(Un,t),zn!==null&&oo(zn,t),no.forEach(e),ro.forEach(e),n=0;n<Hn.length;n++)r=Hn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Hn.length&&(n=Hn[0],n.blockedOn===null);)Ug(n),n.blockedOn===null&&Hn.shift()}var ai=vn.ReactCurrentBatchConfig,Hs=!0;function zS(t,e,n,r){var i=ve,o=ai.transition;ai.transition=null;try{ve=1,zc(t,e,n,r)}finally{ve=i,ai.transition=o}}function HS(t,e,n,r){var i=ve,o=ai.transition;ai.transition=null;try{ve=4,zc(t,e,n,r)}finally{ve=i,ai.transition=o}}function zc(t,e,n,r){if(Hs){var i=Hc(t,e,n,r);if(i===null)su(t,e,r,Vs,n),jg(t,r);else if(jS(i,t,e,n,r))r.stopPropagation();else if(jg(t,r),e&4&&-1<BS.indexOf(t)){for(;i!==null;){var o=bo(i);if(o!==null&&Ng(o),o=Hc(t,e,n,r),o===null&&su(t,e,r,Vs,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else su(t,e,r,null,n)}}var Vs=null;function Hc(t,e,n,r){if(Vs=null,t=Dc(r),t=_r(t),t!==null)if(e=xr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Eg(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Vs=t,null}function Hg(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(OS()){case Nc:return 1;case Pg:return 4;case Ns:case DS:return 16;case Lg:return 536870912;default:return 16}default:return 16}}var Vn=null,Vc=null,Ks=null;function Vg(){if(Ks)return Ks;var t,e=Vc,n=e.length,r,i="value"in Vn?Vn.value:Vn.textContent,o=i.length;for(t=0;t<n&&e[t]===i[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===i[o-r];r++);return Ks=i.slice(t,1<r?1-r:void 0)}function Ws(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function qs(){return!0}function Kg(){return!1}function bt(t){function e(n,r,i,o,s){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?qs:Kg,this.isPropagationStopped=Kg,this}return Me(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=qs)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=qs)},persist:function(){},isPersistent:qs}),e}var li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kc=bt(li),ao=Me({},li,{view:0,detail:0}),VS=bt(ao),Wc,qc,lo,Js=Me({},ao,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==lo&&(lo&&t.type==="mousemove"?(Wc=t.screenX-lo.screenX,qc=t.screenY-lo.screenY):qc=Wc=0,lo=t),Wc)},movementY:function(t){return"movementY"in t?t.movementY:qc}}),Wg=bt(Js),KS=Me({},Js,{dataTransfer:0}),WS=bt(KS),qS=Me({},ao,{relatedTarget:0}),Jc=bt(qS),JS=Me({},li,{animationName:0,elapsedTime:0,pseudoElement:0}),GS=bt(JS),QS=Me({},li,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),YS=bt(QS),XS=Me({},li,{data:0}),qg=bt(XS),ZS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ek={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},tk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nk(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=tk[t])?!!e[t]:!1}function Gc(){return nk}var rk=Me({},ao,{key:function(t){if(t.key){var e=ZS[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ws(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?ek[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gc,charCode:function(t){return t.type==="keypress"?Ws(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ws(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ik=bt(rk),ok=Me({},Js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jg=bt(ok),sk=Me({},ao,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gc}),ak=bt(sk),lk=Me({},li,{propertyName:0,elapsedTime:0,pseudoElement:0}),ck=bt(lk),uk=Me({},Js,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),dk=bt(uk),fk=[9,13,27,32],Qc=mn&&"CompositionEvent"in window,co=null;mn&&"documentMode"in document&&(co=document.documentMode);var hk=mn&&"TextEvent"in window&&!co,Gg=mn&&(!Qc||co&&8<co&&11>=co),Qg=" ",Yg=!1;function Xg(t,e){switch(t){case"keyup":return fk.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ci=!1;function pk(t,e){switch(t){case"compositionend":return Zg(e);case"keypress":return e.which!==32?null:(Yg=!0,Qg);case"textInput":return t=e.data,t===Qg&&Yg?null:t;default:return null}}function gk(t,e){if(ci)return t==="compositionend"||!Qc&&Xg(t,e)?(t=Vg(),Ks=Vc=Vn=null,ci=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Gg&&e.locale!=="ko"?null:e.data;default:return null}}var mk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function em(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!mk[t.type]:e==="textarea"}function tm(t,e,n,r){Sg(r),e=Zs(e,"onChange"),0<e.length&&(n=new Kc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var uo=null,fo=null;function vk(t){bm(t,0)}function Gs(t){var e=pi(t);if(cg(e))return t}function yk(t,e){if(t==="change")return e}var nm=!1;if(mn){var Yc;if(mn){var Xc="oninput"in document;if(!Xc){var rm=document.createElement("div");rm.setAttribute("oninput","return;"),Xc=typeof rm.oninput=="function"}Yc=Xc}else Yc=!1;nm=Yc&&(!document.documentMode||9<document.documentMode)}function im(){uo&&(uo.detachEvent("onpropertychange",om),fo=uo=null)}function om(t){if(t.propertyName==="value"&&Gs(fo)){var e=[];tm(e,fo,t,Dc(t)),Cg(vk,e)}}function bk(t,e,n){t==="focusin"?(im(),uo=e,fo=n,uo.attachEvent("onpropertychange",om)):t==="focusout"&&im()}function wk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Gs(fo)}function Sk(t,e){if(t==="click")return Gs(e)}function kk(t,e){if(t==="input"||t==="change")return Gs(e)}function xk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ht=typeof Object.is=="function"?Object.is:xk;function ho(t,e){if(Ht(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!cc.call(e,i)||!Ht(t[i],e[i]))return!1}return!0}function sm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function am(t,e){var n=sm(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=sm(n)}}function lm(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?lm(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function cm(){for(var t=window,e=Ps();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ps(t.document)}return e}function Zc(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function _k(t){var e=cm(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&lm(n.ownerDocument.documentElement,n)){if(r!==null&&Zc(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=am(n,o);var s=am(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Ck=mn&&"documentMode"in document&&11>=document.documentMode,ui=null,eu=null,po=null,tu=!1;function um(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;tu||ui==null||ui!==Ps(r)||(r=ui,"selectionStart"in r&&Zc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),po&&ho(po,r)||(po=r,r=Zs(eu,"onSelect"),0<r.length&&(e=new Kc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ui)))}function Qs(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var di={animationend:Qs("Animation","AnimationEnd"),animationiteration:Qs("Animation","AnimationIteration"),animationstart:Qs("Animation","AnimationStart"),transitionend:Qs("Transition","TransitionEnd")},nu={},dm={};mn&&(dm=document.createElement("div").style,"AnimationEvent"in window||(delete di.animationend.animation,delete di.animationiteration.animation,delete di.animationstart.animation),"TransitionEvent"in window||delete di.transitionend.transition);function Ys(t){if(nu[t])return nu[t];if(!di[t])return t;var e=di[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in dm)return nu[t]=e[n];return t}var fm=Ys("animationend"),hm=Ys("animationiteration"),pm=Ys("animationstart"),gm=Ys("transitionend"),mm=new Map,vm="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Kn(t,e){mm.set(t,e),kr(e,[t])}for(var ru=0;ru<vm.length;ru++){var iu=vm[ru],Ek=iu.toLowerCase(),Tk=iu[0].toUpperCase()+iu.slice(1);Kn(Ek,"on"+Tk)}Kn(fm,"onAnimationEnd"),Kn(hm,"onAnimationIteration"),Kn(pm,"onAnimationStart"),Kn("dblclick","onDoubleClick"),Kn("focusin","onFocus"),Kn("focusout","onBlur"),Kn(gm,"onTransitionEnd"),ti("onMouseEnter",["mouseout","mouseover"]),ti("onMouseLeave",["mouseout","mouseover"]),ti("onPointerEnter",["pointerout","pointerover"]),ti("onPointerLeave",["pointerout","pointerover"]),kr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),kr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),kr("onBeforeInput",["compositionend","keypress","textInput","paste"]),kr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),kr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),kr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var go="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Mk=new Set("cancel close invalid load scroll toggle".split(" ").concat(go));function ym(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,ES(r,e,void 0,t),t.currentTarget=null}function bm(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var o=void 0;if(e)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&i.isPropagationStopped())break e;ym(i,a,c),o=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==o&&i.isPropagationStopped())break e;ym(i,a,c),o=l}}}if(Rs)throw t=Rc,Rs=!1,Rc=null,t}function Ce(t,e){var n=e[fu];n===void 0&&(n=e[fu]=new Set);var r=t+"__bubble";n.has(r)||(wm(e,t,2,!1),n.add(r))}function ou(t,e,n){var r=0;e&&(r|=4),wm(n,t,r,e)}var Xs="_reactListening"+Math.random().toString(36).slice(2);function mo(t){if(!t[Xs]){t[Xs]=!0,tg.forEach(function(n){n!=="selectionchange"&&(Mk.has(n)||ou(n,!1,t),ou(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Xs]||(e[Xs]=!0,ou("selectionchange",!1,e))}}function wm(t,e,n,r){switch(Hg(e)){case 1:var i=zS;break;case 4:i=HS;break;default:i=zc}n=i.bind(null,e,n,t),i=void 0,!Ic||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function su(t,e,n,r,i){var o=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;s=s.return}for(;a!==null;){if(s=_r(a),s===null)return;if(l=s.tag,l===5||l===6){r=o=s;continue e}a=a.parentNode}}r=r.return}Cg(function(){var c=o,d=Dc(n),f=[];e:{var h=mm.get(t);if(h!==void 0){var b=Kc,y=t;switch(t){case"keypress":if(Ws(n)===0)break e;case"keydown":case"keyup":b=ik;break;case"focusin":y="focus",b=Jc;break;case"focusout":y="blur",b=Jc;break;case"beforeblur":case"afterblur":b=Jc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":b=Wg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":b=WS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":b=ak;break;case fm:case hm:case pm:b=GS;break;case gm:b=ck;break;case"scroll":b=VS;break;case"wheel":b=dk;break;case"copy":case"cut":case"paste":b=YS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":b=Jg}var g=(e&4)!==0,S=!g&&t==="scroll",v=g?h!==null?h+"Capture":null:h;g=[];for(var w=c,k;w!==null;){k=w;var C=k.stateNode;if(k.tag===5&&C!==null&&(k=C,v!==null&&(C=Yi(w,v),C!=null&&g.push(vo(w,C,k)))),S)break;w=w.return}0<g.length&&(h=new b(h,y,null,n,d),f.push({event:h,listeners:g}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",b=t==="mouseout"||t==="pointerout",h&&n!==Oc&&(y=n.relatedTarget||n.fromElement)&&(_r(y)||y[yn]))break e;if((b||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,b?(y=n.relatedTarget||n.toElement,b=c,y=y?_r(y):null,y!==null&&(S=xr(y),y!==S||y.tag!==5&&y.tag!==6)&&(y=null)):(b=null,y=c),b!==y)){if(g=Wg,C="onMouseLeave",v="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(g=Jg,C="onPointerLeave",v="onPointerEnter",w="pointer"),S=b==null?h:pi(b),k=y==null?h:pi(y),h=new g(C,w+"leave",b,n,d),h.target=S,h.relatedTarget=k,C=null,_r(d)===c&&(g=new g(v,w+"enter",y,n,d),g.target=k,g.relatedTarget=S,C=g),S=C,b&&y)t:{for(g=b,v=y,w=0,k=g;k;k=fi(k))w++;for(k=0,C=v;C;C=fi(C))k++;for(;0<w-k;)g=fi(g),w--;for(;0<k-w;)v=fi(v),k--;for(;w--;){if(g===v||v!==null&&g===v.alternate)break t;g=fi(g),v=fi(v)}g=null}else g=null;b!==null&&Sm(f,h,b,g,!1),y!==null&&S!==null&&Sm(f,S,y,g,!0)}}e:{if(h=c?pi(c):window,b=h.nodeName&&h.nodeName.toLowerCase(),b==="select"||b==="input"&&h.type==="file")var E=yk;else if(em(h))if(nm)E=kk;else{E=wk;var A=bk}else(b=h.nodeName)&&b.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(E=Sk);if(E&&(E=E(t,c))){tm(f,E,n,d);break e}A&&A(t,h,c),t==="focusout"&&(A=h._wrapperState)&&A.controlled&&h.type==="number"&&Cc(h,"number",h.value)}switch(A=c?pi(c):window,t){case"focusin":(em(A)||A.contentEditable==="true")&&(ui=A,eu=c,po=null);break;case"focusout":po=eu=ui=null;break;case"mousedown":tu=!0;break;case"contextmenu":case"mouseup":case"dragend":tu=!1,um(f,n,d);break;case"selectionchange":if(Ck)break;case"keydown":case"keyup":um(f,n,d)}var D;if(Qc)e:{switch(t){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else ci?Xg(t,n)&&($="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(Gg&&n.locale!=="ko"&&(ci||$!=="onCompositionStart"?$==="onCompositionEnd"&&ci&&(D=Vg()):(Vn=d,Vc="value"in Vn?Vn.value:Vn.textContent,ci=!0)),A=Zs(c,$),0<A.length&&($=new qg($,t,null,n,d),f.push({event:$,listeners:A}),D?$.data=D:(D=Zg(n),D!==null&&($.data=D)))),(D=hk?pk(t,n):gk(t,n))&&(c=Zs(c,"onBeforeInput"),0<c.length&&(d=new qg("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:c}),d.data=D))}bm(f,e)})}function vo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Zs(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=Yi(t,n),o!=null&&r.unshift(vo(t,o,i)),o=Yi(t,e),o!=null&&r.push(vo(t,o,i))),t=t.return}return r}function fi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Sm(t,e,n,r,i){for(var o=e._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=Yi(n,o),l!=null&&s.unshift(vo(n,l,a))):i||(l=Yi(n,o),l!=null&&s.push(vo(n,l,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var Ak=/\r\n?/g,Ok=/\u0000|\uFFFD/g;function km(t){return(typeof t=="string"?t:""+t).replace(Ak,`
|
|
372
|
+
`).replace(Ok,"")}function ea(t,e,n){if(e=km(e),km(t)!==e&&n)throw Error(N(425))}function ta(){}var au=null,lu=null;function cu(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var uu=typeof setTimeout=="function"?setTimeout:void 0,Dk=typeof clearTimeout=="function"?clearTimeout:void 0,xm=typeof Promise=="function"?Promise:void 0,Pk=typeof queueMicrotask=="function"?queueMicrotask:typeof xm<"u"?function(t){return xm.resolve(null).then(t).catch(Lk)}:uu;function Lk(t){setTimeout(function(){throw t})}function du(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),so(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);so(e)}function Wn(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function _m(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var hi=Math.random().toString(36).slice(2),nn="__reactFiber$"+hi,yo="__reactProps$"+hi,yn="__reactContainer$"+hi,fu="__reactEvents$"+hi,Ik="__reactListeners$"+hi,Rk="__reactHandles$"+hi;function _r(t){var e=t[nn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[yn]||n[nn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=_m(t);t!==null;){if(n=t[nn])return n;t=_m(t)}return e}t=n,n=t.parentNode}return null}function bo(t){return t=t[nn]||t[yn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function pi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(N(33))}function na(t){return t[yo]||null}var hu=[],gi=-1;function qn(t){return{current:t}}function Ee(t){0>gi||(t.current=hu[gi],hu[gi]=null,gi--)}function _e(t,e){gi++,hu[gi]=t.current,t.current=e}var Jn={},Ge=qn(Jn),at=qn(!1),Cr=Jn;function mi(t,e){var n=t.type.contextTypes;if(!n)return Jn;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function lt(t){return t=t.childContextTypes,t!=null}function ra(){Ee(at),Ee(Ge)}function Cm(t,e,n){if(Ge.current!==Jn)throw Error(N(168));_e(Ge,e),_e(at,n)}function Em(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(N(108,bS(t)||"Unknown",i));return Me({},n,r)}function ia(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Jn,Cr=Ge.current,_e(Ge,t),_e(at,at.current),!0}function Tm(t,e,n){var r=t.stateNode;if(!r)throw Error(N(169));n?(t=Em(t,e,Cr),r.__reactInternalMemoizedMergedChildContext=t,Ee(at),Ee(Ge),_e(Ge,t)):Ee(at),_e(at,n)}var bn=null,oa=!1,pu=!1;function Mm(t){bn===null?bn=[t]:bn.push(t)}function Nk(t){oa=!0,Mm(t)}function Gn(){if(!pu&&bn!==null){pu=!0;var t=0,e=ve;try{var n=bn;for(ve=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}bn=null,oa=!1}catch(i){throw bn!==null&&(bn=bn.slice(t+1)),Og(Nc,Gn),i}finally{ve=e,pu=!1}}return null}var vi=[],yi=0,sa=null,aa=0,At=[],Ot=0,Er=null,wn=1,Sn="";function Tr(t,e){vi[yi++]=aa,vi[yi++]=sa,sa=t,aa=e}function Am(t,e,n){At[Ot++]=wn,At[Ot++]=Sn,At[Ot++]=Er,Er=t;var r=wn;t=Sn;var i=32-zt(r)-1;r&=~(1<<i),n+=1;var o=32-zt(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,wn=1<<32-zt(e)+i|n<<i|r,Sn=o+t}else wn=1<<o|n<<i|r,Sn=t}function gu(t){t.return!==null&&(Tr(t,1),Am(t,1,0))}function mu(t){for(;t===sa;)sa=vi[--yi],vi[yi]=null,aa=vi[--yi],vi[yi]=null;for(;t===Er;)Er=At[--Ot],At[Ot]=null,Sn=At[--Ot],At[Ot]=null,wn=At[--Ot],At[Ot]=null}var wt=null,St=null,Te=!1,Vt=null;function Om(t,e){var n=It(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Dm(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,wt=t,St=Wn(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,wt=t,St=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Er!==null?{id:wn,overflow:Sn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=It(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,wt=t,St=null,!0):!1;default:return!1}}function vu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function yu(t){if(Te){var e=St;if(e){var n=e;if(!Dm(t,e)){if(vu(t))throw Error(N(418));e=Wn(n.nextSibling);var r=wt;e&&Dm(t,e)?Om(r,n):(t.flags=t.flags&-4097|2,Te=!1,wt=t)}}else{if(vu(t))throw Error(N(418));t.flags=t.flags&-4097|2,Te=!1,wt=t}}}function Pm(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;wt=t}function la(t){if(t!==wt)return!1;if(!Te)return Pm(t),Te=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!cu(t.type,t.memoizedProps)),e&&(e=St)){if(vu(t))throw Lm(),Error(N(418));for(;e;)Om(t,e),e=Wn(e.nextSibling)}if(Pm(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(N(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){St=Wn(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}St=null}}else St=wt?Wn(t.stateNode.nextSibling):null;return!0}function Lm(){for(var t=St;t;)t=Wn(t.nextSibling)}function bi(){St=wt=null,Te=!1}function bu(t){Vt===null?Vt=[t]:Vt.push(t)}var $k=vn.ReactCurrentBatchConfig;function wo(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(N(309));var r=n.stateNode}if(!r)throw Error(N(147,t));var i=r,o=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===o?e.ref:(e=function(s){var a=i.refs;s===null?delete a[o]:a[o]=s},e._stringRef=o,e)}if(typeof t!="string")throw Error(N(284));if(!n._owner)throw Error(N(290,t))}return t}function ca(t,e){throw t=Object.prototype.toString.call(e),Error(N(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Im(t){var e=t._init;return e(t._payload)}function Rm(t){function e(v,w){if(t){var k=v.deletions;k===null?(v.deletions=[w],v.flags|=16):k.push(w)}}function n(v,w){if(!t)return null;for(;w!==null;)e(v,w),w=w.sibling;return null}function r(v,w){for(v=new Map;w!==null;)w.key!==null?v.set(w.key,w):v.set(w.index,w),w=w.sibling;return v}function i(v,w){return v=rr(v,w),v.index=0,v.sibling=null,v}function o(v,w,k){return v.index=k,t?(k=v.alternate,k!==null?(k=k.index,k<w?(v.flags|=2,w):k):(v.flags|=2,w)):(v.flags|=1048576,w)}function s(v){return t&&v.alternate===null&&(v.flags|=2),v}function a(v,w,k,C){return w===null||w.tag!==6?(w=ud(k,v.mode,C),w.return=v,w):(w=i(w,k),w.return=v,w)}function l(v,w,k,C){var E=k.type;return E===ri?d(v,w,k.props.children,C,k.key):w!==null&&(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Fn&&Im(E)===w.type)?(C=i(w,k.props),C.ref=wo(v,w,k),C.return=v,C):(C=La(k.type,k.key,k.props,null,v.mode,C),C.ref=wo(v,w,k),C.return=v,C)}function c(v,w,k,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==k.containerInfo||w.stateNode.implementation!==k.implementation?(w=dd(k,v.mode,C),w.return=v,w):(w=i(w,k.children||[]),w.return=v,w)}function d(v,w,k,C,E){return w===null||w.tag!==7?(w=Rr(k,v.mode,C,E),w.return=v,w):(w=i(w,k),w.return=v,w)}function f(v,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=ud(""+w,v.mode,k),w.return=v,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Os:return k=La(w.type,w.key,w.props,null,v.mode,k),k.ref=wo(v,null,w),k.return=v,k;case ni:return w=dd(w,v.mode,k),w.return=v,w;case Fn:var C=w._init;return f(v,C(w._payload),k)}if(Ji(w)||Wi(w))return w=Rr(w,v.mode,k,null),w.return=v,w;ca(v,w)}return null}function h(v,w,k,C){var E=w!==null?w.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return E!==null?null:a(v,w,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Os:return k.key===E?l(v,w,k,C):null;case ni:return k.key===E?c(v,w,k,C):null;case Fn:return E=k._init,h(v,w,E(k._payload),C)}if(Ji(k)||Wi(k))return E!==null?null:d(v,w,k,C,null);ca(v,k)}return null}function b(v,w,k,C,E){if(typeof C=="string"&&C!==""||typeof C=="number")return v=v.get(k)||null,a(w,v,""+C,E);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Os:return v=v.get(C.key===null?k:C.key)||null,l(w,v,C,E);case ni:return v=v.get(C.key===null?k:C.key)||null,c(w,v,C,E);case Fn:var A=C._init;return b(v,w,k,A(C._payload),E)}if(Ji(C)||Wi(C))return v=v.get(k)||null,d(w,v,C,E,null);ca(w,C)}return null}function y(v,w,k,C){for(var E=null,A=null,D=w,$=w=0,X=null;D!==null&&$<k.length;$++){D.index>$?(X=D,D=null):X=D.sibling;var V=h(v,D,k[$],C);if(V===null){D===null&&(D=X);break}t&&D&&V.alternate===null&&e(v,D),w=o(V,w,$),A===null?E=V:A.sibling=V,A=V,D=X}if($===k.length)return n(v,D),Te&&Tr(v,$),E;if(D===null){for(;$<k.length;$++)D=f(v,k[$],C),D!==null&&(w=o(D,w,$),A===null?E=D:A.sibling=D,A=D);return Te&&Tr(v,$),E}for(D=r(v,D);$<k.length;$++)X=b(D,v,$,k[$],C),X!==null&&(t&&X.alternate!==null&&D.delete(X.key===null?$:X.key),w=o(X,w,$),A===null?E=X:A.sibling=X,A=X);return t&&D.forEach(function(B){return e(v,B)}),Te&&Tr(v,$),E}function g(v,w,k,C){var E=Wi(k);if(typeof E!="function")throw Error(N(150));if(k=E.call(k),k==null)throw Error(N(151));for(var A=E=null,D=w,$=w=0,X=null,V=k.next();D!==null&&!V.done;$++,V=k.next()){D.index>$?(X=D,D=null):X=D.sibling;var B=h(v,D,V.value,C);if(B===null){D===null&&(D=X);break}t&&D&&B.alternate===null&&e(v,D),w=o(B,w,$),A===null?E=B:A.sibling=B,A=B,D=X}if(V.done)return n(v,D),Te&&Tr(v,$),E;if(D===null){for(;!V.done;$++,V=k.next())V=f(v,V.value,C),V!==null&&(w=o(V,w,$),A===null?E=V:A.sibling=V,A=V);return Te&&Tr(v,$),E}for(D=r(v,D);!V.done;$++,V=k.next())V=b(D,v,$,V.value,C),V!==null&&(t&&V.alternate!==null&&D.delete(V.key===null?$:V.key),w=o(V,w,$),A===null?E=V:A.sibling=V,A=V);return t&&D.forEach(function(K){return e(v,K)}),Te&&Tr(v,$),E}function S(v,w,k,C){if(typeof k=="object"&&k!==null&&k.type===ri&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Os:e:{for(var E=k.key,A=w;A!==null;){if(A.key===E){if(E=k.type,E===ri){if(A.tag===7){n(v,A.sibling),w=i(A,k.props.children),w.return=v,v=w;break e}}else if(A.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Fn&&Im(E)===A.type){n(v,A.sibling),w=i(A,k.props),w.ref=wo(v,A,k),w.return=v,v=w;break e}n(v,A);break}else e(v,A);A=A.sibling}k.type===ri?(w=Rr(k.props.children,v.mode,C,k.key),w.return=v,v=w):(C=La(k.type,k.key,k.props,null,v.mode,C),C.ref=wo(v,w,k),C.return=v,v=C)}return s(v);case ni:e:{for(A=k.key;w!==null;){if(w.key===A)if(w.tag===4&&w.stateNode.containerInfo===k.containerInfo&&w.stateNode.implementation===k.implementation){n(v,w.sibling),w=i(w,k.children||[]),w.return=v,v=w;break e}else{n(v,w);break}else e(v,w);w=w.sibling}w=dd(k,v.mode,C),w.return=v,v=w}return s(v);case Fn:return A=k._init,S(v,w,A(k._payload),C)}if(Ji(k))return y(v,w,k,C);if(Wi(k))return g(v,w,k,C);ca(v,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,w!==null&&w.tag===6?(n(v,w.sibling),w=i(w,k),w.return=v,v=w):(n(v,w),w=ud(k,v.mode,C),w.return=v,v=w),s(v)):n(v,w)}return S}var wi=Rm(!0),Nm=Rm(!1),ua=qn(null),da=null,Si=null,wu=null;function Su(){wu=Si=da=null}function ku(t){var e=ua.current;Ee(ua),t._currentValue=e}function xu(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ki(t,e){da=t,wu=Si=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(ct=!0),t.firstContext=null)}function Dt(t){var e=t._currentValue;if(wu!==t)if(t={context:t,memoizedValue:e,next:null},Si===null){if(da===null)throw Error(N(308));Si=t,da.dependencies={lanes:0,firstContext:t}}else Si=Si.next=t;return e}var Mr=null;function _u(t){Mr===null?Mr=[t]:Mr.push(t)}function $m(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,_u(e)):(n.next=i.next,i.next=n),e.interleaved=n,kn(t,r)}function kn(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Qn=!1;function Cu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fm(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function xn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Yn(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,he&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,kn(t,n)}return i=r.interleaved,i===null?(e.next=e,_u(r)):(e.next=i.next,i.next=e),r.interleaved=e,kn(t,n)}function fa(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Bc(t,n)}}function Bm(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function ha(t,e,n,r){var i=t.updateQueue;Qn=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?o=c:s.next=c,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,d=c=l=null,a=o;do{var h=a.lane,b=a.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:b,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=t,g=a;switch(h=e,b=n,g.tag){case 1:if(y=g.payload,typeof y=="function"){f=y.call(b,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=g.payload,h=typeof y=="function"?y.call(b,f,h):y,h==null)break e;f=Me({},f,h);break e;case 2:Qn=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else b={eventTime:b,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=b,l=f):d=d.next=b,s|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Dr|=s,t.lanes=s,t.memoizedState=f}}function jm(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(N(191,i));i.call(r)}}}var So={},rn=qn(So),ko=qn(So),xo=qn(So);function Ar(t){if(t===So)throw Error(N(174));return t}function Eu(t,e){switch(_e(xo,e),_e(ko,t),_e(rn,So),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Tc(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Tc(e,t)}Ee(rn),_e(rn,e)}function xi(){Ee(rn),Ee(ko),Ee(xo)}function Um(t){Ar(xo.current);var e=Ar(rn.current),n=Tc(e,t.type);e!==n&&(_e(ko,t),_e(rn,n))}function Tu(t){ko.current===t&&(Ee(rn),Ee(ko))}var Ae=qn(0);function pa(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mu=[];function Au(){for(var t=0;t<Mu.length;t++)Mu[t]._workInProgressVersionPrimary=null;Mu.length=0}var ga=vn.ReactCurrentDispatcher,Ou=vn.ReactCurrentBatchConfig,Or=0,Oe=null,Re=null,Fe=null,ma=!1,_o=!1,Co=0,Fk=0;function Qe(){throw Error(N(321))}function Du(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Ht(t[n],e[n]))return!1;return!0}function Pu(t,e,n,r,i,o){if(Or=o,Oe=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ga.current=t===null||t.memoizedState===null?zk:Hk,t=n(r,i),_o){o=0;do{if(_o=!1,Co=0,25<=o)throw Error(N(301));o+=1,Fe=Re=null,e.updateQueue=null,ga.current=Vk,t=n(r,i)}while(_o)}if(ga.current=ba,e=Re!==null&&Re.next!==null,Or=0,Fe=Re=Oe=null,ma=!1,e)throw Error(N(300));return t}function Lu(){var t=Co!==0;return Co=0,t}function on(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fe===null?Oe.memoizedState=Fe=t:Fe=Fe.next=t,Fe}function Pt(){if(Re===null){var t=Oe.alternate;t=t!==null?t.memoizedState:null}else t=Re.next;var e=Fe===null?Oe.memoizedState:Fe.next;if(e!==null)Fe=e,Re=t;else{if(t===null)throw Error(N(310));Re=t,t={memoizedState:Re.memoizedState,baseState:Re.baseState,baseQueue:Re.baseQueue,queue:Re.queue,next:null},Fe===null?Oe.memoizedState=Fe=t:Fe=Fe.next=t}return Fe}function Eo(t,e){return typeof e=="function"?e(t):e}function Iu(t){var e=Pt(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=Re,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var a=s=null,l=null,c=o;do{var d=c.lane;if((Or&d)===d)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var f={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,s=r):l=l.next=f,Oe.lanes|=d,Dr|=d}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,Ht(r,e.memoizedState)||(ct=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do o=i.lane,Oe.lanes|=o,Dr|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Ru(t){var e=Pt(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,o=e.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=t(o,s.action),s=s.next;while(s!==i);Ht(o,e.memoizedState)||(ct=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function zm(){}function Hm(t,e){var n=Oe,r=Pt(),i=e(),o=!Ht(r.memoizedState,i);if(o&&(r.memoizedState=i,ct=!0),r=r.queue,Nu(Wm.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||Fe!==null&&Fe.memoizedState.tag&1){if(n.flags|=2048,To(9,Km.bind(null,n,r,i,e),void 0,null),Be===null)throw Error(N(349));Or&30||Vm(n,e,i)}return i}function Vm(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Oe.updateQueue,e===null?(e={lastEffect:null,stores:null},Oe.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Km(t,e,n,r){e.value=n,e.getSnapshot=r,qm(e)&&Jm(t)}function Wm(t,e,n){return n(function(){qm(e)&&Jm(t)})}function qm(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Ht(t,n)}catch{return!0}}function Jm(t){var e=kn(t,1);e!==null&&Jt(e,t,1,-1)}function Gm(t){var e=on();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:t},e.queue=t,t=t.dispatch=Uk.bind(null,Oe,t),[e.memoizedState,t]}function To(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Oe.updateQueue,e===null?(e={lastEffect:null,stores:null},Oe.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function Qm(){return Pt().memoizedState}function va(t,e,n,r){var i=on();Oe.flags|=t,i.memoizedState=To(1|e,n,void 0,r===void 0?null:r)}function ya(t,e,n,r){var i=Pt();r=r===void 0?null:r;var o=void 0;if(Re!==null){var s=Re.memoizedState;if(o=s.destroy,r!==null&&Du(r,s.deps)){i.memoizedState=To(e,n,o,r);return}}Oe.flags|=t,i.memoizedState=To(1|e,n,o,r)}function Ym(t,e){return va(8390656,8,t,e)}function Nu(t,e){return ya(2048,8,t,e)}function Xm(t,e){return ya(4,2,t,e)}function Zm(t,e){return ya(4,4,t,e)}function ev(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function tv(t,e,n){return n=n!=null?n.concat([t]):null,ya(4,4,ev.bind(null,e,t),n)}function $u(){}function nv(t,e){var n=Pt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Du(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function rv(t,e){var n=Pt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Du(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function iv(t,e,n){return Or&21?(Ht(n,e)||(n=Ig(),Oe.lanes|=n,Dr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,ct=!0),t.memoizedState=n)}function Bk(t,e){var n=ve;ve=n!==0&&4>n?n:4,t(!0);var r=Ou.transition;Ou.transition={};try{t(!1),e()}finally{ve=n,Ou.transition=r}}function ov(){return Pt().memoizedState}function jk(t,e,n){var r=tr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},sv(t))av(e,n);else if(n=$m(t,e,n,r),n!==null){var i=st();Jt(n,t,r,i),lv(n,e,r)}}function Uk(t,e,n){var r=tr(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(sv(t))av(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Ht(a,s)){var l=e.interleaved;l===null?(i.next=i,_u(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=$m(t,e,i,r),n!==null&&(i=st(),Jt(n,t,r,i),lv(n,e,r))}}function sv(t){var e=t.alternate;return t===Oe||e!==null&&e===Oe}function av(t,e){_o=ma=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function lv(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Bc(t,n)}}var ba={readContext:Dt,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useInsertionEffect:Qe,useLayoutEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useMutableSource:Qe,useSyncExternalStore:Qe,useId:Qe,unstable_isNewReconciler:!1},zk={readContext:Dt,useCallback:function(t,e){return on().memoizedState=[t,e===void 0?null:e],t},useContext:Dt,useEffect:Ym,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,va(4194308,4,ev.bind(null,e,t),n)},useLayoutEffect:function(t,e){return va(4194308,4,t,e)},useInsertionEffect:function(t,e){return va(4,2,t,e)},useMemo:function(t,e){var n=on();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=on();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=jk.bind(null,Oe,t),[r.memoizedState,t]},useRef:function(t){var e=on();return t={current:t},e.memoizedState=t},useState:Gm,useDebugValue:$u,useDeferredValue:function(t){return on().memoizedState=t},useTransition:function(){var t=Gm(!1),e=t[0];return t=Bk.bind(null,t[1]),on().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Oe,i=on();if(Te){if(n===void 0)throw Error(N(407));n=n()}else{if(n=e(),Be===null)throw Error(N(349));Or&30||Vm(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Ym(Wm.bind(null,r,o,t),[t]),r.flags|=2048,To(9,Km.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=on(),e=Be.identifierPrefix;if(Te){var n=Sn,r=wn;n=(r&~(1<<32-zt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Co++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Fk++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Hk={readContext:Dt,useCallback:nv,useContext:Dt,useEffect:Nu,useImperativeHandle:tv,useInsertionEffect:Xm,useLayoutEffect:Zm,useMemo:rv,useReducer:Iu,useRef:Qm,useState:function(){return Iu(Eo)},useDebugValue:$u,useDeferredValue:function(t){var e=Pt();return iv(e,Re.memoizedState,t)},useTransition:function(){var t=Iu(Eo)[0],e=Pt().memoizedState;return[t,e]},useMutableSource:zm,useSyncExternalStore:Hm,useId:ov,unstable_isNewReconciler:!1},Vk={readContext:Dt,useCallback:nv,useContext:Dt,useEffect:Nu,useImperativeHandle:tv,useInsertionEffect:Xm,useLayoutEffect:Zm,useMemo:rv,useReducer:Ru,useRef:Qm,useState:function(){return Ru(Eo)},useDebugValue:$u,useDeferredValue:function(t){var e=Pt();return Re===null?e.memoizedState=t:iv(e,Re.memoizedState,t)},useTransition:function(){var t=Ru(Eo)[0],e=Pt().memoizedState;return[t,e]},useMutableSource:zm,useSyncExternalStore:Hm,useId:ov,unstable_isNewReconciler:!1};function Kt(t,e){if(t&&t.defaultProps){e=Me({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Fu(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Me({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var wa={isMounted:function(t){return(t=t._reactInternals)?xr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=st(),i=tr(t),o=xn(r,i);o.payload=e,n!=null&&(o.callback=n),e=Yn(t,o,i),e!==null&&(Jt(e,t,i,r),fa(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=st(),i=tr(t),o=xn(r,i);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=Yn(t,o,i),e!==null&&(Jt(e,t,i,r),fa(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=st(),r=tr(t),i=xn(n,r);i.tag=2,e!=null&&(i.callback=e),e=Yn(t,i,r),e!==null&&(Jt(e,t,r,n),fa(e,t,r))}};function cv(t,e,n,r,i,o,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,o,s):e.prototype&&e.prototype.isPureReactComponent?!ho(n,r)||!ho(i,o):!0}function uv(t,e,n){var r=!1,i=Jn,o=e.contextType;return typeof o=="object"&&o!==null?o=Dt(o):(i=lt(e)?Cr:Ge.current,r=e.contextTypes,o=(r=r!=null)?mi(t,i):Jn),e=new e(n,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=wa,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function dv(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&wa.enqueueReplaceState(e,e.state,null)}function Bu(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Cu(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Dt(o):(o=lt(e)?Cr:Ge.current,i.context=mi(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(Fu(t,e,o,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&wa.enqueueReplaceState(i,i.state,null),ha(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function _i(t,e){try{var n="",r=e;do n+=yS(r),r=r.return;while(r);var i=n}catch(o){i=`
|
|
373
373
|
Error generating stack: `+o.message+`
|
|
374
|
-
`+o.stack}return{value:t,source:e,stack:i,digest:null}}function Bu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function ju(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Vk=typeof WeakMap=="function"?WeakMap:Map;function dv(t,e,n){n=xn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ta||(Ta=!0,td=r),ju(t,e)},n}function fv(t,e,n){n=xn(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){ju(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){ju(t,e),typeof r!="function"&&(Xn===null?Xn=new Set([this]):Xn.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function hv(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Vk;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=ix.bind(null,t,e,n),e.then(t,t))}function pv(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function gv(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=xn(-1,1),e.tag=2,Qn(n,e,1))),n.lanes|=1),t)}var Wk=vn.ReactCurrentOwner,ct=!1;function ot(t,e,n,r){e.child=t===null?Rm(e,null,n,r):wi(e,t.child,n,r)}function mv(t,e,n,r,i){n=n.render;var o=e.ref;return ki(e,i),r=Pu(t,e,n,r,o,i),n=Du(),t!==null&&!ct?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,_n(t,e,i)):(Te&&n&&pu(e),e.flags|=1,ot(t,e,r,i),e.child)}function vv(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!ld(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,yv(t,e,o,r,i)):(t=La(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:ho,n(s,r)&&t.ref===e.ref)return _n(t,e,i)}return e.flags|=1,t=nr(o,r),t.ref=e.ref,t.return=e,e.child=t}function yv(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(ho(o,r)&&t.ref===e.ref)if(ct=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(ct=!0);else return e.lanes=t.lanes,_n(t,e,i)}return Uu(t,e,n,r,i)}function bv(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},_e(Ei,kt),kt|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,_e(Ei,kt),kt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,_e(Ei,kt),kt|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,_e(Ei,kt),kt|=r;return ot(t,e,i,n),e.child}function wv(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Uu(t,e,n,r,i){var o=lt(n)?_r:Ge.current;return o=mi(e,o),ki(e,i),n=Pu(t,e,n,r,o,i),r=Du(),t!==null&&!ct?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,_n(t,e,i)):(Te&&r&&pu(e),e.flags|=1,ot(t,e,n,i),e.child)}function Sv(t,e,n,r,i){if(lt(n)){var o=!0;ia(e)}else o=!1;if(ki(e,i),e.stateNode===null)ka(t,e),cv(e,n,r),Fu(e,n,r,i),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Pt(c):(c=lt(n)?_r:Ge.current,c=mi(e,c));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&uv(e,s,r,c),Gn=!1;var h=e.memoizedState;s.state=h,ha(e,r,s,i),l=e.memoizedState,a!==r||h!==l||at.current||Gn?(typeof d=="function"&&($u(e,n,d,r),l=e.memoizedState),(a=Gn||lv(e,n,a,r,h,l,c))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,$m(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Wt(e.type,a),s.props=c,f=e.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Pt(l):(l=lt(n)?_r:Ge.current,l=mi(e,l));var b=n.getDerivedStateFromProps;(d=typeof b=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||h!==l)&&uv(e,s,r,l),Gn=!1,h=e.memoizedState,s.state=h,ha(e,r,s,i);var y=e.memoizedState;a!==f||h!==y||at.current||Gn?(typeof b=="function"&&($u(e,n,b,r),y=e.memoizedState),(c=Gn||lv(e,n,c,r,h,y,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,y,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,y,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=y),s.props=r,s.state=y,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return zu(t,e,n,r,o,i)}function zu(t,e,n,r,i,o){wv(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&Em(e,n,!1),_n(t,e,o);r=e.stateNode,Wk.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=wi(e,t.child,null,o),e.child=wi(e,null,a,o)):ot(t,e,a,o),e.memoizedState=r.state,i&&Em(e,n,!0),e.child}function kv(t){var e=t.stateNode;e.pendingContext?_m(t,e.pendingContext,e.pendingContext!==e.context):e.context&&_m(t,e.context,!1),Cu(t,e.containerInfo)}function xv(t,e,n,r,i){return bi(),yu(i),e.flags|=256,ot(t,e,n,r),e.child}var Hu={dehydrated:null,treeContext:null,retryLane:0};function Vu(t){return{baseLanes:t,cachePool:null,transitions:null}}function _v(t,e,n){var r=e.pendingProps,i=Ae.current,o=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),_e(Ae,i&1),t===null)return vu(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,o?(r=e.mode,o=e.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=Ia(s,r,0,null),t=Ir(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Vu(n),e.memoizedState=Hu,t):Wu(e,s));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Kk(t,e,s,r,a,i,n);if(o){o=r.fallback,s=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=nr(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?o=nr(a,o):(o=Ir(o,s,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,r=o,o=e.child,s=t.child.memoizedState,s=s===null?Vu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=Hu,r}return o=t.child,t=o.sibling,r=nr(o,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Wu(t,e){return e=Ia({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Sa(t,e,n,r){return r!==null&&yu(r),wi(e,t.child,null,n),t=Wu(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Kk(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=Bu(Error(N(422))),Sa(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Ia({mode:"visible",children:r.children},i,0,null),o=Ir(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&wi(e,t.child,null,s),e.child.memoizedState=Vu(s),e.memoizedState=Hu,o);if(!(e.mode&1))return Sa(t,e,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error(N(419)),r=Bu(o,r,void 0),Sa(t,e,s,r)}if(a=(s&t.childLanes)!==0,ct||a){if(r=Be,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,kn(t,i),Jt(r,t,i,-1))}return ad(),r=Bu(Error(N(421))),Sa(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=ox.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,St=Wn(i.nextSibling),wt=e,Te=!0,Vt=null,t!==null&&(At[Ot++]=wn,At[Ot++]=Sn,At[Ot++]=Cr,wn=t.id,Sn=t.overflow,Cr=e),e=Wu(e,r.children),e.flags|=4096,e)}function Cv(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ku(t.return,e,n)}function Ku(t,e,n,r,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Ev(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(ot(t,e,r.children,n),r=Ae.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Cv(t,n,e);else if(t.tag===19)Cv(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(_e(Ae,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&pa(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Ku(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&pa(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Ku(e,!0,n,null,o);break;case"together":Ku(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ka(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function _n(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Or|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(N(153));if(e.child!==null){for(t=e.child,n=nr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=nr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function qk(t,e,n){switch(e.tag){case 3:kv(e),bi();break;case 5:jm(e);break;case 1:lt(e.type)&&ia(e);break;case 4:Cu(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;_e(ua,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(_e(Ae,Ae.current&1),e.flags|=128,null):n&e.child.childLanes?_v(t,e,n):(_e(Ae,Ae.current&1),t=_n(t,e,n),t!==null?t.sibling:null);_e(Ae,Ae.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Ev(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),_e(Ae,Ae.current),r)break;return null;case 22:case 23:return e.lanes=0,bv(t,e,n)}return _n(t,e,n)}var Tv,qu,Mv,Av;Tv=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},qu=function(){},Mv=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Mr(rn.current);var o=null;switch(n){case"input":i=kc(t,i),r=kc(t,r),o=[];break;case"select":i=Me({},i,{value:void 0}),r=Me({},r,{value:void 0}),o=[];break;case"textarea":i=Cc(t,i),r=Cc(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=ta)}Tc(n,r);var s;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Wi.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(o||(o=[]),o.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Wi.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ce("scroll",t),o||a===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(e.updateQueue=c)&&(e.flags|=4)}},Av=function(t,e,n,r){n!==r&&(e.flags|=4)};function Mo(t,e){if(!Te)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Ye(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function Jk(t,e,n){var r=e.pendingProps;switch(gu(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(e),null;case 1:return lt(e.type)&&ra(),Ye(e),null;case 3:return r=e.stateNode,xi(),Ee(at),Ee(Ge),Mu(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(la(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Vt!==null&&(id(Vt),Vt=null))),qu(t,e),Ye(e),null;case 5:Eu(e);var i=Mr(xo.current);if(n=e.type,t!==null&&e.stateNode!=null)Mv(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(N(166));return Ye(e),null}if(t=Mr(rn.current),la(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[nn]=e,r[yo]=o,t=(e.mode&1)!==0,n){case"dialog":Ce("cancel",r),Ce("close",r);break;case"iframe":case"object":case"embed":Ce("load",r);break;case"video":case"audio":for(i=0;i<go.length;i++)Ce(go[i],r);break;case"source":Ce("error",r);break;case"img":case"image":case"link":Ce("error",r),Ce("load",r);break;case"details":Ce("toggle",r);break;case"input":cg(r,o),Ce("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Ce("invalid",r);break;case"textarea":fg(r,o),Ce("invalid",r)}Tc(n,o),i=null;for(var s in o)if(o.hasOwnProperty(s)){var a=o[s];s==="children"?typeof a=="string"?r.textContent!==a&&(o.suppressHydrationWarning!==!0&&ea(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&ea(r.textContent,a,t),i=["children",""+a]):Wi.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ce("scroll",r)}switch(n){case"input":Ps(r),dg(r,o,!0);break;case"textarea":Ps(r),pg(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=ta)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=gg(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[nn]=e,t[yo]=r,Tv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Mc(n,r),n){case"dialog":Ce("cancel",t),Ce("close",t),i=r;break;case"iframe":case"object":case"embed":Ce("load",t),i=r;break;case"video":case"audio":for(i=0;i<go.length;i++)Ce(go[i],t);i=r;break;case"source":Ce("error",t),i=r;break;case"img":case"image":case"link":Ce("error",t),Ce("load",t),i=r;break;case"details":Ce("toggle",t),i=r;break;case"input":cg(t,r),i=kc(t,r),Ce("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Me({},r,{value:void 0}),Ce("invalid",t);break;case"textarea":fg(t,r),i=Cc(t,r),Ce("invalid",t);break;default:i=r}Tc(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?yg(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&mg(t,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Gi(t,l):typeof l=="number"&&Gi(t,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Wi.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Ce("scroll",t):l!=null&&dc(t,o,l,s))}switch(n){case"input":Ps(t),dg(t,r,!1);break;case"textarea":Ps(t),pg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Fn(r.value));break;case"select":t.multiple=!!r.multiple,o=r.value,o!=null?ii(t,!!r.multiple,o,!1):r.defaultValue!=null&&ii(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=ta)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Ye(e),null;case 6:if(t&&e.stateNode!=null)Av(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(N(166));if(n=Mr(xo.current),Mr(rn.current),la(e)){if(r=e.stateNode,n=e.memoizedProps,r[nn]=e,(o=r.nodeValue!==n)&&(t=wt,t!==null))switch(t.tag){case 3:ea(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ea(r.nodeValue,n,(t.mode&1)!==0)}o&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[nn]=e,e.stateNode=r}return Ye(e),null;case 13:if(Ee(Ae),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Te&&St!==null&&e.mode&1&&!(e.flags&128))Dm(),bi(),e.flags|=98560,o=!1;else if(o=la(e),r!==null&&r.dehydrated!==null){if(t===null){if(!o)throw Error(N(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(N(317));o[nn]=e}else bi(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ye(e),o=!1}else Vt!==null&&(id(Vt),Vt=null),o=!0;if(!o)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Ae.current&1?Ne===0&&(Ne=3):ad())),e.updateQueue!==null&&(e.flags|=4),Ye(e),null);case 4:return xi(),qu(t,e),t===null&&mo(e.stateNode.containerInfo),Ye(e),null;case 10:return Su(e.type._context),Ye(e),null;case 17:return lt(e.type)&&ra(),Ye(e),null;case 19:if(Ee(Ae),o=e.memoizedState,o===null)return Ye(e),null;if(r=(e.flags&128)!==0,s=o.rendering,s===null)if(r)Mo(o,!1);else{if(Ne!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=pa(t),s!==null){for(e.flags|=128,Mo(o,!1),r=s.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)o=n,t=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=t,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,t=s.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return _e(Ae,Ae.current&1|2),e.child}t=t.sibling}o.tail!==null&&Le()>Ti&&(e.flags|=128,r=!0,Mo(o,!1),e.lanes=4194304)}else{if(!r)if(t=pa(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Mo(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Te)return Ye(e),null}else 2*Le()-o.renderingStartTime>Ti&&n!==1073741824&&(e.flags|=128,r=!0,Mo(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Le(),e.sibling=null,n=Ae.current,_e(Ae,r?n&1|2:n&1),e):(Ye(e),null);case 22:case 23:return sd(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?kt&1073741824&&(Ye(e),e.subtreeFlags&6&&(e.flags|=8192)):Ye(e),null;case 24:return null;case 25:return null}throw Error(N(156,e.tag))}function Gk(t,e){switch(gu(e),e.tag){case 1:return lt(e.type)&&ra(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xi(),Ee(at),Ee(Ge),Mu(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Eu(e),null;case 13:if(Ee(Ae),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(N(340));bi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ee(Ae),null;case 4:return xi(),null;case 10:return Su(e.type._context),null;case 22:case 23:return sd(),null;case 24:return null;default:return null}}var xa=!1,Xe=!1,Qk=typeof WeakSet=="function"?WeakSet:Set,j=null;function Ci(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(t,e,r)}else n.current=null}function Ju(t,e,n){try{n()}catch(r){Pe(t,e,r)}}var Ov=!1;function Yk(t,e){if(su=Hs,t=lm(),Xc(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,d=0,f=t,h=null;t:for(;;){for(var b;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(b=f.firstChild)!==null;)h=f,f=b;for(;;){if(f===t)break t;if(h===n&&++c===i&&(a=s),h===o&&++d===r&&(l=s),(b=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=b}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(au={focusedElem:t,selectionRange:n},Hs=!1,j=e;j!==null;)if(e=j,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,j=t;else for(;j!==null;){e=j;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var m=y.memoizedProps,S=y.memoizedState,v=e.stateNode,w=v.getSnapshotBeforeUpdate(e.elementType===e.type?m:Wt(e.type,m),S);v.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(C){Pe(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,j=t;break}j=e.return}return y=Ov,Ov=!1,y}function Ao(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Ju(e,n,o)}i=i.next}while(i!==r)}}function _a(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Gu(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Pv(t){var e=t.alternate;e!==null&&(t.alternate=null,Pv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[yo],delete e[du],delete e[Lk],delete e[Ik])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Dv(t){return t.tag===5||t.tag===3||t.tag===4}function Lv(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Dv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Qu(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=ta));else if(r!==4&&(t=t.child,t!==null))for(Qu(t,e,n),t=t.sibling;t!==null;)Qu(t,e,n),t=t.sibling}function Yu(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Yu(t,e,n),t=t.sibling;t!==null;)Yu(t,e,n),t=t.sibling}var Ve=null,Kt=!1;function Yn(t,e,n){for(n=n.child;n!==null;)Iv(t,e,n),n=n.sibling}function Iv(t,e,n){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount($s,n)}catch{}switch(n.tag){case 5:Xe||Ci(n,e);case 6:var r=Ve,i=Kt;Ve=null,Yn(t,e,n),Ve=r,Kt=i,Ve!==null&&(Kt?(t=Ve,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ve.removeChild(n.stateNode));break;case 18:Ve!==null&&(Kt?(t=Ve,n=n.stateNode,t.nodeType===8?uu(t.parentNode,n):t.nodeType===1&&uu(t,n),so(t)):uu(Ve,n.stateNode));break;case 4:r=Ve,i=Kt,Ve=n.stateNode.containerInfo,Kt=!0,Yn(t,e,n),Ve=r,Kt=i;break;case 0:case 11:case 14:case 15:if(!Xe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Ju(n,e,s),i=i.next}while(i!==r)}Yn(t,e,n);break;case 1:if(!Xe&&(Ci(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Pe(n,e,a)}Yn(t,e,n);break;case 21:Yn(t,e,n);break;case 22:n.mode&1?(Xe=(r=Xe)||n.memoizedState!==null,Yn(t,e,n),Xe=r):Yn(t,e,n);break;default:Yn(t,e,n)}}function Rv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Qk),e.forEach(function(r){var i=sx.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function qt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=t,s=e,a=s;e:for(;a!==null;){switch(a.tag){case 5:Ve=a.stateNode,Kt=!1;break e;case 3:Ve=a.stateNode.containerInfo,Kt=!0;break e;case 4:Ve=a.stateNode.containerInfo,Kt=!0;break e}a=a.return}if(Ve===null)throw Error(N(160));Iv(o,s,i),Ve=null,Kt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Pe(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Nv(e,t),e=e.sibling}function Nv(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(qt(e,t),sn(t),r&4){try{Ao(3,t,t.return),_a(3,t)}catch(m){Pe(t,t.return,m)}try{Ao(5,t,t.return)}catch(m){Pe(t,t.return,m)}}break;case 1:qt(e,t),sn(t),r&512&&n!==null&&Ci(n,n.return);break;case 5:if(qt(e,t),sn(t),r&512&&n!==null&&Ci(n,n.return),t.flags&32){var i=t.stateNode;try{Gi(i,"")}catch(m){Pe(t,t.return,m)}}if(r&4&&(i=t.stateNode,i!=null)){var o=t.memoizedProps,s=n!==null?n.memoizedProps:o,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&ug(i,o),Mc(a,s);var c=Mc(a,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d==="style"?yg(i,f):d==="dangerouslySetInnerHTML"?mg(i,f):d==="children"?Gi(i,f):dc(i,d,f,c)}switch(a){case"input":xc(i,o);break;case"textarea":hg(i,o);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var b=o.value;b!=null?ii(i,!!o.multiple,b,!1):h!==!!o.multiple&&(o.defaultValue!=null?ii(i,!!o.multiple,o.defaultValue,!0):ii(i,!!o.multiple,o.multiple?[]:"",!1))}i[yo]=o}catch(m){Pe(t,t.return,m)}}break;case 6:if(qt(e,t),sn(t),r&4){if(t.stateNode===null)throw Error(N(162));i=t.stateNode,o=t.memoizedProps;try{i.nodeValue=o}catch(m){Pe(t,t.return,m)}}break;case 3:if(qt(e,t),sn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{so(e.containerInfo)}catch(m){Pe(t,t.return,m)}break;case 4:qt(e,t),sn(t);break;case 13:qt(e,t),sn(t),i=t.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(ed=Le())),r&4&&Rv(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Xe=(c=Xe)||d,qt(e,t),Xe=c):qt(e,t),sn(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(j=t,d=t.child;d!==null;){for(f=j=d;j!==null;){switch(h=j,b=h.child,h.tag){case 0:case 11:case 14:case 15:Ao(4,h,h.return);break;case 1:Ci(h,h.return);var y=h.stateNode;if(typeof y.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(m){Pe(r,n,m)}}break;case 5:Ci(h,h.return);break;case 22:if(h.memoizedState!==null){Bv(f);continue}}b!==null?(b.return=h,j=b):Bv(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=vg("display",s))}catch(m){Pe(t,t.return,m)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(m){Pe(t,t.return,m)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:qt(e,t),sn(t),r&4&&Rv(t);break;case 21:break;default:qt(e,t),sn(t)}}function sn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Dv(n)){var r=n;break e}n=n.return}throw Error(N(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Gi(i,""),r.flags&=-33);var o=Lv(t);Yu(t,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=Lv(t);Qu(t,a,s);break;default:throw Error(N(161))}}catch(l){Pe(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Xk(t,e,n){j=t,$v(t)}function $v(t,e,n){for(var r=(t.mode&1)!==0;j!==null;){var i=j,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||xa;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Xe;a=xa;var c=Xe;if(xa=s,(Xe=l)&&!c)for(j=i;j!==null;)s=j,l=s.child,s.tag===22&&s.memoizedState!==null?jv(i):l!==null?(l.return=s,j=l):jv(i);for(;o!==null;)j=o,$v(o),o=o.sibling;j=i,xa=a,Xe=c}Fv(t)}else i.subtreeFlags&8772&&o!==null?(o.return=i,j=o):Fv(t)}}function Fv(t){for(;j!==null;){var e=j;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Xe||_a(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Xe)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Wt(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=e.updateQueue;o!==null&&Bm(e,o,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}Bm(e,s,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&so(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(N(163))}Xe||e.flags&512&&Gu(e)}catch(h){Pe(e,e.return,h)}}if(e===t){j=null;break}if(n=e.sibling,n!==null){n.return=e.return,j=n;break}j=e.return}}function Bv(t){for(;j!==null;){var e=j;if(e===t){j=null;break}var n=e.sibling;if(n!==null){n.return=e.return,j=n;break}j=e.return}}function jv(t){for(;j!==null;){var e=j;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{_a(4,e)}catch(l){Pe(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Pe(e,i,l)}}var o=e.return;try{Gu(e)}catch(l){Pe(e,o,l)}break;case 5:var s=e.return;try{Gu(e)}catch(l){Pe(e,s,l)}}}catch(l){Pe(e,e.return,l)}if(e===t){j=null;break}var a=e.sibling;if(a!==null){a.return=e.return,j=a;break}j=e.return}}var Zk=Math.ceil,Ca=vn.ReactCurrentDispatcher,Xu=vn.ReactCurrentOwner,Lt=vn.ReactCurrentBatchConfig,he=0,Be=null,Ie=null,We=0,kt=0,Ei=Kn(0),Ne=0,Oo=null,Or=0,Ea=0,Zu=0,Po=null,ut=null,ed=0,Ti=1/0,Cn=null,Ta=!1,td=null,Xn=null,Ma=!1,Zn=null,Aa=0,Do=0,nd=null,Oa=-1,Pa=0;function st(){return he&6?Le():Oa!==-1?Oa:Oa=Le()}function er(t){return t.mode&1?he&2&&We!==0?We&-We:Nk.transition!==null?(Pa===0&&(Pa=Lg()),Pa):(t=ve,t!==0||(t=window.event,t=t===void 0?16:zg(t.type)),t):1}function Jt(t,e,n,r){if(50<Do)throw Do=0,nd=null,Error(N(185));to(t,n,r),(!(he&2)||t!==Be)&&(t===Be&&(!(he&2)&&(Ea|=n),Ne===4&&tr(t,We)),dt(t,r),n===1&&he===0&&!(e.mode&1)&&(Ti=Le()+500,oa&&Jn()))}function dt(t,e){var n=t.callbackNode;NS(t,e);var r=js(t,t===Be?We:0);if(r===0)n!==null&&Og(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Og(n),e===1)t.tag===0?Rk(zv.bind(null,t)):Tm(zv.bind(null,t)),Pk(function(){!(he&6)&&Jn()}),n=null;else{switch(Ig(r)){case 1:n=Rc;break;case 4:n=Pg;break;case 16:n=Ns;break;case 536870912:n=Dg;break;default:n=Ns}n=Qv(n,Uv.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Uv(t,e){if(Oa=-1,Pa=0,he&6)throw Error(N(327));var n=t.callbackNode;if(Mi()&&t.callbackNode!==n)return null;var r=js(t,t===Be?We:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Da(t,r);else{e=r;var i=he;he|=2;var o=Vv();(Be!==t||We!==e)&&(Cn=null,Ti=Le()+500,Dr(t,e));do try{nx();break}catch(a){Hv(t,a)}while(!0);wu(),Ca.current=o,he=i,Ie!==null?e=0:(Be=null,We=0,e=Ne)}if(e!==0){if(e===2&&(i=Nc(t),i!==0&&(r=i,e=rd(t,i))),e===1)throw n=Oo,Dr(t,0),tr(t,r),dt(t,Le()),n;if(e===6)tr(t,r);else{if(i=t.current.alternate,!(r&30)&&!ex(i)&&(e=Da(t,r),e===2&&(o=Nc(t),o!==0&&(r=o,e=rd(t,o))),e===1))throw n=Oo,Dr(t,0),tr(t,r),dt(t,Le()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(N(345));case 2:Lr(t,ut,Cn);break;case 3:if(tr(t,r),(r&130023424)===r&&(e=ed+500-Le(),10<e)){if(js(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){st(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=cu(Lr.bind(null,t,ut,Cn),e);break}Lr(t,ut,Cn);break;case 4:if(tr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var s=31-zt(r);o=1<<s,s=e[s],s>i&&(i=s),r&=~o}if(r=i,r=Le()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Zk(r/1960))-r,10<r){t.timeoutHandle=cu(Lr.bind(null,t,ut,Cn),r);break}Lr(t,ut,Cn);break;case 5:Lr(t,ut,Cn);break;default:throw Error(N(329))}}}return dt(t,Le()),t.callbackNode===n?Uv.bind(null,t):null}function rd(t,e){var n=Po;return t.current.memoizedState.isDehydrated&&(Dr(t,e).flags|=256),t=Da(t,e),t!==2&&(e=ut,ut=n,e!==null&&id(e)),t}function id(t){ut===null?ut=t:ut.push.apply(ut,t)}function ex(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!Ht(o(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function tr(t,e){for(e&=~Zu,e&=~Ea,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-zt(e),r=1<<n;t[n]=-1,e&=~r}}function zv(t){if(he&6)throw Error(N(327));Mi();var e=js(t,0);if(!(e&1))return dt(t,Le()),null;var n=Da(t,e);if(t.tag!==0&&n===2){var r=Nc(t);r!==0&&(e=r,n=rd(t,r))}if(n===1)throw n=Oo,Dr(t,0),tr(t,e),dt(t,Le()),n;if(n===6)throw Error(N(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Lr(t,ut,Cn),dt(t,Le()),null}function od(t,e){var n=he;he|=1;try{return t(e)}finally{he=n,he===0&&(Ti=Le()+500,oa&&Jn())}}function Pr(t){Zn!==null&&Zn.tag===0&&!(he&6)&&Mi();var e=he;he|=1;var n=Lt.transition,r=ve;try{if(Lt.transition=null,ve=1,t)return t()}finally{ve=r,Lt.transition=n,he=e,!(he&6)&&Jn()}}function sd(){kt=Ei.current,Ee(Ei)}function Dr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Ok(n)),Ie!==null)for(n=Ie.return;n!==null;){var r=n;switch(gu(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ra();break;case 3:xi(),Ee(at),Ee(Ge),Mu();break;case 5:Eu(r);break;case 4:xi();break;case 13:Ee(Ae);break;case 19:Ee(Ae);break;case 10:Su(r.type._context);break;case 22:case 23:sd()}n=n.return}if(Be=t,Ie=t=nr(t.current,null),We=kt=e,Ne=0,Oo=null,Zu=Ea=Or=0,ut=Po=null,Tr!==null){for(e=0;e<Tr.length;e++)if(n=Tr[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var s=o.next;o.next=i,r.next=s}n.pending=r}Tr=null}return t}function Hv(t,e){do{var n=Ie;try{if(wu(),ga.current=ba,ma){for(var r=Oe.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ma=!1}if(Ar=0,Fe=Re=Oe=null,_o=!1,Co=0,Xu.current=null,n===null||n.return===null){Ne=1,Oo=e,Ie=null;break}e:{var o=t,s=n.return,a=n,l=e;if(e=We,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var b=pv(s);if(b!==null){b.flags&=-257,gv(b,s,a,o,e),b.mode&1&&hv(o,c,e),e=b,l=c;var y=e.updateQueue;if(y===null){var m=new Set;m.add(l),e.updateQueue=m}else y.add(l);break e}else{if(!(e&1)){hv(o,c,e),ad();break e}l=Error(N(426))}}else if(Te&&a.mode&1){var S=pv(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),gv(S,s,a,o,e),yu(_i(l,a));break e}}o=l=_i(l,a),Ne!==4&&(Ne=2),Po===null?Po=[o]:Po.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var v=dv(o,l,e);Fm(o,v);break e;case 1:a=l;var w=o.type,k=o.stateNode;if(!(o.flags&128)&&(typeof w.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Xn===null||!Xn.has(k)))){o.flags|=65536,e&=-e,o.lanes|=e;var C=fv(o,a,e);Fm(o,C);break e}}o=o.return}while(o!==null)}Kv(n)}catch(T){e=T,Ie===n&&n!==null&&(Ie=n=n.return);continue}break}while(!0)}function Vv(){var t=Ca.current;return Ca.current=ba,t===null?ba:t}function ad(){(Ne===0||Ne===3||Ne===2)&&(Ne=4),Be===null||!(Or&268435455)&&!(Ea&268435455)||tr(Be,We)}function Da(t,e){var n=he;he|=2;var r=Vv();(Be!==t||We!==e)&&(Cn=null,Dr(t,e));do try{tx();break}catch(i){Hv(t,i)}while(!0);if(wu(),he=n,Ca.current=r,Ie!==null)throw Error(N(261));return Be=null,We=0,Ne}function tx(){for(;Ie!==null;)Wv(Ie)}function nx(){for(;Ie!==null&&!TS();)Wv(Ie)}function Wv(t){var e=Gv(t.alternate,t,kt);t.memoizedProps=t.pendingProps,e===null?Kv(t):Ie=e,Xu.current=null}function Kv(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=Gk(n,e),n!==null){n.flags&=32767,Ie=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ne=6,Ie=null;return}}else if(n=Jk(n,e,kt),n!==null){Ie=n;return}if(e=e.sibling,e!==null){Ie=e;return}Ie=e=t}while(e!==null);Ne===0&&(Ne=5)}function Lr(t,e,n){var r=ve,i=Lt.transition;try{Lt.transition=null,ve=1,rx(t,e,n,r)}finally{Lt.transition=i,ve=r}return null}function rx(t,e,n,r){do Mi();while(Zn!==null);if(he&6)throw Error(N(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(N(177));t.callbackNode=null,t.callbackPriority=0;var o=n.lanes|n.childLanes;if($S(t,o),t===Be&&(Ie=Be=null,We=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ma||(Ma=!0,Qv(Ns,function(){return Mi(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Lt.transition,Lt.transition=null;var s=ve;ve=1;var a=he;he|=4,Xu.current=null,Yk(t,n),Nv(n,t),xk(au),Hs=!!su,au=su=null,t.current=n,Xk(n),MS(),he=a,ve=s,Lt.transition=o}else t.current=n;if(Ma&&(Ma=!1,Zn=t,Aa=i),o=t.pendingLanes,o===0&&(Xn=null),PS(n.stateNode),dt(t,Le()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ta)throw Ta=!1,t=td,td=null,t;return Aa&1&&t.tag!==0&&Mi(),o=t.pendingLanes,o&1?t===nd?Do++:(Do=0,nd=t):Do=0,Jn(),null}function Mi(){if(Zn!==null){var t=Ig(Aa),e=Lt.transition,n=ve;try{if(Lt.transition=null,ve=16>t?16:t,Zn===null)var r=!1;else{if(t=Zn,Zn=null,Aa=0,he&6)throw Error(N(331));var i=he;for(he|=4,j=t.current;j!==null;){var o=j,s=o.child;if(j.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(j=c;j!==null;){var d=j;switch(d.tag){case 0:case 11:case 15:Ao(8,d,o)}var f=d.child;if(f!==null)f.return=d,j=f;else for(;j!==null;){d=j;var h=d.sibling,b=d.return;if(Pv(d),d===c){j=null;break}if(h!==null){h.return=b,j=h;break}j=b}}}var y=o.alternate;if(y!==null){var m=y.child;if(m!==null){y.child=null;do{var S=m.sibling;m.sibling=null,m=S}while(m!==null)}}j=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,j=s;else e:for(;j!==null;){if(o=j,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Ao(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,j=v;break e}j=o.return}}var w=t.current;for(j=w;j!==null;){s=j;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,j=k;else e:for(s=w;j!==null;){if(a=j,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:_a(9,a)}}catch(T){Pe(a,a.return,T)}if(a===s){j=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,j=C;break e}j=a.return}}if(he=i,Jn(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot($s,t)}catch{}r=!0}return r}finally{ve=n,Lt.transition=e}}return!1}function qv(t,e,n){e=_i(n,e),e=dv(t,e,1),t=Qn(t,e,1),e=st(),t!==null&&(to(t,1,e),dt(t,e))}function Pe(t,e,n){if(t.tag===3)qv(t,t,n);else for(;e!==null;){if(e.tag===3){qv(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Xn===null||!Xn.has(r))){t=_i(n,t),t=fv(e,t,1),e=Qn(e,t,1),t=st(),e!==null&&(to(e,1,t),dt(e,t));break}}e=e.return}}function ix(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=st(),t.pingedLanes|=t.suspendedLanes&n,Be===t&&(We&n)===n&&(Ne===4||Ne===3&&(We&130023424)===We&&500>Le()-ed?Dr(t,0):Zu|=n),dt(t,e)}function Jv(t,e){e===0&&(t.mode&1?(e=Bs,Bs<<=1,!(Bs&130023424)&&(Bs=4194304)):e=1);var n=st();t=kn(t,e),t!==null&&(to(t,e,n),dt(t,n))}function ox(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Jv(t,n)}function sx(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(e),Jv(t,n)}var Gv;Gv=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||at.current)ct=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return ct=!1,qk(t,e,n);ct=!!(t.flags&131072)}else ct=!1,Te&&e.flags&1048576&&Mm(e,aa,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ka(t,e),t=e.pendingProps;var i=mi(e,Ge.current);ki(e,n),i=Pu(null,e,r,t,i,n);var o=Du();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,lt(r)?(o=!0,ia(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,_u(e),i.updater=wa,e.stateNode=i,i._reactInternals=e,Fu(e,r,t,n),e=zu(null,e,r,!0,o,n)):(e.tag=0,Te&&o&&pu(e),ot(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(ka(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=lx(r),t=Wt(r,t),i){case 0:e=Uu(null,e,r,t,n);break e;case 1:e=Sv(null,e,r,t,n);break e;case 11:e=mv(null,e,r,t,n);break e;case 14:e=vv(null,e,r,Wt(r.type,t),n);break e}throw Error(N(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wt(r,i),Uu(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wt(r,i),Sv(t,e,r,i,n);case 3:e:{if(kv(e),t===null)throw Error(N(387));r=e.pendingProps,o=e.memoizedState,i=o.element,$m(t,e),ha(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=_i(Error(N(423)),e),e=xv(t,e,r,n,i);break e}else if(r!==i){i=_i(Error(N(424)),e),e=xv(t,e,r,n,i);break e}else for(St=Wn(e.stateNode.containerInfo.firstChild),wt=e,Te=!0,Vt=null,n=Rm(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bi(),r===i){e=_n(t,e,n);break e}ot(t,e,r,n)}e=e.child}return e;case 5:return jm(e),t===null&&vu(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,lu(r,i)?s=null:o!==null&&lu(r,o)&&(e.flags|=32),wv(t,e),ot(t,e,s,n),e.child;case 6:return t===null&&vu(e),null;case 13:return _v(t,e,n);case 4:return Cu(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=wi(e,null,r,n):ot(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wt(r,i),mv(t,e,r,i,n);case 7:return ot(t,e,e.pendingProps,n),e.child;case 8:return ot(t,e,e.pendingProps.children,n),e.child;case 12:return ot(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,_e(ua,r._currentValue),r._currentValue=s,o!==null)if(Ht(o.value,s)){if(o.children===i.children&&!at.current){e=_n(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=xn(-1,n&-n),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),ku(o.return,n,e),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(N(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),ku(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ot(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,ki(e,n),i=Pt(i),r=r(i),e.flags|=1,ot(t,e,r,n),e.child;case 14:return r=e.type,i=Wt(r,e.pendingProps),i=Wt(r.type,i),vv(t,e,r,i,n);case 15:return yv(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wt(r,i),ka(t,e),e.tag=1,lt(r)?(t=!0,ia(e)):t=!1,ki(e,n),cv(e,r,i),Fu(e,r,i,n),zu(null,e,r,!0,t,n);case 19:return Ev(t,e,n);case 22:return bv(t,e,n)}throw Error(N(156,e.tag))};function Qv(t,e){return Ag(t,e)}function ax(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function It(t,e,n,r){return new ax(t,e,n,r)}function ld(t){return t=t.prototype,!(!t||!t.isReactComponent)}function lx(t){if(typeof t=="function")return ld(t)?1:0;if(t!=null){if(t=t.$$typeof,t===pc)return 11;if(t===vc)return 14}return 2}function nr(t,e){var n=t.alternate;return n===null?(n=It(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function La(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")ld(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ri:return Ir(n.children,i,o,e);case fc:s=8,i|=8;break;case hc:return t=It(12,n,e,i|2),t.elementType=hc,t.lanes=o,t;case gc:return t=It(13,n,e,i),t.elementType=gc,t.lanes=o,t;case mc:return t=It(19,n,e,i),t.elementType=mc,t.lanes=o,t;case og:return Ia(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case rg:s=10;break e;case ig:s=9;break e;case pc:s=11;break e;case vc:s=14;break e;case $n:s=16,r=null;break e}throw Error(N(130,t==null?t:typeof t,""))}return e=It(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Ir(t,e,n,r){return t=It(7,t,r,e),t.lanes=n,t}function Ia(t,e,n,r){return t=It(22,t,r,e),t.elementType=og,t.lanes=n,t.stateNode={isHidden:!1},t}function cd(t,e,n){return t=It(6,t,null,e),t.lanes=n,t}function ud(t,e,n){return e=It(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function cx(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$c(0),this.expirationTimes=$c(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$c(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function dd(t,e,n,r,i,o,s,a,l){return t=new cx(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=It(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_u(o),t}function ux(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ni,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Yv(t){if(!t)return qn;t=t._reactInternals;e:{if(kr(t)!==t||t.tag!==1)throw Error(N(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(lt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(N(171))}if(t.tag===1){var n=t.type;if(lt(n))return Cm(t,n,e)}return e}function Xv(t,e,n,r,i,o,s,a,l){return t=dd(n,r,!0,t,i,o,s,a,l),t.context=Yv(null),n=t.current,r=st(),i=er(n),o=xn(r,i),o.callback=e??null,Qn(n,o,i),t.current.lanes=i,to(t,i,r),dt(t,r),t}function Ra(t,e,n,r){var i=e.current,o=st(),s=er(i);return n=Yv(n),e.context===null?e.context=n:e.pendingContext=n,e=xn(o,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Qn(i,e,s),t!==null&&(Jt(t,i,s,o),fa(t,i,s)),s}function Na(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Zv(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function fd(t,e){Zv(t,e),(t=t.alternate)&&Zv(t,e)}function dx(){return null}var ey=typeof reportError=="function"?reportError:function(t){console.error(t)};function hd(t){this._internalRoot=t}$a.prototype.render=hd.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(N(409));Ra(t,e,null,null)},$a.prototype.unmount=hd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Pr(function(){Ra(null,t,null,null)}),e[yn]=null}};function $a(t){this._internalRoot=t}$a.prototype.unstable_scheduleHydration=function(t){if(t){var e=$g();t={blockedOn:null,target:t,priority:e};for(var n=0;n<zn.length&&e!==0&&e<zn[n].priority;n++);zn.splice(n,0,t),n===0&&jg(t)}};function pd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Fa(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function ty(){}function fx(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=Na(s);o.call(c)}}var s=Xv(e,r,t,0,null,!1,!1,"",ty);return t._reactRootContainer=s,t[yn]=s.current,mo(t.nodeType===8?t.parentNode:t),Pr(),s}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=Na(l);a.call(c)}}var l=dd(t,0,!1,null,null,!1,!1,"",ty);return t._reactRootContainer=l,t[yn]=l.current,mo(t.nodeType===8?t.parentNode:t),Pr(function(){Ra(e,l,n,r)}),l}function Ba(t,e,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if(typeof i=="function"){var a=i;i=function(){var l=Na(s);a.call(l)}}Ra(e,s,t,i)}else s=fx(n,e,t,i,r);return Na(s)}Rg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=eo(e.pendingLanes);n!==0&&(Fc(e,n|1),dt(e,Le()),!(he&6)&&(Ti=Le()+500,Jn()))}break;case 13:Pr(function(){var r=kn(t,1);if(r!==null){var i=st();Jt(r,t,1,i)}}),fd(t,1)}},Bc=function(t){if(t.tag===13){var e=kn(t,134217728);if(e!==null){var n=st();Jt(e,t,134217728,n)}fd(t,134217728)}},Ng=function(t){if(t.tag===13){var e=er(t),n=kn(t,e);if(n!==null){var r=st();Jt(n,t,e,r)}fd(t,e)}},$g=function(){return ve},Fg=function(t,e){var n=ve;try{return ve=t,e()}finally{ve=n}},Pc=function(t,e,n){switch(e){case"input":if(xc(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=na(r);if(!i)throw Error(N(90));lg(r),xc(r,i)}}}break;case"textarea":hg(t,n);break;case"select":e=n.value,e!=null&&ii(t,!!n.multiple,e,!1)}},kg=od,xg=Pr;var hx={usingClientEntryPoint:!1,Events:[bo,pi,na,wg,Sg,od]},Lo={findFiberByHostInstance:xr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},px={bundleType:Lo.bundleType,version:Lo.version,rendererPackageName:Lo.rendererPackageName,rendererConfig:Lo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Tg(t),t===null?null:t.stateNode},findFiberByHostInstance:Lo.findFiberByHostInstance||dx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ja=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ja.isDisabled&&ja.supportsFiber)try{$s=ja.inject(px),tn=ja}catch{}}vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=hx,vt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!pd(e))throw Error(N(200));return ux(t,e,null,n)},vt.createRoot=function(t,e){if(!pd(t))throw Error(N(299));var n=!1,r="",i=ey;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=dd(t,1,!1,null,null,n,!1,r,i),t[yn]=e.current,mo(t.nodeType===8?t.parentNode:t),new hd(e)},vt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(N(188)):(t=Object.keys(t).join(","),Error(N(268,t)));return t=Tg(e),t=t===null?null:t.stateNode,t},vt.flushSync=function(t){return Pr(t)},vt.hydrate=function(t,e,n){if(!Fa(e))throw Error(N(200));return Ba(null,t,e,!0,n)},vt.hydrateRoot=function(t,e,n){if(!pd(t))throw Error(N(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=ey;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=Xv(e,null,t,1,n??null,i,!1,o,s),t[yn]=e.current,mo(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new $a(e)},vt.render=function(t,e,n){if(!Fa(e))throw Error(N(200));return Ba(null,t,e,!1,n)},vt.unmountComponentAtNode=function(t){if(!Fa(t))throw Error(N(40));return t._reactRootContainer?(Pr(function(){Ba(null,null,t,!1,function(){t._reactRootContainer=null,t[yn]=null})}),!0):!1},vt.unstable_batchedUpdates=od,vt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Fa(n))throw Error(N(200));if(t==null||t._reactInternals===void 0)throw Error(N(38));return Ba(t,e,n,!1,r)},vt.version="18.3.1-next-f1338f8080-20240426";function ny(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ny)}catch(t){console.error(t)}}ny(),Yp.exports=vt;var gx=Yp.exports,ry=gx;ac.createRoot=ry.createRoot,ac.hydrateRoot=ry.hydrateRoot;var iy={exports:{}},Ua={};/**
|
|
374
|
+
`+o.stack}return{value:t,source:e,stack:i,digest:null}}function ju(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Uu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Kk=typeof WeakMap=="function"?WeakMap:Map;function fv(t,e,n){n=xn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ta||(Ta=!0,nd=r),Uu(t,e)},n}function hv(t,e,n){n=xn(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Uu(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Uu(t,e),typeof r!="function"&&(Zn===null?Zn=new Set([this]):Zn.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function pv(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Kk;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=ox.bind(null,t,e,n),e.then(t,t))}function gv(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function mv(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=xn(-1,1),e.tag=2,Yn(n,e,1))),n.lanes|=1),t)}var Wk=vn.ReactCurrentOwner,ct=!1;function ot(t,e,n,r){e.child=t===null?Nm(e,null,n,r):wi(e,t.child,n,r)}function vv(t,e,n,r,i){n=n.render;var o=e.ref;return ki(e,i),r=Pu(t,e,n,r,o,i),n=Lu(),t!==null&&!ct?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,_n(t,e,i)):(Te&&n&&gu(e),e.flags|=1,ot(t,e,r,i),e.child)}function yv(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!cd(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,bv(t,e,o,r,i)):(t=La(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:ho,n(s,r)&&t.ref===e.ref)return _n(t,e,i)}return e.flags|=1,t=rr(o,r),t.ref=e.ref,t.return=e,e.child=t}function bv(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(ho(o,r)&&t.ref===e.ref)if(ct=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(ct=!0);else return e.lanes=t.lanes,_n(t,e,i)}return zu(t,e,n,r,i)}function wv(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},_e(Ei,kt),kt|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,_e(Ei,kt),kt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,_e(Ei,kt),kt|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,_e(Ei,kt),kt|=r;return ot(t,e,i,n),e.child}function Sv(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function zu(t,e,n,r,i){var o=lt(n)?Cr:Ge.current;return o=mi(e,o),ki(e,i),n=Pu(t,e,n,r,o,i),r=Lu(),t!==null&&!ct?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,_n(t,e,i)):(Te&&r&&gu(e),e.flags|=1,ot(t,e,n,i),e.child)}function kv(t,e,n,r,i){if(lt(n)){var o=!0;ia(e)}else o=!1;if(ki(e,i),e.stateNode===null)ka(t,e),uv(e,n,r),Bu(e,n,r,i),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Dt(c):(c=lt(n)?Cr:Ge.current,c=mi(e,c));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&dv(e,s,r,c),Qn=!1;var h=e.memoizedState;s.state=h,ha(e,r,s,i),l=e.memoizedState,a!==r||h!==l||at.current||Qn?(typeof d=="function"&&(Fu(e,n,d,r),l=e.memoizedState),(a=Qn||cv(e,n,a,r,h,l,c))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,Fm(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Kt(e.type,a),s.props=c,f=e.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Dt(l):(l=lt(n)?Cr:Ge.current,l=mi(e,l));var b=n.getDerivedStateFromProps;(d=typeof b=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||h!==l)&&dv(e,s,r,l),Qn=!1,h=e.memoizedState,s.state=h,ha(e,r,s,i);var y=e.memoizedState;a!==f||h!==y||at.current||Qn?(typeof b=="function"&&(Fu(e,n,b,r),y=e.memoizedState),(c=Qn||cv(e,n,c,r,h,y,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,y,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,y,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=y),s.props=r,s.state=y,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return Hu(t,e,n,r,o,i)}function Hu(t,e,n,r,i,o){Sv(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&Tm(e,n,!1),_n(t,e,o);r=e.stateNode,Wk.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=wi(e,t.child,null,o),e.child=wi(e,null,a,o)):ot(t,e,a,o),e.memoizedState=r.state,i&&Tm(e,n,!0),e.child}function xv(t){var e=t.stateNode;e.pendingContext?Cm(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Cm(t,e.context,!1),Eu(t,e.containerInfo)}function _v(t,e,n,r,i){return bi(),bu(i),e.flags|=256,ot(t,e,n,r),e.child}var Vu={dehydrated:null,treeContext:null,retryLane:0};function Ku(t){return{baseLanes:t,cachePool:null,transitions:null}}function Cv(t,e,n){var r=e.pendingProps,i=Ae.current,o=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),_e(Ae,i&1),t===null)return yu(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,o?(r=e.mode,o=e.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=Ia(s,r,0,null),t=Rr(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Ku(n),e.memoizedState=Vu,t):Wu(e,s));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return qk(t,e,s,r,a,i,n);if(o){o=r.fallback,s=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=rr(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?o=rr(a,o):(o=Rr(o,s,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,r=o,o=e.child,s=t.child.memoizedState,s=s===null?Ku(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=Vu,r}return o=t.child,t=o.sibling,r=rr(o,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Wu(t,e){return e=Ia({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Sa(t,e,n,r){return r!==null&&bu(r),wi(e,t.child,null,n),t=Wu(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function qk(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=ju(Error(N(422))),Sa(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Ia({mode:"visible",children:r.children},i,0,null),o=Rr(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&wi(e,t.child,null,s),e.child.memoizedState=Ku(s),e.memoizedState=Vu,o);if(!(e.mode&1))return Sa(t,e,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error(N(419)),r=ju(o,r,void 0),Sa(t,e,s,r)}if(a=(s&t.childLanes)!==0,ct||a){if(r=Be,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,kn(t,i),Jt(r,t,i,-1))}return ld(),r=ju(Error(N(421))),Sa(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=sx.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,St=Wn(i.nextSibling),wt=e,Te=!0,Vt=null,t!==null&&(At[Ot++]=wn,At[Ot++]=Sn,At[Ot++]=Er,wn=t.id,Sn=t.overflow,Er=e),e=Wu(e,r.children),e.flags|=4096,e)}function Ev(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),xu(t.return,e,n)}function qu(t,e,n,r,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Tv(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(ot(t,e,r.children,n),r=Ae.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Ev(t,n,e);else if(t.tag===19)Ev(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(_e(Ae,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&pa(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),qu(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&pa(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}qu(e,!0,n,null,o);break;case"together":qu(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ka(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function _n(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Dr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(N(153));if(e.child!==null){for(t=e.child,n=rr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=rr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Jk(t,e,n){switch(e.tag){case 3:xv(e),bi();break;case 5:Um(e);break;case 1:lt(e.type)&&ia(e);break;case 4:Eu(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;_e(ua,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(_e(Ae,Ae.current&1),e.flags|=128,null):n&e.child.childLanes?Cv(t,e,n):(_e(Ae,Ae.current&1),t=_n(t,e,n),t!==null?t.sibling:null);_e(Ae,Ae.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Tv(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),_e(Ae,Ae.current),r)break;return null;case 22:case 23:return e.lanes=0,wv(t,e,n)}return _n(t,e,n)}var Mv,Ju,Av,Ov;Mv=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ju=function(){},Av=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Ar(rn.current);var o=null;switch(n){case"input":i=xc(t,i),r=xc(t,r),o=[];break;case"select":i=Me({},i,{value:void 0}),r=Me({},r,{value:void 0}),o=[];break;case"textarea":i=Ec(t,i),r=Ec(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=ta)}Mc(n,r);var s;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ki.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(o||(o=[]),o.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ki.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ce("scroll",t),o||a===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(e.updateQueue=c)&&(e.flags|=4)}},Ov=function(t,e,n,r){n!==r&&(e.flags|=4)};function Mo(t,e){if(!Te)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Ye(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function Gk(t,e,n){var r=e.pendingProps;switch(mu(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(e),null;case 1:return lt(e.type)&&ra(),Ye(e),null;case 3:return r=e.stateNode,xi(),Ee(at),Ee(Ge),Au(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(la(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Vt!==null&&(od(Vt),Vt=null))),Ju(t,e),Ye(e),null;case 5:Tu(e);var i=Ar(xo.current);if(n=e.type,t!==null&&e.stateNode!=null)Av(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(N(166));return Ye(e),null}if(t=Ar(rn.current),la(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[nn]=e,r[yo]=o,t=(e.mode&1)!==0,n){case"dialog":Ce("cancel",r),Ce("close",r);break;case"iframe":case"object":case"embed":Ce("load",r);break;case"video":case"audio":for(i=0;i<go.length;i++)Ce(go[i],r);break;case"source":Ce("error",r);break;case"img":case"image":case"link":Ce("error",r),Ce("load",r);break;case"details":Ce("toggle",r);break;case"input":ug(r,o),Ce("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Ce("invalid",r);break;case"textarea":hg(r,o),Ce("invalid",r)}Mc(n,o),i=null;for(var s in o)if(o.hasOwnProperty(s)){var a=o[s];s==="children"?typeof a=="string"?r.textContent!==a&&(o.suppressHydrationWarning!==!0&&ea(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&ea(r.textContent,a,t),i=["children",""+a]):Ki.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ce("scroll",r)}switch(n){case"input":Ds(r),fg(r,o,!0);break;case"textarea":Ds(r),gg(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=ta)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=mg(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[nn]=e,t[yo]=r,Mv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Ac(n,r),n){case"dialog":Ce("cancel",t),Ce("close",t),i=r;break;case"iframe":case"object":case"embed":Ce("load",t),i=r;break;case"video":case"audio":for(i=0;i<go.length;i++)Ce(go[i],t);i=r;break;case"source":Ce("error",t),i=r;break;case"img":case"image":case"link":Ce("error",t),Ce("load",t),i=r;break;case"details":Ce("toggle",t),i=r;break;case"input":ug(t,r),i=xc(t,r),Ce("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Me({},r,{value:void 0}),Ce("invalid",t);break;case"textarea":hg(t,r),i=Ec(t,r),Ce("invalid",t);break;default:i=r}Mc(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?bg(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&vg(t,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Gi(t,l):typeof l=="number"&&Gi(t,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Ki.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Ce("scroll",t):l!=null&&fc(t,o,l,s))}switch(n){case"input":Ds(t),fg(t,r,!1);break;case"textarea":Ds(t),gg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Bn(r.value));break;case"select":t.multiple=!!r.multiple,o=r.value,o!=null?ii(t,!!r.multiple,o,!1):r.defaultValue!=null&&ii(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=ta)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Ye(e),null;case 6:if(t&&e.stateNode!=null)Ov(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(N(166));if(n=Ar(xo.current),Ar(rn.current),la(e)){if(r=e.stateNode,n=e.memoizedProps,r[nn]=e,(o=r.nodeValue!==n)&&(t=wt,t!==null))switch(t.tag){case 3:ea(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ea(r.nodeValue,n,(t.mode&1)!==0)}o&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[nn]=e,e.stateNode=r}return Ye(e),null;case 13:if(Ee(Ae),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Te&&St!==null&&e.mode&1&&!(e.flags&128))Lm(),bi(),e.flags|=98560,o=!1;else if(o=la(e),r!==null&&r.dehydrated!==null){if(t===null){if(!o)throw Error(N(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(N(317));o[nn]=e}else bi(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ye(e),o=!1}else Vt!==null&&(od(Vt),Vt=null),o=!0;if(!o)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Ae.current&1?Ne===0&&(Ne=3):ld())),e.updateQueue!==null&&(e.flags|=4),Ye(e),null);case 4:return xi(),Ju(t,e),t===null&&mo(e.stateNode.containerInfo),Ye(e),null;case 10:return ku(e.type._context),Ye(e),null;case 17:return lt(e.type)&&ra(),Ye(e),null;case 19:if(Ee(Ae),o=e.memoizedState,o===null)return Ye(e),null;if(r=(e.flags&128)!==0,s=o.rendering,s===null)if(r)Mo(o,!1);else{if(Ne!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=pa(t),s!==null){for(e.flags|=128,Mo(o,!1),r=s.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)o=n,t=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=t,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,t=s.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return _e(Ae,Ae.current&1|2),e.child}t=t.sibling}o.tail!==null&&Le()>Ti&&(e.flags|=128,r=!0,Mo(o,!1),e.lanes=4194304)}else{if(!r)if(t=pa(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Mo(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Te)return Ye(e),null}else 2*Le()-o.renderingStartTime>Ti&&n!==1073741824&&(e.flags|=128,r=!0,Mo(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Le(),e.sibling=null,n=Ae.current,_e(Ae,r?n&1|2:n&1),e):(Ye(e),null);case 22:case 23:return ad(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?kt&1073741824&&(Ye(e),e.subtreeFlags&6&&(e.flags|=8192)):Ye(e),null;case 24:return null;case 25:return null}throw Error(N(156,e.tag))}function Qk(t,e){switch(mu(e),e.tag){case 1:return lt(e.type)&&ra(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xi(),Ee(at),Ee(Ge),Au(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Tu(e),null;case 13:if(Ee(Ae),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(N(340));bi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ee(Ae),null;case 4:return xi(),null;case 10:return ku(e.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var xa=!1,Xe=!1,Yk=typeof WeakSet=="function"?WeakSet:Set,j=null;function Ci(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(t,e,r)}else n.current=null}function Gu(t,e,n){try{n()}catch(r){De(t,e,r)}}var Dv=!1;function Xk(t,e){if(au=Hs,t=cm(),Zc(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,d=0,f=t,h=null;t:for(;;){for(var b;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(b=f.firstChild)!==null;)h=f,f=b;for(;;){if(f===t)break t;if(h===n&&++c===i&&(a=s),h===o&&++d===r&&(l=s),(b=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=b}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(lu={focusedElem:t,selectionRange:n},Hs=!1,j=e;j!==null;)if(e=j,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,j=t;else for(;j!==null;){e=j;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var g=y.memoizedProps,S=y.memoizedState,v=e.stateNode,w=v.getSnapshotBeforeUpdate(e.elementType===e.type?g:Kt(e.type,g),S);v.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(C){De(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,j=t;break}j=e.return}return y=Dv,Dv=!1,y}function Ao(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Gu(e,n,o)}i=i.next}while(i!==r)}}function _a(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Qu(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Pv(t){var e=t.alternate;e!==null&&(t.alternate=null,Pv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[yo],delete e[fu],delete e[Ik],delete e[Rk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Lv(t){return t.tag===5||t.tag===3||t.tag===4}function Iv(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Lv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yu(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=ta));else if(r!==4&&(t=t.child,t!==null))for(Yu(t,e,n),t=t.sibling;t!==null;)Yu(t,e,n),t=t.sibling}function Xu(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Xu(t,e,n),t=t.sibling;t!==null;)Xu(t,e,n),t=t.sibling}var Ve=null,Wt=!1;function Xn(t,e,n){for(n=n.child;n!==null;)Rv(t,e,n),n=n.sibling}function Rv(t,e,n){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount($s,n)}catch{}switch(n.tag){case 5:Xe||Ci(n,e);case 6:var r=Ve,i=Wt;Ve=null,Xn(t,e,n),Ve=r,Wt=i,Ve!==null&&(Wt?(t=Ve,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ve.removeChild(n.stateNode));break;case 18:Ve!==null&&(Wt?(t=Ve,n=n.stateNode,t.nodeType===8?du(t.parentNode,n):t.nodeType===1&&du(t,n),so(t)):du(Ve,n.stateNode));break;case 4:r=Ve,i=Wt,Ve=n.stateNode.containerInfo,Wt=!0,Xn(t,e,n),Ve=r,Wt=i;break;case 0:case 11:case 14:case 15:if(!Xe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Gu(n,e,s),i=i.next}while(i!==r)}Xn(t,e,n);break;case 1:if(!Xe&&(Ci(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){De(n,e,a)}Xn(t,e,n);break;case 21:Xn(t,e,n);break;case 22:n.mode&1?(Xe=(r=Xe)||n.memoizedState!==null,Xn(t,e,n),Xe=r):Xn(t,e,n);break;default:Xn(t,e,n)}}function Nv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Yk),e.forEach(function(r){var i=ax.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function qt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=t,s=e,a=s;e:for(;a!==null;){switch(a.tag){case 5:Ve=a.stateNode,Wt=!1;break e;case 3:Ve=a.stateNode.containerInfo,Wt=!0;break e;case 4:Ve=a.stateNode.containerInfo,Wt=!0;break e}a=a.return}if(Ve===null)throw Error(N(160));Rv(o,s,i),Ve=null,Wt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){De(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)$v(e,t),e=e.sibling}function $v(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(qt(e,t),sn(t),r&4){try{Ao(3,t,t.return),_a(3,t)}catch(g){De(t,t.return,g)}try{Ao(5,t,t.return)}catch(g){De(t,t.return,g)}}break;case 1:qt(e,t),sn(t),r&512&&n!==null&&Ci(n,n.return);break;case 5:if(qt(e,t),sn(t),r&512&&n!==null&&Ci(n,n.return),t.flags&32){var i=t.stateNode;try{Gi(i,"")}catch(g){De(t,t.return,g)}}if(r&4&&(i=t.stateNode,i!=null)){var o=t.memoizedProps,s=n!==null?n.memoizedProps:o,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&dg(i,o),Ac(a,s);var c=Ac(a,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d==="style"?bg(i,f):d==="dangerouslySetInnerHTML"?vg(i,f):d==="children"?Gi(i,f):fc(i,d,f,c)}switch(a){case"input":_c(i,o);break;case"textarea":pg(i,o);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var b=o.value;b!=null?ii(i,!!o.multiple,b,!1):h!==!!o.multiple&&(o.defaultValue!=null?ii(i,!!o.multiple,o.defaultValue,!0):ii(i,!!o.multiple,o.multiple?[]:"",!1))}i[yo]=o}catch(g){De(t,t.return,g)}}break;case 6:if(qt(e,t),sn(t),r&4){if(t.stateNode===null)throw Error(N(162));i=t.stateNode,o=t.memoizedProps;try{i.nodeValue=o}catch(g){De(t,t.return,g)}}break;case 3:if(qt(e,t),sn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{so(e.containerInfo)}catch(g){De(t,t.return,g)}break;case 4:qt(e,t),sn(t);break;case 13:qt(e,t),sn(t),i=t.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(td=Le())),r&4&&Nv(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Xe=(c=Xe)||d,qt(e,t),Xe=c):qt(e,t),sn(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(j=t,d=t.child;d!==null;){for(f=j=d;j!==null;){switch(h=j,b=h.child,h.tag){case 0:case 11:case 14:case 15:Ao(4,h,h.return);break;case 1:Ci(h,h.return);var y=h.stateNode;if(typeof y.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(g){De(r,n,g)}}break;case 5:Ci(h,h.return);break;case 22:if(h.memoizedState!==null){jv(f);continue}}b!==null?(b.return=h,j=b):jv(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=yg("display",s))}catch(g){De(t,t.return,g)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(g){De(t,t.return,g)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:qt(e,t),sn(t),r&4&&Nv(t);break;case 21:break;default:qt(e,t),sn(t)}}function sn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Lv(n)){var r=n;break e}n=n.return}throw Error(N(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Gi(i,""),r.flags&=-33);var o=Iv(t);Xu(t,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=Iv(t);Yu(t,a,s);break;default:throw Error(N(161))}}catch(l){De(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Zk(t,e,n){j=t,Fv(t)}function Fv(t,e,n){for(var r=(t.mode&1)!==0;j!==null;){var i=j,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||xa;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Xe;a=xa;var c=Xe;if(xa=s,(Xe=l)&&!c)for(j=i;j!==null;)s=j,l=s.child,s.tag===22&&s.memoizedState!==null?Uv(i):l!==null?(l.return=s,j=l):Uv(i);for(;o!==null;)j=o,Fv(o),o=o.sibling;j=i,xa=a,Xe=c}Bv(t)}else i.subtreeFlags&8772&&o!==null?(o.return=i,j=o):Bv(t)}}function Bv(t){for(;j!==null;){var e=j;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Xe||_a(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Xe)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Kt(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=e.updateQueue;o!==null&&jm(e,o,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}jm(e,s,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&so(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(N(163))}Xe||e.flags&512&&Qu(e)}catch(h){De(e,e.return,h)}}if(e===t){j=null;break}if(n=e.sibling,n!==null){n.return=e.return,j=n;break}j=e.return}}function jv(t){for(;j!==null;){var e=j;if(e===t){j=null;break}var n=e.sibling;if(n!==null){n.return=e.return,j=n;break}j=e.return}}function Uv(t){for(;j!==null;){var e=j;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{_a(4,e)}catch(l){De(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){De(e,i,l)}}var o=e.return;try{Qu(e)}catch(l){De(e,o,l)}break;case 5:var s=e.return;try{Qu(e)}catch(l){De(e,s,l)}}}catch(l){De(e,e.return,l)}if(e===t){j=null;break}var a=e.sibling;if(a!==null){a.return=e.return,j=a;break}j=e.return}}var ex=Math.ceil,Ca=vn.ReactCurrentDispatcher,Zu=vn.ReactCurrentOwner,Lt=vn.ReactCurrentBatchConfig,he=0,Be=null,Ie=null,Ke=0,kt=0,Ei=qn(0),Ne=0,Oo=null,Dr=0,Ea=0,ed=0,Do=null,ut=null,td=0,Ti=1/0,Cn=null,Ta=!1,nd=null,Zn=null,Ma=!1,er=null,Aa=0,Po=0,rd=null,Oa=-1,Da=0;function st(){return he&6?Le():Oa!==-1?Oa:Oa=Le()}function tr(t){return t.mode&1?he&2&&Ke!==0?Ke&-Ke:$k.transition!==null?(Da===0&&(Da=Ig()),Da):(t=ve,t!==0||(t=window.event,t=t===void 0?16:Hg(t.type)),t):1}function Jt(t,e,n,r){if(50<Po)throw Po=0,rd=null,Error(N(185));to(t,n,r),(!(he&2)||t!==Be)&&(t===Be&&(!(he&2)&&(Ea|=n),Ne===4&&nr(t,Ke)),dt(t,r),n===1&&he===0&&!(e.mode&1)&&(Ti=Le()+500,oa&&Gn()))}function dt(t,e){var n=t.callbackNode;$S(t,e);var r=js(t,t===Be?Ke:0);if(r===0)n!==null&&Dg(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Dg(n),e===1)t.tag===0?Nk(Hv.bind(null,t)):Mm(Hv.bind(null,t)),Pk(function(){!(he&6)&&Gn()}),n=null;else{switch(Rg(r)){case 1:n=Nc;break;case 4:n=Pg;break;case 16:n=Ns;break;case 536870912:n=Lg;break;default:n=Ns}n=Yv(n,zv.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function zv(t,e){if(Oa=-1,Da=0,he&6)throw Error(N(327));var n=t.callbackNode;if(Mi()&&t.callbackNode!==n)return null;var r=js(t,t===Be?Ke:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Pa(t,r);else{e=r;var i=he;he|=2;var o=Kv();(Be!==t||Ke!==e)&&(Cn=null,Ti=Le()+500,Lr(t,e));do try{rx();break}catch(a){Vv(t,a)}while(!0);Su(),Ca.current=o,he=i,Ie!==null?e=0:(Be=null,Ke=0,e=Ne)}if(e!==0){if(e===2&&(i=$c(t),i!==0&&(r=i,e=id(t,i))),e===1)throw n=Oo,Lr(t,0),nr(t,r),dt(t,Le()),n;if(e===6)nr(t,r);else{if(i=t.current.alternate,!(r&30)&&!tx(i)&&(e=Pa(t,r),e===2&&(o=$c(t),o!==0&&(r=o,e=id(t,o))),e===1))throw n=Oo,Lr(t,0),nr(t,r),dt(t,Le()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(N(345));case 2:Ir(t,ut,Cn);break;case 3:if(nr(t,r),(r&130023424)===r&&(e=td+500-Le(),10<e)){if(js(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){st(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=uu(Ir.bind(null,t,ut,Cn),e);break}Ir(t,ut,Cn);break;case 4:if(nr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var s=31-zt(r);o=1<<s,s=e[s],s>i&&(i=s),r&=~o}if(r=i,r=Le()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ex(r/1960))-r,10<r){t.timeoutHandle=uu(Ir.bind(null,t,ut,Cn),r);break}Ir(t,ut,Cn);break;case 5:Ir(t,ut,Cn);break;default:throw Error(N(329))}}}return dt(t,Le()),t.callbackNode===n?zv.bind(null,t):null}function id(t,e){var n=Do;return t.current.memoizedState.isDehydrated&&(Lr(t,e).flags|=256),t=Pa(t,e),t!==2&&(e=ut,ut=n,e!==null&&od(e)),t}function od(t){ut===null?ut=t:ut.push.apply(ut,t)}function tx(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!Ht(o(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function nr(t,e){for(e&=~ed,e&=~Ea,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-zt(e),r=1<<n;t[n]=-1,e&=~r}}function Hv(t){if(he&6)throw Error(N(327));Mi();var e=js(t,0);if(!(e&1))return dt(t,Le()),null;var n=Pa(t,e);if(t.tag!==0&&n===2){var r=$c(t);r!==0&&(e=r,n=id(t,r))}if(n===1)throw n=Oo,Lr(t,0),nr(t,e),dt(t,Le()),n;if(n===6)throw Error(N(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Ir(t,ut,Cn),dt(t,Le()),null}function sd(t,e){var n=he;he|=1;try{return t(e)}finally{he=n,he===0&&(Ti=Le()+500,oa&&Gn())}}function Pr(t){er!==null&&er.tag===0&&!(he&6)&&Mi();var e=he;he|=1;var n=Lt.transition,r=ve;try{if(Lt.transition=null,ve=1,t)return t()}finally{ve=r,Lt.transition=n,he=e,!(he&6)&&Gn()}}function ad(){kt=Ei.current,Ee(Ei)}function Lr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Dk(n)),Ie!==null)for(n=Ie.return;n!==null;){var r=n;switch(mu(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ra();break;case 3:xi(),Ee(at),Ee(Ge),Au();break;case 5:Tu(r);break;case 4:xi();break;case 13:Ee(Ae);break;case 19:Ee(Ae);break;case 10:ku(r.type._context);break;case 22:case 23:ad()}n=n.return}if(Be=t,Ie=t=rr(t.current,null),Ke=kt=e,Ne=0,Oo=null,ed=Ea=Dr=0,ut=Do=null,Mr!==null){for(e=0;e<Mr.length;e++)if(n=Mr[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var s=o.next;o.next=i,r.next=s}n.pending=r}Mr=null}return t}function Vv(t,e){do{var n=Ie;try{if(Su(),ga.current=ba,ma){for(var r=Oe.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ma=!1}if(Or=0,Fe=Re=Oe=null,_o=!1,Co=0,Zu.current=null,n===null||n.return===null){Ne=1,Oo=e,Ie=null;break}e:{var o=t,s=n.return,a=n,l=e;if(e=Ke,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var b=gv(s);if(b!==null){b.flags&=-257,mv(b,s,a,o,e),b.mode&1&&pv(o,c,e),e=b,l=c;var y=e.updateQueue;if(y===null){var g=new Set;g.add(l),e.updateQueue=g}else y.add(l);break e}else{if(!(e&1)){pv(o,c,e),ld();break e}l=Error(N(426))}}else if(Te&&a.mode&1){var S=gv(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),mv(S,s,a,o,e),bu(_i(l,a));break e}}o=l=_i(l,a),Ne!==4&&(Ne=2),Do===null?Do=[o]:Do.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var v=fv(o,l,e);Bm(o,v);break e;case 1:a=l;var w=o.type,k=o.stateNode;if(!(o.flags&128)&&(typeof w.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Zn===null||!Zn.has(k)))){o.flags|=65536,e&=-e,o.lanes|=e;var C=hv(o,a,e);Bm(o,C);break e}}o=o.return}while(o!==null)}qv(n)}catch(E){e=E,Ie===n&&n!==null&&(Ie=n=n.return);continue}break}while(!0)}function Kv(){var t=Ca.current;return Ca.current=ba,t===null?ba:t}function ld(){(Ne===0||Ne===3||Ne===2)&&(Ne=4),Be===null||!(Dr&268435455)&&!(Ea&268435455)||nr(Be,Ke)}function Pa(t,e){var n=he;he|=2;var r=Kv();(Be!==t||Ke!==e)&&(Cn=null,Lr(t,e));do try{nx();break}catch(i){Vv(t,i)}while(!0);if(Su(),he=n,Ca.current=r,Ie!==null)throw Error(N(261));return Be=null,Ke=0,Ne}function nx(){for(;Ie!==null;)Wv(Ie)}function rx(){for(;Ie!==null&&!MS();)Wv(Ie)}function Wv(t){var e=Qv(t.alternate,t,kt);t.memoizedProps=t.pendingProps,e===null?qv(t):Ie=e,Zu.current=null}function qv(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=Qk(n,e),n!==null){n.flags&=32767,Ie=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ne=6,Ie=null;return}}else if(n=Gk(n,e,kt),n!==null){Ie=n;return}if(e=e.sibling,e!==null){Ie=e;return}Ie=e=t}while(e!==null);Ne===0&&(Ne=5)}function Ir(t,e,n){var r=ve,i=Lt.transition;try{Lt.transition=null,ve=1,ix(t,e,n,r)}finally{Lt.transition=i,ve=r}return null}function ix(t,e,n,r){do Mi();while(er!==null);if(he&6)throw Error(N(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(N(177));t.callbackNode=null,t.callbackPriority=0;var o=n.lanes|n.childLanes;if(FS(t,o),t===Be&&(Ie=Be=null,Ke=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ma||(Ma=!0,Yv(Ns,function(){return Mi(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Lt.transition,Lt.transition=null;var s=ve;ve=1;var a=he;he|=4,Zu.current=null,Xk(t,n),$v(n,t),_k(lu),Hs=!!au,lu=au=null,t.current=n,Zk(n),AS(),he=a,ve=s,Lt.transition=o}else t.current=n;if(Ma&&(Ma=!1,er=t,Aa=i),o=t.pendingLanes,o===0&&(Zn=null),PS(n.stateNode),dt(t,Le()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ta)throw Ta=!1,t=nd,nd=null,t;return Aa&1&&t.tag!==0&&Mi(),o=t.pendingLanes,o&1?t===rd?Po++:(Po=0,rd=t):Po=0,Gn(),null}function Mi(){if(er!==null){var t=Rg(Aa),e=Lt.transition,n=ve;try{if(Lt.transition=null,ve=16>t?16:t,er===null)var r=!1;else{if(t=er,er=null,Aa=0,he&6)throw Error(N(331));var i=he;for(he|=4,j=t.current;j!==null;){var o=j,s=o.child;if(j.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(j=c;j!==null;){var d=j;switch(d.tag){case 0:case 11:case 15:Ao(8,d,o)}var f=d.child;if(f!==null)f.return=d,j=f;else for(;j!==null;){d=j;var h=d.sibling,b=d.return;if(Pv(d),d===c){j=null;break}if(h!==null){h.return=b,j=h;break}j=b}}}var y=o.alternate;if(y!==null){var g=y.child;if(g!==null){y.child=null;do{var S=g.sibling;g.sibling=null,g=S}while(g!==null)}}j=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,j=s;else e:for(;j!==null;){if(o=j,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Ao(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,j=v;break e}j=o.return}}var w=t.current;for(j=w;j!==null;){s=j;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,j=k;else e:for(s=w;j!==null;){if(a=j,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:_a(9,a)}}catch(E){De(a,a.return,E)}if(a===s){j=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,j=C;break e}j=a.return}}if(he=i,Gn(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot($s,t)}catch{}r=!0}return r}finally{ve=n,Lt.transition=e}}return!1}function Jv(t,e,n){e=_i(n,e),e=fv(t,e,1),t=Yn(t,e,1),e=st(),t!==null&&(to(t,1,e),dt(t,e))}function De(t,e,n){if(t.tag===3)Jv(t,t,n);else for(;e!==null;){if(e.tag===3){Jv(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Zn===null||!Zn.has(r))){t=_i(n,t),t=hv(e,t,1),e=Yn(e,t,1),t=st(),e!==null&&(to(e,1,t),dt(e,t));break}}e=e.return}}function ox(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=st(),t.pingedLanes|=t.suspendedLanes&n,Be===t&&(Ke&n)===n&&(Ne===4||Ne===3&&(Ke&130023424)===Ke&&500>Le()-td?Lr(t,0):ed|=n),dt(t,e)}function Gv(t,e){e===0&&(t.mode&1?(e=Bs,Bs<<=1,!(Bs&130023424)&&(Bs=4194304)):e=1);var n=st();t=kn(t,e),t!==null&&(to(t,e,n),dt(t,n))}function sx(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Gv(t,n)}function ax(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(e),Gv(t,n)}var Qv;Qv=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||at.current)ct=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return ct=!1,Jk(t,e,n);ct=!!(t.flags&131072)}else ct=!1,Te&&e.flags&1048576&&Am(e,aa,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ka(t,e),t=e.pendingProps;var i=mi(e,Ge.current);ki(e,n),i=Pu(null,e,r,t,i,n);var o=Lu();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,lt(r)?(o=!0,ia(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Cu(e),i.updater=wa,e.stateNode=i,i._reactInternals=e,Bu(e,r,t,n),e=Hu(null,e,r,!0,o,n)):(e.tag=0,Te&&o&&gu(e),ot(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(ka(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=cx(r),t=Kt(r,t),i){case 0:e=zu(null,e,r,t,n);break e;case 1:e=kv(null,e,r,t,n);break e;case 11:e=vv(null,e,r,t,n);break e;case 14:e=yv(null,e,r,Kt(r.type,t),n);break e}throw Error(N(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Kt(r,i),zu(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Kt(r,i),kv(t,e,r,i,n);case 3:e:{if(xv(e),t===null)throw Error(N(387));r=e.pendingProps,o=e.memoizedState,i=o.element,Fm(t,e),ha(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=_i(Error(N(423)),e),e=_v(t,e,r,n,i);break e}else if(r!==i){i=_i(Error(N(424)),e),e=_v(t,e,r,n,i);break e}else for(St=Wn(e.stateNode.containerInfo.firstChild),wt=e,Te=!0,Vt=null,n=Nm(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bi(),r===i){e=_n(t,e,n);break e}ot(t,e,r,n)}e=e.child}return e;case 5:return Um(e),t===null&&yu(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,cu(r,i)?s=null:o!==null&&cu(r,o)&&(e.flags|=32),Sv(t,e),ot(t,e,s,n),e.child;case 6:return t===null&&yu(e),null;case 13:return Cv(t,e,n);case 4:return Eu(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=wi(e,null,r,n):ot(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Kt(r,i),vv(t,e,r,i,n);case 7:return ot(t,e,e.pendingProps,n),e.child;case 8:return ot(t,e,e.pendingProps.children,n),e.child;case 12:return ot(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,_e(ua,r._currentValue),r._currentValue=s,o!==null)if(Ht(o.value,s)){if(o.children===i.children&&!at.current){e=_n(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=xn(-1,n&-n),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),xu(o.return,n,e),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(N(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),xu(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ot(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,ki(e,n),i=Dt(i),r=r(i),e.flags|=1,ot(t,e,r,n),e.child;case 14:return r=e.type,i=Kt(r,e.pendingProps),i=Kt(r.type,i),yv(t,e,r,i,n);case 15:return bv(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Kt(r,i),ka(t,e),e.tag=1,lt(r)?(t=!0,ia(e)):t=!1,ki(e,n),uv(e,r,i),Bu(e,r,i,n),Hu(null,e,r,!0,t,n);case 19:return Tv(t,e,n);case 22:return wv(t,e,n)}throw Error(N(156,e.tag))};function Yv(t,e){return Og(t,e)}function lx(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function It(t,e,n,r){return new lx(t,e,n,r)}function cd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function cx(t){if(typeof t=="function")return cd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===gc)return 11;if(t===yc)return 14}return 2}function rr(t,e){var n=t.alternate;return n===null?(n=It(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function La(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")cd(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ri:return Rr(n.children,i,o,e);case hc:s=8,i|=8;break;case pc:return t=It(12,n,e,i|2),t.elementType=pc,t.lanes=o,t;case mc:return t=It(13,n,e,i),t.elementType=mc,t.lanes=o,t;case vc:return t=It(19,n,e,i),t.elementType=vc,t.lanes=o,t;case sg:return Ia(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ig:s=10;break e;case og:s=9;break e;case gc:s=11;break e;case yc:s=14;break e;case Fn:s=16,r=null;break e}throw Error(N(130,t==null?t:typeof t,""))}return e=It(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Rr(t,e,n,r){return t=It(7,t,r,e),t.lanes=n,t}function Ia(t,e,n,r){return t=It(22,t,r,e),t.elementType=sg,t.lanes=n,t.stateNode={isHidden:!1},t}function ud(t,e,n){return t=It(6,t,null,e),t.lanes=n,t}function dd(t,e,n){return e=It(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function ux(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fc(0),this.expirationTimes=Fc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fc(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function fd(t,e,n,r,i,o,s,a,l){return t=new ux(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=It(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cu(o),t}function dx(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ni,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Xv(t){if(!t)return Jn;t=t._reactInternals;e:{if(xr(t)!==t||t.tag!==1)throw Error(N(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(lt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(N(171))}if(t.tag===1){var n=t.type;if(lt(n))return Em(t,n,e)}return e}function Zv(t,e,n,r,i,o,s,a,l){return t=fd(n,r,!0,t,i,o,s,a,l),t.context=Xv(null),n=t.current,r=st(),i=tr(n),o=xn(r,i),o.callback=e??null,Yn(n,o,i),t.current.lanes=i,to(t,i,r),dt(t,r),t}function Ra(t,e,n,r){var i=e.current,o=st(),s=tr(i);return n=Xv(n),e.context===null?e.context=n:e.pendingContext=n,e=xn(o,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Yn(i,e,s),t!==null&&(Jt(t,i,s,o),fa(t,i,s)),s}function Na(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function ey(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function hd(t,e){ey(t,e),(t=t.alternate)&&ey(t,e)}function fx(){return null}var ty=typeof reportError=="function"?reportError:function(t){console.error(t)};function pd(t){this._internalRoot=t}$a.prototype.render=pd.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(N(409));Ra(t,e,null,null)},$a.prototype.unmount=pd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Pr(function(){Ra(null,t,null,null)}),e[yn]=null}};function $a(t){this._internalRoot=t}$a.prototype.unstable_scheduleHydration=function(t){if(t){var e=Fg();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Hn.length&&e!==0&&e<Hn[n].priority;n++);Hn.splice(n,0,t),n===0&&Ug(t)}};function gd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Fa(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function ny(){}function hx(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=Na(s);o.call(c)}}var s=Zv(e,r,t,0,null,!1,!1,"",ny);return t._reactRootContainer=s,t[yn]=s.current,mo(t.nodeType===8?t.parentNode:t),Pr(),s}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=Na(l);a.call(c)}}var l=fd(t,0,!1,null,null,!1,!1,"",ny);return t._reactRootContainer=l,t[yn]=l.current,mo(t.nodeType===8?t.parentNode:t),Pr(function(){Ra(e,l,n,r)}),l}function Ba(t,e,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if(typeof i=="function"){var a=i;i=function(){var l=Na(s);a.call(l)}}Ra(e,s,t,i)}else s=hx(n,e,t,i,r);return Na(s)}Ng=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=eo(e.pendingLanes);n!==0&&(Bc(e,n|1),dt(e,Le()),!(he&6)&&(Ti=Le()+500,Gn()))}break;case 13:Pr(function(){var r=kn(t,1);if(r!==null){var i=st();Jt(r,t,1,i)}}),hd(t,1)}},jc=function(t){if(t.tag===13){var e=kn(t,134217728);if(e!==null){var n=st();Jt(e,t,134217728,n)}hd(t,134217728)}},$g=function(t){if(t.tag===13){var e=tr(t),n=kn(t,e);if(n!==null){var r=st();Jt(n,t,e,r)}hd(t,e)}},Fg=function(){return ve},Bg=function(t,e){var n=ve;try{return ve=t,e()}finally{ve=n}},Pc=function(t,e,n){switch(e){case"input":if(_c(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=na(r);if(!i)throw Error(N(90));cg(r),_c(r,i)}}}break;case"textarea":pg(t,n);break;case"select":e=n.value,e!=null&&ii(t,!!n.multiple,e,!1)}},xg=sd,_g=Pr;var px={usingClientEntryPoint:!1,Events:[bo,pi,na,Sg,kg,sd]},Lo={findFiberByHostInstance:_r,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gx={bundleType:Lo.bundleType,version:Lo.version,rendererPackageName:Lo.rendererPackageName,rendererConfig:Lo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Mg(t),t===null?null:t.stateNode},findFiberByHostInstance:Lo.findFiberByHostInstance||fx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ja=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ja.isDisabled&&ja.supportsFiber)try{$s=ja.inject(gx),tn=ja}catch{}}vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=px,vt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gd(e))throw Error(N(200));return dx(t,e,null,n)},vt.createRoot=function(t,e){if(!gd(t))throw Error(N(299));var n=!1,r="",i=ty;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=fd(t,1,!1,null,null,n,!1,r,i),t[yn]=e.current,mo(t.nodeType===8?t.parentNode:t),new pd(e)},vt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(N(188)):(t=Object.keys(t).join(","),Error(N(268,t)));return t=Mg(e),t=t===null?null:t.stateNode,t},vt.flushSync=function(t){return Pr(t)},vt.hydrate=function(t,e,n){if(!Fa(e))throw Error(N(200));return Ba(null,t,e,!0,n)},vt.hydrateRoot=function(t,e,n){if(!gd(t))throw Error(N(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=ty;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=Zv(e,null,t,1,n??null,i,!1,o,s),t[yn]=e.current,mo(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new $a(e)},vt.render=function(t,e,n){if(!Fa(e))throw Error(N(200));return Ba(null,t,e,!1,n)},vt.unmountComponentAtNode=function(t){if(!Fa(t))throw Error(N(40));return t._reactRootContainer?(Pr(function(){Ba(null,null,t,!1,function(){t._reactRootContainer=null,t[yn]=null})}),!0):!1},vt.unstable_batchedUpdates=sd,vt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Fa(n))throw Error(N(200));if(t==null||t._reactInternals===void 0)throw Error(N(38));return Ba(t,e,n,!1,r)},vt.version="18.3.1-next-f1338f8080-20240426";function ry(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ry)}catch(t){console.error(t)}}ry(),Xp.exports=vt;var mx=Xp.exports,iy=mx;lc.createRoot=iy.createRoot,lc.hydrateRoot=iy.hydrateRoot;var oy={exports:{}},Ua={};/**
|
|
375
375
|
* @license React
|
|
376
376
|
* react-jsx-runtime.production.min.js
|
|
377
377
|
*
|
|
@@ -379,36 +379,27 @@ Error generating stack: `+o.message+`
|
|
|
379
379
|
*
|
|
380
380
|
* This source code is licensed under the MIT license found in the
|
|
381
381
|
* LICENSE file in the root directory of this source tree.
|
|
382
|
-
*/var
|
|
382
|
+
*/var vx=oe,yx=Symbol.for("react.element"),bx=Symbol.for("react.fragment"),wx=Object.prototype.hasOwnProperty,Sx=vx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,kx={key:!0,ref:!0,__self:!0,__source:!0};function sy(t,e,n){var r,i={},o=null,s=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)wx.call(e,r)&&!kx.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:yx,type:t,key:o,ref:s,props:i,_owner:Sx.current}}Ua.Fragment=bx,Ua.jsx=sy,Ua.jsxs=sy,oy.exports=Ua;var O=oy.exports;const xx=400,_x=({text:t,isVisible:e,onClick:n,autoHideDelay:r=0,onAutoHide:i,orbSize:o=56})=>{const[s,a]=oe.useState(!1),[l,c]=oe.useState(!1);return oe.useEffect(()=>{if(e)c(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a(!0)})});else{a(!1);const d=setTimeout(()=>{c(!1)},xx);return()=>clearTimeout(d)}},[e]),oe.useEffect(()=>{if(e&&r>0&&i){const d=setTimeout(i,r);return()=>clearTimeout(d)}},[e,r,i]),l?O.jsx("div",{onClick:n,...n&&{role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" "||d.key==="Spacebar")&&(d.preventDefault(),n())}},style:{position:"absolute",right:0,height:`${o}px`,display:"flex",alignItems:"center",paddingLeft:"24px",paddingRight:`${o/2+24}px`,background:"linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%)",borderRadius:`${o/2}px`,boxShadow:`
|
|
383
383
|
0 2px 20px rgba(0, 0, 0, 0.1),
|
|
384
384
|
0 8px 32px rgba(0, 0, 0, 0.08),
|
|
385
385
|
inset 0 1px 0 rgba(255, 255, 255, 1),
|
|
386
386
|
inset 0 -1px 0 rgba(0, 0, 0, 0.02)
|
|
387
|
-
`,cursor:n?"pointer":"default",opacity:s?1:0,transform:`translateX(${s?"0":"30px"})`,transition:"all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',pointerEvents:"all",whiteSpace:"nowrap",zIndex:0},children:
|
|
387
|
+
`,cursor:n?"pointer":"default",opacity:s?1:0,transform:`translateX(${s?"0":"30px"})`,transition:"all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',pointerEvents:"all",whiteSpace:"nowrap",zIndex:0},children:O.jsx("span",{style:{fontSize:"15px",fontWeight:"500",color:"rgba(0, 0, 0, 0.85)",letterSpacing:"-0.01em",paddingRight:"24px"},children:t})}):null},Nr="floe_nudge_state",ay="floe_nudge_sound_played",Io={initialDelay:5e3,autoHideDuration:1e4,maxImpressions:3,cooldownDays:7},Cx=({connected:t,agentState:e,onExpand:n,onToggleConnection:r,isReturningUser:i=!1,hasSkippedOnboarding:o=!1,nudgeText:s="Hi 👋 How can I help you today?",showNudge:a,onNudgeDismiss:l,nudgeAutoHideDelay:c,nudgeAutoShow:d=!0})=>{const f=i||o,[h,b]=oe.useState(!1),[y,g]=oe.useState(!1),[S,v]=oe.useState(!1),w=oe.useRef(null),k=oe.useCallback(()=>{try{const J=localStorage.getItem(Nr);if(!J)return!0;const G=JSON.parse(J);return!(G.hasEngaged||G.impressions>=Io.maxImpressions||G.lastDismissed&&(Date.now()-G.lastDismissed)/864e5<Io.cooldownDays)}catch{return!0}},[]),C=oe.useCallback(()=>{try{const J=localStorage.getItem(Nr),G=J?JSON.parse(J):{impressions:0};G.impressions=(G.impressions||0)+1,G.lastShown=Date.now(),localStorage.setItem(Nr,JSON.stringify(G))}catch{}},[]),E=oe.useCallback(()=>{try{const J=localStorage.getItem(Nr),G=J?JSON.parse(J):{impressions:0};G.lastDismissed=Date.now(),localStorage.setItem(Nr,JSON.stringify(G))}catch{}},[]),A=oe.useCallback(()=>{try{const J=localStorage.getItem(Nr),G=J?JSON.parse(J):{impressions:0};G.hasEngaged=!0,localStorage.setItem(Nr,JSON.stringify(G))}catch{}},[]),D=oe.useCallback(()=>{try{if(sessionStorage.getItem(ay))return;const J=window.AudioContext||window.webkitAudioContext;if(!J)return;const G=new J;G.state==="suspended"&&G.resume();const ne=G.currentTime,F=G.createOscillator(),z=G.createGain();F.connect(z),z.connect(G.destination),F.frequency.setValueAtTime(659,ne),F.type="sine",z.gain.setValueAtTime(.25,ne),z.gain.exponentialRampToValueAtTime(.01,ne+.3),F.start(ne),F.stop(ne+.3);const q=G.createOscillator(),re=G.createGain();q.connect(re),re.connect(G.destination),q.frequency.setValueAtTime(784,ne+.12),q.type="sine",re.gain.setValueAtTime(0,ne),re.gain.setValueAtTime(.2,ne+.12),re.gain.exponentialRampToValueAtTime(.01,ne+.5),q.start(ne+.12),q.stop(ne+.5);const me=G.createOscillator(),u=G.createGain();me.connect(u),u.connect(G.destination),me.frequency.setValueAtTime(1318,ne),me.type="sine",u.gain.setValueAtTime(.08,ne),u.gain.exponentialRampToValueAtTime(.001,ne+.2),me.start(ne),me.stop(ne+.2),q.onended=()=>{G.close()},console.log("[Floe] Nudge sound played"),sessionStorage.setItem(ay,"true")}catch{}},[]),$=a!==void 0?a:y&&!S&&!t;oe.useEffect(()=>{if(a===void 0&&d&&f&&!t&&!S){if(!k())return;const J=setTimeout(()=>{g(!0),C(),D()},Io.initialDelay),G=c===void 0?Io.autoHideDuration:c;let ne;return G>0&&(ne=setTimeout(()=>{g(!1),E()},Io.initialDelay+G)),()=>{clearTimeout(J),ne&&clearTimeout(ne)}}},[f,t,S,k,C,E,D,a,d,c]);const X=oe.useCallback(()=>{g(!1),v(!0),E(),l==null||l()},[E,l]),V=oe.useCallback(()=>{g(!1),A(),n==null||n(),f&&!t&&r&&r()},[A,n,f,t,r]),B=oe.useCallback(()=>{A(),n==null||n(),f&&!t&&r&&r()},[A,n,f,t,r]),K=oe.useCallback(J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),B())},[B]),W=()=>{switch(e){case"connecting":return"#fbbf24";case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#22d3ee";case"paused":return"#f59e0b";case"minimized":return"#6b7280";default:return"#6b7280"}},se=f&&!t?56:52;return O.jsxs("div",{style:{position:"fixed",bottom:"24px",right:"24px",display:"flex",alignItems:"center",justifyContent:"flex-end",zIndex:2147483645,pointerEvents:"none"},children:[O.jsx(_x,{text:s,isVisible:$,onClick:V,onAutoHide:X,orbSize:se}),O.jsxs("div",{ref:w,role:"button",tabIndex:0,"aria-label":f?i?"Welcome back - Start Floe":"Start Floe":"Expand Floe",onClick:B,onKeyDown:K,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{position:"relative",width:`${se}px`,height:`${se}px`,borderRadius:"50%",background:"linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 50%, #0f0f0f 100%)",border:"1px solid rgba(255, 255, 255, 0.1)",boxShadow:`
|
|
388
388
|
0 4px 24px rgba(0, 0, 0, 0.4),
|
|
389
389
|
0 12px 48px rgba(0, 0, 0, 0.3),
|
|
390
390
|
inset 0 1px 0 rgba(255, 255, 255, 0.08),
|
|
391
391
|
inset 0 -1px 0 rgba(0, 0, 0, 0.2)
|
|
392
|
-
`,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"all",transition:"all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",transform:h?"scale(1.06)":"scale(1)",outline:"none",flexShrink:0,zIndex:1},children:[(t&&e!=="idle"||f&&!t&&!$)&&
|
|
392
|
+
`,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"all",transition:"all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",transform:h?"scale(1.06)":"scale(1)",outline:"none",flexShrink:0,zIndex:1},children:[(t&&e!=="idle"||f&&!t&&!$)&&O.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",border:`2px solid ${f&&!t?"rgba(255, 255, 255, 0.25)":W()}`,animation:"pulseRing 2.5s ease-out infinite",opacity:.5}}),O.jsxs("svg",{width:"22",height:"18",viewBox:"0 0 159 138",fill:"none",style:{transition:"all 0.3s ease"},children:[O.jsx("path",{fill:t?W():"white",d:"M64 31.5c-23.5 0-34 18-64 48.5C0 31.5 26.5 1 54 1s105-1 105-1c-2 11.5-18.5 31.5-29.5 31.5z"}),O.jsx("path",{fill:t?W():"white",d:"M64.5 89.5c-23.5 0-34 18-64 48.5 0-48.5 26.5-79 54-79s75-1 75-1c-2 11.5-18.5 31.5-29.5 31.5z"})]})]}),O.jsx("style",{children:`
|
|
393
393
|
@keyframes pulseRing {
|
|
394
394
|
0% { transform: scale(1); opacity: 0.5; }
|
|
395
395
|
100% { transform: scale(1.6); opacity: 0; }
|
|
396
396
|
}
|
|
397
|
-
`})]})},
|
|
398
|
-
@keyframes circularPulse {
|
|
399
|
-
0% { transform: scale(1); opacity: 0.4; }
|
|
400
|
-
100% { transform: scale(1.6); opacity: 0; }
|
|
401
|
-
}
|
|
402
|
-
@keyframes innerGlow {
|
|
403
|
-
0%, 100% { opacity: 0.6; transform: scale(1); }
|
|
404
|
-
50% { opacity: 1; transform: scale(1.1); }
|
|
405
|
-
}
|
|
406
|
-
`})]})},Tx=({isOpen:t,agentState:e,connected:n,voiceEnabled:r=!0,messages:i,currentTranscript:o="",currentRole:s,screenShareEnabled:a=!1,isSpeaking:l=!1,audioLevels:c=[],onToggleConnection:d,onToggleMute:f,onToggleScreenShare:h,onMinimize:b,onResume:y,onStop:m,connectionProgress:S})=>{const v=oe.useRef(null),[w,k]=oe.useState(!1);oe.useEffect(()=>{var O;(O=v.current)==null||O.scrollIntoView({behavior:"smooth"})},[i,o]),oe.useEffect(()=>{t&&k(!0)},[t]);const C=()=>{if(e==="connecting")return(S==null?void 0:S.message)||"Connecting...";if(!r&&n&&e!=="speaking")return"Muted";switch(e){case"listening":return"Listening";case"thinking":return"Thinking";case"speaking":return"Speaking";case"guiding":return"Guiding";case"paused":return"Paused";default:return n?"Ready":"Offline"}},T=()=>{if(e==="connecting")return"#fbbf24";if(!r&&n&&e!=="speaking")return"#ef4444";switch(e){case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#22d3ee";case"paused":return"#f59e0b";default:return"#6b7280"}};return!t&&!w?null:A.jsx(A.Fragment,{children:A.jsxs("div",{onTransitionEnd:()=>!t&&k(!1),style:{position:"fixed",bottom:"24px",right:"24px",width:"360px",maxHeight:"min(70vh, 700px)",minHeight:"220px",background:"linear-gradient(180deg, rgba(22, 22, 24, 0.98) 0%, rgba(18, 18, 20, 0.99) 100%)",backdropFilter:"blur(24px)",borderRadius:"20px",border:"1px solid rgba(255, 255, 255, 0.08)",boxShadow:`
|
|
397
|
+
`})]})},Ex=({isActive:t,color:e="#60a5fa",height:n=24,barCount:r=5,barWidth:i=3,gap:o=2,audioLevels:s})=>{const a=Math.ceil(r/2),[l,c]=oe.useState(Array(a).fill(.15)),d=oe.useRef(),f=oe.useRef(Array(a).fill(.15));oe.useEffect(()=>{if(s&&s.length>0&&t){const y=Array(a).fill(0).map((g,S)=>{let v=0;if(S===0)v=s.reduce((k,C)=>k+C,0)/s.length,v=Math.pow(v,.7)*1.3;else{const w=Math.floor(s.length/(a-1)),k=(S-1)*w,C=Math.min(k+w,s.length);let E=0,A=0;for(let D=k;D<C;D++)E+=s[D],A++;v=A>0?E/A:0,v=v*(1-S*.08)}return Math.max(.15,Math.min(1,.15+v*.85))});f.current=y}else t||(f.current=Array(a).fill(.15))},[s,t,a]),oe.useEffect(()=>{const y=()=>{c(g=>g.map((S,v)=>{const w=f.current[v]||.15,k=t?.35:.15;return S+(w-S)*k})),d.current=requestAnimationFrame(y)};return d.current=requestAnimationFrame(y),()=>{d.current&&cancelAnimationFrame(d.current)}},[t,a]);const h=Yp.useMemo(()=>{const y=[];for(let g=a-1;g>0;g--)y.push(l[g]);y.push(l[0]);for(let g=1;g<a;g++)y.push(l[g]);return y},[l,a]),b=h.length*i+(h.length-1)*o;return O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:`${n}px`,width:`${b}px`,gap:`${o}px`},children:h.map((y,g)=>{const S=g===Math.floor(h.length/2),v=Math.max(4,n*y*(S?1.1:1));return O.jsx("div",{style:{width:`${i}px`,height:`${v}px`,background:e,borderRadius:`${i/2}px`,transition:"none",opacity:t?1:.4,boxShadow:t&&y>.3?`0 0 ${6*y}px ${e}50`:"none"}},g)})})},Tx=({isOpen:t,agentState:e,connected:n,voiceEnabled:r=!0,messages:i,currentTranscript:o="",currentRole:s,screenShareEnabled:a=!1,isSpeaking:l=!1,audioLevels:c=[],onToggleConnection:d,onToggleMute:f,onToggleScreenShare:h,onMinimize:b,onResume:y,onStop:g,connectionProgress:S})=>{const v=oe.useRef(null),[w,k]=oe.useState(!1);oe.useEffect(()=>{var A;(A=v.current)==null||A.scrollIntoView({behavior:"smooth"})},[i,o]),oe.useEffect(()=>{t&&k(!0)},[t]);const C=()=>{if(e==="connecting")return(S==null?void 0:S.message)||"Connecting...";if(!r&&n&&e!=="speaking")return"Muted";switch(e){case"listening":return"Listening";case"thinking":return"Thinking";case"speaking":return"Speaking";case"guiding":return"Guiding";case"paused":return"Paused";default:return n?"Ready":"Offline"}},E=()=>{if(e==="connecting")return"#fbbf24";if(!r&&n&&e!=="speaking")return"#ef4444";switch(e){case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#22d3ee";case"paused":return"#f59e0b";default:return"#6b7280"}};return!t&&!w?null:O.jsx(O.Fragment,{children:O.jsxs("div",{onTransitionEnd:()=>!t&&k(!1),style:{position:"fixed",bottom:"24px",right:"24px",width:"360px",maxHeight:"min(70vh, 700px)",minHeight:"220px",background:"linear-gradient(180deg, rgba(22, 22, 24, 0.98) 0%, rgba(18, 18, 20, 0.99) 100%)",backdropFilter:"blur(24px)",borderRadius:"20px",border:"1px solid rgba(255, 255, 255, 0.08)",boxShadow:`
|
|
407
398
|
0 0 0 1px rgba(0, 0, 0, 0.3),
|
|
408
399
|
0 24px 48px rgba(0, 0, 0, 0.5),
|
|
409
400
|
0 12px 24px rgba(0, 0, 0, 0.3),
|
|
410
401
|
inset 0 1px 0 rgba(255, 255, 255, 0.05)
|
|
411
|
-
`,display:"flex",flexDirection:"column",zIndex:2147483645,pointerEvents:"all",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',transform:t?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",opacity:t?1:0,transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:[A.jsxs("div",{style:{padding:"16px 16px 12px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[A.jsx(Ex,{isActive:n&&e!=="idle",state:e,size:36}),A.jsxs("div",{style:{minWidth:0},children:[A.jsx("div",{style:{fontSize:"14px",fontWeight:"600",color:"rgba(255, 255, 255, 0.95)",marginBottom:"1px"},children:"AI Assistant"}),A.jsxs("div",{style:{fontSize:"11px",color:T(),fontWeight:"500",display:"flex",alignItems:"center",gap:"5px"},children:[A.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:T(),boxShadow:`0 0 6px ${T()}`,flexShrink:0}}),C()]})]})]}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexShrink:0},children:[e!=="paused"&&A.jsx(Ro,{onClick:d,tooltip:e==="connecting"?"Connecting…":n?"End Session":"Connect",ariaLabel:e==="connecting"?"Connecting, please wait":n?"End session":"Connect",active:n,activeColor:"#34d399",disabled:e==="connecting",children:e==="connecting"?A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{animation:"headerSpinner 0.8s linear infinite"},children:[A.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"rgba(251, 191, 36, 0.25)",strokeWidth:"2.5"}),A.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"#fbbf24",strokeWidth:"2.5",strokeLinecap:"round"})]}):n?A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),A.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}):A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("path",{d:"M5 12.55a11 11 0 0 1 14.08 0"}),A.jsx("path",{d:"M1.42 9a16 16 0 0 1 21.16 0"}),A.jsx("path",{d:"M8.53 16.11a6 6 0 0 1 6.95 0"}),A.jsx("circle",{cx:"12",cy:"20",r:"1"})]})}),e==="paused"&&y&&A.jsx(Ro,{onClick:y,tooltip:"Resume",ariaLabel:"Resume session",active:!0,activeColor:"#34d399",children:A.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:A.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),e==="paused"&&m&&A.jsx(Ro,{onClick:m,tooltip:"End Session",ariaLabel:"End session",activeColor:"#ef4444",children:A.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:A.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),A.jsx(Ro,{onClick:h,disabled:!n,active:a,activeColor:"#22d3ee",tooltip:a?"Stop Share":"Share Screen",ariaLabel:a?"Stop screen share":"Share screen",children:a?A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),A.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),A.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),A.jsx("path",{d:"M12 11V7l3 2-3 2z",fill:"currentColor"})]}):A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),A.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),A.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),A.jsx("div",{style:{width:"1px",height:"20px",background:"rgba(255, 255, 255, 0.08)",margin:"0 2px"}}),A.jsx(Ro,{onClick:b,tooltip:"Minimize",ariaLabel:"Minimize panel",children:A.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:A.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})]})]}),e==="connecting"&&S&&A.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",gap:"10px"},children:[A.jsx("div",{style:{width:"18px",height:"18px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"3px",flex:1},children:[A.jsx("span",{style:{fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.9)"},children:S.message}),A.jsx("div",{style:{width:"100%",height:"2px",background:"rgba(255, 255, 255, 0.1)",borderRadius:"2px",overflow:"hidden"},children:A.jsx("div",{style:{width:`${S.progress}%`,height:"100%",background:"linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%)",borderRadius:"2px",transition:"width 0.3s ease"}})})]})]}),e==="paused"&&A.jsxs("div",{style:{padding:"14px 16px",background:"rgba(245, 158, 11, 0.1)",borderBottom:"1px solid rgba(245, 158, 11, 0.2)",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[A.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#f59e0b",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("circle",{cx:"12",cy:"12",r:"10"}),A.jsx("line",{x1:"10",y1:"15",x2:"10",y2:"9"}),A.jsx("line",{x1:"14",y1:"15",x2:"14",y2:"9"})]}),A.jsx("span",{style:{color:"#f59e0b",fontSize:"13px",fontWeight:"600"},children:"Session Paused"})]}),A.jsx("div",{style:{color:"rgba(255, 255, 255, 0.5)",fontSize:"12px",textAlign:"center",lineHeight:"1.4"},children:"You were inactive. Click Resume to continue."}),y&&A.jsxs("button",{onClick:y,style:{padding:"8px 20px",background:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",border:"none",borderRadius:"8px",color:"white",fontSize:"13px",fontWeight:"600",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",boxShadow:"0 4px 12px rgba(245, 158, 11, 0.3)",transition:"all 0.2s ease"},onMouseEnter:O=>{O.currentTarget.style.transform="scale(1.02)"},onMouseLeave:O=>{O.currentTarget.style.transform="scale(1)"},children:[A.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:A.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Resume"]})]}),A.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.length===0&&!o?A.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"32px 16px",color:"rgba(255, 255, 255, 0.4)"},children:[A.jsx("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{marginBottom:"12px",opacity:.5},children:A.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),A.jsx("div",{style:{fontSize:"13px",fontWeight:"500",marginBottom:"6px"},children:"No messages yet"}),A.jsx("div",{style:{fontSize:"12px",lineHeight:"1.5"},children:"Start speaking to begin your conversation"})]}):A.jsxs(A.Fragment,{children:[i.map(O=>A.jsx(ay,{message:O},O.id)),o&&s&&A.jsx(ay,{message:{id:"current",role:s,content:o,timestamp:Date.now(),isPartial:!0}})]}),A.jsx("div",{ref:v})]}),A.jsx("div",{style:{padding:"10px 16px 14px 16px",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},children:A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"rgba(255, 255, 255, 0.04)",borderRadius:"12px",border:`1px solid ${!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.2)":"rgba(255, 255, 255, 0.06)"}`},children:[A.jsx("button",{onClick:f,disabled:!n,"aria-label":r?"Mute microphone":"Unmute microphone",style:{width:"32px",height:"32px",borderRadius:"8px",border:!r&&n&&e!=="speaking"?"1px solid rgba(239, 68, 68, 0.3)":"none",background:!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.15)":r&&n?`${T()}15`:"transparent",color:!r&&n&&e!=="speaking"?"#ef4444":n?"rgba(255, 255, 255, 0.8)":"rgba(255, 255, 255, 0.3)",cursor:n?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:n?1:.5,flexShrink:0},children:r?A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),A.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),A.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),A.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}):A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),A.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),A.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"}),A.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),A.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}),A.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",gap:"8px",minWidth:0},children:n&&r&&(e==="speaking"||e==="listening")?A.jsx(Cx,{isActive:l,color:T(),height:22,barCount:7,audioLevels:c}):e==="connecting"&&S?A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[A.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),A.jsx("span",{style:{fontSize:"12px",color:"#fbbf24",fontWeight:"500"},children:S.message})]}):A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[!r&&n&&e!=="speaking"&&A.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),A.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),A.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"})]}),A.jsx("span",{style:{fontSize:"12px",fontWeight:"500",color:!r&&n&&e!=="speaking"?"#ef4444":"rgba(255, 255, 255, 0.5)",letterSpacing:"0.01em"},children:C()})]})}),n&&A.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"#34d399",boxShadow:"0 0 8px #34d39980",animation:"pulse 2s ease-in-out infinite",flexShrink:0}})]})}),A.jsx("style",{children:`
|
|
402
|
+
`,display:"flex",flexDirection:"column",zIndex:2147483645,pointerEvents:"all",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',transform:t?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",opacity:t?1:0,transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:[O.jsxs("div",{style:{padding:"16px 16px 12px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[O.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:"linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 50%, #0f0f0f 100%)",border:`1.5px solid ${E()}40`,boxShadow:`0 0 12px ${E()}30`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.3s ease",animation:n&&e!=="idle"?"logoGlow 2s ease-in-out infinite":"none","--glow-color":E()},children:O.jsxs("svg",{width:"16",height:"14",viewBox:"0 0 159 138",fill:"none",children:[O.jsx("path",{fill:E(),d:"M64 31.5c-23.5 0-34 18-64 48.5C0 31.5 26.5 1 54 1s105-1 105-1c-2 11.5-18.5 31.5-29.5 31.5z"}),O.jsx("path",{fill:E(),d:"M64.5 89.5c-23.5 0-34 18-64 48.5 0-48.5 26.5-79 54-79s75-1 75-1c-2 11.5-18.5 31.5-29.5 31.5z"})]})}),O.jsxs("div",{style:{minWidth:0},children:[O.jsx("div",{style:{fontSize:"14px",fontWeight:"600",color:"rgba(255, 255, 255, 0.95)",marginBottom:"1px"},children:"Floe"}),O.jsxs("div",{style:{fontSize:"11px",color:E(),fontWeight:"500",display:"flex",alignItems:"center",gap:"5px"},children:[O.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:E(),boxShadow:`0 0 6px ${E()}`,flexShrink:0}}),C()]})]})]}),O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexShrink:0},children:[e!=="paused"&&O.jsx(Ro,{onClick:d,tooltip:e==="connecting"?"Connecting…":n?"End Session":"Connect",ariaLabel:e==="connecting"?"Connecting, please wait":n?"End session":"Connect",active:n,activeColor:"#34d399",disabled:e==="connecting",children:e==="connecting"?O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{animation:"headerSpinner 0.8s linear infinite"},children:[O.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"rgba(251, 191, 36, 0.25)",strokeWidth:"2.5"}),O.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"#fbbf24",strokeWidth:"2.5",strokeLinecap:"round"})]}):n?O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),O.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}):O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("path",{d:"M5 12.55a11 11 0 0 1 14.08 0"}),O.jsx("path",{d:"M1.42 9a16 16 0 0 1 21.16 0"}),O.jsx("path",{d:"M8.53 16.11a6 6 0 0 1 6.95 0"}),O.jsx("circle",{cx:"12",cy:"20",r:"1"})]})}),e==="paused"&&y&&O.jsx(Ro,{onClick:y,tooltip:"Resume",ariaLabel:"Resume session",active:!0,activeColor:"#34d399",children:O.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:O.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),e==="paused"&&g&&O.jsx(Ro,{onClick:g,tooltip:"End Session",ariaLabel:"End session",activeColor:"#ef4444",children:O.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:O.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),O.jsx(Ro,{onClick:h,disabled:!n,active:a,activeColor:"#22d3ee",tooltip:a?"Stop Share":"Share Screen",ariaLabel:a?"Stop screen share":"Share screen",children:a?O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),O.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),O.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),O.jsx("path",{d:"M12 11V7l3 2-3 2z",fill:"currentColor"})]}):O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),O.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),O.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),O.jsx("div",{style:{width:"1px",height:"20px",background:"rgba(255, 255, 255, 0.08)",margin:"0 2px"}}),O.jsx(Ro,{onClick:b,tooltip:"Minimize",ariaLabel:"Minimize panel",children:O.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:O.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})]})]}),e==="connecting"&&S&&O.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",gap:"10px"},children:[O.jsx("div",{style:{width:"18px",height:"18px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),O.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"3px",flex:1},children:[O.jsx("span",{style:{fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.9)"},children:S.message}),O.jsx("div",{style:{width:"100%",height:"2px",background:"rgba(255, 255, 255, 0.1)",borderRadius:"2px",overflow:"hidden"},children:O.jsx("div",{style:{width:`${S.progress}%`,height:"100%",background:"linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%)",borderRadius:"2px",transition:"width 0.3s ease"}})})]})]}),e==="paused"&&O.jsxs("div",{style:{padding:"14px 16px",background:"rgba(245, 158, 11, 0.1)",borderBottom:"1px solid rgba(245, 158, 11, 0.2)",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},children:[O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[O.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#f59e0b",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("circle",{cx:"12",cy:"12",r:"10"}),O.jsx("line",{x1:"10",y1:"15",x2:"10",y2:"9"}),O.jsx("line",{x1:"14",y1:"15",x2:"14",y2:"9"})]}),O.jsx("span",{style:{color:"#f59e0b",fontSize:"13px",fontWeight:"600"},children:"Session Paused"})]}),O.jsx("div",{style:{color:"rgba(255, 255, 255, 0.5)",fontSize:"12px",textAlign:"center",lineHeight:"1.4"},children:"You were inactive. Click Resume to continue."}),y&&O.jsxs("button",{onClick:y,style:{padding:"8px 20px",background:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",border:"none",borderRadius:"8px",color:"white",fontSize:"13px",fontWeight:"600",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",boxShadow:"0 4px 12px rgba(245, 158, 11, 0.3)",transition:"all 0.2s ease"},onMouseEnter:A=>{A.currentTarget.style.transform="scale(1.02)"},onMouseLeave:A=>{A.currentTarget.style.transform="scale(1)"},children:[O.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:O.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Resume"]})]}),O.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.length===0&&!o?O.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"32px 16px",color:"rgba(255, 255, 255, 0.4)"},children:[O.jsx("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{marginBottom:"12px",opacity:.5},children:O.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),O.jsx("div",{style:{fontSize:"13px",fontWeight:"500",marginBottom:"6px"},children:"No messages yet"}),O.jsx("div",{style:{fontSize:"12px",lineHeight:"1.5"},children:"Start speaking to begin your conversation"})]}):O.jsxs(O.Fragment,{children:[i.map(A=>O.jsx(ly,{message:A},A.id)),o&&s&&O.jsx(ly,{message:{id:"current",role:s,content:o,timestamp:Date.now(),isPartial:!0}})]}),O.jsx("div",{ref:v})]}),O.jsx("div",{style:{padding:"10px 16px 14px 16px",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},children:O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"rgba(255, 255, 255, 0.04)",borderRadius:"12px",border:`1px solid ${!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.2)":"rgba(255, 255, 255, 0.06)"}`},children:[O.jsx("button",{onClick:f,disabled:!n,"aria-label":r?"Mute microphone":"Unmute microphone",style:{width:"32px",height:"32px",borderRadius:"8px",border:!r&&n&&e!=="speaking"?"1px solid rgba(239, 68, 68, 0.3)":"none",background:!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.15)":r&&n?`${E()}15`:"transparent",color:!r&&n&&e!=="speaking"?"#ef4444":n?"rgba(255, 255, 255, 0.8)":"rgba(255, 255, 255, 0.3)",cursor:n?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:n?1:.5,flexShrink:0},children:r?O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),O.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),O.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),O.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}):O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),O.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),O.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"}),O.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),O.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}),O.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",gap:"8px",minWidth:0},children:n&&r&&(e==="speaking"||e==="listening")?O.jsx(Ex,{isActive:l,color:E(),height:22,barCount:7,audioLevels:c}):e==="connecting"&&S?O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[O.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),O.jsx("span",{style:{fontSize:"12px",color:"#fbbf24",fontWeight:"500"},children:S.message})]}):O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[!r&&n&&e!=="speaking"&&O.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),O.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),O.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"})]}),O.jsx("span",{style:{fontSize:"12px",fontWeight:"500",color:!r&&n&&e!=="speaking"?"#ef4444":"rgba(255, 255, 255, 0.5)",letterSpacing:"0.01em"},children:C()})]})}),n&&O.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"#34d399",boxShadow:"0 0 8px #34d39980",animation:"pulse 2s ease-in-out infinite",flexShrink:0}})]})}),O.jsx("style",{children:`
|
|
412
403
|
@keyframes pulse {
|
|
413
404
|
0%, 100% { opacity: 1; }
|
|
414
405
|
50% { opacity: 0.5; }
|
|
@@ -421,12 +412,16 @@ Error generating stack: `+o.message+`
|
|
|
421
412
|
from { transform: rotate(0deg); }
|
|
422
413
|
to { transform: rotate(360deg); }
|
|
423
414
|
}
|
|
424
|
-
|
|
415
|
+
@keyframes logoGlow {
|
|
416
|
+
0%, 100% { box-shadow: 0 0 12px rgba(255, 255, 255, 0.15); }
|
|
417
|
+
50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.3); }
|
|
418
|
+
}
|
|
419
|
+
`})]})})},Ro=({onClick:t,disabled:e=!1,active:n=!1,activeColor:r="#60a5fa",tooltip:i,ariaLabel:o,children:s})=>{const[a,l]=oe.useState(!1),c=()=>n?`${r}18`:a&&!e?"rgba(255, 255, 255, 0.08)":"transparent",d=()=>n?r:e?"rgba(255, 255, 255, 0.25)":"rgba(255, 255, 255, 0.6)";return O.jsxs("div",{style:{position:"relative"},children:[O.jsx("button",{onClick:t,disabled:e,"aria-label":o,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:c(),color:d(),cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:e?.5:1},children:s}),i&&a&&!e&&O.jsx("div",{style:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"6px",padding:"4px 8px",background:"rgba(0, 0, 0, 0.9)",borderRadius:"5px",fontSize:"10px",fontWeight:"500",color:"rgba(255, 255, 255, 0.9)",whiteSpace:"nowrap",pointerEvents:"none",animation:"tooltipFade 0.15s ease",zIndex:10},children:i}),O.jsx("style",{children:`
|
|
425
420
|
@keyframes tooltipFade {
|
|
426
421
|
from { opacity: 0; transform: translateX(-50%) translateY(4px); }
|
|
427
422
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
428
423
|
}
|
|
429
|
-
`})]})},
|
|
424
|
+
`})]})},ly=({message:t})=>{const e=t.role==="user";return O.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:e?"flex-end":"flex-start",animation:"messageSlide 0.3s ease-out"},children:[O.jsx("div",{style:{fontSize:"10px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",color:"rgba(255, 255, 255, 0.4)",marginBottom:"5px",paddingLeft:e?"0":"10px",paddingRight:e?"10px":"0"},children:e?"You":"Assistant"}),O.jsxs("div",{style:{maxWidth:"90%",padding:"10px 14px",borderRadius:e?"14px 14px 4px 14px":"14px 14px 14px 4px",background:e?"linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)":"rgba(255, 255, 255, 0.08)",color:e?"white":"rgba(255, 255, 255, 0.9)",fontSize:"13px",lineHeight:"1.5",boxShadow:e?"0 4px 12px rgba(59, 130, 246, 0.3)":"0 2px 8px rgba(0, 0, 0, 0.2)",opacity:t.isPartial?.7:1,border:e?"none":"1px solid rgba(255, 255, 255, 0.06)"},children:[t.content,t.isPartial&&O.jsx("span",{style:{display:"inline-block",width:"4px",height:"14px",background:"currentColor",marginLeft:"4px",animation:"blink 1s step-end infinite",verticalAlign:"text-bottom"}})]}),!t.isPartial&&O.jsx("div",{style:{fontSize:"10px",color:"rgba(255, 255, 255, 0.3)",marginTop:"3px",paddingLeft:e?"0":"10px",paddingRight:e?"10px":"0"},children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),O.jsx("style",{children:`
|
|
430
425
|
@keyframes messageSlide {
|
|
431
426
|
from { opacity: 0; transform: translateY(8px); }
|
|
432
427
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -435,7 +430,7 @@ Error generating stack: `+o.message+`
|
|
|
435
430
|
0%, 100% { opacity: 1; }
|
|
436
431
|
50% { opacity: 0; }
|
|
437
432
|
}
|
|
438
|
-
`})]})},Mx=({connected:t,voiceEnabled:e,agentState:n,botTranscript:r="",userTranscript:i="",screenShareEnabled:o=!1,userIsSpeaking:s=!1,botIsSpeaking:a=!1,audioLevels:l=[],onToggleConnection:c,onToggleMute:d,onToggleScreenShare:f,transcriptHistory:h=[],onResume:b,pausedSessionId:y,onStop:
|
|
433
|
+
`})]})},Mx=({connected:t,voiceEnabled:e,agentState:n,botTranscript:r="",userTranscript:i="",screenShareEnabled:o=!1,userIsSpeaking:s=!1,botIsSpeaking:a=!1,audioLevels:l=[],onToggleConnection:c,onToggleMute:d,onToggleScreenShare:f,transcriptHistory:h=[],onResume:b,pausedSessionId:y,onStop:g,connectionProgress:S,isReturningUser:v=!1,hasSkippedOnboarding:w=!1,onMinimize:k,onExpand:C,nudgeText:E,showNudge:A,onNudgeDismiss:D,nudgeAutoHideDelay:$,nudgeAutoShow:X})=>{const[V,B]=oe.useState(!v&&!w);oe.useEffect(()=>{(v||w)&&!t&&B(!1)},[v,w,t]),oe.useEffect(()=>{t&&B(!0)},[t]),oe.useEffect(()=>{console.log("[AgentUI] Rendering with state:",{connected:t,agentState:n,voiceEnabled:e,screenShareEnabled:o,panelOpen:V,historyCount:h.length,botTranscript:r==null?void 0:r.substring(0,30),userTranscript:i==null?void 0:i.substring(0,30)})},[t,n,e,o,V,h.length,r,i]);const{currentTranscript:K,currentRole:W}=oe.useMemo(()=>n==="speaking"&&r?{currentTranscript:r,currentRole:"assistant"}:n==="listening"&&i?{currentTranscript:i,currentRole:"user"}:{currentTranscript:"",currentRole:void 0},[n,r,i]),se=oe.useCallback(()=>{B(!0),C==null||C()},[C]),J=oe.useCallback(()=>{B(!1),k==null||k()},[k]);return O.jsxs(O.Fragment,{children:[!V&&O.jsx(Cx,{connected:t,agentState:n,onExpand:se,onToggleConnection:c,isReturningUser:v,hasSkippedOnboarding:w,nudgeText:E,showNudge:A,onNudgeDismiss:D,nudgeAutoHideDelay:$,nudgeAutoShow:X}),O.jsx(Tx,{isOpen:V,agentState:n,connected:t,voiceEnabled:e,messages:h,currentTranscript:K,currentRole:W,screenShareEnabled:o,isSpeaking:s||a,audioLevels:l,onToggleConnection:c,onToggleMute:d,onToggleScreenShare:f,onMinimize:J,onResume:b,onStop:g,connectionProgress:S}),O.jsx("style",{children:`
|
|
439
434
|
/* Smooth scrollbar for sidebar */
|
|
440
435
|
#onboarding-sdk-react-ui *::-webkit-scrollbar {
|
|
441
436
|
width: 6px;
|
|
@@ -450,8 +445,8 @@ Error generating stack: `+o.message+`
|
|
|
450
445
|
#onboarding-sdk-react-ui *::-webkit-scrollbar-thumb:hover {
|
|
451
446
|
background: rgba(255, 255, 255, 0.2);
|
|
452
447
|
}
|
|
453
|
-
`})]})},_t=class _t{constructor(){
|
|
454
|
-
`);n=((i=o[0])==null?void 0:i.trim())||"",o.length>1&&o.length<=3&&(n=o.join(" - ").slice(0,100))}return n.slice(0,100)}extractIconName(e){var s;const r=e.querySelector('[class*="icon"], [class*="Icon"], svg, i')||e,i=typeof r.className=="string"?r.className:"",o=[/fa-([a-z-]+)/i,/fas? fa-([a-z-]+)/i,/far? fa-([a-z-]+)/i,/icon-([a-z-]+)/i,/([a-z]+)-icon/i,/material-icons/i,/lucide-([a-z-]+)/i,/heroicon-([a-z-]+)/i,/ri-([a-z-]+)/i,/bi-([a-z-]+)/i,/bx-([a-z-]+)/i,/bxs-([a-z-]+)/i,/ph-([a-z-]+)/i,/tabler-([a-z-]+)/i,/mdi-([a-z-]+)/i];for(const a of o){const l=i.match(a);if(l&&l[1])return l[1].replace(/-/g," ").replace(/([a-z])([A-Z])/g,"$1 $2")}if(i.includes("material-icons")||i.includes("material-symbols")){const a=(s=r.textContent)==null?void 0:s.trim();if(a&&a.length<30)return a.replace(/_/g," ")}return""}findSiblingLabel(e){var i,o;let n=e.previousElementSibling;for(;n;){if(n.matches('label, .label, [class*="label"], [class*="Label"]')){const s=(i=n.textContent)==null?void 0:i.trim();if(s&&s.length<50)return s}n=n.previousElementSibling}const r=e.parentElement;if(r){const s=r.querySelector(':scope > label, :scope > .label, :scope > [class*="FormLabel"]');if(s&&!s.contains(e)){const a=(o=s.textContent)==null?void 0:o.trim();if(a&&a.length<50)return a}}return""}generateFallbackName(e,n){const r=e.tagName.toLowerCase(),i=this.getSiblingIndex(e),o=this.getParentContext(e),s=[];return s.push(n||r),i>0&&s.push(`${i+1}`),o&&s.push(`in ${o}`),s.join(" ")}getSiblingIndex(e){const n=e.parentElement;return n?Array.from(n.children).filter(i=>i.tagName===e.tagName).indexOf(e):0}getParentContext(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=n.getAttribute("aria-label")||n.getAttribute("title")||(n.matches("nav, main, header, footer, aside, section, article")?n.tagName.toLowerCase():null);if(r)return r.slice(0,30);n=n.parentElement}return""}getRole(e){const n=e.getAttribute("role");if(n)return n;const r=e.tagName.toLowerCase();if(r==="input"){const i=e.type||"text";return _t.INPUT_TYPE_ROLES[i]||"textbox"}return r==="a"?e.hasAttribute("href")?"link":"":_t.IMPLICIT_ROLES[r]||""}looksLikeCard(e){const n=typeof e.className=="string"?e.className.toLowerCase():"";if(n.includes("card")||n.includes("tile")||n.includes("option")||n.includes("selection"))return!0;const r=window.getComputedStyle(e),o=!(r.borderWidth||"0").split(" ").every(c=>c==="0px"||c==="0")&&r.borderStyle!=="none",s=r.borderRadius||"0",a=parseFloat(s)>0;r.backgroundColor!=="rgba(0, 0, 0, 0)"&&r.backgroundColor;const l=e.getBoundingClientRect();return!!(o&&a&&l.height>50&&l.width>100)}getState(e){const n={};e.getAttribute("aria-selected")==="true"&&(n.selected=!0);const r=e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio");(e.getAttribute("aria-checked")==="true"||r&&e.checked)&&(n.checked=!0),e.getAttribute("aria-expanded")==="true"&&(n.expanded=!0),e instanceof HTMLDetailsElement&&e.open&&(n.expanded=!0),e.getAttribute("aria-pressed")==="true"&&(n.pressed=!0);const i=e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement;(e.getAttribute("aria-disabled")==="true"||i&&e.disabled||e.hasAttribute("disabled"))&&(n.disabled=!0),(e.getAttribute("aria-current")==="true"||e.getAttribute("aria-current")==="page")&&(n.current=!0),!n.selected&&this.detectVisualSelection(e)&&(n.selected=!0);const o=typeof e.className=="string"?e.className.toLowerCase():"";!n.selected&&(o.includes("selected")||o.includes("active")||o.includes("chosen")||o.includes("current"))&&(n.selected=!0),!n.disabled&&o.includes("disabled")&&(n.disabled=!0);const s=e.getAttribute("data-state");return(s==="checked"||s==="on")&&(n.checked=!0),(s==="open"||s==="expanded")&&(n.expanded=!0),(s==="active"||s==="selected")&&(n.selected=!0),n}detectVisualSelection(e){const n=window.getComputedStyle(e),r=n.borderColor.toLowerCase();if(r.includes("rgb(8, 103, 236)")||r.includes("rgb(59, 130, 246)")||r.includes("rgb(37, 99, 235)")||r.includes("rgb(29, 78, 216)"))return!0;const i=n.backgroundColor.toLowerCase();return!!(i.includes("rgb(238, 245, 252)")||i.includes("rgb(239, 246, 255)")||i.includes("rgb(219, 234, 254)"))}findContext(e){var l,c,d,f,h,b,y,
|
|
448
|
+
`})]})},_t=class _t{constructor(){P(this,"refCounters",{});P(this,"lastSnapshotHash","")}capture(e){this.refCounters={};const n=[],r={width:window.innerWidth,height:window.innerHeight};try{const s=this.queryInteractiveElements(),a=this.queryCursorPointerElements(),l=this.dedupeElements([...s,...a]);for(const c of l)try{const d=this.processElement(c,r);d&&n.push(d)}catch(d){console.warn("[AccessibleSnapshot] Error processing element:",d)}n.sort((c,d)=>{const f=c.rect.y-d.rect.y;return Math.abs(f)<20?c.rect.x-d.rect.x:f}),this.renumberRefs(n)}catch(s){console.error("[AccessibleSnapshot] Error during capture:",s)}const i=this.computeSnapshotHash(n),o=i!==this.lastSnapshotHash;return this.lastSnapshotHash=i,{timestamp:Date.now(),url:window.location.pathname,title:document.title,viewport:r,elements:n,elementCount:n.length,domChanged:o,captureReason:e}}async captureWhenStable(e=2e3,n){const r=Date.now();let i=this.capture(n);for(;Date.now()-r<e;){await this.sleep(200);const o=this.capture(n);if(this.snapshotsAreEqual(i,o))return o;i=o}return i}queryInteractiveElements(){return Array.from(document.querySelectorAll(_t.INTERACTIVE_SELECTOR)).filter(n=>this.shouldIncludeElement(n))}queryCursorPointerElements(){const e=['[class*="card"]:not(button):not(a)','[class*="Card"]:not(button):not(a)','[class*="tile"]:not(button):not(a)','[class*="Tile"]:not(button):not(a)','[class*="option"]:not(button):not(a)','[class*="Option"]:not(button):not(a)','[class*="clickable"]','[class*="Clickable"]','[class*="selectable"]','[class*="Selectable"]',"[data-clickable]","[data-action]","[data-onclick]",'li[class*="item"]','li[class*="Item"]','div[class*="cursor-pointer"]','div[class*="pointer"]'].join(", "),n=[];try{const o=Array.from(document.querySelectorAll(e));n.push(...o)}catch{}const r=document.querySelectorAll('main, [role="main"], #app, #root, .app, .main');for(const o of r){const s=Array.from(o.querySelectorAll(":scope > div, :scope > section > div"));n.push(...s.slice(0,50))}const i=new Set;return n.filter(o=>{if(i.has(o)||(i.add(o),!this.shouldIncludeElement(o))||window.getComputedStyle(o).cursor!=="pointer")return!1;const a=o.parentElement;return!(a&&window.getComputedStyle(a).cursor==="pointer"&&!o.onclick&&!o.getAttribute("onclick")&&!o.getAttribute("role"))})}shouldIncludeElement(e){for(const i of _t.SKIP_SELECTORS)if(e.matches(i)||e.closest(i))return!1;if(e.getAttribute("aria-hidden")==="true"||e.closest('[aria-hidden="true"]'))return!1;const n=e.getAttribute("role");if(n==="presentation"||n==="none"||!this.isVisible(e))return!1;const r=e.getBoundingClientRect();return!(r.bottom<0||r.top>window.innerHeight||r.right<0||r.left>window.innerWidth||r.width<=0||r.height<=0)}isVisible(e){if(e.offsetParent===null){const n=window.getComputedStyle(e);if(n.position!=="fixed"&&(n.display==="none"||n.visibility==="hidden"))return!1}try{const n=window.getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"||n.opacity==="0")return!1;let r=e.parentElement,i=0;const o=10;for(;r&&r!==document.body&&i<o;){const s=window.getComputedStyle(r);if(s.display==="none"||s.visibility==="hidden")return!1;r=r.parentElement,i++}return!0}catch{return!0}}dedupeElements(e){const n=new Set,r=[],i=new Map,o=new Map,s=new Map,a=f=>(i.has(f)||i.set(f,this.getElementDepth(f)),i.get(f)),l=f=>(o.has(f)||o.set(f,this.getRole(f)),o.get(f)),c=f=>(s.has(f)||s.set(f,this.computeAccessibleName(f)),s.get(f)),d=[...e].sort((f,h)=>a(h)-a(f));for(const f of d){if(n.has(f))continue;let h=!1;for(const b of r)if(f.contains(b)&&f!==b){const y=l(f),g=l(b);if(y==="card"||y==="listitem"||y==="option"){if(!c(f)){h=!0;break}}else if(y===g){h=!0;break}}if(!h){for(const b of r)if(b.contains(f)&&b!==f){const y=c(f),g=c(b);if(!y||y===g){h=!0;break}}}h||(n.add(f),r.push(f))}return r}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}processElement(e,n){const r=e.getBoundingClientRect(),i=this.computeAccessibleName(e);let o=this.getRole(e);if((!o||o==="element")&&this.looksLikeCard(e)&&(o="card"),!i&&(!o||o==="element"))return null;const s=this.getState(e),a=this.findContext(e),l=this.getRowContext(e),c=this.generateRef(o||"element");let d;if(e instanceof HTMLInputElement&&e.value)d=e.value;else if(e instanceof HTMLTextAreaElement&&e.value)d=e.value;else if(e instanceof HTMLSelectElement&&e.selectedIndex>=0){const f=e.options[e.selectedIndex];f&&(d=f.text)}return{ref:c,role:o||"element",name:i||this.generateFallbackName(e,o),...Object.keys(s).length&&{state:s},...d&&{value:d},...a&&{context:a},...l&&{rowContext:l},rect:{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)},selector:this.generateSelector(e),tag:e.tagName.toLowerCase()}}computeAccessibleName(e){var f,h,b,y,g,S;const n=e.getAttribute("aria-labelledby");if(n){const v=n.split(/\s+/).map(w=>{var k,C;return(C=(k=document.getElementById(w))==null?void 0:k.textContent)==null?void 0:C.trim()}).filter(Boolean);if(v.length)return v.join(" ").slice(0,100)}const r=(f=e.getAttribute("aria-label"))==null?void 0:f.trim();if(r)return r.slice(0,100);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){const v=this.getInputLabel(e);if(v)return v;if("placeholder"in e&&e.placeholder)return e.placeholder.slice(0,100)}if(e instanceof HTMLImageElement&&e.alt)return e.alt.slice(0,100);const i=(h=e.getAttribute("title"))==null?void 0:h.trim();if(i)return i.slice(0,100);const o=this.getDirectTextContent(e);if(o)return o;const s=this.findSiblingLabel(e);if(s)return s;const a=e.querySelector("svg");if(a){const v=(y=(b=a.querySelector("title"))==null?void 0:b.textContent)==null?void 0:y.trim();if(v)return v.slice(0,100);const w=(S=(g=a.querySelector("desc"))==null?void 0:g.textContent)==null?void 0:S.trim();if(w)return w.slice(0,100)}const l=e.getAttribute("data-tooltip")||e.getAttribute("data-tip")||e.getAttribute("data-original-title");if(l)return l.slice(0,100);const c=e.getAttribute("data-testid");if(c)return c.replace(/[-_]/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").slice(0,100);const d=this.extractIconName(e);return d||""}getInputLabel(e){var i,o,s;if(e.id){const a=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(a){const l=(i=a.textContent)==null?void 0:i.trim();if(l)return l.slice(0,100)}}const n=e.closest("label");if(n){const a=n.cloneNode(!0);a.querySelectorAll("input, select, textarea").forEach(c=>c.remove());const l=(o=a.textContent)==null?void 0:o.trim();if(l)return l.slice(0,100)}const r=e.getAttribute("aria-describedby");if(r){const a=document.getElementById(r);if(a){const l=(s=a.textContent)==null?void 0:s.trim();if(l)return l.slice(0,100)}}return""}getDirectTextContent(e){var r,i;let n="";for(const o of e.childNodes)o.nodeType===Node.TEXT_NODE&&(n+=(o.textContent||"")+" ");if(n=n.trim(),!n){const o=[":scope > span",":scope > strong",":scope > em",":scope > b",":scope > label",":scope > .MuiButton-label",":scope > .ant-btn-content",':scope > [class*="label"]',':scope > [class*="text"]'];for(const s of o)try{const a=e.querySelector(s);if(a&&a.children.length===0){const l=(r=a.textContent)==null?void 0:r.trim();if(l){n=l;break}}}catch{}}if(!n&&e.innerText){const o=e.innerText.trim().split(`
|
|
449
|
+
`);n=((i=o[0])==null?void 0:i.trim())||"",o.length>1&&o.length<=3&&(n=o.join(" - ").slice(0,100))}return n.slice(0,100)}extractIconName(e){var s;const r=e.querySelector('[class*="icon"], [class*="Icon"], svg, i')||e,i=typeof r.className=="string"?r.className:"",o=[/fa-([a-z-]+)/i,/fas? fa-([a-z-]+)/i,/far? fa-([a-z-]+)/i,/icon-([a-z-]+)/i,/([a-z]+)-icon/i,/material-icons/i,/lucide-([a-z-]+)/i,/heroicon-([a-z-]+)/i,/ri-([a-z-]+)/i,/bi-([a-z-]+)/i,/bx-([a-z-]+)/i,/bxs-([a-z-]+)/i,/ph-([a-z-]+)/i,/tabler-([a-z-]+)/i,/mdi-([a-z-]+)/i];for(const a of o){const l=i.match(a);if(l&&l[1])return l[1].replace(/-/g," ").replace(/([a-z])([A-Z])/g,"$1 $2")}if(i.includes("material-icons")||i.includes("material-symbols")){const a=(s=r.textContent)==null?void 0:s.trim();if(a&&a.length<30)return a.replace(/_/g," ")}return""}findSiblingLabel(e){var i,o;let n=e.previousElementSibling;for(;n;){if(n.matches('label, .label, [class*="label"], [class*="Label"]')){const s=(i=n.textContent)==null?void 0:i.trim();if(s&&s.length<50)return s}n=n.previousElementSibling}const r=e.parentElement;if(r){const s=r.querySelector(':scope > label, :scope > .label, :scope > [class*="FormLabel"]');if(s&&!s.contains(e)){const a=(o=s.textContent)==null?void 0:o.trim();if(a&&a.length<50)return a}}return""}generateFallbackName(e,n){const r=e.tagName.toLowerCase(),i=this.getSiblingIndex(e),o=this.getParentContext(e),s=[];return s.push(n||r),i>0&&s.push(`${i+1}`),o&&s.push(`in ${o}`),s.join(" ")}getSiblingIndex(e){const n=e.parentElement;return n?Array.from(n.children).filter(i=>i.tagName===e.tagName).indexOf(e):0}getParentContext(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=n.getAttribute("aria-label")||n.getAttribute("title")||(n.matches("nav, main, header, footer, aside, section, article")?n.tagName.toLowerCase():null);if(r)return r.slice(0,30);n=n.parentElement}return""}getRole(e){const n=e.getAttribute("role");if(n)return n;const r=e.tagName.toLowerCase();if(r==="input"){const i=e.type||"text";return _t.INPUT_TYPE_ROLES[i]||"textbox"}return r==="a"?e.hasAttribute("href")?"link":"":_t.IMPLICIT_ROLES[r]||""}looksLikeCard(e){const n=typeof e.className=="string"?e.className.toLowerCase():"";if(n.includes("card")||n.includes("tile")||n.includes("option")||n.includes("selection"))return!0;const r=window.getComputedStyle(e),o=!(r.borderWidth||"0").split(" ").every(c=>c==="0px"||c==="0")&&r.borderStyle!=="none",s=r.borderRadius||"0",a=parseFloat(s)>0;r.backgroundColor!=="rgba(0, 0, 0, 0)"&&r.backgroundColor;const l=e.getBoundingClientRect();return!!(o&&a&&l.height>50&&l.width>100)}getState(e){const n={};e.getAttribute("aria-selected")==="true"&&(n.selected=!0);const r=e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio");(e.getAttribute("aria-checked")==="true"||r&&e.checked)&&(n.checked=!0),e.getAttribute("aria-expanded")==="true"&&(n.expanded=!0),e instanceof HTMLDetailsElement&&e.open&&(n.expanded=!0),e.getAttribute("aria-pressed")==="true"&&(n.pressed=!0);const i=e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement;(e.getAttribute("aria-disabled")==="true"||i&&e.disabled||e.hasAttribute("disabled"))&&(n.disabled=!0),(e.getAttribute("aria-current")==="true"||e.getAttribute("aria-current")==="page")&&(n.current=!0),!n.selected&&this.detectVisualSelection(e)&&(n.selected=!0);const o=typeof e.className=="string"?e.className.toLowerCase():"";!n.selected&&(o.includes("selected")||o.includes("active")||o.includes("chosen")||o.includes("current"))&&(n.selected=!0),!n.disabled&&o.includes("disabled")&&(n.disabled=!0);const s=e.getAttribute("data-state");return(s==="checked"||s==="on")&&(n.checked=!0),(s==="open"||s==="expanded")&&(n.expanded=!0),(s==="active"||s==="selected")&&(n.selected=!0),n}detectVisualSelection(e){const n=window.getComputedStyle(e),r=n.borderColor.toLowerCase();if(r.includes("rgb(8, 103, 236)")||r.includes("rgb(59, 130, 246)")||r.includes("rgb(37, 99, 235)")||r.includes("rgb(29, 78, 216)"))return!0;const i=n.backgroundColor.toLowerCase();return!!(i.includes("rgb(238, 245, 252)")||i.includes("rgb(239, 246, 255)")||i.includes("rgb(219, 234, 254)"))}findContext(e){var l,c,d,f,h,b,y,g;const n=e.getAttribute("aria-describedby");if(n){const S=document.getElementById(n);if(S)return((l=S.textContent)==null?void 0:l.trim().slice(0,50))||null}const r=e.closest("fieldset");if(r){const S=r.querySelector("legend");if(S)return((c=S.textContent)==null?void 0:c.trim().slice(0,50))||null}const i=e.closest('[class*="form-group"], [class*="FormGroup"], [class*="field"]');if(i){const S=i.querySelector(":scope > label, :scope > .label");if(S&&!S.contains(e))return((d=S.textContent)==null?void 0:d.trim().slice(0,50))||null}const o=e.closest('section, [role="region"], form, [class*="section"], [class*="Section"]');if(o){const S=o.querySelector(':scope > h1, :scope > h2, :scope > h3, :scope > h4, :scope > h5, :scope > h6, :scope > [role="heading"]');if(S)return((f=S.textContent)==null?void 0:f.trim().slice(0,50))||null;const v=o.querySelector(':scope > [class*="title"], :scope > [class*="Title"], :scope > [class*="header"] > *');if(v)return((h=v.textContent)==null?void 0:h.trim().slice(0,50))||null}const s=e.previousElementSibling;if(s&&s.matches('p, label, h1, h2, h3, h4, h5, h6, [class*="label"], [class*="Label"]')){const S=(b=s.textContent)==null?void 0:b.trim();if(S&&S.length<50)return S}const a=(y=e.parentElement)==null?void 0:y.previousElementSibling;if(a&&a.matches('p, label, [class*="label"], [class*="Label"]')){const S=(g=a.textContent)==null?void 0:g.trim();if(S&&S.length<50)return S}return null}getRowContext(e){var o,s,a;const n=e.closest('tr, [role="row"]');if(n){const l=n.querySelector('td:first-child, th:first-child, [role="cell"]:first-child');if(l&&!l.contains(e)){const c=(o=l.textContent)==null?void 0:o.trim();if(c)return c.slice(0,40)}}const r=e.closest('li, [role="listitem"]');if(r){const l=r.querySelector('.name, .title, [class*="name"], [class*="title"], [class*="Name"]');if(l&&!l.contains(e)){const c=(s=l.textContent)==null?void 0:s.trim();if(c)return c.slice(0,40)}}const i=['[class*="data-row"]','[class*="DataRow"]','[class*="list-item"]','[class*="ListItem"]','[class*="table-row"]','[class*="TableRow"]','.row[class*="item"]','.Row[class*="Item"]'];for(const l of i)try{const c=e.closest(l);if(c&&!c.matches("tr")){const d=c.querySelector('[class*="name"], [class*="title"], [class*="-id"]');if(d&&!d.contains(e)){const f=(a=d.textContent)==null?void 0:a.trim();if(f&&f.length<40)return f}}}catch{}return null}generateRef(e){const n=_t.ROLE_PREFIXES[e]||"E";return this.refCounters[n]=(this.refCounters[n]||0)+1,`${n}${this.refCounters[n]}`}renumberRefs(e){const n={};for(const r of e){const i=_t.ROLE_PREFIXES[r.role]||"E";n[i]=(n[i]||0)+1,r.ref=`${i}${n[i]}`}}generateSelector(e){try{if(e.id){const o=`#${CSS.escape(e.id)}`;if(document.querySelector(o)===e)return o}const n=e.getAttribute("data-testid");if(n){const o=`[data-testid="${CSS.escape(n)}"]`;if(document.querySelector(o)===e)return o}if(e.className&&typeof e.className=="string"){const o=e.className.split(/\s+/).filter(s=>s&&!s.includes(":")&&!s.startsWith("css-"));if(o.length>0){const s=o.slice(0,3).map(a=>{try{return CSS.escape(a)}catch{return null}}).filter(Boolean);if(s.length>0){const a=`${e.tagName.toLowerCase()}.${s.join(".")}`;try{if(document.querySelectorAll(a).length===1)return a}catch{}}}}const r=[];let i=e;for(;i&&i!==document.body&&r.length<4;){let o=i.tagName.toLowerCase();if(i.id)try{const a=`#${CSS.escape(i.id)}`;if(document.querySelector(a)){r.unshift(a);break}}catch{}const s=i.parentElement;if(s){const a=Array.from(s.children).filter(l=>l.tagName===i.tagName);if(a.length>1){const l=a.indexOf(i)+1;o+=`:nth-of-type(${l})`}}r.unshift(o),i=s}return r.join(" > ")}catch{const r=e.parentElement;if(r){const o=Array.from(r.children).indexOf(e);return`${e.tagName.toLowerCase()}:nth-child(${o+1})`}return e.tagName.toLowerCase()}}computeSnapshotHash(e){const n=e.map(r=>`${r.role}:${r.name}:${r.state?JSON.stringify(r.state):""}`).join("|");return this.simpleHash(n)}simpleHash(e){let n=0;for(let r=0;r<e.length;r++){const i=e.charCodeAt(r);n=(n<<5)-n+i,n=n&n}return n.toString(36)}snapshotsAreEqual(e,n){if(e.elementCount!==n.elementCount||e.elements.length!==n.elements.length)return!1;for(let r=0;r<e.elements.length;r++){const i=e.elements[r],o=n.elements[r];if(!i||!o||i.name!==o.name||i.role!==o.role)return!1;const s=JSON.stringify(i.state||{}),a=JSON.stringify(o.state||{});if(s!==a)return!1}return!0}sleep(e){return new Promise(n=>setTimeout(n,e))}};P(_t,"IMPLICIT_ROLES",{button:"button",a:"link",input:"textbox",textarea:"textbox",select:"combobox",option:"option",img:"img",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",form:"form",table:"table",ul:"list",ol:"list",li:"listitem",article:"article",aside:"complementary",section:"region",dialog:"dialog",menu:"menu",menuitem:"menuitem",progress:"progressbar",meter:"meter"}),P(_t,"INPUT_TYPE_ROLES",{button:"button",submit:"button",reset:"button",image:"button",checkbox:"checkbox",radio:"radio",range:"slider",search:"searchbox",email:"textbox",tel:"textbox",url:"textbox",password:"textbox",text:"textbox",number:"spinbutton"}),P(_t,"ROLE_PREFIXES",{button:"B",link:"L",textbox:"T",searchbox:"T",checkbox:"X",radio:"R",combobox:"S",listbox:"S",option:"O",tab:"TAB",menuitem:"M",menu:"MENU",img:"I",card:"C",dialog:"D",slider:"SL",spinbutton:"N",switch:"SW",navigation:"NAV"}),P(_t,"INTERACTIVE_SELECTOR",`
|
|
455
450
|
button,
|
|
456
451
|
a[href],
|
|
457
452
|
input:not([type="hidden"]),
|
|
@@ -474,8 +469,8 @@ Error generating stack: `+o.message+`
|
|
|
474
469
|
[tabindex]:not([tabindex="-1"]),
|
|
475
470
|
[contenteditable="true"],
|
|
476
471
|
summary
|
|
477
|
-
`.replace(/\s+/g," ").trim()),D(_t,"SKIP_SELECTORS",["#onboarding-overlay","#onboarding-sdk-react-ui","#hse-highlight-element","script","style","noscript","template"]);let gd=_t;const Ax=["#onboarding-overlay","#floe-cursor","#onboarding-sdk-react-ui","#hse-highlight-element","#floe-cursor-styles","#onboarding-animations"],Ai="data-floe-widget";function xt(t){if(!t)return!1;if(t.hasAttribute(Ai))return!0;for(const e of Ax)if(t.closest(e))return!0;return!1}function Nr(){return window.location.origin+window.location.pathname}function ly(t){return t&&t.replace(/\.ng-(untouched|touched|pristine|dirty|valid|invalid)/g,"")}function cy(t){try{const n=document.querySelector(t);if(n)return n}catch{}const e=ly(t);if(e!==t)try{const n=document.querySelector(e);if(n)return console.log(`[AngularFallback] Selector matched after stripping state classes: "${e}"`),n}catch{}return null}function Ox(t){let e=t,n=0;for(;e&&n<5;){const r=e.getAttribute("role");if(r==="dialog"||r==="alertdialog"||e.getAttribute("aria-modal")==="true"||e.tagName==="DIALOG")return!0;const i=e.tagName.toLowerCase();if(i.includes("modal")||i.includes("dialog"))return!0;const o=typeof e.className=="string"?e.className.toLowerCase():"";if(o.includes("modal")||o.includes("dialog")||o.includes("cdk-overlay"))return!0;e=e.parentElement,n++}return!1}function uy(t,e={}){var h,b,y,m,S;const{focus:n=!0,includePointerEvents:r=!0,nativeClickFallback:i=!1,includeMouseEnter:o=!1}=e,s=t.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c=document.elementFromPoint(a,l);let d;if(c&&(c===t||t.contains(c)||c.contains(t)))d=c,d!==t&&console.log("[humanLikeClick] 🎯 Using element at point:",d.tagName,"instead of target:",t.tagName);else if(c){if(console.warn("[humanLikeClick] ⚠️ Element at point is unrelated:",c.tagName,(h=c.className)==null?void 0:h.toString().slice(0,50)),console.warn("[humanLikeClick] Expected target:",t.tagName,(b=t.className)==null?void 0:b.toString().slice(0,50)),Ox(c)){const v=`${c.tagName} (${(y=c.className)==null?void 0:y.toString().slice(0,80)})`;throw console.error("[humanLikeClick] ❌ BLOCKED: Modal/dialog overlay is covering the target element.",`Overlay: ${v}`,`Target: ${t.tagName} "${(m=t.textContent)==null?void 0:m.trim().slice(0,50)}"`),new Error(`Click blocked by modal overlay: ${v}. Target "${(S=t.textContent)==null?void 0:S.trim().slice(0,50)}" is behind the modal. Interact with the modal instead.`)}d=t}else console.warn("[humanLikeClick] ⚠️ No element at coordinates, falling back to target"),d=t;n&&typeof d.focus=="function"&&d.focus();const f={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l,screenX:a+window.screenX,screenY:l+window.screenY,button:0,buttons:1};if(r){const v={...f,pointerType:"mouse",isPrimary:!0};d.dispatchEvent(new PointerEvent("pointerdown",v)),d.dispatchEvent(new PointerEvent("pointerup",v))}return o&&(d.dispatchEvent(new MouseEvent("mouseenter",{...f,bubbles:!1})),d.dispatchEvent(new MouseEvent("mouseover",f))),d.dispatchEvent(new MouseEvent("mousedown",f)),d.dispatchEvent(new MouseEvent("mouseup",f)),d.dispatchEvent(new MouseEvent("click",f)),i&&typeof d.click=="function"&&d.click(),console.log("[humanLikeClick] ✅ Completed on",d.tagName,"at (",Math.round(a),",",Math.round(l),")"),d}class dy{constructor(){D(this,"audioContext",null);D(this,"analyzerNode",null);D(this,"sourceNode",null);D(this,"dataArray",new Uint8Array(0));D(this,"isRunning",!1);D(this,"onLevelsCallback",null);D(this,"animationId",null);D(this,"analyze",()=>{if(!this.isRunning||!this.analyzerNode||this.dataArray.length===0)return;this.analyzerNode.getByteFrequencyData(this.dataArray);const e=[];for(let n=0;n<this.dataArray.length;n++)n>=2&&n<this.dataArray.length-2&&e.push(this.dataArray[n]/255);this.onLevelsCallback&&this.onLevelsCallback(e),this.animationId=requestAnimationFrame(this.analyze)})}start(e,n){try{this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext.state==="suspended"&&this.audioContext.resume(),this.analyzerNode=this.audioContext.createAnalyser(),this.analyzerNode.fftSize=64,this.analyzerNode.smoothingTimeConstant=.4,this.sourceNode=this.audioContext.createMediaStreamSource(e),this.sourceNode.connect(this.analyzerNode);const r=this.analyzerNode.frequencyBinCount;this.dataArray=new Uint8Array(r),this.onLevelsCallback=n,this.isRunning=!0,this.analyze(),console.log("[AudioAnalyzer] Started analyzing audio stream")}catch(r){console.error("[AudioAnalyzer] Failed to start:",r)}}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=null),this.analyzerNode=null,this.dataArray=new Uint8Array(0),this.onLevelsCallback=null,console.log("[AudioAnalyzer] Stopped")}destroy(){this.stop(),this.audioContext&&(this.audioContext.close(),this.audioContext=null)}}class Px{constructor(){D(this,"events",{})}on(e,n){return this.events[e]||(this.events[e]=[]),this.events[e].push(n),this}off(e,n){if(!this.events[e])return this;const r=this.events[e].indexOf(n);return r>-1&&this.events[e].splice(r,1),this}emit(e,...n){if(!this.events[e])return!1;for(const r of this.events[e])r(...n);return!0}}class Dx{constructor(){D(this,"lastSnapshot",null);D(this,"lastSnapshotHash","");D(this,"snapshotInterval",null);D(this,"sendCallback",null);D(this,"correlationCounter",0);D(this,"INTERACTIVE_TAGS",new Set(["button","a","input","select","textarea","label","summary","details","option","menuitem"]));D(this,"INTERACTIVE_ROLES",new Set(["button","link","menuitem","option","tab","checkbox","radio","switch","textbox","combobox","listbox","slider"]));D(this,"mutationObserver",null);D(this,"mutationDebounceTimer",null)}startCapturing(e=1500,n){console.log(`[DOMIntrospector] Starting DOM capture every ${e}ms`),this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.sendCallback=n,this.captureAndSend(),this.snapshotInterval=window.setInterval(()=>{this.captureAndSend()},e),this.setupMutationObserver()}stopCapturing(){this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),console.log("[DOMIntrospector] Stopped DOM capture")}captureAndSendImmediate(e="immediate"){console.log(`[DOMIntrospector] Immediate capture triggered: ${e}`);const n=this.captureSnapshot(),r=this.computeSnapshotHash(n),i=r!==this.lastSnapshotHash,o={...n,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:e,domChanged:i};return this.lastSnapshot=o,this.lastSnapshotHash=r,this.sendCallback&&(console.log(`[DOMIntrospector] Sending immediate snapshot (changed=${i}): ${n.elements.length} elements, corr=${o.correlationId}`),this.sendCallback(o)),o.correlationId}setupMutationObserver(){this.mutationObserver||(this.mutationObserver=new MutationObserver(e=>{this.mutationDebounceTimer&&clearTimeout(this.mutationDebounceTimer),e.some(r=>r.type==="childList"||r.type==="attributes"&&["href","src","hidden","disabled"].includes(r.attributeName||""))&&(this.mutationDebounceTimer=setTimeout(()=>{console.log("[DOMIntrospector] Significant DOM change detected"),this.captureAndSendImmediate("dom-mutation")},300))}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","disabled","aria-hidden","href","src"]}))}captureAndSend(){const e=this.captureSnapshot(),n=this.computeSnapshotHash(e);if(n!==this.lastSnapshotHash){const i={...e,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:"periodic",domChanged:!0};this.lastSnapshot=i,this.lastSnapshotHash=n,this.sendCallback&&(console.log(`[DOMIntrospector] Sending snapshot (DOM changed): ${e.elements.length} elements, ${e.interactiveCount} interactive, corr=${i.correlationId}`),this.sendCallback(i))}else console.debug("[DOMIntrospector] Snapshot unchanged, skipping send")}computeSnapshotHash(e){const n=e.elements.length,r=e.interactiveCount||0,i=30,o=e.elements.slice(0,i),s=Math.max(0,Math.floor(n/2)-Math.floor(i/2)),a=e.elements.slice(s,s+i),l=e.elements.slice(-i),c=f=>f.map(h=>{var b;return`${h.tag}:${(b=h.text)==null?void 0:b.slice(0,20)}:${Math.round(h.rect.x)}:${Math.round(h.rect.y)}`}).join("|");return`count:${n}:${r}|`+c(o)+"||"+c(a)+"||"+c(l)}captureSnapshot(){const e=[],n={width:window.innerWidth,height:window.innerHeight},r=document.body.querySelectorAll("*");let i=0,o=0;return r.forEach(s=>{var h;const a=s;if(this.shouldSkipElement(a))return;const l=a.getBoundingClientRect();if(l.bottom<0||l.top>n.height||l.right<0||l.left>n.width||l.width<=0||l.height<=0)return;const c=this.isInteractiveElement(a);c&&o++;const d=this.getVisibleText(a);if(!c&&!d)return;const f={index:i++,tag:a.tagName.toLowerCase(),text:d,id:a.id||"",className:typeof a.className=="string"?a.className:"",ariaLabel:a.getAttribute("aria-label"),placeholder:a.getAttribute("placeholder"),role:a.getAttribute("role"),href:a.getAttribute("href"),type:a.getAttribute("type"),name:a.getAttribute("name"),rect:{x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height)},isVisible:!0,isInteractive:c,parentTag:((h=a.parentElement)==null?void 0:h.tagName.toLowerCase())||null,depth:this.getElementDepth(a)};e.push(f)}),{timestamp:Date.now(),url:Nr(),viewport:n,elements:e,totalElements:e.length,interactiveCount:o}}shouldSkipElement(e){if(xt(e))return!0;const n=e.tagName.toLowerCase();if(["script","style","noscript","template","svg","path"].includes(n))return!0;const r=window.getComputedStyle(e);return r.display==="none"||r.visibility==="hidden"||r.opacity==="0"}isInteractiveElement(e){const n=e.tagName.toLowerCase();if(this.INTERACTIVE_TAGS.has(n))return!0;const r=e.getAttribute("role");if(r&&this.INTERACTIVE_ROLES.has(r)||e.onclick||e.getAttribute("onclick")||e.contentEditable==="true")return!0;const i=e.getAttribute("tabindex");return!!(i&&parseInt(i)>=0||window.getComputedStyle(e).cursor==="pointer")}getVisibleText(e){var r;return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?(e.value||e.placeholder||"").trim().slice(0,80):(((r=e.innerText)==null?void 0:r.trim())||"").slice(0,80)}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}getLastSnapshot(){return this.lastSnapshot}findElementByIndex(e){if(!this.lastSnapshot)return null;const n=this.lastSnapshot.elements.find(r=>r.index===e);return n?this.findElementByBoundingBox(n.rect,n.tag,n.text):null}findElementByBoundingBox(e,n,r){var a;const o=[];if(document.body.querySelectorAll("*").forEach(l=>{var m;const c=l;if(this.shouldSkipElement(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x)<=10,h=Math.abs(d.y-e.y)<=10,b=Math.abs(d.width-e.width)<=10*2,y=Math.abs(d.height-e.height)<=10*2;if(f&&h&&b&&y){let S=100,v=!1;if(n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r){const w=((m=c.innerText)==null?void 0:m.trim().toLowerCase())||"",k=r.toLowerCase();w.length===0?v=!1:w===k?(S+=50,v=!0):(w.includes(k)||k.includes(w))&&(S+=25,v=!0)}else v=!0;o.push({element:c,score:S,textMatch:v})}}),o.sort((l,c)=>c.score-l.score),o.length>0){const l=o[0],c=((a=l.element.innerText)==null?void 0:a.trim().slice(0,50))||"";return r&&!l.textMatch?(console.warn(`[DOMIntrospector] ⚠️ Bounding box match REJECTED - text mismatch! Expected: "${r}", Found: "${c}"`),console.warn(`[DOMIntrospector] Element at (${e.x}, ${e.y}) has text "${c}" which doesn't match expected "${r}" - page may have scrolled`),null):(console.log(`[DOMIntrospector] Found ${o.length} candidates by bounding box, best score: ${l.score}, text: "${c}"`),l.element)}return null}}const rr=class rr{static extractSelectorContext(e){if(!e)return{};const n=e.split(/\s*([>+~]|\s)\s*/);if(n.length<2)return{};const r=n[n.length-1],i=n.slice(0,-2),o=r.match(/^([a-zA-Z][a-zA-Z0-9-]*)/),s=o?o[1].toLowerCase():void 0,a=i.length>0?i.join(" "):void 0;let l;if(i.length>0){const d=i[i.length-1].match(/^([a-zA-Z][a-zA-Z0-9-]*)/);l=d?d[1].toLowerCase():void 0}return{expectedTag:s,parentSelector:a,parentTag:l}}static matchesSelectorContext(e,n){if(!n.parentTag&&!n.parentSelector)return .5;let r=0,i=0;if(n.parentTag&&(i++,e.closest(n.parentTag)&&(r+=1)),n.parentSelector){i++;try{e.closest(n.parentSelector)&&(r+=1)}catch{}}return i>0?r/i:.5}static setDOMIntrospector(e){rr.domIntrospector=e,console.log("[HybridTargetResolver] DOM Introspector set for enhanced targeting")}static safeStringify(e,n){const r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(o&&typeof o=="object"){if(o instanceof HTMLElement){const s=o.tagName||"Unknown",a=o.id?`#${o.id}`:"",l=o.className&&typeof o.className=="string"?`.${o.className.split(" ").filter(Boolean).join(".")}`:"";return`[HTMLElement: ${s}${a}${l}]`}if(o instanceof Element)return`[Element: ${o.tagName||"Unknown"}]`;if(o instanceof Node)return`[Node: ${o.nodeName}]`;if(r.has(o))return"[Circular]";r.add(o)}return o},n)}static resolveTarget(e){if(!e)return console.warn("[HybridTargetResolver] ❌ No target provided"),null;console.log("[HybridTargetResolver] Target details:",this.safeStringify(e,2));const n=this.resolveTargetWithConsensus(e),r=n.element?`[HTMLElement: ${n.element.tagName}${n.element.id?`#${n.element.id}`:""}${n.element.className&&typeof n.element.className=="string"?`.${n.element.className.split(" ").filter(Boolean).join(".")}`:""}]`:null,i={...n,element:r};return console.log(`[HybridTargetResolver] consensus results (${n.confidence.toFixed(1)}% confidence)`,this.safeStringify(i,2)),n.element?n.element:null}static resolveTargetWithConsensus(e){var f;const n=performance.now(),r=this.getAvailableStrategies(e);if(r.length===0)return console.warn("[HybridTargetResolver] ⚠️ No strategies available for target"),{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};console.log(`[HybridTargetResolver] 🔄 Running ${r.length} strategies in parallel...`);const i=new Map;for(const h of r){const b=this.executeStrategyMulti(h,e);for(const y of b)xt(y)||y.isConnected&&(i.has(y)?i.get(y).strategies.push(h):i.set(y,{element:y,strategies:[h],validationScore:0,interactable:!1,confidence:0}))}if(console.log(`[HybridTargetResolver] 📊 Found ${i.size} unique candidate(s)`),i.size===0)return{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};const o=[];for(const[h,b]of i){if(!h.isConnected){console.warn("[HybridTargetResolver] ⚠️ Candidate element was removed from DOM, skipping");continue}b.validationScore=this.computeValidationScore(h,e),b.interactable=this.checkInteractability(h).ok,b.confidence=this.computeConfidence(b,r.length,e),o.push(b),console.log(`[HybridTargetResolver] <${h.tagName.toLowerCase()}> "${(f=h.textContent)==null?void 0:f.slice(0,25)}..."`),console.log(`[HybridTargetResolver] Strategies: ${b.strategies.join(", ")} (${b.strategies.length}/${r.length})`),console.log(`[HybridTargetResolver] Confidence: ${b.confidence.toFixed(1)}%`)}if(o.length===0)return{element:null,confidence:0,strategies:[],candidateCount:i.size,ambiguous:!1,duration:performance.now()-n};o.sort((h,b)=>b.confidence-h.confidence);const s=o[0],a=o.length>1?o[1]:void 0,l=performance.now()-n,c=a!==void 0&&s.confidence-a.confidence<10;if(c&&console.warn("[HybridTargetResolver] ⚠️ AMBIGUOUS: Top candidates have similar confidence"),s.confidence<30)return console.warn(`[HybridTargetResolver] ❌ Best candidate confidence too low: ${s.confidence.toFixed(1)}%`),{element:null,confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l};if(!s.interactable){const h=o.find(b=>b.interactable);if(h&&h.confidence>30)return console.log(`[HybridTargetResolver] ✅ Using interactable candidate (${h.confidence.toFixed(1)}%)`),{element:this.getClickableContainer(h.element),confidence:h.confidence,strategies:h.strategies,candidateCount:i.size,ambiguous:c,duration:l}}return console.log(`[HybridTargetResolver] ✅ Winner: ${s.confidence.toFixed(1)}% confidence (${l.toFixed(1)}ms)`),{element:this.getClickableContainer(s.element),confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l}}static isValidCSSSelector(e){if(!e||typeof e!="string")return!1;if(/^(role|text|label|placeholder)=/.test(e))return console.warn(`[HybridTargetResolver] Skipping Playwright-style selector (not CSS): "${e.substring(0,50)}..."`),!1;try{return document.querySelector(e),!0}catch{return console.warn(`[HybridTargetResolver] Invalid CSS selector: "${e.substring(0,50)}..."`),!1}}static executeStrategyMulti(e,n){const r=[];try{switch(e){case"selector":{const i=new Set,o=[n.selector,...n.selectorFallbacks||[]].filter(a=>!!a),s=[];for(const a of o){this.isValidCSSSelector(a)&&s.push(a);const l=ly(a);l!==a&&this.isValidCSSSelector(l)&&!s.includes(l)&&s.push(l)}for(const a of s)try{document.querySelectorAll(a).forEach(l=>i.add(l))}catch{console.warn(`[HybridTargetResolver] querySelectorAll failed for: "${a.substring(0,50)}..."`)}r.push(...i);break}case"text":n.text&&r.push(...this.findAllByText(n.text));break;case"ariaLabel":n.ariaLabel&&document.querySelectorAll(`[aria-label*="${CSS.escape(n.ariaLabel)}"]`).forEach(i=>r.push(i));break;case"placeholder":n.placeholder&&document.querySelectorAll(`[placeholder*="${CSS.escape(n.placeholder)}"]`).forEach(i=>r.push(i));break;case"role":n.role&&document.querySelectorAll(`[role="${n.role}"]`).forEach(i=>r.push(i));break;case"labelText":{if(n.labelText){let i=n.selector||"";(!i||/react-select-\d+/.test(i))&&(n.role?i=`[role="${n.role}"]`:n.tag?i=n.tag:i="*");const o=this.findElementByLabelText(n.labelText,i);o&&r.push(o)}break}case"optionText":{if(n.optionText){const i=this.findDropdownOptionByText(n.optionText);i&&r.push(i)}break}case"removeChip":{if(n.removeChipText){const i=this.findMultiSelectChipRemoveButton(n.removeChipText);i&&r.push(i)}break}case"tag":{if(n.tag){const i=document.getElementsByTagName(n.tag);for(const o of i)(!n.text||(o.textContent||"").toLowerCase().includes(n.text.toLowerCase()))&&r.push(o)}break}case"domIndex":if(n.domIndex!==void 0){const i=this.findByDomIndex(n.domIndex);i&&r.push(i)}break;case"boundingBox":{if(n.boundingBox){const i=this.findByBoundingBox(n.boundingBox,n.tag,n.text);i&&r.push(i)}break}}}catch(i){console.warn(`[HybridTargetResolver] Strategy "${e}" threw error:`,i)}return r}static findAllByText(e,n){var b,y;const r=[],i=new Set;if(!e)return r;const o=e.trim();if(!o)return r;const s=n||"*",a=this.escapeXPathString(o),l=`//${s}[normalize-space(.)=${a}]`;try{const m=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<m.snapshotLength;S++){const v=m.snapshotItem(S);v&&!this.isDropdownDisplayValue(v)&&!i.has(v)&&(r.push(v),i.add(v))}}catch{}const c=`//${s}[contains(normalize-space(.), ${a})]`;try{const m=document.evaluate(c,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<m.snapshotLength;S++){const v=m.snapshotItem(S);v&&!this.isDropdownDisplayValue(v)&&!i.has(v)&&(r.push(v),i.add(v))}}catch{}const d=[];for(const m of r)if(!this.isInteractiveElement(m)){const S=this.findNearbyInput(m);S&&!i.has(S)&&(console.log(`[HybridTargetResolver] → Found nearby input for label "${(b=m.textContent)==null?void 0:b.trim().substring(0,30)}": <${S.tagName.toLowerCase()}>`),d.push(S),i.add(S))}r.push(...d);const f=o.toLowerCase(),h=document.querySelectorAll("input, textarea");for(const m of h){const S=m;if(xt(S)||i.has(S))continue;const v=((y=S.getAttribute("placeholder"))==null?void 0:y.trim().toLowerCase())||"";if(v===f||v&&v.includes(f)&&f.length/v.length>.6){const w=S.getBoundingClientRect();w.width>0&&w.height>0&&(r.push(S),i.add(S))}}return r}static isInteractiveElement(e){return!!(["INPUT","BUTTON","SELECT","TEXTAREA","A"].includes(e.tagName)||e.getAttribute("role")==="button"||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="textbox"||e.getAttribute("role")==="listbox"||e.getAttribute("contenteditable")==="true"||e.getAttribute("tabindex")!==null&&e.getAttribute("tabindex")!=="-1")}static findNearbyInput(e){if(e.tagName==="LABEL"){const i=e.getAttribute("for");if(i){const o=document.getElementById(i);if(o)return o}}let n=e.nextElementSibling;for(let i=0;i<3&&n;i++){const o=this.findFirstInput(n);if(o)return o;n=n.nextElementSibling}const r=e.parentElement;if(r){const i=r.querySelectorAll('input, textarea, select, [role="combobox"], [role="listbox"], nz-select input, .ant-select input');for(const o of i)if(e.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING){const s=o.getBoundingClientRect();if(s.width>0&&s.height>0)return o}}return null}static findFirstInput(e){if(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="listbox")return e;const n=e.querySelector('input, textarea, select, [role="combobox"], [role="listbox"]');if(n){const r=n.getBoundingClientRect();if(r.width>0&&r.height>0)return n}return null}static computeValidationScore(e,n){var c,d,f;let r=0,i=0,o=!1,s=!1;if(n.role){i+=25;const h=e.getAttribute("role");if(h===n.role)r+=25;else if(h)o=!0;else{const b=e.tagName.toLowerCase(),y=typeof e.className=="string"?e.className:"";b==="div"||b==="span"||e.classList.contains("container")||y.includes("control")||y.includes("wrapper")?r+=10:s=!0}}if(n.role==="combobox"&&e.querySelector('[role="combobox"]')&&(r+=10,i+=10),n.tag){i+=15;const h=e.tagName.toLowerCase(),b=n.tag.toLowerCase();h===b?r+=15:n.role==="combobox"&&(h==="input"||h==="div")&&(r+=10)}if(n.text&&!n.optionText){i+=20;const h=(e.textContent||"").toLowerCase().trim(),b=n.text.toLowerCase().trim();if(n.role==="combobox"&&e.tagName.toLowerCase()==="input"){const y=(c=e.closest('.css-6lmz24, [class*="value-container"], [class*="placeholder"]'))==null?void 0:c.parentElement,m=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]'),S=((d=m==null?void 0:m.textContent)==null?void 0:d.toLowerCase().trim())||"";(S===b||S.includes(b))&&(r+=20)}else if(h===b)r+=20;else if(h.includes(b)){const y=b.length/h.length;y>.8?r+=15:y>.5?r+=8:(new RegExp(`\\b${rr.escapeRegex(b)}\\b`,"i").test(h)?r+=2:r+=0,console.log(`[HybridTargetResolver] Text length mismatch: "${b}" (${b.length}) in "${h.slice(0,30)}..." (${h.length}), ratio=${y.toFixed(2)}, points=${r}`))}else if(b.includes(h)){const y=h.length/b.length;r+=Math.round(15*y)}}if(n.ariaLabel){i+=15;const h=e.getAttribute("aria-label")||"";h.toLowerCase()===n.ariaLabel.toLowerCase()?r+=15:h.toLowerCase().includes(n.ariaLabel.toLowerCase())&&(r+=10)}if(n.placeholder){i+=15;const h=e.placeholder||"",b=n.placeholder.toLowerCase();if(h.toLowerCase().includes(b))r+=15;else if(n.role==="combobox"){const y=e.closest('[class*="container"]')||e.parentElement,m=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]');(((f=m==null?void 0:m.textContent)==null?void 0:f.toLowerCase().trim())||"").includes(b)&&(r+=15)}}if(n.labelText){i+=20;const h=this.getAssociatedLabelText(e);if(h){const b=h.toLowerCase().trim().replace(/\*$/,"").trim(),y=n.labelText.toLowerCase().trim().replace(/\*$/,"").trim();b===y?r+=20:(b.includes(y)||y.includes(b))&&(r+=15)}}if(n.optionText){i+=15;const b=(e.textContent||"").trim().toLowerCase(),y=n.optionText.toLowerCase().trim();b===y?r+=15:b.includes(y)&&(r+=10)}if(i===0)return 100;let a=Math.round(r/i*100);if(o?(a=Math.round(a*.3),console.log(`[HybridTargetResolver] Role mismatch penalty (30%): ${e.tagName}[role="${e.getAttribute("role")}"] vs target role="${n.role}"`)):s&&(e.closest('[role="listbox"], [role="menu"], [role="tree"]')||(a=Math.round(a*.7),console.log(`[HybridTargetResolver] No role penalty (70%): ${e.tagName} expected role="${n.role}"`))),e.getAttribute("tabindex")==="-1"&&(e.closest('[role="listbox"], [role="menu"], [role="combobox"], .select, [class*="dropdown"]')||e.tagName.toLowerCase()==="input"&&(a=Math.round(a*.85),console.log("[HybridTargetResolver] tabindex=-1 input penalty (85%): likely hidden placeholder"))),n.selector){const h=this.extractSelectorContext(n.selector);if(h.parentTag||h.parentSelector){const b=this.matchesSelectorContext(e,h);b>.5?a=Math.min(100,Math.round(a*1.15)):b<.5&&n.text&&(a=Math.round(a*.7))}}if(n.text){const h=e.tagName.toLowerCase(),b=e.getAttribute("role"),y=["button","a","input","select","textarea"].includes(h),m=["button","link","menuitem","option","tab","checkbox","radio"].includes(b||""),S=e.onclick!==null||e.hasAttribute("onclick"),v=e.closest('button, a, [role="button"], [role="link"]');y||m?(a=Math.min(100,Math.round(a*1.25)),console.log(`[HybridTargetResolver] Interactive element bonus (25%): <${h}> is natively interactive`)):v?a=Math.min(100,Math.round(a*1.15)):S&&(a=Math.min(100,Math.round(a*1.1)))}return a}static computeConfidence(e,n,r){if(n===0)return console.warn("[HybridTargetResolver] computeConfidence: totalStrategies is 0, returning 0"),0;const i=e.strategies.length/n*100,o=e.validationScore;let s=100;try{const c=e.element.getBoundingClientRect();(c.width===0||c.height===0)&&(s=0),e.interactable||(s*=.5)}catch{s=0}let a=0;if(e.strategies.includes("selector"))if(r.text){const c=(e.element.textContent||"").toLowerCase().trim(),d=r.text.toLowerCase().trim();c===d?(a=100,console.log("[HybridTargetResolver] Selector + exact text match bonus applied")):c.includes(d)?(a=70,console.log("[HybridTargetResolver] Selector + partial text match bonus applied")):(a=20,console.log("[HybridTargetResolver] Selector match but NO text match - reduced bonus"))}else a=100,console.log("[HybridTargetResolver] Selector match bonus applied (no text to validate)");return i*.3+o*.4+s*.15+a*.15}static checkInteractability(e){try{if(!e.isConnected)return{ok:!1,reason:"Element is not connected to DOM"};let n;try{n=window.getComputedStyle(e)}catch{return{ok:!1,reason:"Cannot compute style (element may be in different document)"}}if(n.display==="none")return{ok:!1,reason:"Element has display: none"};if(n.visibility==="hidden")return{ok:!1,reason:"Element has visibility: hidden"};const r=parseFloat(n.opacity);if(isNaN(r)||r===0)return{ok:!1,reason:"Element has opacity: 0"};if(n.pointerEvents==="none")return{ok:!1,reason:"Element has pointer-events: none"};if(e.disabled)return{ok:!1,reason:"Element is disabled"};if(e.getAttribute("aria-disabled")==="true")return{ok:!1,reason:"Element has aria-disabled: true"};if(!e.offsetParent&&n.position!=="fixed"&&n.position!=="sticky"){let o=e.parentElement,s=!1;for(;o&&o!==document.body;){try{const a=window.getComputedStyle(o);if(a.position==="fixed"||a.position==="sticky"){s=!0;break}}catch{break}o=o.parentElement}if(!s)return{ok:!1,reason:"Element is not rendered (offsetParent is null)"}}let i;try{i=e.getBoundingClientRect()}catch{return{ok:!1,reason:"Cannot get bounding rect (element may be in different frame)"}}return i.width===0||i.height===0?{ok:!1,reason:"Element has zero dimensions"}:{ok:!0}}catch(n){return console.warn("[HybridTargetResolver] checkInteractability error:",n),{ok:!1,reason:`Error checking interactability: ${n}`}}}static getAvailableStrategies(e){const n=[];return e.labelText&&n.push("labelText"),e.optionText&&n.push("optionText"),e.removeChipText&&n.push("removeChip"),e.selector&&n.push("selector"),e.domIndex!==void 0&&n.push("domIndex"),e.boundingBox&&n.push("boundingBox"),e.placeholder&&n.push("placeholder"),e.ariaLabel&&n.push("ariaLabel"),e.text&&n.push("text"),e.role&&n.push("role"),e.tag&&n.push("tag"),console.log("[HybridTargetResolver] Auto-detected available strategies:",n.join(", ")),n}static findByDomIndex(e){return e===void 0?null:this.domIntrospector?this.domIntrospector.findElementByIndex(e):null}static findByBoundingBox(e,n,r){if(!e)return null;if(this.domIntrospector)return this.domIntrospector.findElementByBoundingBox(e,n,r);const i=10,o=document.body.querySelectorAll("*");let s=null,a=0;return o.forEach(l=>{var m;const c=l;if(xt(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x),h=Math.abs(d.y-e.y),b=Math.abs(d.width-e.width),y=Math.abs(d.height-e.height);if(f<=i&&h<=i&&b<=i*2&&y<=i*2){let S=100-f-h;n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r&&(((m=c.innerText)==null?void 0:m.trim().toLowerCase())||"").includes(r.toLowerCase())&&(S+=25),S>a&&(a=S,s=c)}}),s}static validateElementMatchesTarget(e,n){var o;if(!n.labelText&&!n.optionText&&!n.role&&!n.ariaLabel&&!n.placeholder&&!n.name&&!n.tag&&!n.text)return!0;const r=[];if(n.tag){const s=e.tagName.toLowerCase(),a=n.tag.toLowerCase();if(s!==a&&["input","select","textarea","button","a"].includes(a))return console.log(`[HybridTargetResolver] Validation failed: tag="${s}" !== expected "${a}"`),!1;r.push("tag")}if(n.text&&!n.optionText){const s=(e.textContent||"").trim().toLowerCase(),a=n.text.trim().toLowerCase(),l=s===a,c=s.includes(a)||a.includes(s);if(!l&&!c)return console.log(`[HybridTargetResolver] Validation failed: text="${s.slice(0,50)}" !== expected "${a}"`),!1;if(a.length<=10&&!l){const d=a.length/Math.max(s.length,1);if(d<.5)return console.log(`[HybridTargetResolver] Validation failed: text match ratio too low (${d.toFixed(2)})`),!1}r.push("text")}const i=(s,a)=>{const l=s.toLowerCase().trim().replace(/\*$/,"").trim(),c=a.toLowerCase().trim();return l===c?!0:new RegExp(`(^|\\s)${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(s)};if(n.role){const s=e.getAttribute("role");if(s!==n.role)return console.log(`[HybridTargetResolver] Validation failed: role="${s}" !== expected "${n.role}"`),!1;r.push("role")}if(n.ariaLabel){const s=e.getAttribute("aria-label")||"";if(!i(s,n.ariaLabel))return console.log(`[HybridTargetResolver] Validation failed: aria-label="${s}" !== expected "${n.ariaLabel}"`),!1;r.push("ariaLabel")}if(n.placeholder){const s=e.placeholder||"";if(!i(s,n.placeholder))return console.log(`[HybridTargetResolver] Validation failed: placeholder="${s}" !== expected "${n.placeholder}"`),!1;r.push("placeholder")}if(n.name){const s=e.getAttribute("name")||"";if(s!==n.name)return console.log(`[HybridTargetResolver] Validation failed: name="${s}" !== expected "${n.name}"`),!1;r.push("name")}if(n.labelText){const s=this.getAssociatedLabelText(e);if(!s||!i(s,n.labelText))return console.log(`[HybridTargetResolver] Validation failed: associated label="${s}" !== expected "${n.labelText}"`),!1;console.log(`[HybridTargetResolver] ✓ Label validation passed: "${s}" matches "${n.labelText}"`),r.push("labelText")}if(n.optionText){const s=((o=e.textContent)==null?void 0:o.trim())||"";if(!i(s,n.optionText))return console.log(`[HybridTargetResolver] Validation failed: option text="${s}" !== expected "${n.optionText}"`),!1;r.push("optionText")}return r.length>0&&console.log(`[HybridTargetResolver] ✓ Validated: ${r.join(", ")}`),!0}static getAssociatedLabelText(e){var s,a,l,c;const n=e.getAttribute("id");if(n)try{const d=document.querySelector(`label[for="${CSS.escape(n)}"]`);if(d)return((s=d.textContent)==null?void 0:s.trim().replace(/\*$/,"").trim())||null}catch{}const r=e.getAttribute("aria-labelledby");if(r){const d=r.split(/\s+/).filter(f=>f.length>0);for(const f of d){const h=document.getElementById(f);if(h)return((a=h.textContent)==null?void 0:a.trim().replace(/\*$/,"").trim())||null}}let i=e.parentElement,o=0;for(;i&&o<8;){const d=i.querySelectorAll('label, .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"], .label');for(const f of d){if(e.contains(f)||f.contains(e)||f.querySelector('input, select, textarea, [role="combobox"]'))continue;if(i.querySelectorAll('input, select, textarea, [role="combobox"]').length===1){const b=(l=f.textContent)==null?void 0:l.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}else if(this.isLabelForElement(f,e,i)){const b=(c=f.textContent)==null?void 0:c.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}}i=i.parentElement,o++}return null}static isLabelForElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect(),s=i.bottom<=o.top+30,a=i.right<=o.left+30&&Math.abs(i.top-o.top)<60;if(!s&&!a)return!1;const l=r.querySelectorAll('input, select, textarea, [role="combobox"]');if(l.length<=1)return!0;for(const c of l){if(c===n)continue;const d=c.getBoundingClientRect();if(s&&(d.top>=i.bottom-5&&d.bottom<o.top||Math.abs(d.left-i.left)<Math.abs(o.left-i.left)&&d.top<o.top))return!1;if(a){const f=Math.abs(d.left-i.right),h=Math.abs(o.left-i.right);if(f<h&&Math.abs(d.top-i.top)<40)return!1}}return!0}static isTextNearElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect();if(i.width===0||i.height===0||o.width===0||o.height===0)return(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;const s=i.bottom<=o.top+40,a=i.right<=o.left+20&&Math.abs(i.top-o.top)<50;if(!s&&!a)return!1;for(const l of r){if(l===n)continue;const c=l.getBoundingClientRect();if(!(c.width===0||c.height===0)){if(s&&c.top>=i.bottom-10&&c.bottom<o.top||s&&Math.abs(c.left-i.left)<Math.abs(o.left-i.left)-20&&c.top<o.top&&c.top>=i.bottom-50)return!1;if(a){const d=Math.abs(c.left-i.right),f=Math.abs(o.left-i.right);if(d<f-10&&Math.abs(c.top-i.top)<40)return!1}}}return!0}static isHiddenPlaceholderInput(e){const n=e.tagName.toLowerCase(),r=e.getAttribute("role");if(r==="option"||r==="menuitem"||r==="treeitem"||e.closest('[role="listbox"], [role="menu"], [role="tree"]')||n!=="input"&&!r)return!1;if(e.getAttribute("tabindex")==="-1"&&n==="input")return console.log('[HybridTargetResolver] → Input has tabindex="-1" (hidden placeholder)'),!0;try{const o=window.getComputedStyle(e);if(o.opacity==="0")return console.log("[HybridTargetResolver] → Element has opacity: 0 (hidden placeholder)"),!0;if(o.visibility==="hidden")return console.log("[HybridTargetResolver] → Element has visibility: hidden (hidden placeholder)"),!0;const s=e.getBoundingClientRect();if(s.width<=5&&s.height<=5)return console.log(`[HybridTargetResolver] → Element is too small (${s.width}x${s.height}) - hidden placeholder`),!0;if(o.position==="absolute"){const a=e.parentElement;if(a&&a.getBoundingClientRect().width>s.width*10&&s.width<20)return console.log("[HybridTargetResolver] → Element is tiny absolute-positioned (hidden placeholder)"),!0}}catch{}return!1}static getClickableContainer(e){var o,s;if(!this.isHiddenPlaceholderInput(e))return e;console.log("[HybridTargetResolver] → Looking for clickable container...");const n=['[class*="-control"]','[class*="control"]',".MuiSelect-select",".MuiInputBase-root",".MuiOutlinedInput-root",'[role="button"]','[role="combobox"]:not(input)','[aria-haspopup="listbox"]','[class*="select-container"]','[class*="dropdown-container"]','[class*="picker"]'];let r=e.parentElement,i=0;for(;r&&i<6;){for(const l of n)try{if(r.matches(l)){const c=r.getBoundingClientRect();if(c.width>50&&c.height>20)return console.log(`[HybridTargetResolver] → Found clickable container: ${r.tagName}.${(o=r.className)==null?void 0:o.split(" ").slice(0,2).join(".")}`),r}}catch{}const a=r.getBoundingClientRect();if(a.width>100&&a.height>30){const l=r.getAttribute("role"),c=r.onclick!==null||r.getAttribute("onclick")!==null||r.classList.contains("clickable");if(l==="button"||l==="combobox"||c||r.querySelector('input[role="combobox"]')===e)return console.log(`[HybridTargetResolver] → Found clickable container (generic): ${r.tagName}.${(s=r.className)==null?void 0:s.split(" ").slice(0,2).join(".")}`),r}r=r.parentElement,i++}return console.log("[HybridTargetResolver] → No clickable container found, using original element"),e}static findBySelector(e){if(!e)return null;const n=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\");console.log(`[HybridTargetResolver] → Normalized selector: "${n}"`);const r=n.match(/\[data-option-text="([^"]+)"\]/);if(r){const l=r[1];return console.log(`[HybridTargetResolver] → Virtual selector - searching for option text: "${l}"`),this.findDropdownOptionByText(l)}const i=n.match(/\[data-label="([^"]+)"\]/);if(i){const l=i[1];return console.log(`[HybridTargetResolver] → Virtual selector - searching for combobox with label: "${l}"`),this.findComboboxByLabel(l)}const o=n.replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim();if(/#?react-select-\d+-(input|listbox|option|placeholder|live-region)/.test(o))return console.log(`[HybridTargetResolver] → Detected unstable React-Select ID pattern in "${o}", skipping selector strategy`),null;if(o==='input[role="combobox"]'||o==='[role="combobox"]'){const l=document.querySelectorAll(o);l.length>1&&(console.warn(`[HybridTargetResolver] ⚠️ AMBIGUOUS SELECTOR: "${o}" matches ${l.length} elements!`),console.warn("[HybridTargetResolver] ⚠️ Bot should send more specific targeting (text, label, boundingBox, domIndex)"),l.forEach((c,d)=>{const f=c,h=f.getAttribute("placeholder")||"",b=f.getAttribute("aria-label")||"",y=f.id||"";console.log(`[HybridTargetResolver] ${d}: id="${y}" placeholder="${h}" aria-label="${b}"`)}))}const a=document.querySelector(o);return a?this.isAccessibilityOnlyElement(a)?(console.log(`[HybridTargetResolver] → Selector matched a11y-only element (class: ${a.className}), skipping`),null):a:(console.log(`[HybridTargetResolver] → Selector "${o}" matched 0 elements`),null)}static isAccessibilityOnlyElement(e){const n=typeof e.className=="string"?e.className:"",r=(e.textContent||"").trim();if(n.includes("a11yText")&&!r||n.includes("sr-only")||n.includes("visually-hidden")||n.includes("screenreader")||n.includes("screen-reader")||e.getAttribute("aria-live")&&!r||e.getAttribute("role")==="log"&&!r)return!0;try{const i=getComputedStyle(e);if(i.position==="absolute"&&(i.width==="1px"||i.height==="1px"||i.clip==="rect(0px, 0px, 0px, 0px)"||i.clipPath==="inset(50%)"))return!0}catch{}return!1}static isDropdownDisplayValue(e){var a;const n=(e.className||"").toLowerCase(),r=(((a=e.parentElement)==null?void 0:a.className)||"").toLowerCase(),i=["singlevalue","single-value","selectedvalue","selected-value","placeholder","value-container","valuecontainer","muiselect-select","select__single-value"];for(const l of i)if(n.includes(l)||r.includes(l))return!0;const o=e.closest('[class*="-control"]:not([class*="-menu"])'),s=!e.closest('[role="listbox"], [role="menu"], [class*="-menu"]');return!!(o&&s)}static findDropdownOptionByText(e){var o,s,a;const n=e.toLowerCase().trim(),r=['[role="listbox"]','[role="menu"]','[class*="-menu"]:not([aria-hidden="true"])','[class*="listbox"]','[class*="options-container"]',".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"],i=["singleValue","single-value","selectedValue","selected-value","placeholder","value-container","MuiSelect-select"];for(const l of r){let c;try{c=document.querySelectorAll(l)}catch{continue}for(const d of c){const f=d;if(!rr.isVisible(f)||f.getBoundingClientRect().height<20)continue;const b=d.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]):not([class*="placeholder"]), nz-option-item, .ant-select-item-option, .ant-select-item-option-content');for(const y of b){const m=y,S=m.className||"";if(i.some(k=>S.toLowerCase().includes(k.toLowerCase()))){console.log(`[HybridTargetResolver] → Skipping display value: "${(o=m.textContent)==null?void 0:o.trim().substring(0,30)}..."`);continue}if(!m.closest('[role="listbox"], [role="menu"], [class*="-menu"]'))continue;const w=((s=m.textContent)==null?void 0:s.trim().toLowerCase())||"";if(w===n||w.includes(n))return console.log(`[HybridTargetResolver] → Found ACTUAL option in open menu: "${(a=m.textContent)==null?void 0:a.trim()}"`),m}}}return console.log(`[HybridTargetResolver] → No option "${e}" found in any open dropdown menu`),console.log("[HybridTargetResolver] → The dropdown may need to be opened first"),null}static findMultiSelectChipRemoveButton(e){var i;const n=e.toLowerCase().trim();console.log(`[HybridTargetResolver] → Searching for multi-select chip: "${e}"`);const r=['[class*="multiValue"]','[class*="multi-value"]','[class*="chip"]','[class*="tag"]',"[data-tag]"];for(const o of r){let s;try{s=document.querySelectorAll(o)}catch{continue}for(const a of s){const l=a;if(!this.isVisible(l))continue;const c=l.querySelector('[class*="label"], [class*="Label"], span:first-of-type'),d=c?(c.textContent||"").trim().toLowerCase():(l.textContent||"").replace(/×|✕|x/gi,"").trim().toLowerCase();if(d===n||d.includes(n)||n.includes(d)){console.log(`[HybridTargetResolver] → Found chip with text: "${(i=l.textContent)==null?void 0:i.trim().substring(0,30)}..."`);const f=['[role="button"]','[class*="remove"]','[class*="Remove"]','[class*="clear"]','[class*="delete"]','[aria-label*="Remove"]','[aria-label*="remove"]','[aria-label*="Delete"]','[aria-label*="delete"]',"button","svg"];for(const h of f){const b=l.querySelector(h);if(b&&this.isVisible(b))return console.log(`[HybridTargetResolver] → Found remove button: <${b.tagName.toLowerCase()}> with selector "${h}"`),b}return console.log("[HybridTargetResolver] → No specific remove button found, returning chip container"),l}}}return console.log(`[HybridTargetResolver] → No chip found with text: "${e}"`),null}static findComboboxByLabel(e){const n=e.toLowerCase().trim(),r=a=>a.toLowerCase().trim().replace(/\*$/,"").trim()===n?!0:new RegExp(`(^|\\s)${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(a),i=document.querySelectorAll("label[for]");for(const a of i)if(r(a.textContent||"")){const l=a.getAttribute("for");if(l){const c=document.getElementById(l);if(c&&(c.getAttribute("role")==="combobox"||c.getAttribute("aria-haspopup")==="listbox"))return console.log(`[HybridTargetResolver] → Found combobox via label[for]: "${e}"`),c}}const o=document.querySelectorAll('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');for(const a of o){const l=a.getAttribute("aria-labelledby");if(l){const c=document.getElementById(l.split(/\s+/)[0]);if(c&&r(c.textContent||""))return console.log(`[HybridTargetResolver] → Found combobox via aria-labelledby: "${e}"`),a}}const s=document.querySelectorAll("label");for(const a of s)if(r(a.textContent||"")){const l=a.closest('fieldset, [role="group"], form > div, [class*="form"], [class*="field"]')||a.parentElement;if(l){const c=l.querySelector('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');if(c&&this.isElementVisible(c))return console.log(`[HybridTargetResolver] → Found combobox in label container: "${e}"`),c}}return null}static isElementVisible(e){const n=e.getBoundingClientRect();if(n.width===0||n.height===0)return!1;if(!e.offsetParent)try{const r=window.getComputedStyle(e);if(r.position!=="fixed"&&r.position!=="sticky")return!1}catch{return!1}return!0}static findElementByLabelText(e,n){var b,y,m;const i=n.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim(),o=i.toLowerCase().trim(),s=["*","div","span","p","a","li","ul","section","article"],a=/\[role=/.test(i);if(s.includes(o)&&!a)return null;let l;try{l=document.querySelectorAll(i)}catch{return console.warn(`[HybridTargetResolver] → Invalid selector: "${i}"`),null}if(l.length===0)return null;console.log(`[HybridTargetResolver] → Looking for "${i}" associated with label "${e}"`),console.log(`[HybridTargetResolver] → Found ${l.length} elements matching selector`);const c=e.toLowerCase().trim();function d(S){return S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const f=S=>S.toLowerCase().trim().replace(/\*$/,"").trim()===c?!0:new RegExp(`(^|\\s)${d(c)}($|\\s|[:\\*\\?\\.\\,\\)\\]\\}\\-])`,"i").test(S),h=S=>{const v=S,w=v.getBoundingClientRect();if(w.width===0||w.height===0)return!1;if(!v.offsetParent)try{const C=window.getComputedStyle(v).position;if(C!=="fixed"&&C!=="sticky")return!1}catch{return!1}return!0};for(const S of l){if(!h(S))continue;const v=S.getAttribute("id");if(v)try{const P=document.querySelector(`label[for="${CSS.escape(v)}"]`);if(P&&f(P.textContent||""))return console.log("[HybridTargetResolver] → Found via label[for] attribute"),S}catch{}const w=S.getAttribute("aria-labelledby");if(w){const P=w.split(/\s+/).filter($=>$.length>0);for(const $ of P){const X=document.getElementById($);if(X&&f(X.textContent||""))return console.log("[HybridTargetResolver] → Found via aria-labelledby"),S}}const k=S.getAttribute("aria-label")||"";if(k&&f(k))return console.log("[HybridTargetResolver] → Found via aria-label"),S;const C=S.getAttribute("placeholder")||"";if(C&&f(C))return console.log("[HybridTargetResolver] → Found via placeholder"),S;let T=S.parentElement,O=0;for(;T&&O<6;){const P=T.querySelectorAll('input, select, textarea, [role="combobox"], [role="listbox"]'),$=Array.from(P),X=$.includes(S),V=T.classList.contains("MuiFormControl-root")||T.tagName==="FIELDSET"||/form(-|_)?(field|group|control|item|row)/i.test(T.className)||T.childElementCount>=2&&T.childElementCount<=5,B=T.querySelectorAll('label, [class*="label"]:not(input):not(select):not(textarea):not([role="combobox"]), .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"]');for(const W of B){if(S.contains(W)||W.contains(S)||W.querySelector('input, select, textarea, [role="combobox"]'))continue;const K=((b=W.textContent)==null?void 0:b.trim())||"";if(!(K.length>50)&&f(K)){if(P.length===1&&X)return console.log(`[HybridTargetResolver] → Found via label in container: "${K}"`),S;if(X&&this.isTextNearElement(W,S,$))return console.log(`[HybridTargetResolver] → Found via label position: "${K}"`),S}}if(V||O>=3){const W=T.querySelectorAll(":scope > div, :scope > span, :scope > p, :scope > div > div, :scope > div > span, :scope > div > p");for(const K of W){if(K.querySelector('input, select, textarea, [role="combobox"]')||K.contains(S)||S.contains(K))continue;const se=S.value||"";if(se&&((y=K.textContent)==null?void 0:y.trim())===se)continue;const J=((m=K.textContent)==null?void 0:m.trim())||"";if(J.length>0&&J.length<=30&&f(J)){if(P.length===1&&X)return console.log(`[HybridTargetResolver] → Found via nearby text: "${J}"`),S;if(X&&this.isTextNearElement(K,S,$))return console.log(`[HybridTargetResolver] → Found via nearby text (position): "${J}"`),S}}}T=T.parentElement,O++}}return null}static escapeXPathString(e){const n=e.replace(/[\n\r\t]+/g," ").replace(/\s+/g," ").trim();if(n.includes('"')&&n.includes("'")){const r=n.split('"');return`concat(${r.map((o,s)=>s===r.length-1?`"${o}"`:`"${o}", '"'`).join(", ")})`}return n.includes('"')?`'${n}'`:`"${n}"`}static escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}static findByText(e,n,r){var C,T,O,P,$,X,V;if(!e)return null;const i=e.trim();if(!i)return null;const o=i.toLowerCase(),s=n||"*",a=this.escapeXPathString(i);if(r){const B=this.findElementByLabelText(i,r);if(B)return console.log(`[HybridTargetResolver] → Found element matching selector "${r}" associated with label "${i}"`),B}const l=`//${s}[normalize-space(.)=${a}]`;console.log(`[HybridTargetResolver] → XPath exact query: ${l}`);let c;try{c=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(B){console.warn("[HybridTargetResolver] → XPath query failed:",B),c={snapshotLength:0,snapshotItem:()=>null}}if(c.snapshotLength>0){console.log(`[HybridTargetResolver] → Found ${c.snapshotLength} exact match(es), checking visibility...`);let B=null,W=null;for(let K=0;K<c.snapshotLength;K++){const se=c.snapshotItem(K);if(W||(W=se),this.isDropdownDisplayValue(se)){console.log(`[HybridTargetResolver] → Skipping display value (not an option): "${(C=se.textContent)==null?void 0:C.trim().substring(0,30)}..."`);continue}const J=se.getBoundingClientRect();if(J.width>0&&J.height>0){B=se,console.log(`[HybridTargetResolver] → Returning visible match ${K}: "${(T=se.textContent)==null?void 0:T.trim().substring(0,30)}..."`);break}}if(B)return B;if(W&&!this.isDropdownDisplayValue(W))return console.log("[HybridTargetResolver] → No visible matches, returning first (possibly hidden) element"),W}console.log("[HybridTargetResolver] → No exact match, trying partial match...");const d=`//${s}[contains(normalize-space(.), ${a})]`;console.log(`[HybridTargetResolver] → XPath partial query: ${d}`);let f;try{f=document.evaluate(d,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(B){console.warn("[HybridTargetResolver] → XPath partial query failed:",B),f={snapshotLength:0,snapshotItem:()=>null}}if(f.snapshotLength>0){let B=null,W=-1;const K=r?this.extractSelectorContext(r):{},se=!!(K.parentTag||K.parentSelector);console.log(`[HybridTargetResolver] → Selector context: parentTag="${K.parentTag||"none"}", expectedTag="${K.expectedTag||"none"}"`);for(let J=0;J<f.snapshotLength;J++){const G=f.snapshotItem(J),ne=(G.textContent||"").trim();if(ne.length===0)continue;const F=ne.toLowerCase(),z=o.length/F.length,q=G.getBoundingClientRect();if(q.width===0||q.height===0||this.isDropdownDisplayValue(G))continue;let re=z;if(new RegExp(`\\b${rr.escapeRegex(o)}\\b`,"i").test(F))re+=.5;else if(z<.5)if(se){if(this.matchesSelectorContext(G,K)<.5){console.log(`[HybridTargetResolver] → Skipping low ratio match that doesn't match selector context: "${ne.slice(0,30)}..."`);continue}}else{console.log(`[HybridTargetResolver] → Skipping low ratio match (${z.toFixed(2)}): "${ne.slice(0,30)}..."`);continue}if(se){const g=this.matchesSelectorContext(G,K);re+=g*.3}re>W&&(W=re,B=G)}if(B)return console.log(`[HybridTargetResolver] → XPath partial match found (score=${W.toFixed(2)})!`),B}console.log("[HybridTargetResolver] → XPath found nothing, trying fallback...");const h=document.querySelectorAll(n||"*");console.log(`[HybridTargetResolver] → Fallback: checking ${h.length} <${n||"*"}> elements for text "${i}"`);const b=B=>{const W=B;return xt(W)?!0:W.id==="root"||W.id==="app"||W.id==="__next"||W.tagName==="BODY"||W.tagName==="HTML"};for(const B of h){if(b(B)||(((O=B.textContent)==null?void 0:O.trim().toLowerCase())||"")!==o)continue;const K=B.getBoundingClientRect();if(K.width>0&&K.height>0&&(((P=B.innerText)==null?void 0:P.trim().toLowerCase())||"")===o)return console.log("[HybridTargetResolver] → Found via exact text match"),B}let y=null,m=-1/0;for(const B of h){if(b(B))continue;const W=(($=B.textContent)==null?void 0:$.trim().toLowerCase())||"";if(W.length!==0&&W.includes(o)){const K=o.length/W.length,se=B.getBoundingClientRect(),J=se.width*se.height;if(J>0&&J<5e5){const G=Math.max(0,50-J/1e4),ne=K*50,F=G+ne;F>m&&(m=F,y=B)}}}if(y){const B=y.getBoundingClientRect();return console.log(`[HybridTargetResolver] → Found via textContent (${B.width.toFixed(0)}x${B.height.toFixed(0)}px, score=${m.toFixed(0)})`),y}const S=n&&["input","textarea"].includes(n.toLowerCase())?n.toLowerCase():"input, textarea",v=document.querySelectorAll(S);console.log(`[HybridTargetResolver] → Checking ${v.length} input/textarea elements for placeholder "${i}"`);for(const B of v){const W=B;if(xt(W))continue;const K=((X=W.getAttribute("placeholder"))==null?void 0:X.trim())||"";if(K.toLowerCase()===o){const se=W.getBoundingClientRect();if(se.width>0&&se.height>0)return console.log(`[HybridTargetResolver] → Found via placeholder match: "${K}"`),W}}let w=null,k=0;for(const B of v){const W=B;if(xt(W))continue;const K=((V=W.getAttribute("placeholder"))==null?void 0:V.trim().toLowerCase())||"";if(K&&K.includes(o)){const se=o.length/K.length;if(se>.6&&se>k){const J=W.getBoundingClientRect();J.width>0&&J.height>0&&(w=W,k=se)}}}return w?(console.log(`[HybridTargetResolver] → Found via partial placeholder match (ratio=${k.toFixed(2)})`),w):null}static findByAriaLabel(e){if(!e)return null;let n=document.querySelector(`[aria-label="${e}"]`);if(n)return console.log("[HybridTargetResolver] → Found via exact aria-label match"),n;const r=document.querySelectorAll("[aria-label]");console.log(`[HybridTargetResolver] → Checking ${r.length} elements with aria-label`);for(const i of r){const o=i.getAttribute("aria-label")||"";if(o.toLowerCase().includes(e.toLowerCase()))return console.log(`[HybridTargetResolver] → Found via partial aria-label match: "${o}"`),i}return null}static findByPlaceholder(e){if(!e)return null;let n=document.querySelector(`[placeholder="${e}"]`);if(n)return console.log("[HybridTargetResolver] → Found via exact placeholder match"),n;const r=document.querySelectorAll("input, textarea");console.log(`[HybridTargetResolver] → Checking ${r.length} input/textarea elements`);for(const i of r){const o=i.getAttribute("placeholder")||"";if(o.toLowerCase().includes(e.toLowerCase()))return console.log(`[HybridTargetResolver] → Found via partial placeholder match: "${o}"`),i}return null}static findByRole(e,n){var i;if(!e)return null;const r=document.querySelectorAll(`[role="${e}"]`);if(console.log(`[HybridTargetResolver] → Found ${r.length} elements with role="${e}"`),n){for(const o of r)if((((i=o.textContent)==null?void 0:i.trim())||"").toLowerCase().includes(n.toLowerCase()))return console.log("[HybridTargetResolver] → Found role element with matching text"),o}return r[0]||null}static findByTag(e,n){var i,o,s;if(!e)return null;const r=document.getElementsByTagName(e);if(console.log(`[HybridTargetResolver] → Found ${r.length} <${e}> elements`),n){const a=n.toLowerCase().trim();let l=null,c=null,d=0;for(const f of r){const h=f;if(h.id==="root"||h.id==="app"||h.tagName==="BODY"||h.tagName==="HTML"||!rr.isVisible(h)||(((i=h.innerText)==null?void 0:i.length)||0)>200)continue;const y=((o=h.innerText)==null?void 0:o.trim())||"",m=y.toLowerCase();if(m===a){console.log(`[HybridTargetResolver] → Found exact match: "${y.substring(0,50)}..."`),l=h;break}if(m.includes(a)){const S=a.length/m.length;S>.7&&S>d&&(c=h,d=S)}}if(l)return l;if(c){const f=((s=c.innerText)==null?void 0:s.trim().substring(0,50))||"";return console.log(`[HybridTargetResolver] → Found close match (${(d*100).toFixed(0)}%): "${f}..."`),c}return console.log(`[HybridTargetResolver] → No matching <${e}> found for text "${n}"`),null}if(e==="div"||e==="span")return console.log(`[HybridTargetResolver] → REFUSING to blindly return first <${e}> - too ambiguous without text`),null;for(const a of r){const l=a;if(l.id==="root"||l.id==="app"||l.tagName==="BODY"||l.tagName==="HTML"||l.classList.contains("App"))continue;const c=l.getBoundingClientRect();if(!(c.width>500&&c.height>500)&&c.width>0&&c.height>0)return l}return null}static isVisible(e){const n=e.getBoundingClientRect(),r=window.getComputedStyle(e);return n.width>0&&n.height>0&&r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}static scrollIntoView(e,n){console.log("[HybridTargetResolver] 📜 Scrolling element into view"),e.scrollIntoView({behavior:"smooth",block:"center",...n})}static async waitForPositionStability(e,n=1e3,r=50,i=2){console.log("[HybridTargetResolver] ⏳ Waiting for element position stability...");let o=e.getBoundingClientRect(),s=0;const a=3,l=Date.now();for(;Date.now()-l<n;){await new Promise(h=>setTimeout(h,r));const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return console.warn("[HybridTargetResolver] ⚠️ Element disappeared during stability check"),null;const d=Math.abs(c.x-o.x),f=Math.abs(c.y-o.y);if(d<i&&f<i){if(s++,s>=a)return console.log(`[HybridTargetResolver] ✅ Element position stable at (${c.x.toFixed(0)}, ${c.y.toFixed(0)}) after ${Date.now()-l}ms`),c}else s=0,console.log(`[HybridTargetResolver] 📍 Element still moving: (${o.x.toFixed(0)}, ${o.y.toFixed(0)}) → (${c.x.toFixed(0)}, ${c.y.toFixed(0)})`);o=c}return console.warn(`[HybridTargetResolver] ⚠️ Position stability timeout after ${n}ms`),e.getBoundingClientRect()}static reResolveAndVerify(e,n){var a,l,c;const r={text:e.text,selector:e.selector,selectorFallbacks:e.selectorFallbacks,tag:e.tag,ariaLabel:e.ariaLabel,placeholder:e.placeholder,role:e.role,labelText:e.labelText,optionText:e.optionText,name:e.name,removeChipText:e.removeChipText,dropdownTriggerSelector:e.dropdownTriggerSelector,selectedValues:e.selectedValues,strategy:(a=e.strategy)==null?void 0:a.filter(d=>d!=="boundingBox"&&d!=="domIndex")};console.log("[HybridTargetResolver] 🔄 Re-resolving with position-independent target (no boundingBox/domIndex)");const i=this.resolveTarget(r);if(!i)return console.warn("[HybridTargetResolver] ⚠️ Re-resolution failed - element no longer found"),null;const o=((l=n.textContent)==null?void 0:l.trim().toLowerCase())||"",s=((c=i.textContent)==null?void 0:c.trim().toLowerCase())||"";return o!==s&&o&&s&&console.warn(`[HybridTargetResolver] ⚠️ Element changed during wait: "${o}" → "${s}"`),i}};D(rr,"domIntrospector",null);let Se=rr;class Lx{constructor(){D(this,"confirmationSound");D(this,"lastError",null);this.confirmationSound=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=")}humanLikeClick(e,n={}){return uy(e,n)}async executeWithConsent(e,n=!0){try{if(n&&this.isDestructive(e)&&!await this.getConsent(e))return!1;const r=await this.execute(e);return r&&(this.confirmationSound.play().catch(()=>{}),console.log(`[ActionExecutor] Executed ${e.type} on ${e.selector}`)),r}catch(r){return console.error("[ActionExecutor] Failed to execute action:",r),!1}}async executeHybridAction(e,n=!0){this.lastError=null;try{if(console.log("[ActionExecutor] Executing hybrid action:",e),e.target.optionText&&e.action==="click"){console.log("[ActionExecutor] 🔽 Dropdown option click detected:",e.target.optionText);let s=Se.resolveTarget(e.target);if(!s){console.log("[ActionExecutor] Option not visible - dropdown may be closed, attempting to open...");let a=!1;if(e.target.dropdownTriggerSelector){console.log("[ActionExecutor] Using dropdownTriggerSelector:",e.target.dropdownTriggerSelector);const l=cy(e.target.dropdownTriggerSelector);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.labelText){console.log("[ActionExecutor] Trying to find dropdown by label:",e.target.labelText);const l=this.findComboboxByLabel(e.target.labelText);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.selector){console.log("[ActionExecutor] Trying to find dropdown by selector:",e.target.selector);const l={...e.target,optionText:void 0},c=Se.resolveTarget(l);if(c){const d=this.findComboboxInput(c);d&&(this.handleComboboxClick(d),a=!0)}}if(a){if(console.log("[ActionExecutor] Waiting for dropdown to open..."),await new Promise(l=>setTimeout(l,300)),s=Se.resolveTarget(e.target),!s)return console.warn("[ActionExecutor] ❌ Option still not found after opening dropdown:",e.target.optionText),!1;console.log("[ActionExecutor] ✅ Found option after opening dropdown")}else return console.warn("[ActionExecutor] ❌ Could not open dropdown - no trigger found. Add a separate task to open the dropdown first."),!1}return n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e)?!1:(Se.scrollIntoView(s),await new Promise(a=>setTimeout(a,100)),this.performClick(s),this.confirmationSound.play().catch(()=>{}),console.log(`[ActionExecutor] ✅ Successfully clicked dropdown option: "${e.target.optionText}"`),!0)}const r=Se.resolveTarget(e.target);if(!r)return console.warn("[ActionExecutor] Could not resolve target:",e.target),!1;if(n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e))return!1;const i=e.target.selector,o=await this.executeOnElement(e.action,r,e.value,i);return o&&(this.confirmationSound.play().catch(()=>{}),console.log(`[ActionExecutor] Successfully executed "${e.action}" on element`)),o}catch(r){return console.error("[ActionExecutor] Failed to execute hybrid action:",r),this.lastError=r instanceof Error?r.message:String(r),!1}}async executeOnElement(e,n,r,i){switch(Se.scrollIntoView(n),await new Promise(o=>setTimeout(o,300)),e){case"click":await this.expandCollapsedContainer(n),this.simulateClick(n,i);break;case"type":n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?(n.focus(),n.value=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))):(n.focus(),n.textContent=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})));break;case"focus":n.focus();break;case"hover":n.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),n.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":n.scrollIntoView({behavior:"smooth",block:"center"});break;case"highlight":n.style.outline="3px solid #00aaff",n.style.outlineOffset="2px";break;default:return console.warn("[ActionExecutor] Unknown action type:",e),!1}return!0}async expandCollapsedContainer(e){const n=this.findCollapsedContainer(e);if(n){console.log("[ActionExecutor] Found collapsed container, hovering to expand...");const r=n.getBoundingClientRect(),i=r.left+r.width/2,o=r.top+r.height/2,s={bubbles:!0,cancelable:!0,view:window,clientX:i,clientY:o};n.dispatchEvent(new MouseEvent("mouseenter",s)),n.dispatchEvent(new MouseEvent("mouseover",s));const a=e.getBoundingClientRect(),l={bubbles:!0,cancelable:!0,view:window,clientX:a.left+a.width/2,clientY:a.top+a.height/2};e.dispatchEvent(new MouseEvent("mouseenter",l)),e.dispatchEvent(new MouseEvent("mouseover",l)),await new Promise(c=>setTimeout(c,400)),console.log("[ActionExecutor] Container expanded, proceeding with click")}}findCollapsedContainer(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=window.getComputedStyle(n),i=n.getBoundingClientRect().width,o=r.transition.includes("width")||r.transitionProperty.includes("width")||r.transitionProperty==="all",s=i<80,a=n.offsetHeight>window.innerHeight*.7,l=typeof n.className=="string"?n.className:"",c=l.includes("sidebar")||l.includes("nav")||l.includes("menu");if(s&&(o||c)&&a)return console.log("[ActionExecutor] Detected collapsed container:",{width:i,hasTransition:o,isFullHeight:a,classes:n.className.substring(0,100)}),n;n=n.parentElement}return null}simulateClick(e,n){if(n){const d=this.parseOptionTextFromSelector(n);if(d){console.log("[ActionExecutor] 🎯 Detected dropdown option selector, searching for:",d);const h=this.findDropdownOption(d);if(h){console.log("[ActionExecutor] Found option by text, clicking it"),this.performClick(h);return}console.log("[ActionExecutor] Option not found by text, trying direct click")}const f=this.parseLabelFromSelector(n);if(f){console.log("[ActionExecutor] 🎯 Detected labeled combobox selector:",f);const h=this.findComboboxByLabel(f);if(h){console.log("[ActionExecutor] Found combobox by label, opening it"),this.handleComboboxClick(h);return}console.log("[ActionExecutor] Combobox not found by label, trying direct match")}}const r=this.findComboboxInput(e);if(r){console.log("[ActionExecutor] 🎯 Detected combobox/dropdown - using special handling"),this.handleComboboxClick(r);return}if(this.isDropdownOption(e)){console.log("[ActionExecutor] 🎯 Element is dropdown option - using React onClick + DOM events");const d=this.triggerReactOnClick(e);console.log(`[ActionExecutor] React onClick triggered: ${d}`),this.performClick(e);return}const i=this.findClickableElement(e),o=i.getBoundingClientRect(),s=o.left+o.width/2,a=o.top+o.height/2;if(i.focus&&i.focus(),this.hasReactOnClickHandler(i)){if(console.log("[ActionExecutor] 🎯 Element has React onClick - using direct call only"),this.triggerReactOnClick(i)){this.sendClickMetadata(i,e),console.log("[ActionExecutor] ✅ React onClick executed at",s,a,"on",i.tagName),i!==e&&console.log("[ActionExecutor] Note: Clicked parent",i.tagName,"instead of",e.tagName);return}console.log("[ActionExecutor] ⚠️ React onClick found but call failed, falling back to DOM events")}console.log("[ActionExecutor] Using humanLikeClick (no React onClick or fallback)");const c=this.humanLikeClick(i,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});c!==e&&c!==i&&console.log("[ActionExecutor] Note: humanLikeClick hit",c.tagName,"instead of element",e.tagName,"or clickTarget",i.tagName)}findComboboxInput(e){if(e.getAttribute("role")==="combobox")return console.log("[ActionExecutor] Element is combobox"),e;if(e.getAttribute("aria-haspopup")==="listbox"||e.getAttribute("aria-haspopup")==="true"){const o=e.querySelector('input[role="combobox"]');if(o)return console.log("[ActionExecutor] Found combobox via aria-haspopup container"),o;if(e.tagName==="BUTTON")return console.log("[ActionExecutor] Element is button with aria-haspopup"),e}let n=e,r=0;const i=5;for(;n&&r<i;){const o=typeof n.className=="string"?n.className:"",s=o.includes("css-")&&o.includes("control"),a=o.includes("css-")&&o.includes("ValueContainer"),l=o.includes("css-")&&o.includes("Indicator"),c=o.includes("MuiSelect-select")||o.includes("MuiAutocomplete-inputRoot"),d=(o.includes("headlessui")||o.includes("radix"))&&(o.includes("trigger")||o.includes("button"));if(s||a||l||c||d||o.includes("control")&&n.querySelector('input[role="combobox"]')||o.includes("trigger")&&n.getAttribute("aria-haspopup")){const h=n.querySelector('input[role="combobox"]');if(h)return console.log("[ActionExecutor] Found combobox input via control element"),h;const b=n.parentElement;if(b){const m=b.querySelector('input[role="combobox"]');if(m)return console.log("[ActionExecutor] Found combobox input in parent container"),m}const y=n.querySelector('button[aria-haspopup="listbox"]');if(y)return console.log("[ActionExecutor] Found listbox trigger button"),y}n=n.parentElement,r++}return null}parseOptionTextFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-option-text="([^"]+)"\]/);return r?r[1]:null}parseLabelFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-label="([^"]+)"\]/);return r?r[1]:null}stripVirtualAttributes(e){return e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim()}findComboboxByLabel(e){var r;const n=document.querySelectorAll("label");for(const i of n){const o=(r=i.textContent)==null?void 0:r.trim().replace(/\*$/,"").trim();if(o===e||o!=null&&o.includes(e)){const s=i.closest('div[class*="container"], div[aria-label], .MuiFormControl-root, form > div');if(s){const a=s.querySelector('input[role="combobox"], button[aria-haspopup="listbox"]');if(a)return console.log("[ActionExecutor] Found combobox by label:",e),a}}}return null}handleComboboxClick(e){console.log("[ActionExecutor] Opening combobox/dropdown with humanLikeClick");const r=e.closest('[class*="control"]')||e.closest('[class*="trigger"]')||e.closest("[aria-haspopup]")||e.parentElement||e,i=this.humanLikeClick(r,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});e.dispatchEvent(new FocusEvent("focus",{bubbles:!0})),e instanceof HTMLInputElement&&e.dispatchEvent(new Event("input",{bubbles:!0})),console.log("[ActionExecutor] ✅ Combobox/dropdown humanLikeClick complete, actual element:",i.tagName)}openDropdown(e){this.handleComboboxClick(e)}triggerReactOnClickPublic(e){return this.triggerReactOnClick(e)}findDropdownOption(e){var r;const n=['[role="listbox"]','[role="menu"]','[class*="menu"]:not([aria-hidden])','[class*="listbox"]','[class*="options"]',"[data-radix-popper-content-wrapper]",".MuiMenu-list",".MuiAutocomplete-listbox",".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"];for(const i of n){const o=document.querySelectorAll(i);for(const s of o){if(!Se.isVisible(s))continue;const a=['[role="option"]','[class*="option"]','[class*="item"]',"nz-option-item",".ant-select-item-option",".ant-select-item-option-content","li"];for(const l of a){const c=s.querySelectorAll(l);for(const d of c){const f=(r=d.textContent)==null?void 0:r.trim();if(f===e||f!=null&&f.includes(e))return console.log("[ActionExecutor] Found dropdown option:",f),d}}}}return null}isDropdownOption(e){if(e.getAttribute("role")==="option")return!0;const n=typeof e.className=="string"?e.className:"";return n.includes("option")||n.includes("item")?e.closest('[role="listbox"], [role="menu"], [class*="menu"], [class*="listbox"]')!==null:!1}performClick(e){this.humanLikeClick(e,{focus:!0,includePointerEvents:!0,nativeClickFallback:!0})}hasReactOnClickHandler(e){const n=["__reactProps","__reactFiber","__reactEventHandlers"];try{const o=Object.keys(e);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=e[s];if(a!=null&&a.onClick)return!0}}catch{}let r=e.parentElement,i=0;for(;r&&i<5;){try{const o=Object.keys(r);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=r[s];if(a!=null&&a.onClick)return!0}}catch{}r=r.parentElement,i++}return!1}findClickableElement(e){var a;const n=["SPAN","LABEL","P","H1","H2","H3","H4","H5","H6","TEXT","SVG","PATH"],r=l=>l.className?typeof l.className=="string"?l.className:typeof l.className.baseVal=="string"?l.className.baseVal:"":"";if(console.log("[ActionExecutor] Finding clickable element for:",e.tagName,r(e).substring(0,50)),!n.includes(e.tagName))return console.log("[ActionExecutor] Element is already interactive"),e;let i=e.parentElement,o=e,s=0;for(;i&&i!==document.body&&s<10;){s++;const l=window.getComputedStyle(i),c=l.cursor==="pointer",d=r(i),f=d.includes("cursor-pointer"),h=(a=i.classList)==null?void 0:a.contains("cursor-pointer"),b=i.hasAttribute("onclick")||i.hasAttribute("data-onclick")||i.getAttribute("role")==="button"||i.getAttribute("role")==="menuitem",y=i.tagName==="BUTTON"||i.tagName==="A";if(console.log(`[ActionExecutor] Checking parent #${s}:`,i.tagName,"cursor:",l.cursor,"hasCursorClass:",f||h,"classes:",d.substring(0,60)),(c||f||h||b||y)&&(o=i,console.log("[ActionExecutor] ✅ Found clickable parent:",i.tagName,d.substring(0,80)),y||i.getAttribute("role")==="button"))break;i=i.parentElement}return console.log("[ActionExecutor] Final click target:",o.tagName,r(o).substring(0,60)),o}triggerReactOnClick(e){try{const n=Object.keys(e);for(const s of n)if(s.startsWith("__reactFiber")||s.startsWith("__reactProps")||s.startsWith("__reactEventHandlers")){const a=e[s];if(console.log("[ActionExecutor] Found React property:",s),a!=null&&a.onClick){console.log("[ActionExecutor] 🎯 Calling React onClick directly!");const l=new MouseEvent("click",{bubbles:!0,cancelable:!0}),c={type:"click",target:e,currentTarget:e,nativeEvent:l,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{c.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>c.defaultPrevented,isPropagationStopped:()=>!1};return a.onClick(c),!0}}const r=["__reactProps","__reactFiber","__reactEventHandlers"];let i=e.parentElement,o=0;for(;i&&o<5;){const s=Object.keys(i);for(const a of s)if(r.some(l=>a.startsWith(l))){const l=i[a];if(l!=null&&l.onClick){console.log("[ActionExecutor] 🎯 Found onClick on parent, calling directly!");const c=new MouseEvent("click",{bubbles:!0,cancelable:!0}),d={type:"click",target:e,currentTarget:i,nativeEvent:c,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{d.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>d.defaultPrevented,isPropagationStopped:()=>!1};return l.onClick(d),!0}}i=i.parentElement,o++}return console.log("[ActionExecutor] No React onClick handler found"),!1}catch(n){return console.log("[ActionExecutor] Error accessing React internals:",n),!1}}sendClickMetadata(e,n){const r=d=>d.className?typeof d.className=="string"?d.className:typeof d.className.baseVal=="string"?d.className.baseVal:"":"",i=[];let o=e;for(;o&&o!==document.body&&i.length<5;){let d=o.tagName.toLowerCase();if(o.id)d=`#${o.id}`;else{const f=r(o);if(f){const h=f.trim().split(/\s+/).slice(0,3).join(".");h&&(d+="."+h)}}i.unshift(d),o=o.parentElement}const s=d=>{var b;const f=d.querySelector("span, label, p");if((b=f==null?void 0:f.textContent)!=null&&b.trim())return f.textContent.trim().substring(0,50);let h="";for(const y of Array.from(d.childNodes))y.nodeType===Node.TEXT_NODE&&(h+=(y.textContent||"").trim()+" ");return h=h.trim(),!h&&d.textContent&&(h=d.textContent.trim().substring(0,50)),h},a=window.__onboardingSDK,l=(a==null?void 0:a._botActionDepth)>0,c={type:"click",selector:i.join(" > "),text:s(n),tagName:e.tagName.toLowerCase(),timestamp:Date.now(),source:l?"bot":"user",sourceDetail:"react_onclick"};console.log("[ActionExecutor] 📤 Sending React onClick metadata:",c.text,`(source: ${c.source})`),a!=null&&a.sendMetadata?a.sendMetadata(c):console.warn("[ActionExecutor] ⚠️ SDK not found on window, cannot send metadata")}isDestructive(e){const n=["submit","delete","remove","clear"],r=['[type="submit"]',".delete",".remove"];return n.some(i=>{var o;return(o=e.description)==null?void 0:o.toLowerCase().includes(i)})||r.some(i=>e.selector.includes(i))}isHybridActionDestructive(e){var o,s;const n=["submit","delete","remove","clear","confirm","proceed"],r=((o=e.description)==null?void 0:o.toLowerCase())||"",i=((s=e.target.text)==null?void 0:s.toLowerCase())||"";return n.some(a=>r.includes(a)||i.includes(a))}async getConsent(e){const n=`Allow action: ${e.description||e.type} on ${e.selector}?`;return confirm(n)}async getHybridConsent(e){const n=e.target.text||e.target.selector||"element",r=`Allow "${e.action}" on "${n}"?
|
|
478
|
-
${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){const i=this.parseOptionTextFromSelector(e.selector);if(i){console.log("[ActionExecutor] Virtual selector detected - finding option by text:",i);const s=this.findDropdownOption(i);return s?(this.performClick(s),!0):(console.warn("[ActionExecutor] Option not found by text:",i),!1)}const o=this.parseLabelFromSelector(e.selector);if(o){console.log("[ActionExecutor] Virtual selector detected - finding combobox by label:",o);const s=this.findComboboxByLabel(o);return s?(this.handleComboboxClick(s),!0):(console.warn("[ActionExecutor] Combobox not found by label:",o),!1)}}const n=this.stripVirtualAttributes(e.selector),r=document.querySelector(n);if(!r)return console.warn("[ActionExecutor] Element not found:",n),!1;switch(e.type){case"click":this.simulateClick(r,e.selector);break;case"type":(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&(r.focus(),r.value=e.value||"",r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"select":const i=this.findComboboxInput(r);if(i){if(this.handleComboboxClick(i),await new Promise(o=>setTimeout(o,200)),e.value){const o=this.findDropdownOption(e.value);o&&this.performClick(o)}}else r instanceof HTMLSelectElement&&(r.value=e.value||"",r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"hover":r.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),r.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":r.scrollIntoView({behavior:"smooth",block:"center"});break;default:return console.warn("[ActionExecutor] Unknown action type:",e.type),!1}return!0}}class Ix{constructor(){
|
|
472
|
+
`.replace(/\s+/g," ").trim()),P(_t,"SKIP_SELECTORS",["#onboarding-overlay","#onboarding-sdk-react-ui","#hse-highlight-element","script","style","noscript","template"]);let md=_t;const Ax=["#onboarding-overlay","#floe-cursor","#onboarding-sdk-react-ui","#hse-highlight-element","#floe-cursor-styles","#onboarding-animations"],Ai="data-floe-widget";function xt(t){if(!t)return!1;if(t.hasAttribute(Ai))return!0;for(const e of Ax)if(t.closest(e))return!0;return!1}function En(){return window.location.origin+window.location.pathname}function za(t){try{const e=new URL(t,window.location.origin);return e.origin+e.pathname}catch{return t}}function cy(t){return t&&t.replace(/\.ng-(untouched|touched|pristine|dirty|valid|invalid)/g,"")}function uy(t){try{const n=document.querySelector(t);if(n)return n}catch{}const e=cy(t);if(e!==t)try{const n=document.querySelector(e);if(n)return console.log(`[AngularFallback] Selector matched after stripping state classes: "${e}"`),n}catch{}return null}function Ox(t){let e=t,n=0;for(;e&&n<5;){const r=e.getAttribute("role");if(r==="dialog"||r==="alertdialog"||e.getAttribute("aria-modal")==="true"||e.tagName==="DIALOG")return!0;const i=e.tagName.toLowerCase();if(i.includes("modal")||i.includes("dialog"))return!0;const o=typeof e.className=="string"?e.className.toLowerCase():"";if(o.includes("modal")||o.includes("dialog")||o.includes("cdk-overlay"))return!0;e=e.parentElement,n++}return!1}function dy(t,e={}){var h,b,y,g,S;const{focus:n=!0,includePointerEvents:r=!0,nativeClickFallback:i=!1,includeMouseEnter:o=!1}=e,s=t.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c=document.elementFromPoint(a,l);let d;if(c&&(c===t||t.contains(c)||c.contains(t)))d=c,d!==t&&console.log("[humanLikeClick] 🎯 Using element at point:",d.tagName,"instead of target:",t.tagName);else if(c){if(console.warn("[humanLikeClick] ⚠️ Element at point is unrelated:",c.tagName,(h=c.className)==null?void 0:h.toString().slice(0,50)),console.warn("[humanLikeClick] Expected target:",t.tagName,(b=t.className)==null?void 0:b.toString().slice(0,50)),Ox(c)){const v=`${c.tagName} (${(y=c.className)==null?void 0:y.toString().slice(0,80)})`;throw console.error("[humanLikeClick] ❌ BLOCKED: Modal/dialog overlay is covering the target element.",`Overlay: ${v}`,`Target: ${t.tagName} "${(g=t.textContent)==null?void 0:g.trim().slice(0,50)}"`),new Error(`Click blocked by modal overlay: ${v}. Target "${(S=t.textContent)==null?void 0:S.trim().slice(0,50)}" is behind the modal. Interact with the modal instead.`)}d=t}else console.warn("[humanLikeClick] ⚠️ No element at coordinates, falling back to target"),d=t;n&&typeof d.focus=="function"&&d.focus();const f={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l,screenX:a+window.screenX,screenY:l+window.screenY,button:0,buttons:1};if(r){const v={...f,pointerType:"mouse",isPrimary:!0};d.dispatchEvent(new PointerEvent("pointerdown",v)),d.dispatchEvent(new PointerEvent("pointerup",v))}return o&&(d.dispatchEvent(new MouseEvent("mouseenter",{...f,bubbles:!1})),d.dispatchEvent(new MouseEvent("mouseover",f))),d.dispatchEvent(new MouseEvent("mousedown",f)),d.dispatchEvent(new MouseEvent("mouseup",f)),d.dispatchEvent(new MouseEvent("click",f)),i&&typeof d.click=="function"&&d.click(),console.log("[humanLikeClick] ✅ Completed on",d.tagName,"at (",Math.round(a),",",Math.round(l),")"),d}class fy{constructor(){P(this,"audioContext",null);P(this,"analyzerNode",null);P(this,"sourceNode",null);P(this,"dataArray",new Uint8Array(0));P(this,"isRunning",!1);P(this,"onLevelsCallback",null);P(this,"animationId",null);P(this,"analyze",()=>{if(!this.isRunning||!this.analyzerNode||this.dataArray.length===0)return;this.analyzerNode.getByteFrequencyData(this.dataArray);const e=[];for(let n=0;n<this.dataArray.length;n++)n>=2&&n<this.dataArray.length-2&&e.push(this.dataArray[n]/255);this.onLevelsCallback&&this.onLevelsCallback(e),this.animationId=requestAnimationFrame(this.analyze)})}start(e,n){try{this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext.state==="suspended"&&this.audioContext.resume(),this.analyzerNode=this.audioContext.createAnalyser(),this.analyzerNode.fftSize=64,this.analyzerNode.smoothingTimeConstant=.4,this.sourceNode=this.audioContext.createMediaStreamSource(e),this.sourceNode.connect(this.analyzerNode);const r=this.analyzerNode.frequencyBinCount;this.dataArray=new Uint8Array(r),this.onLevelsCallback=n,this.isRunning=!0,this.analyze(),console.log("[AudioAnalyzer] Started analyzing audio stream")}catch(r){console.error("[AudioAnalyzer] Failed to start:",r)}}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=null),this.analyzerNode=null,this.dataArray=new Uint8Array(0),this.onLevelsCallback=null,console.log("[AudioAnalyzer] Stopped")}destroy(){this.stop(),this.audioContext&&(this.audioContext.close(),this.audioContext=null)}}class Dx{constructor(){P(this,"events",{})}on(e,n){return this.events[e]||(this.events[e]=[]),this.events[e].push(n),this}off(e,n){if(!this.events[e])return this;const r=this.events[e].indexOf(n);return r>-1&&this.events[e].splice(r,1),this}emit(e,...n){if(!this.events[e])return!1;for(const r of this.events[e])r(...n);return!0}}class Px{constructor(){P(this,"lastSnapshot",null);P(this,"lastSnapshotHash","");P(this,"snapshotInterval",null);P(this,"sendCallback",null);P(this,"correlationCounter",0);P(this,"INTERACTIVE_TAGS",new Set(["button","a","input","select","textarea","label","summary","details","option","menuitem"]));P(this,"INTERACTIVE_ROLES",new Set(["button","link","menuitem","option","tab","checkbox","radio","switch","textbox","combobox","listbox","slider"]));P(this,"mutationObserver",null);P(this,"mutationDebounceTimer",null)}startCapturing(e=1500,n){console.log(`[DOMIntrospector] Starting DOM capture every ${e}ms`),this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.sendCallback=n,this.captureAndSend(),this.snapshotInterval=window.setInterval(()=>{this.captureAndSend()},e),this.setupMutationObserver()}stopCapturing(){this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),console.log("[DOMIntrospector] Stopped DOM capture")}captureAndSendImmediate(e="immediate"){console.log(`[DOMIntrospector] Immediate capture triggered: ${e}`);const n=this.captureSnapshot(),r=this.computeSnapshotHash(n),i=r!==this.lastSnapshotHash,o={...n,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:e,domChanged:i};return this.lastSnapshot=o,this.lastSnapshotHash=r,this.sendCallback&&(console.log(`[DOMIntrospector] Sending immediate snapshot (changed=${i}): ${n.elements.length} elements, corr=${o.correlationId}`),this.sendCallback(o)),o.correlationId}setupMutationObserver(){this.mutationObserver||(this.mutationObserver=new MutationObserver(e=>{this.mutationDebounceTimer&&clearTimeout(this.mutationDebounceTimer),e.some(r=>r.type==="childList"||r.type==="attributes"&&["href","src","hidden","disabled"].includes(r.attributeName||""))&&(this.mutationDebounceTimer=setTimeout(()=>{console.log("[DOMIntrospector] Significant DOM change detected"),this.captureAndSendImmediate("dom-mutation")},300))}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","disabled","aria-hidden","href","src"]}))}captureAndSend(){const e=this.captureSnapshot(),n=this.computeSnapshotHash(e);if(n!==this.lastSnapshotHash){const i={...e,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:"periodic",domChanged:!0};this.lastSnapshot=i,this.lastSnapshotHash=n,this.sendCallback&&(console.log(`[DOMIntrospector] Sending snapshot (DOM changed): ${e.elements.length} elements, ${e.interactiveCount} interactive, corr=${i.correlationId}`),this.sendCallback(i))}else console.debug("[DOMIntrospector] Snapshot unchanged, skipping send")}computeSnapshotHash(e){const n=e.elements.length,r=e.interactiveCount||0,i=30,o=e.elements.slice(0,i),s=Math.max(0,Math.floor(n/2)-Math.floor(i/2)),a=e.elements.slice(s,s+i),l=e.elements.slice(-i),c=f=>f.map(h=>{var b;return`${h.tag}:${(b=h.text)==null?void 0:b.slice(0,20)}:${Math.round(h.rect.x)}:${Math.round(h.rect.y)}`}).join("|");return`count:${n}:${r}|`+c(o)+"||"+c(a)+"||"+c(l)}captureSnapshot(){const e=[],n={width:window.innerWidth,height:window.innerHeight},r=document.body.querySelectorAll("*");let i=0,o=0;return r.forEach(s=>{var h;const a=s;if(this.shouldSkipElement(a))return;const l=a.getBoundingClientRect();if(l.bottom<0||l.top>n.height||l.right<0||l.left>n.width||l.width<=0||l.height<=0)return;const c=this.isInteractiveElement(a);c&&o++;const d=this.getVisibleText(a);if(!c&&!d)return;const f={index:i++,tag:a.tagName.toLowerCase(),text:d,id:a.id||"",className:typeof a.className=="string"?a.className:"",ariaLabel:a.getAttribute("aria-label"),placeholder:a.getAttribute("placeholder"),role:a.getAttribute("role"),href:a.getAttribute("href"),type:a.getAttribute("type"),name:a.getAttribute("name"),rect:{x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height)},isVisible:!0,isInteractive:c,parentTag:((h=a.parentElement)==null?void 0:h.tagName.toLowerCase())||null,depth:this.getElementDepth(a)};e.push(f)}),{timestamp:Date.now(),url:En(),viewport:n,elements:e,totalElements:e.length,interactiveCount:o}}shouldSkipElement(e){if(xt(e))return!0;const n=e.tagName.toLowerCase();if(["script","style","noscript","template","svg","path"].includes(n))return!0;const r=window.getComputedStyle(e);return r.display==="none"||r.visibility==="hidden"||r.opacity==="0"}isInteractiveElement(e){const n=e.tagName.toLowerCase();if(this.INTERACTIVE_TAGS.has(n))return!0;const r=e.getAttribute("role");if(r&&this.INTERACTIVE_ROLES.has(r)||e.onclick||e.getAttribute("onclick")||e.contentEditable==="true")return!0;const i=e.getAttribute("tabindex");return!!(i&&parseInt(i)>=0||window.getComputedStyle(e).cursor==="pointer")}getVisibleText(e){var r;return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?(e.value||e.placeholder||"").trim().slice(0,80):(((r=e.innerText)==null?void 0:r.trim())||"").slice(0,80)}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}getLastSnapshot(){return this.lastSnapshot}findElementByIndex(e){if(!this.lastSnapshot)return null;const n=this.lastSnapshot.elements.find(r=>r.index===e);return n?this.findElementByBoundingBox(n.rect,n.tag,n.text):null}findElementByBoundingBox(e,n,r){var a;const o=[];if(document.body.querySelectorAll("*").forEach(l=>{var g;const c=l;if(this.shouldSkipElement(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x)<=10,h=Math.abs(d.y-e.y)<=10,b=Math.abs(d.width-e.width)<=10*2,y=Math.abs(d.height-e.height)<=10*2;if(f&&h&&b&&y){let S=100,v=!1;if(n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r){const w=((g=c.innerText)==null?void 0:g.trim().toLowerCase())||"",k=r.toLowerCase();w.length===0?v=!1:w===k?(S+=50,v=!0):(w.includes(k)||k.includes(w))&&(S+=25,v=!0)}else v=!0;o.push({element:c,score:S,textMatch:v})}}),o.sort((l,c)=>c.score-l.score),o.length>0){const l=o[0],c=((a=l.element.innerText)==null?void 0:a.trim().slice(0,50))||"";return r&&!l.textMatch?(console.warn(`[DOMIntrospector] ⚠️ Bounding box match REJECTED - text mismatch! Expected: "${r}", Found: "${c}"`),console.warn(`[DOMIntrospector] Element at (${e.x}, ${e.y}) has text "${c}" which doesn't match expected "${r}" - page may have scrolled`),null):(console.log(`[DOMIntrospector] Found ${o.length} candidates by bounding box, best score: ${l.score}, text: "${c}"`),l.element)}return null}}const ir=class ir{static extractSelectorContext(e){if(!e)return{};const n=e.split(/\s*([>+~]|\s)\s*/);if(n.length<2)return{};const r=n[n.length-1],i=n.slice(0,-2),o=r.match(/^([a-zA-Z][a-zA-Z0-9-]*)/),s=o?o[1].toLowerCase():void 0,a=i.length>0?i.join(" "):void 0;let l;if(i.length>0){const d=i[i.length-1].match(/^([a-zA-Z][a-zA-Z0-9-]*)/);l=d?d[1].toLowerCase():void 0}return{expectedTag:s,parentSelector:a,parentTag:l}}static matchesSelectorContext(e,n){if(!n.parentTag&&!n.parentSelector)return .5;let r=0,i=0;if(n.parentTag&&(i++,e.closest(n.parentTag)&&(r+=1)),n.parentSelector){i++;try{e.closest(n.parentSelector)&&(r+=1)}catch{}}return i>0?r/i:.5}static setDOMIntrospector(e){ir.domIntrospector=e,console.log("[HybridTargetResolver] DOM Introspector set for enhanced targeting")}static safeStringify(e,n){const r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(o&&typeof o=="object"){if(o instanceof HTMLElement){const s=o.tagName||"Unknown",a=o.id?`#${o.id}`:"",l=o.className&&typeof o.className=="string"?`.${o.className.split(" ").filter(Boolean).join(".")}`:"";return`[HTMLElement: ${s}${a}${l}]`}if(o instanceof Element)return`[Element: ${o.tagName||"Unknown"}]`;if(o instanceof Node)return`[Node: ${o.nodeName}]`;if(r.has(o))return"[Circular]";r.add(o)}return o},n)}static resolveTarget(e){if(!e)return console.warn("[HybridTargetResolver] ❌ No target provided"),null;console.log("[HybridTargetResolver] Target details:",this.safeStringify(e,2));const n=this.resolveTargetWithConsensus(e),r=n.element?`[HTMLElement: ${n.element.tagName}${n.element.id?`#${n.element.id}`:""}${n.element.className&&typeof n.element.className=="string"?`.${n.element.className.split(" ").filter(Boolean).join(".")}`:""}]`:null,i={...n,element:r};return console.log(`[HybridTargetResolver] consensus results (${n.confidence.toFixed(1)}% confidence)`,this.safeStringify(i,2)),n.element?n.element:null}static resolveTargetWithConsensus(e){var f;const n=performance.now(),r=this.getAvailableStrategies(e);if(r.length===0)return console.warn("[HybridTargetResolver] ⚠️ No strategies available for target"),{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};console.log(`[HybridTargetResolver] 🔄 Running ${r.length} strategies in parallel...`);const i=new Map;for(const h of r){const b=this.executeStrategyMulti(h,e);for(const y of b)xt(y)||y.isConnected&&(i.has(y)?i.get(y).strategies.push(h):i.set(y,{element:y,strategies:[h],validationScore:0,interactable:!1,confidence:0}))}if(console.log(`[HybridTargetResolver] 📊 Found ${i.size} unique candidate(s)`),i.size===0)return{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};const o=[];for(const[h,b]of i){if(!h.isConnected){console.warn("[HybridTargetResolver] ⚠️ Candidate element was removed from DOM, skipping");continue}b.validationScore=this.computeValidationScore(h,e),b.interactable=this.checkInteractability(h).ok,b.confidence=this.computeConfidence(b,r.length,e),o.push(b),console.log(`[HybridTargetResolver] <${h.tagName.toLowerCase()}> "${(f=h.textContent)==null?void 0:f.slice(0,25)}..."`),console.log(`[HybridTargetResolver] Strategies: ${b.strategies.join(", ")} (${b.strategies.length}/${r.length})`),console.log(`[HybridTargetResolver] Confidence: ${b.confidence.toFixed(1)}%`)}if(o.length===0)return{element:null,confidence:0,strategies:[],candidateCount:i.size,ambiguous:!1,duration:performance.now()-n};o.sort((h,b)=>b.confidence-h.confidence);const s=o[0],a=o.length>1?o[1]:void 0,l=performance.now()-n,c=a!==void 0&&s.confidence-a.confidence<10;if(c&&console.warn("[HybridTargetResolver] ⚠️ AMBIGUOUS: Top candidates have similar confidence"),s.confidence<30)return console.warn(`[HybridTargetResolver] ❌ Best candidate confidence too low: ${s.confidence.toFixed(1)}%`),{element:null,confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l};if(!s.interactable){const h=o.find(b=>b.interactable);if(h&&h.confidence>30)return console.log(`[HybridTargetResolver] ✅ Using interactable candidate (${h.confidence.toFixed(1)}%)`),{element:this.getClickableContainer(h.element),confidence:h.confidence,strategies:h.strategies,candidateCount:i.size,ambiguous:c,duration:l}}return console.log(`[HybridTargetResolver] ✅ Winner: ${s.confidence.toFixed(1)}% confidence (${l.toFixed(1)}ms)`),{element:this.getClickableContainer(s.element),confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l}}static isValidCSSSelector(e){if(!e||typeof e!="string")return!1;if(/^(role|text|label|placeholder)=/.test(e))return console.warn(`[HybridTargetResolver] Skipping Playwright-style selector (not CSS): "${e.substring(0,50)}..."`),!1;try{return document.querySelector(e),!0}catch{return console.warn(`[HybridTargetResolver] Invalid CSS selector: "${e.substring(0,50)}..."`),!1}}static executeStrategyMulti(e,n){const r=[];try{switch(e){case"selector":{const i=new Set,o=[n.selector,...n.selectorFallbacks||[]].filter(a=>!!a),s=[];for(const a of o){this.isValidCSSSelector(a)&&s.push(a);const l=cy(a);l!==a&&this.isValidCSSSelector(l)&&!s.includes(l)&&s.push(l)}for(const a of s)try{document.querySelectorAll(a).forEach(l=>i.add(l))}catch{console.warn(`[HybridTargetResolver] querySelectorAll failed for: "${a.substring(0,50)}..."`)}r.push(...i);break}case"text":n.text&&r.push(...this.findAllByText(n.text));break;case"ariaLabel":n.ariaLabel&&document.querySelectorAll(`[aria-label*="${CSS.escape(n.ariaLabel)}"]`).forEach(i=>r.push(i));break;case"placeholder":n.placeholder&&document.querySelectorAll(`[placeholder*="${CSS.escape(n.placeholder)}"]`).forEach(i=>r.push(i));break;case"role":n.role&&document.querySelectorAll(`[role="${n.role}"]`).forEach(i=>r.push(i));break;case"labelText":{if(n.labelText){let i=n.selector||"";(!i||/react-select-\d+/.test(i))&&(n.role?i=`[role="${n.role}"]`:n.tag?i=n.tag:i="*");const o=this.findElementByLabelText(n.labelText,i);o&&r.push(o)}break}case"optionText":{if(n.optionText){const i=this.findDropdownOptionByText(n.optionText);i&&r.push(i)}break}case"removeChip":{if(n.removeChipText){const i=this.findMultiSelectChipRemoveButton(n.removeChipText);i&&r.push(i)}break}case"tag":{if(n.tag){const i=document.getElementsByTagName(n.tag);for(const o of i)(!n.text||(o.textContent||"").toLowerCase().includes(n.text.toLowerCase()))&&r.push(o)}break}case"domIndex":if(n.domIndex!==void 0){const i=this.findByDomIndex(n.domIndex);i&&r.push(i)}break;case"boundingBox":{if(n.boundingBox){const i=this.findByBoundingBox(n.boundingBox,n.tag,n.text);i&&r.push(i)}break}}}catch(i){console.warn(`[HybridTargetResolver] Strategy "${e}" threw error:`,i)}return r}static findAllByText(e,n){var b,y;const r=[],i=new Set;if(!e)return r;const o=e.trim();if(!o)return r;const s=n||"*",a=this.escapeXPathString(o),l=`//${s}[normalize-space(.)=${a}]`;try{const g=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<g.snapshotLength;S++){const v=g.snapshotItem(S);v&&!this.isDropdownDisplayValue(v)&&!i.has(v)&&(r.push(v),i.add(v))}}catch{}const c=`//${s}[contains(normalize-space(.), ${a})]`;try{const g=document.evaluate(c,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<g.snapshotLength;S++){const v=g.snapshotItem(S);v&&!this.isDropdownDisplayValue(v)&&!i.has(v)&&(r.push(v),i.add(v))}}catch{}const d=[];for(const g of r)if(!this.isInteractiveElement(g)){const S=this.findNearbyInput(g);S&&!i.has(S)&&(console.log(`[HybridTargetResolver] → Found nearby input for label "${(b=g.textContent)==null?void 0:b.trim().substring(0,30)}": <${S.tagName.toLowerCase()}>`),d.push(S),i.add(S))}r.push(...d);const f=o.toLowerCase(),h=document.querySelectorAll("input, textarea");for(const g of h){const S=g;if(xt(S)||i.has(S))continue;const v=((y=S.getAttribute("placeholder"))==null?void 0:y.trim().toLowerCase())||"";if(v===f||v&&v.includes(f)&&f.length/v.length>.6){const w=S.getBoundingClientRect();w.width>0&&w.height>0&&(r.push(S),i.add(S))}}return r}static isInteractiveElement(e){return!!(["INPUT","BUTTON","SELECT","TEXTAREA","A"].includes(e.tagName)||e.getAttribute("role")==="button"||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="textbox"||e.getAttribute("role")==="listbox"||e.getAttribute("contenteditable")==="true"||e.getAttribute("tabindex")!==null&&e.getAttribute("tabindex")!=="-1")}static findNearbyInput(e){if(e.tagName==="LABEL"){const i=e.getAttribute("for");if(i){const o=document.getElementById(i);if(o)return o}}let n=e.nextElementSibling;for(let i=0;i<3&&n;i++){const o=this.findFirstInput(n);if(o)return o;n=n.nextElementSibling}const r=e.parentElement;if(r){const i=r.querySelectorAll('input, textarea, select, [role="combobox"], [role="listbox"], nz-select input, .ant-select input');for(const o of i)if(e.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING){const s=o.getBoundingClientRect();if(s.width>0&&s.height>0)return o}}return null}static findFirstInput(e){if(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="listbox")return e;const n=e.querySelector('input, textarea, select, [role="combobox"], [role="listbox"]');if(n){const r=n.getBoundingClientRect();if(r.width>0&&r.height>0)return n}return null}static computeValidationScore(e,n){var c,d,f;let r=0,i=0,o=!1,s=!1;if(n.role){i+=25;const h=e.getAttribute("role");if(h===n.role)r+=25;else if(h)o=!0;else{const b=e.tagName.toLowerCase(),y=typeof e.className=="string"?e.className:"";b==="div"||b==="span"||e.classList.contains("container")||y.includes("control")||y.includes("wrapper")?r+=10:s=!0}}if(n.role==="combobox"&&e.querySelector('[role="combobox"]')&&(r+=10,i+=10),n.tag){i+=15;const h=e.tagName.toLowerCase(),b=n.tag.toLowerCase();h===b?r+=15:n.role==="combobox"&&(h==="input"||h==="div")&&(r+=10)}if(n.text&&!n.optionText){i+=20;const h=(e.textContent||"").toLowerCase().trim(),b=n.text.toLowerCase().trim();if(n.role==="combobox"&&e.tagName.toLowerCase()==="input"){const y=(c=e.closest('.css-6lmz24, [class*="value-container"], [class*="placeholder"]'))==null?void 0:c.parentElement,g=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]'),S=((d=g==null?void 0:g.textContent)==null?void 0:d.toLowerCase().trim())||"";(S===b||S.includes(b))&&(r+=20)}else if(h===b)r+=20;else if(h.includes(b)){const y=b.length/h.length;y>.8?r+=15:y>.5?r+=8:(new RegExp(`\\b${ir.escapeRegex(b)}\\b`,"i").test(h)?r+=2:r+=0,console.log(`[HybridTargetResolver] Text length mismatch: "${b}" (${b.length}) in "${h.slice(0,30)}..." (${h.length}), ratio=${y.toFixed(2)}, points=${r}`))}else if(b.includes(h)){const y=h.length/b.length;r+=Math.round(15*y)}}if(n.ariaLabel){i+=15;const h=e.getAttribute("aria-label")||"";h.toLowerCase()===n.ariaLabel.toLowerCase()?r+=15:h.toLowerCase().includes(n.ariaLabel.toLowerCase())&&(r+=10)}if(n.placeholder){i+=15;const h=e.placeholder||"",b=n.placeholder.toLowerCase();if(h.toLowerCase().includes(b))r+=15;else if(n.role==="combobox"){const y=e.closest('[class*="container"]')||e.parentElement,g=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]');(((f=g==null?void 0:g.textContent)==null?void 0:f.toLowerCase().trim())||"").includes(b)&&(r+=15)}}if(n.labelText){i+=20;const h=this.getAssociatedLabelText(e);if(h){const b=h.toLowerCase().trim().replace(/\*$/,"").trim(),y=n.labelText.toLowerCase().trim().replace(/\*$/,"").trim();b===y?r+=20:(b.includes(y)||y.includes(b))&&(r+=15)}}if(n.optionText){i+=15;const b=(e.textContent||"").trim().toLowerCase(),y=n.optionText.toLowerCase().trim();b===y?r+=15:b.includes(y)&&(r+=10)}if(i===0)return 100;let a=Math.round(r/i*100);if(o?(a=Math.round(a*.3),console.log(`[HybridTargetResolver] Role mismatch penalty (30%): ${e.tagName}[role="${e.getAttribute("role")}"] vs target role="${n.role}"`)):s&&(e.closest('[role="listbox"], [role="menu"], [role="tree"]')||(a=Math.round(a*.7),console.log(`[HybridTargetResolver] No role penalty (70%): ${e.tagName} expected role="${n.role}"`))),e.getAttribute("tabindex")==="-1"&&(e.closest('[role="listbox"], [role="menu"], [role="combobox"], .select, [class*="dropdown"]')||e.tagName.toLowerCase()==="input"&&(a=Math.round(a*.85),console.log("[HybridTargetResolver] tabindex=-1 input penalty (85%): likely hidden placeholder"))),n.selector){const h=this.extractSelectorContext(n.selector);if(h.parentTag||h.parentSelector){const b=this.matchesSelectorContext(e,h);b>.5?a=Math.min(100,Math.round(a*1.15)):b<.5&&n.text&&(a=Math.round(a*.7))}}if(n.text){const h=e.tagName.toLowerCase(),b=e.getAttribute("role"),y=["button","a","input","select","textarea"].includes(h),g=["button","link","menuitem","option","tab","checkbox","radio"].includes(b||""),S=e.onclick!==null||e.hasAttribute("onclick"),v=e.closest('button, a, [role="button"], [role="link"]');y||g?(a=Math.min(100,Math.round(a*1.25)),console.log(`[HybridTargetResolver] Interactive element bonus (25%): <${h}> is natively interactive`)):v?a=Math.min(100,Math.round(a*1.15)):S&&(a=Math.min(100,Math.round(a*1.1)))}return a}static computeConfidence(e,n,r){if(n===0)return console.warn("[HybridTargetResolver] computeConfidence: totalStrategies is 0, returning 0"),0;const i=e.strategies.length/n*100,o=e.validationScore;let s=100;try{const c=e.element.getBoundingClientRect();(c.width===0||c.height===0)&&(s=0),e.interactable||(s*=.5)}catch{s=0}let a=0;if(e.strategies.includes("selector"))if(r.text){const c=(e.element.textContent||"").toLowerCase().trim(),d=r.text.toLowerCase().trim();c===d?(a=100,console.log("[HybridTargetResolver] Selector + exact text match bonus applied")):c.includes(d)?(a=70,console.log("[HybridTargetResolver] Selector + partial text match bonus applied")):(a=20,console.log("[HybridTargetResolver] Selector match but NO text match - reduced bonus"))}else a=100,console.log("[HybridTargetResolver] Selector match bonus applied (no text to validate)");return i*.3+o*.4+s*.15+a*.15}static checkInteractability(e){try{if(!e.isConnected)return{ok:!1,reason:"Element is not connected to DOM"};let n;try{n=window.getComputedStyle(e)}catch{return{ok:!1,reason:"Cannot compute style (element may be in different document)"}}if(n.display==="none")return{ok:!1,reason:"Element has display: none"};if(n.visibility==="hidden")return{ok:!1,reason:"Element has visibility: hidden"};const r=parseFloat(n.opacity);if(isNaN(r)||r===0)return{ok:!1,reason:"Element has opacity: 0"};if(n.pointerEvents==="none")return{ok:!1,reason:"Element has pointer-events: none"};if(e.disabled)return{ok:!1,reason:"Element is disabled"};if(e.getAttribute("aria-disabled")==="true")return{ok:!1,reason:"Element has aria-disabled: true"};if(!e.offsetParent&&n.position!=="fixed"&&n.position!=="sticky"){let o=e.parentElement,s=!1;for(;o&&o!==document.body;){try{const a=window.getComputedStyle(o);if(a.position==="fixed"||a.position==="sticky"){s=!0;break}}catch{break}o=o.parentElement}if(!s)return{ok:!1,reason:"Element is not rendered (offsetParent is null)"}}let i;try{i=e.getBoundingClientRect()}catch{return{ok:!1,reason:"Cannot get bounding rect (element may be in different frame)"}}return i.width===0||i.height===0?{ok:!1,reason:"Element has zero dimensions"}:{ok:!0}}catch(n){return console.warn("[HybridTargetResolver] checkInteractability error:",n),{ok:!1,reason:`Error checking interactability: ${n}`}}}static getAvailableStrategies(e){const n=[];return e.labelText&&n.push("labelText"),e.optionText&&n.push("optionText"),e.removeChipText&&n.push("removeChip"),e.selector&&n.push("selector"),e.domIndex!==void 0&&n.push("domIndex"),e.boundingBox&&n.push("boundingBox"),e.placeholder&&n.push("placeholder"),e.ariaLabel&&n.push("ariaLabel"),e.text&&n.push("text"),e.role&&n.push("role"),e.tag&&n.push("tag"),console.log("[HybridTargetResolver] Auto-detected available strategies:",n.join(", ")),n}static findByDomIndex(e){return e===void 0?null:this.domIntrospector?this.domIntrospector.findElementByIndex(e):null}static findByBoundingBox(e,n,r){if(!e)return null;if(this.domIntrospector)return this.domIntrospector.findElementByBoundingBox(e,n,r);const i=10,o=document.body.querySelectorAll("*");let s=null,a=0;return o.forEach(l=>{var g;const c=l;if(xt(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x),h=Math.abs(d.y-e.y),b=Math.abs(d.width-e.width),y=Math.abs(d.height-e.height);if(f<=i&&h<=i&&b<=i*2&&y<=i*2){let S=100-f-h;n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r&&(((g=c.innerText)==null?void 0:g.trim().toLowerCase())||"").includes(r.toLowerCase())&&(S+=25),S>a&&(a=S,s=c)}}),s}static validateElementMatchesTarget(e,n){var o;if(!n.labelText&&!n.optionText&&!n.role&&!n.ariaLabel&&!n.placeholder&&!n.name&&!n.tag&&!n.text)return!0;const r=[];if(n.tag){const s=e.tagName.toLowerCase(),a=n.tag.toLowerCase();if(s!==a&&["input","select","textarea","button","a"].includes(a))return console.log(`[HybridTargetResolver] Validation failed: tag="${s}" !== expected "${a}"`),!1;r.push("tag")}if(n.text&&!n.optionText){const s=(e.textContent||"").trim().toLowerCase(),a=n.text.trim().toLowerCase(),l=s===a,c=s.includes(a)||a.includes(s);if(!l&&!c)return console.log(`[HybridTargetResolver] Validation failed: text="${s.slice(0,50)}" !== expected "${a}"`),!1;if(a.length<=10&&!l){const d=a.length/Math.max(s.length,1);if(d<.5)return console.log(`[HybridTargetResolver] Validation failed: text match ratio too low (${d.toFixed(2)})`),!1}r.push("text")}const i=(s,a)=>{const l=s.toLowerCase().trim().replace(/\*$/,"").trim(),c=a.toLowerCase().trim();return l===c?!0:new RegExp(`(^|\\s)${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(s)};if(n.role){const s=e.getAttribute("role");if(s!==n.role)return console.log(`[HybridTargetResolver] Validation failed: role="${s}" !== expected "${n.role}"`),!1;r.push("role")}if(n.ariaLabel){const s=e.getAttribute("aria-label")||"";if(!i(s,n.ariaLabel))return console.log(`[HybridTargetResolver] Validation failed: aria-label="${s}" !== expected "${n.ariaLabel}"`),!1;r.push("ariaLabel")}if(n.placeholder){const s=e.placeholder||"";if(!i(s,n.placeholder))return console.log(`[HybridTargetResolver] Validation failed: placeholder="${s}" !== expected "${n.placeholder}"`),!1;r.push("placeholder")}if(n.name){const s=e.getAttribute("name")||"";if(s!==n.name)return console.log(`[HybridTargetResolver] Validation failed: name="${s}" !== expected "${n.name}"`),!1;r.push("name")}if(n.labelText){const s=this.getAssociatedLabelText(e);if(!s||!i(s,n.labelText))return console.log(`[HybridTargetResolver] Validation failed: associated label="${s}" !== expected "${n.labelText}"`),!1;console.log(`[HybridTargetResolver] ✓ Label validation passed: "${s}" matches "${n.labelText}"`),r.push("labelText")}if(n.optionText){const s=((o=e.textContent)==null?void 0:o.trim())||"";if(!i(s,n.optionText))return console.log(`[HybridTargetResolver] Validation failed: option text="${s}" !== expected "${n.optionText}"`),!1;r.push("optionText")}return r.length>0&&console.log(`[HybridTargetResolver] ✓ Validated: ${r.join(", ")}`),!0}static getAssociatedLabelText(e){var s,a,l,c;const n=e.getAttribute("id");if(n)try{const d=document.querySelector(`label[for="${CSS.escape(n)}"]`);if(d)return((s=d.textContent)==null?void 0:s.trim().replace(/\*$/,"").trim())||null}catch{}const r=e.getAttribute("aria-labelledby");if(r){const d=r.split(/\s+/).filter(f=>f.length>0);for(const f of d){const h=document.getElementById(f);if(h)return((a=h.textContent)==null?void 0:a.trim().replace(/\*$/,"").trim())||null}}let i=e.parentElement,o=0;for(;i&&o<8;){const d=i.querySelectorAll('label, .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"], .label');for(const f of d){if(e.contains(f)||f.contains(e)||f.querySelector('input, select, textarea, [role="combobox"]'))continue;if(i.querySelectorAll('input, select, textarea, [role="combobox"]').length===1){const b=(l=f.textContent)==null?void 0:l.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}else if(this.isLabelForElement(f,e,i)){const b=(c=f.textContent)==null?void 0:c.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}}i=i.parentElement,o++}return null}static isLabelForElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect(),s=i.bottom<=o.top+30,a=i.right<=o.left+30&&Math.abs(i.top-o.top)<60;if(!s&&!a)return!1;const l=r.querySelectorAll('input, select, textarea, [role="combobox"]');if(l.length<=1)return!0;for(const c of l){if(c===n)continue;const d=c.getBoundingClientRect();if(s&&(d.top>=i.bottom-5&&d.bottom<o.top||Math.abs(d.left-i.left)<Math.abs(o.left-i.left)&&d.top<o.top))return!1;if(a){const f=Math.abs(d.left-i.right),h=Math.abs(o.left-i.right);if(f<h&&Math.abs(d.top-i.top)<40)return!1}}return!0}static isTextNearElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect();if(i.width===0||i.height===0||o.width===0||o.height===0)return(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;const s=i.bottom<=o.top+40,a=i.right<=o.left+20&&Math.abs(i.top-o.top)<50;if(!s&&!a)return!1;for(const l of r){if(l===n)continue;const c=l.getBoundingClientRect();if(!(c.width===0||c.height===0)){if(s&&c.top>=i.bottom-10&&c.bottom<o.top||s&&Math.abs(c.left-i.left)<Math.abs(o.left-i.left)-20&&c.top<o.top&&c.top>=i.bottom-50)return!1;if(a){const d=Math.abs(c.left-i.right),f=Math.abs(o.left-i.right);if(d<f-10&&Math.abs(c.top-i.top)<40)return!1}}}return!0}static isHiddenPlaceholderInput(e){const n=e.tagName.toLowerCase(),r=e.getAttribute("role");if(r==="option"||r==="menuitem"||r==="treeitem"||e.closest('[role="listbox"], [role="menu"], [role="tree"]')||n!=="input"&&!r)return!1;if(e.getAttribute("tabindex")==="-1"&&n==="input")return console.log('[HybridTargetResolver] → Input has tabindex="-1" (hidden placeholder)'),!0;try{const o=window.getComputedStyle(e);if(o.opacity==="0")return console.log("[HybridTargetResolver] → Element has opacity: 0 (hidden placeholder)"),!0;if(o.visibility==="hidden")return console.log("[HybridTargetResolver] → Element has visibility: hidden (hidden placeholder)"),!0;const s=e.getBoundingClientRect();if(s.width<=5&&s.height<=5)return console.log(`[HybridTargetResolver] → Element is too small (${s.width}x${s.height}) - hidden placeholder`),!0;if(o.position==="absolute"){const a=e.parentElement;if(a&&a.getBoundingClientRect().width>s.width*10&&s.width<20)return console.log("[HybridTargetResolver] → Element is tiny absolute-positioned (hidden placeholder)"),!0}}catch{}return!1}static getClickableContainer(e){var o,s;if(!this.isHiddenPlaceholderInput(e))return e;console.log("[HybridTargetResolver] → Looking for clickable container...");const n=['[class*="-control"]','[class*="control"]',".MuiSelect-select",".MuiInputBase-root",".MuiOutlinedInput-root",'[role="button"]','[role="combobox"]:not(input)','[aria-haspopup="listbox"]','[class*="select-container"]','[class*="dropdown-container"]','[class*="picker"]'];let r=e.parentElement,i=0;for(;r&&i<6;){for(const l of n)try{if(r.matches(l)){const c=r.getBoundingClientRect();if(c.width>50&&c.height>20)return console.log(`[HybridTargetResolver] → Found clickable container: ${r.tagName}.${(o=r.className)==null?void 0:o.split(" ").slice(0,2).join(".")}`),r}}catch{}const a=r.getBoundingClientRect();if(a.width>100&&a.height>30){const l=r.getAttribute("role"),c=r.onclick!==null||r.getAttribute("onclick")!==null||r.classList.contains("clickable");if(l==="button"||l==="combobox"||c||r.querySelector('input[role="combobox"]')===e)return console.log(`[HybridTargetResolver] → Found clickable container (generic): ${r.tagName}.${(s=r.className)==null?void 0:s.split(" ").slice(0,2).join(".")}`),r}r=r.parentElement,i++}return console.log("[HybridTargetResolver] → No clickable container found, using original element"),e}static findBySelector(e){if(!e)return null;const n=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\");console.log(`[HybridTargetResolver] → Normalized selector: "${n}"`);const r=n.match(/\[data-option-text="([^"]+)"\]/);if(r){const l=r[1];return console.log(`[HybridTargetResolver] → Virtual selector - searching for option text: "${l}"`),this.findDropdownOptionByText(l)}const i=n.match(/\[data-label="([^"]+)"\]/);if(i){const l=i[1];return console.log(`[HybridTargetResolver] → Virtual selector - searching for combobox with label: "${l}"`),this.findComboboxByLabel(l)}const o=n.replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim();if(/#?react-select-\d+-(input|listbox|option|placeholder|live-region)/.test(o))return console.log(`[HybridTargetResolver] → Detected unstable React-Select ID pattern in "${o}", skipping selector strategy`),null;if(o==='input[role="combobox"]'||o==='[role="combobox"]'){const l=document.querySelectorAll(o);l.length>1&&(console.warn(`[HybridTargetResolver] ⚠️ AMBIGUOUS SELECTOR: "${o}" matches ${l.length} elements!`),console.warn("[HybridTargetResolver] ⚠️ Bot should send more specific targeting (text, label, boundingBox, domIndex)"),l.forEach((c,d)=>{const f=c,h=f.getAttribute("placeholder")||"",b=f.getAttribute("aria-label")||"",y=f.id||"";console.log(`[HybridTargetResolver] ${d}: id="${y}" placeholder="${h}" aria-label="${b}"`)}))}const a=document.querySelector(o);return a?this.isAccessibilityOnlyElement(a)?(console.log(`[HybridTargetResolver] → Selector matched a11y-only element (class: ${a.className}), skipping`),null):a:(console.log(`[HybridTargetResolver] → Selector "${o}" matched 0 elements`),null)}static isAccessibilityOnlyElement(e){const n=typeof e.className=="string"?e.className:"",r=(e.textContent||"").trim();if(n.includes("a11yText")&&!r||n.includes("sr-only")||n.includes("visually-hidden")||n.includes("screenreader")||n.includes("screen-reader")||e.getAttribute("aria-live")&&!r||e.getAttribute("role")==="log"&&!r)return!0;try{const i=getComputedStyle(e);if(i.position==="absolute"&&(i.width==="1px"||i.height==="1px"||i.clip==="rect(0px, 0px, 0px, 0px)"||i.clipPath==="inset(50%)"))return!0}catch{}return!1}static isDropdownDisplayValue(e){var a;const n=(e.className||"").toLowerCase(),r=(((a=e.parentElement)==null?void 0:a.className)||"").toLowerCase(),i=["singlevalue","single-value","selectedvalue","selected-value","placeholder","value-container","valuecontainer","muiselect-select","select__single-value"];for(const l of i)if(n.includes(l)||r.includes(l))return!0;const o=e.closest('[class*="-control"]:not([class*="-menu"])'),s=!e.closest('[role="listbox"], [role="menu"], [class*="-menu"]');return!!(o&&s)}static findDropdownOptionByText(e){var o,s,a;const n=e.toLowerCase().trim(),r=['[role="listbox"]','[role="menu"]','[class*="-menu"]:not([aria-hidden="true"])','[class*="listbox"]','[class*="options-container"]',".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"],i=["singleValue","single-value","selectedValue","selected-value","placeholder","value-container","MuiSelect-select"];for(const l of r){let c;try{c=document.querySelectorAll(l)}catch{continue}for(const d of c){const f=d;if(!ir.isVisible(f)||f.getBoundingClientRect().height<20)continue;const b=d.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]):not([class*="placeholder"]), nz-option-item, .ant-select-item-option, .ant-select-item-option-content');for(const y of b){const g=y,S=g.className||"";if(i.some(k=>S.toLowerCase().includes(k.toLowerCase()))){console.log(`[HybridTargetResolver] → Skipping display value: "${(o=g.textContent)==null?void 0:o.trim().substring(0,30)}..."`);continue}if(!g.closest('[role="listbox"], [role="menu"], [class*="-menu"]'))continue;const w=((s=g.textContent)==null?void 0:s.trim().toLowerCase())||"";if(w===n||w.includes(n))return console.log(`[HybridTargetResolver] → Found ACTUAL option in open menu: "${(a=g.textContent)==null?void 0:a.trim()}"`),g}}}return console.log(`[HybridTargetResolver] → No option "${e}" found in any open dropdown menu`),console.log("[HybridTargetResolver] → The dropdown may need to be opened first"),null}static findMultiSelectChipRemoveButton(e){var i;const n=e.toLowerCase().trim();console.log(`[HybridTargetResolver] → Searching for multi-select chip: "${e}"`);const r=['[class*="multiValue"]','[class*="multi-value"]','[class*="chip"]','[class*="tag"]',"[data-tag]"];for(const o of r){let s;try{s=document.querySelectorAll(o)}catch{continue}for(const a of s){const l=a;if(!this.isVisible(l))continue;const c=l.querySelector('[class*="label"], [class*="Label"], span:first-of-type'),d=c?(c.textContent||"").trim().toLowerCase():(l.textContent||"").replace(/×|✕|x/gi,"").trim().toLowerCase();if(d===n||d.includes(n)||n.includes(d)){console.log(`[HybridTargetResolver] → Found chip with text: "${(i=l.textContent)==null?void 0:i.trim().substring(0,30)}..."`);const f=['[role="button"]','[class*="remove"]','[class*="Remove"]','[class*="clear"]','[class*="delete"]','[aria-label*="Remove"]','[aria-label*="remove"]','[aria-label*="Delete"]','[aria-label*="delete"]',"button","svg"];for(const h of f){const b=l.querySelector(h);if(b&&this.isVisible(b))return console.log(`[HybridTargetResolver] → Found remove button: <${b.tagName.toLowerCase()}> with selector "${h}"`),b}return console.log("[HybridTargetResolver] → No specific remove button found, returning chip container"),l}}}return console.log(`[HybridTargetResolver] → No chip found with text: "${e}"`),null}static findComboboxByLabel(e){const n=e.toLowerCase().trim(),r=a=>a.toLowerCase().trim().replace(/\*$/,"").trim()===n?!0:new RegExp(`(^|\\s)${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(a),i=document.querySelectorAll("label[for]");for(const a of i)if(r(a.textContent||"")){const l=a.getAttribute("for");if(l){const c=document.getElementById(l);if(c&&(c.getAttribute("role")==="combobox"||c.getAttribute("aria-haspopup")==="listbox"))return console.log(`[HybridTargetResolver] → Found combobox via label[for]: "${e}"`),c}}const o=document.querySelectorAll('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');for(const a of o){const l=a.getAttribute("aria-labelledby");if(l){const c=document.getElementById(l.split(/\s+/)[0]);if(c&&r(c.textContent||""))return console.log(`[HybridTargetResolver] → Found combobox via aria-labelledby: "${e}"`),a}}const s=document.querySelectorAll("label");for(const a of s)if(r(a.textContent||"")){const l=a.closest('fieldset, [role="group"], form > div, [class*="form"], [class*="field"]')||a.parentElement;if(l){const c=l.querySelector('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');if(c&&this.isElementVisible(c))return console.log(`[HybridTargetResolver] → Found combobox in label container: "${e}"`),c}}return null}static isElementVisible(e){const n=e.getBoundingClientRect();if(n.width===0||n.height===0)return!1;if(!e.offsetParent)try{const r=window.getComputedStyle(e);if(r.position!=="fixed"&&r.position!=="sticky")return!1}catch{return!1}return!0}static findElementByLabelText(e,n){var b,y,g;const i=n.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim(),o=i.toLowerCase().trim(),s=["*","div","span","p","a","li","ul","section","article"],a=/\[role=/.test(i);if(s.includes(o)&&!a)return null;let l;try{l=document.querySelectorAll(i)}catch{return console.warn(`[HybridTargetResolver] → Invalid selector: "${i}"`),null}if(l.length===0)return null;console.log(`[HybridTargetResolver] → Looking for "${i}" associated with label "${e}"`),console.log(`[HybridTargetResolver] → Found ${l.length} elements matching selector`);const c=e.toLowerCase().trim();function d(S){return S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const f=S=>S.toLowerCase().trim().replace(/\*$/,"").trim()===c?!0:new RegExp(`(^|\\s)${d(c)}($|\\s|[:\\*\\?\\.\\,\\)\\]\\}\\-])`,"i").test(S),h=S=>{const v=S,w=v.getBoundingClientRect();if(w.width===0||w.height===0)return!1;if(!v.offsetParent)try{const C=window.getComputedStyle(v).position;if(C!=="fixed"&&C!=="sticky")return!1}catch{return!1}return!0};for(const S of l){if(!h(S))continue;const v=S.getAttribute("id");if(v)try{const D=document.querySelector(`label[for="${CSS.escape(v)}"]`);if(D&&f(D.textContent||""))return console.log("[HybridTargetResolver] → Found via label[for] attribute"),S}catch{}const w=S.getAttribute("aria-labelledby");if(w){const D=w.split(/\s+/).filter($=>$.length>0);for(const $ of D){const X=document.getElementById($);if(X&&f(X.textContent||""))return console.log("[HybridTargetResolver] → Found via aria-labelledby"),S}}const k=S.getAttribute("aria-label")||"";if(k&&f(k))return console.log("[HybridTargetResolver] → Found via aria-label"),S;const C=S.getAttribute("placeholder")||"";if(C&&f(C))return console.log("[HybridTargetResolver] → Found via placeholder"),S;let E=S.parentElement,A=0;for(;E&&A<6;){const D=E.querySelectorAll('input, select, textarea, [role="combobox"], [role="listbox"]'),$=Array.from(D),X=$.includes(S),V=E.classList.contains("MuiFormControl-root")||E.tagName==="FIELDSET"||/form(-|_)?(field|group|control|item|row)/i.test(E.className)||E.childElementCount>=2&&E.childElementCount<=5,B=E.querySelectorAll('label, [class*="label"]:not(input):not(select):not(textarea):not([role="combobox"]), .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"]');for(const K of B){if(S.contains(K)||K.contains(S)||K.querySelector('input, select, textarea, [role="combobox"]'))continue;const W=((b=K.textContent)==null?void 0:b.trim())||"";if(!(W.length>50)&&f(W)){if(D.length===1&&X)return console.log(`[HybridTargetResolver] → Found via label in container: "${W}"`),S;if(X&&this.isTextNearElement(K,S,$))return console.log(`[HybridTargetResolver] → Found via label position: "${W}"`),S}}if(V||A>=3){const K=E.querySelectorAll(":scope > div, :scope > span, :scope > p, :scope > div > div, :scope > div > span, :scope > div > p");for(const W of K){if(W.querySelector('input, select, textarea, [role="combobox"]')||W.contains(S)||S.contains(W))continue;const se=S.value||"";if(se&&((y=W.textContent)==null?void 0:y.trim())===se)continue;const J=((g=W.textContent)==null?void 0:g.trim())||"";if(J.length>0&&J.length<=30&&f(J)){if(D.length===1&&X)return console.log(`[HybridTargetResolver] → Found via nearby text: "${J}"`),S;if(X&&this.isTextNearElement(W,S,$))return console.log(`[HybridTargetResolver] → Found via nearby text (position): "${J}"`),S}}}E=E.parentElement,A++}}return null}static escapeXPathString(e){const n=e.replace(/[\n\r\t]+/g," ").replace(/\s+/g," ").trim();if(n.includes('"')&&n.includes("'")){const r=n.split('"');return`concat(${r.map((o,s)=>s===r.length-1?`"${o}"`:`"${o}", '"'`).join(", ")})`}return n.includes('"')?`'${n}'`:`"${n}"`}static escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}static findByText(e,n,r){var C,E,A,D,$,X,V;if(!e)return null;const i=e.trim();if(!i)return null;const o=i.toLowerCase(),s=n||"*",a=this.escapeXPathString(i);if(r){const B=this.findElementByLabelText(i,r);if(B)return console.log(`[HybridTargetResolver] → Found element matching selector "${r}" associated with label "${i}"`),B}const l=`//${s}[normalize-space(.)=${a}]`;console.log(`[HybridTargetResolver] → XPath exact query: ${l}`);let c;try{c=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(B){console.warn("[HybridTargetResolver] → XPath query failed:",B),c={snapshotLength:0,snapshotItem:()=>null}}if(c.snapshotLength>0){console.log(`[HybridTargetResolver] → Found ${c.snapshotLength} exact match(es), checking visibility...`);let B=null,K=null;for(let W=0;W<c.snapshotLength;W++){const se=c.snapshotItem(W);if(K||(K=se),this.isDropdownDisplayValue(se)){console.log(`[HybridTargetResolver] → Skipping display value (not an option): "${(C=se.textContent)==null?void 0:C.trim().substring(0,30)}..."`);continue}const J=se.getBoundingClientRect();if(J.width>0&&J.height>0){B=se,console.log(`[HybridTargetResolver] → Returning visible match ${W}: "${(E=se.textContent)==null?void 0:E.trim().substring(0,30)}..."`);break}}if(B)return B;if(K&&!this.isDropdownDisplayValue(K))return console.log("[HybridTargetResolver] → No visible matches, returning first (possibly hidden) element"),K}console.log("[HybridTargetResolver] → No exact match, trying partial match...");const d=`//${s}[contains(normalize-space(.), ${a})]`;console.log(`[HybridTargetResolver] → XPath partial query: ${d}`);let f;try{f=document.evaluate(d,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(B){console.warn("[HybridTargetResolver] → XPath partial query failed:",B),f={snapshotLength:0,snapshotItem:()=>null}}if(f.snapshotLength>0){let B=null,K=-1;const W=r?this.extractSelectorContext(r):{},se=!!(W.parentTag||W.parentSelector);console.log(`[HybridTargetResolver] → Selector context: parentTag="${W.parentTag||"none"}", expectedTag="${W.expectedTag||"none"}"`);for(let J=0;J<f.snapshotLength;J++){const G=f.snapshotItem(J),ne=(G.textContent||"").trim();if(ne.length===0)continue;const F=ne.toLowerCase(),z=o.length/F.length,q=G.getBoundingClientRect();if(q.width===0||q.height===0||this.isDropdownDisplayValue(G))continue;let re=z;if(new RegExp(`\\b${ir.escapeRegex(o)}\\b`,"i").test(F))re+=.5;else if(z<.5)if(se){if(this.matchesSelectorContext(G,W)<.5){console.log(`[HybridTargetResolver] → Skipping low ratio match that doesn't match selector context: "${ne.slice(0,30)}..."`);continue}}else{console.log(`[HybridTargetResolver] → Skipping low ratio match (${z.toFixed(2)}): "${ne.slice(0,30)}..."`);continue}if(se){const m=this.matchesSelectorContext(G,W);re+=m*.3}re>K&&(K=re,B=G)}if(B)return console.log(`[HybridTargetResolver] → XPath partial match found (score=${K.toFixed(2)})!`),B}console.log("[HybridTargetResolver] → XPath found nothing, trying fallback...");const h=document.querySelectorAll(n||"*");console.log(`[HybridTargetResolver] → Fallback: checking ${h.length} <${n||"*"}> elements for text "${i}"`);const b=B=>{const K=B;return xt(K)?!0:K.id==="root"||K.id==="app"||K.id==="__next"||K.tagName==="BODY"||K.tagName==="HTML"};for(const B of h){if(b(B)||(((A=B.textContent)==null?void 0:A.trim().toLowerCase())||"")!==o)continue;const W=B.getBoundingClientRect();if(W.width>0&&W.height>0&&(((D=B.innerText)==null?void 0:D.trim().toLowerCase())||"")===o)return console.log("[HybridTargetResolver] → Found via exact text match"),B}let y=null,g=-1/0;for(const B of h){if(b(B))continue;const K=(($=B.textContent)==null?void 0:$.trim().toLowerCase())||"";if(K.length!==0&&K.includes(o)){const W=o.length/K.length,se=B.getBoundingClientRect(),J=se.width*se.height;if(J>0&&J<5e5){const G=Math.max(0,50-J/1e4),ne=W*50,F=G+ne;F>g&&(g=F,y=B)}}}if(y){const B=y.getBoundingClientRect();return console.log(`[HybridTargetResolver] → Found via textContent (${B.width.toFixed(0)}x${B.height.toFixed(0)}px, score=${g.toFixed(0)})`),y}const S=n&&["input","textarea"].includes(n.toLowerCase())?n.toLowerCase():"input, textarea",v=document.querySelectorAll(S);console.log(`[HybridTargetResolver] → Checking ${v.length} input/textarea elements for placeholder "${i}"`);for(const B of v){const K=B;if(xt(K))continue;const W=((X=K.getAttribute("placeholder"))==null?void 0:X.trim())||"";if(W.toLowerCase()===o){const se=K.getBoundingClientRect();if(se.width>0&&se.height>0)return console.log(`[HybridTargetResolver] → Found via placeholder match: "${W}"`),K}}let w=null,k=0;for(const B of v){const K=B;if(xt(K))continue;const W=((V=K.getAttribute("placeholder"))==null?void 0:V.trim().toLowerCase())||"";if(W&&W.includes(o)){const se=o.length/W.length;if(se>.6&&se>k){const J=K.getBoundingClientRect();J.width>0&&J.height>0&&(w=K,k=se)}}}return w?(console.log(`[HybridTargetResolver] → Found via partial placeholder match (ratio=${k.toFixed(2)})`),w):null}static findByAriaLabel(e){if(!e)return null;let n=document.querySelector(`[aria-label="${e}"]`);if(n)return console.log("[HybridTargetResolver] → Found via exact aria-label match"),n;const r=document.querySelectorAll("[aria-label]");console.log(`[HybridTargetResolver] → Checking ${r.length} elements with aria-label`);for(const i of r){const o=i.getAttribute("aria-label")||"";if(o.toLowerCase().includes(e.toLowerCase()))return console.log(`[HybridTargetResolver] → Found via partial aria-label match: "${o}"`),i}return null}static findByPlaceholder(e){if(!e)return null;let n=document.querySelector(`[placeholder="${e}"]`);if(n)return console.log("[HybridTargetResolver] → Found via exact placeholder match"),n;const r=document.querySelectorAll("input, textarea");console.log(`[HybridTargetResolver] → Checking ${r.length} input/textarea elements`);for(const i of r){const o=i.getAttribute("placeholder")||"";if(o.toLowerCase().includes(e.toLowerCase()))return console.log(`[HybridTargetResolver] → Found via partial placeholder match: "${o}"`),i}return null}static findByRole(e,n){var i;if(!e)return null;const r=document.querySelectorAll(`[role="${e}"]`);if(console.log(`[HybridTargetResolver] → Found ${r.length} elements with role="${e}"`),n){for(const o of r)if((((i=o.textContent)==null?void 0:i.trim())||"").toLowerCase().includes(n.toLowerCase()))return console.log("[HybridTargetResolver] → Found role element with matching text"),o}return r[0]||null}static findByTag(e,n){var i,o,s;if(!e)return null;const r=document.getElementsByTagName(e);if(console.log(`[HybridTargetResolver] → Found ${r.length} <${e}> elements`),n){const a=n.toLowerCase().trim();let l=null,c=null,d=0;for(const f of r){const h=f;if(h.id==="root"||h.id==="app"||h.tagName==="BODY"||h.tagName==="HTML"||!ir.isVisible(h)||(((i=h.innerText)==null?void 0:i.length)||0)>200)continue;const y=((o=h.innerText)==null?void 0:o.trim())||"",g=y.toLowerCase();if(g===a){console.log(`[HybridTargetResolver] → Found exact match: "${y.substring(0,50)}..."`),l=h;break}if(g.includes(a)){const S=a.length/g.length;S>.7&&S>d&&(c=h,d=S)}}if(l)return l;if(c){const f=((s=c.innerText)==null?void 0:s.trim().substring(0,50))||"";return console.log(`[HybridTargetResolver] → Found close match (${(d*100).toFixed(0)}%): "${f}..."`),c}return console.log(`[HybridTargetResolver] → No matching <${e}> found for text "${n}"`),null}if(e==="div"||e==="span")return console.log(`[HybridTargetResolver] → REFUSING to blindly return first <${e}> - too ambiguous without text`),null;for(const a of r){const l=a;if(l.id==="root"||l.id==="app"||l.tagName==="BODY"||l.tagName==="HTML"||l.classList.contains("App"))continue;const c=l.getBoundingClientRect();if(!(c.width>500&&c.height>500)&&c.width>0&&c.height>0)return l}return null}static isVisible(e){const n=e.getBoundingClientRect(),r=window.getComputedStyle(e);return n.width>0&&n.height>0&&r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}static scrollIntoView(e,n){console.log("[HybridTargetResolver] 📜 Scrolling element into view"),e.scrollIntoView({behavior:"smooth",block:"center",...n})}static async waitForPositionStability(e,n=1e3,r=50,i=2){console.log("[HybridTargetResolver] ⏳ Waiting for element position stability...");let o=e.getBoundingClientRect(),s=0;const a=3,l=Date.now();for(;Date.now()-l<n;){await new Promise(h=>setTimeout(h,r));const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return console.warn("[HybridTargetResolver] ⚠️ Element disappeared during stability check"),null;const d=Math.abs(c.x-o.x),f=Math.abs(c.y-o.y);if(d<i&&f<i){if(s++,s>=a)return console.log(`[HybridTargetResolver] ✅ Element position stable at (${c.x.toFixed(0)}, ${c.y.toFixed(0)}) after ${Date.now()-l}ms`),c}else s=0,console.log(`[HybridTargetResolver] 📍 Element still moving: (${o.x.toFixed(0)}, ${o.y.toFixed(0)}) → (${c.x.toFixed(0)}, ${c.y.toFixed(0)})`);o=c}return console.warn(`[HybridTargetResolver] ⚠️ Position stability timeout after ${n}ms`),e.getBoundingClientRect()}static reResolveAndVerify(e,n){var a,l,c;const r={text:e.text,selector:e.selector,selectorFallbacks:e.selectorFallbacks,tag:e.tag,ariaLabel:e.ariaLabel,placeholder:e.placeholder,role:e.role,labelText:e.labelText,optionText:e.optionText,name:e.name,removeChipText:e.removeChipText,dropdownTriggerSelector:e.dropdownTriggerSelector,selectedValues:e.selectedValues,strategy:(a=e.strategy)==null?void 0:a.filter(d=>d!=="boundingBox"&&d!=="domIndex")};console.log("[HybridTargetResolver] 🔄 Re-resolving with position-independent target (no boundingBox/domIndex)");const i=this.resolveTarget(r);if(!i)return console.warn("[HybridTargetResolver] ⚠️ Re-resolution failed - element no longer found"),null;const o=((l=n.textContent)==null?void 0:l.trim().toLowerCase())||"",s=((c=i.textContent)==null?void 0:c.trim().toLowerCase())||"";return o!==s&&o&&s&&console.warn(`[HybridTargetResolver] ⚠️ Element changed during wait: "${o}" → "${s}"`),i}};P(ir,"domIntrospector",null);let Se=ir;class Lx{constructor(){P(this,"confirmationSound");P(this,"lastError",null);this.confirmationSound=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=")}humanLikeClick(e,n={}){return dy(e,n)}async executeWithConsent(e,n=!0){try{if(n&&this.isDestructive(e)&&!await this.getConsent(e))return!1;const r=await this.execute(e);return r&&(this.confirmationSound.play().catch(()=>{}),console.log(`[ActionExecutor] Executed ${e.type} on ${e.selector}`)),r}catch(r){return console.error("[ActionExecutor] Failed to execute action:",r),!1}}async executeHybridAction(e,n=!0){this.lastError=null;try{if(console.log("[ActionExecutor] Executing hybrid action:",e),e.action==="navigate"){const s=e.value;if(!s)return console.warn("[ActionExecutor] Navigate action missing target URL"),this.lastError="Navigate action missing target URL",!1;let a;try{const l=new URL(s,window.location.origin);if(l.protocol!=="http:"&&l.protocol!=="https:")return console.warn("[ActionExecutor] Navigate blocked — disallowed scheme:",l.protocol),this.lastError=`Navigate blocked: disallowed URL scheme "${l.protocol}"`,!1;a=l.href}catch{return console.warn("[ActionExecutor] Navigate blocked — invalid URL:",s),this.lastError=`Navigate blocked: invalid URL "${s}"`,!1}return console.log("[ActionExecutor] 🧭 Navigating to URL:",a),window.location.href=a,!0}if(e.target.optionText&&e.action==="click"){console.log("[ActionExecutor] 🔽 Dropdown option click detected:",e.target.optionText);let s=Se.resolveTarget(e.target);if(!s){console.log("[ActionExecutor] Option not visible - dropdown may be closed, attempting to open...");let a=!1;if(e.target.dropdownTriggerSelector){console.log("[ActionExecutor] Using dropdownTriggerSelector:",e.target.dropdownTriggerSelector);const l=uy(e.target.dropdownTriggerSelector);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.labelText){console.log("[ActionExecutor] Trying to find dropdown by label:",e.target.labelText);const l=this.findComboboxByLabel(e.target.labelText);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.selector){console.log("[ActionExecutor] Trying to find dropdown by selector:",e.target.selector);const l={...e.target,optionText:void 0},c=Se.resolveTarget(l);if(c){const d=this.findComboboxInput(c);d&&(this.handleComboboxClick(d),a=!0)}}if(a){if(console.log("[ActionExecutor] Waiting for dropdown to open..."),await new Promise(l=>setTimeout(l,300)),s=Se.resolveTarget(e.target),!s)return console.warn("[ActionExecutor] ❌ Option still not found after opening dropdown:",e.target.optionText),!1;console.log("[ActionExecutor] ✅ Found option after opening dropdown")}else return console.warn("[ActionExecutor] ❌ Could not open dropdown - no trigger found. Add a separate task to open the dropdown first."),!1}return n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e)?!1:(Se.scrollIntoView(s),await new Promise(a=>setTimeout(a,100)),this.performClick(s),this.confirmationSound.play().catch(()=>{}),console.log(`[ActionExecutor] ✅ Successfully clicked dropdown option: "${e.target.optionText}"`),!0)}const r=Se.resolveTarget(e.target);if(!r)return console.warn("[ActionExecutor] Could not resolve target:",e.target),!1;if(n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e))return!1;const i=e.target.selector,o=await this.executeOnElement(e.action,r,e.value,i);return o&&(this.confirmationSound.play().catch(()=>{}),console.log(`[ActionExecutor] Successfully executed "${e.action}" on element`)),o}catch(r){return console.error("[ActionExecutor] Failed to execute hybrid action:",r),this.lastError=r instanceof Error?r.message:String(r),!1}}async executeOnElement(e,n,r,i){switch(Se.scrollIntoView(n),await new Promise(o=>setTimeout(o,300)),e){case"click":await this.expandCollapsedContainer(n),this.simulateClick(n,i);break;case"type":n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?(n.focus(),n.value=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))):(n.focus(),n.textContent=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})));break;case"focus":n.focus();break;case"hover":n.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),n.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":n.scrollIntoView({behavior:"smooth",block:"center"});break;case"highlight":n.style.outline="3px solid #00aaff",n.style.outlineOffset="2px";break;default:return console.warn("[ActionExecutor] Unknown action type:",e),!1}return!0}async expandCollapsedContainer(e){const n=this.findCollapsedContainer(e);if(n){console.log("[ActionExecutor] Found collapsed container, hovering to expand...");const r=n.getBoundingClientRect(),i=r.left+r.width/2,o=r.top+r.height/2,s={bubbles:!0,cancelable:!0,view:window,clientX:i,clientY:o};n.dispatchEvent(new MouseEvent("mouseenter",s)),n.dispatchEvent(new MouseEvent("mouseover",s));const a=e.getBoundingClientRect(),l={bubbles:!0,cancelable:!0,view:window,clientX:a.left+a.width/2,clientY:a.top+a.height/2};e.dispatchEvent(new MouseEvent("mouseenter",l)),e.dispatchEvent(new MouseEvent("mouseover",l)),await new Promise(c=>setTimeout(c,400)),console.log("[ActionExecutor] Container expanded, proceeding with click")}}findCollapsedContainer(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=window.getComputedStyle(n),i=n.getBoundingClientRect().width,o=r.transition.includes("width")||r.transitionProperty.includes("width")||r.transitionProperty==="all",s=i<80,a=n.offsetHeight>window.innerHeight*.7,l=typeof n.className=="string"?n.className:"",c=l.includes("sidebar")||l.includes("nav")||l.includes("menu");if(s&&(o||c)&&a)return console.log("[ActionExecutor] Detected collapsed container:",{width:i,hasTransition:o,isFullHeight:a,classes:n.className.substring(0,100)}),n;n=n.parentElement}return null}simulateClick(e,n){if(n){const d=this.parseOptionTextFromSelector(n);if(d){console.log("[ActionExecutor] 🎯 Detected dropdown option selector, searching for:",d);const h=this.findDropdownOption(d);if(h){console.log("[ActionExecutor] Found option by text, clicking it"),this.performClick(h);return}console.log("[ActionExecutor] Option not found by text, trying direct click")}const f=this.parseLabelFromSelector(n);if(f){console.log("[ActionExecutor] 🎯 Detected labeled combobox selector:",f);const h=this.findComboboxByLabel(f);if(h){console.log("[ActionExecutor] Found combobox by label, opening it"),this.handleComboboxClick(h);return}console.log("[ActionExecutor] Combobox not found by label, trying direct match")}}const r=this.findComboboxInput(e);if(r){console.log("[ActionExecutor] 🎯 Detected combobox/dropdown - using special handling"),this.handleComboboxClick(r);return}if(this.isDropdownOption(e)){console.log("[ActionExecutor] 🎯 Element is dropdown option - using React onClick + DOM events");const d=this.triggerReactOnClick(e);console.log(`[ActionExecutor] React onClick triggered: ${d}`),this.performClick(e);return}const i=this.findClickableElement(e),o=i.getBoundingClientRect(),s=o.left+o.width/2,a=o.top+o.height/2;if(i.focus&&i.focus(),this.hasReactOnClickHandler(i)){if(console.log("[ActionExecutor] 🎯 Element has React onClick - using direct call only"),this.triggerReactOnClick(i)){this.sendClickMetadata(i,e),console.log("[ActionExecutor] ✅ React onClick executed at",s,a,"on",i.tagName),i!==e&&console.log("[ActionExecutor] Note: Clicked parent",i.tagName,"instead of",e.tagName);return}console.log("[ActionExecutor] ⚠️ React onClick found but call failed, falling back to DOM events")}console.log("[ActionExecutor] Using humanLikeClick (no React onClick or fallback)");const c=this.humanLikeClick(i,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});c!==e&&c!==i&&console.log("[ActionExecutor] Note: humanLikeClick hit",c.tagName,"instead of element",e.tagName,"or clickTarget",i.tagName)}findComboboxInput(e){if(e.getAttribute("role")==="combobox")return console.log("[ActionExecutor] Element is combobox"),e;if(e.getAttribute("aria-haspopup")==="listbox"||e.getAttribute("aria-haspopup")==="true"){const o=e.querySelector('input[role="combobox"]');if(o)return console.log("[ActionExecutor] Found combobox via aria-haspopup container"),o;if(e.tagName==="BUTTON")return console.log("[ActionExecutor] Element is button with aria-haspopup"),e}let n=e,r=0;const i=5;for(;n&&r<i;){const o=typeof n.className=="string"?n.className:"",s=o.includes("css-")&&o.includes("control"),a=o.includes("css-")&&o.includes("ValueContainer"),l=o.includes("css-")&&o.includes("Indicator"),c=o.includes("MuiSelect-select")||o.includes("MuiAutocomplete-inputRoot"),d=(o.includes("headlessui")||o.includes("radix"))&&(o.includes("trigger")||o.includes("button"));if(s||a||l||c||d||o.includes("control")&&n.querySelector('input[role="combobox"]')||o.includes("trigger")&&n.getAttribute("aria-haspopup")){const h=n.querySelector('input[role="combobox"]');if(h)return console.log("[ActionExecutor] Found combobox input via control element"),h;const b=n.parentElement;if(b){const g=b.querySelector('input[role="combobox"]');if(g)return console.log("[ActionExecutor] Found combobox input in parent container"),g}const y=n.querySelector('button[aria-haspopup="listbox"]');if(y)return console.log("[ActionExecutor] Found listbox trigger button"),y}n=n.parentElement,r++}return null}parseOptionTextFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-option-text="([^"]+)"\]/);return r?r[1]:null}parseLabelFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-label="([^"]+)"\]/);return r?r[1]:null}stripVirtualAttributes(e){return e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim()}findComboboxByLabel(e){var r;const n=document.querySelectorAll("label");for(const i of n){const o=(r=i.textContent)==null?void 0:r.trim().replace(/\*$/,"").trim();if(o===e||o!=null&&o.includes(e)){const s=i.closest('div[class*="container"], div[aria-label], .MuiFormControl-root, form > div');if(s){const a=s.querySelector('input[role="combobox"], button[aria-haspopup="listbox"]');if(a)return console.log("[ActionExecutor] Found combobox by label:",e),a}}}return null}handleComboboxClick(e){console.log("[ActionExecutor] Opening combobox/dropdown with humanLikeClick");const r=e.closest('[class*="control"]')||e.closest('[class*="trigger"]')||e.closest("[aria-haspopup]")||e.parentElement||e,i=this.humanLikeClick(r,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});e.dispatchEvent(new FocusEvent("focus",{bubbles:!0})),e instanceof HTMLInputElement&&e.dispatchEvent(new Event("input",{bubbles:!0})),console.log("[ActionExecutor] ✅ Combobox/dropdown humanLikeClick complete, actual element:",i.tagName)}openDropdown(e){this.handleComboboxClick(e)}triggerReactOnClickPublic(e){return this.triggerReactOnClick(e)}findDropdownOption(e){var r;const n=['[role="listbox"]','[role="menu"]','[class*="menu"]:not([aria-hidden])','[class*="listbox"]','[class*="options"]',"[data-radix-popper-content-wrapper]",".MuiMenu-list",".MuiAutocomplete-listbox",".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"];for(const i of n){const o=document.querySelectorAll(i);for(const s of o){if(!Se.isVisible(s))continue;const a=['[role="option"]','[class*="option"]','[class*="item"]',"nz-option-item",".ant-select-item-option",".ant-select-item-option-content","li"];for(const l of a){const c=s.querySelectorAll(l);for(const d of c){const f=(r=d.textContent)==null?void 0:r.trim();if(f===e||f!=null&&f.includes(e))return console.log("[ActionExecutor] Found dropdown option:",f),d}}}}return null}isDropdownOption(e){if(e.getAttribute("role")==="option")return!0;const n=typeof e.className=="string"?e.className:"";return n.includes("option")||n.includes("item")?e.closest('[role="listbox"], [role="menu"], [class*="menu"], [class*="listbox"]')!==null:!1}performClick(e){this.humanLikeClick(e,{focus:!0,includePointerEvents:!0,nativeClickFallback:!0})}hasReactOnClickHandler(e){const n=["__reactProps","__reactFiber","__reactEventHandlers"];try{const o=Object.keys(e);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=e[s];if(a!=null&&a.onClick)return!0}}catch{}let r=e.parentElement,i=0;for(;r&&i<5;){try{const o=Object.keys(r);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=r[s];if(a!=null&&a.onClick)return!0}}catch{}r=r.parentElement,i++}return!1}findClickableElement(e){var a;const n=["SPAN","LABEL","P","H1","H2","H3","H4","H5","H6","TEXT","SVG","PATH"],r=l=>l.className?typeof l.className=="string"?l.className:typeof l.className.baseVal=="string"?l.className.baseVal:"":"";if(console.log("[ActionExecutor] Finding clickable element for:",e.tagName,r(e).substring(0,50)),!n.includes(e.tagName))return console.log("[ActionExecutor] Element is already interactive"),e;let i=e.parentElement,o=e,s=0;for(;i&&i!==document.body&&s<10;){s++;const l=window.getComputedStyle(i),c=l.cursor==="pointer",d=r(i),f=d.includes("cursor-pointer"),h=(a=i.classList)==null?void 0:a.contains("cursor-pointer"),b=i.hasAttribute("onclick")||i.hasAttribute("data-onclick")||i.getAttribute("role")==="button"||i.getAttribute("role")==="menuitem",y=i.tagName==="BUTTON"||i.tagName==="A";if(console.log(`[ActionExecutor] Checking parent #${s}:`,i.tagName,"cursor:",l.cursor,"hasCursorClass:",f||h,"classes:",d.substring(0,60)),(c||f||h||b||y)&&(o=i,console.log("[ActionExecutor] ✅ Found clickable parent:",i.tagName,d.substring(0,80)),y||i.getAttribute("role")==="button"))break;i=i.parentElement}return console.log("[ActionExecutor] Final click target:",o.tagName,r(o).substring(0,60)),o}triggerReactOnClick(e){try{const n=Object.keys(e);for(const s of n)if(s.startsWith("__reactFiber")||s.startsWith("__reactProps")||s.startsWith("__reactEventHandlers")){const a=e[s];if(console.log("[ActionExecutor] Found React property:",s),a!=null&&a.onClick){console.log("[ActionExecutor] 🎯 Calling React onClick directly!");const l=new MouseEvent("click",{bubbles:!0,cancelable:!0}),c={type:"click",target:e,currentTarget:e,nativeEvent:l,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{c.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>c.defaultPrevented,isPropagationStopped:()=>!1};return a.onClick(c),!0}}const r=["__reactProps","__reactFiber","__reactEventHandlers"];let i=e.parentElement,o=0;for(;i&&o<5;){const s=Object.keys(i);for(const a of s)if(r.some(l=>a.startsWith(l))){const l=i[a];if(l!=null&&l.onClick){console.log("[ActionExecutor] 🎯 Found onClick on parent, calling directly!");const c=new MouseEvent("click",{bubbles:!0,cancelable:!0}),d={type:"click",target:e,currentTarget:i,nativeEvent:c,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{d.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>d.defaultPrevented,isPropagationStopped:()=>!1};return l.onClick(d),!0}}i=i.parentElement,o++}return console.log("[ActionExecutor] No React onClick handler found"),!1}catch(n){return console.log("[ActionExecutor] Error accessing React internals:",n),!1}}sendClickMetadata(e,n){const r=d=>d.className?typeof d.className=="string"?d.className:typeof d.className.baseVal=="string"?d.className.baseVal:"":"",i=[];let o=e;for(;o&&o!==document.body&&i.length<5;){let d=o.tagName.toLowerCase();if(o.id)d=`#${o.id}`;else{const f=r(o);if(f){const h=f.trim().split(/\s+/).slice(0,3).join(".");h&&(d+="."+h)}}i.unshift(d),o=o.parentElement}const s=d=>{var b;const f=d.querySelector("span, label, p");if((b=f==null?void 0:f.textContent)!=null&&b.trim())return f.textContent.trim().substring(0,50);let h="";for(const y of Array.from(d.childNodes))y.nodeType===Node.TEXT_NODE&&(h+=(y.textContent||"").trim()+" ");return h=h.trim(),!h&&d.textContent&&(h=d.textContent.trim().substring(0,50)),h},a=window.__onboardingSDK,l=(a==null?void 0:a._botActionDepth)>0,c={type:"click",selector:i.join(" > "),text:s(n),tagName:e.tagName.toLowerCase(),timestamp:Date.now(),source:l?"bot":"user",sourceDetail:"react_onclick"};console.log("[ActionExecutor] 📤 Sending React onClick metadata:",c.text,`(source: ${c.source})`),a!=null&&a.sendMetadata?a.sendMetadata(c):console.warn("[ActionExecutor] ⚠️ SDK not found on window, cannot send metadata")}isDestructive(e){const n=["submit","delete","remove","clear"],r=['[type="submit"]',".delete",".remove"];return n.some(i=>{var o;return(o=e.description)==null?void 0:o.toLowerCase().includes(i)})||r.some(i=>e.selector.includes(i))}isHybridActionDestructive(e){var o,s;const n=["submit","delete","remove","clear","confirm","proceed"],r=((o=e.description)==null?void 0:o.toLowerCase())||"",i=((s=e.target.text)==null?void 0:s.toLowerCase())||"";return n.some(a=>r.includes(a)||i.includes(a))}async getConsent(e){const n=`Allow action: ${e.description||e.type} on ${e.selector}?`;return confirm(n)}async getHybridConsent(e){const n=e.target.text||e.target.selector||"element",r=`Allow "${e.action}" on "${n}"?
|
|
473
|
+
${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){const i=this.parseOptionTextFromSelector(e.selector);if(i){console.log("[ActionExecutor] Virtual selector detected - finding option by text:",i);const s=this.findDropdownOption(i);return s?(this.performClick(s),!0):(console.warn("[ActionExecutor] Option not found by text:",i),!1)}const o=this.parseLabelFromSelector(e.selector);if(o){console.log("[ActionExecutor] Virtual selector detected - finding combobox by label:",o);const s=this.findComboboxByLabel(o);return s?(this.handleComboboxClick(s),!0):(console.warn("[ActionExecutor] Combobox not found by label:",o),!1)}}const n=this.stripVirtualAttributes(e.selector),r=document.querySelector(n);if(!r)return console.warn("[ActionExecutor] Element not found:",n),!1;switch(e.type){case"click":this.simulateClick(r,e.selector);break;case"type":(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&(r.focus(),r.value=e.value||"",r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"select":const i=this.findComboboxInput(r);if(i){if(this.handleComboboxClick(i),await new Promise(o=>setTimeout(o,200)),e.value){const o=this.findDropdownOption(e.value);o&&this.performClick(o)}}else r instanceof HTMLSelectElement&&(r.value=e.value||"",r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"hover":r.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),r.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":r.scrollIntoView({behavior:"smooth",block:"center"});break;default:return console.warn("[ActionExecutor] Unknown action type:",e.type),!1}return!0}}class Ix{constructor(){P(this,"container",null);P(this,"highlightEl",null);P(this,"tooltipElement",null);P(this,"floeCursor",null)}inject(){this.container||(this.container=document.createElement("div"),this.container.id="onboarding-overlay",this.container.setAttribute(Ai,"overlay"),this.container.style.cssText=`
|
|
479
474
|
position: fixed;
|
|
480
475
|
top: 0;
|
|
481
476
|
left: 0;
|
|
@@ -549,7 +544,7 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
549
544
|
30% { transform: scale(0.85); }
|
|
550
545
|
100% { transform: scale(1); }
|
|
551
546
|
}
|
|
552
|
-
`,document.head.appendChild(e),document.body.appendChild(this.floeCursor),console.log("[OverlaySystem] Floe cursor injected")}showFloeCursor(){this.floeCursor&&(this.floeCursor.style.opacity="1",this.floeCursor.style.transform="scale(1)")}hideFloeCursor(){this.floeCursor&&(this.floeCursor.style.opacity="0",this.floeCursor.style.transform="scale(0.8)")}animateFloeCursorTo(e,n,r=400){return new Promise(i=>{if(!this.floeCursor){i();return}this.showFloeCursor();const o=parseFloat(this.floeCursor.style.top)||0,s=parseFloat(this.floeCursor.style.left)||0,a=performance.now(),l=s,c=o,d=f=>{const h=f-a,b=Math.min(h/r,1),y=1-Math.pow(1-b,3),
|
|
547
|
+
`,document.head.appendChild(e),document.body.appendChild(this.floeCursor),console.log("[OverlaySystem] Floe cursor injected")}showFloeCursor(){this.floeCursor&&(this.floeCursor.style.opacity="1",this.floeCursor.style.transform="scale(1)")}hideFloeCursor(){this.floeCursor&&(this.floeCursor.style.opacity="0",this.floeCursor.style.transform="scale(0.8)")}animateFloeCursorTo(e,n,r=400){return new Promise(i=>{if(!this.floeCursor){i();return}this.showFloeCursor();const o=parseFloat(this.floeCursor.style.top)||0,s=parseFloat(this.floeCursor.style.left)||0,a=performance.now(),l=s,c=o,d=f=>{const h=f-a,b=Math.min(h/r,1),y=1-Math.pow(1-b,3),g=l+(e-l)*y,S=c+(n-c)*y;this.floeCursor&&(this.floeCursor.style.left=`${g}px`,this.floeCursor.style.top=`${S}px`),b<1?requestAnimationFrame(d):i()};requestAnimationFrame(d)})}animateFloeCursorClick(){return new Promise(e=>{if(!this.floeCursor){e();return}const n=this.floeCursor.querySelector("svg");n?(n.style.animation="floeCursorClick 0.2s ease",setTimeout(()=>{n.style.animation="",e()},200)):e()})}async moveToElementAndClick(e){const n=e.getBoundingClientRect(),r=n.left+n.width/2-5,i=n.top+n.height/2-5;await this.animateFloeCursorTo(r,i,500),await new Promise(o=>setTimeout(o,100)),await this.animateFloeCursorClick()}showScreenShareModal(){return new Promise(e=>{const n=document.createElement("div");n.setAttribute(Ai,"consent-modal"),n.style.cssText=`
|
|
553
548
|
position: fixed;
|
|
554
549
|
top: 0;
|
|
555
550
|
left: 0;
|
|
@@ -801,13 +796,13 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
801
796
|
max-width: 300px;
|
|
802
797
|
text-align: center;
|
|
803
798
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
804
|
-
`,this.tooltipElement.textContent=e}hideTooltip(){this.tooltipElement&&(this.tooltipElement.remove(),this.tooltipElement=null)}remove(){var r;const e=document.getElementById("floe-cursor-styles");e&&e.remove();const n=document.getElementById("onboarding-animations");n&&n.remove(),(r=this.container)==null||r.remove(),this.container=null,this.highlightEl=null,this.tooltipElement=null}}class
|
|
799
|
+
`,this.tooltipElement.textContent=e}hideTooltip(){this.tooltipElement&&(this.tooltipElement.remove(),this.tooltipElement=null)}remove(){var r;const e=document.getElementById("floe-cursor-styles");e&&e.remove();const n=document.getElementById("onboarding-animations");n&&n.remove(),(r=this.container)==null||r.remove(),this.container=null,this.highlightEl=null,this.tooltipElement=null}}class vd{constructor(e){P(this,"piiPatterns");this.piiPatterns={email:/[\w.-]+@[\w.-]+\.\w+/,phone:/[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}/,ssn:/\d{3}-\d{2}-\d{4}/,creditCard:/\d{4}[\s.-]?\d{4}[\s.-]?\d{4}[\s.-]?\d{4}/,...e}}safeCanvasToDataURL(e,n,r){const i=`image/${n}`;try{return Promise.resolve(e.toDataURL(i,r))}catch(o){console.warn("[ScreenCapture] toDataURL failed (tainted canvas?), trying toBlob fallback:",o)}return new Promise((o,s)=>{try{e.toBlob(a=>{if(!a){s(new Error("[ScreenCapture] canvas.toBlob returned null — canvas may be tainted"));return}const l=new FileReader;l.onloadend=()=>{typeof l.result=="string"?o(l.result):s(new Error("[ScreenCapture] FileReader did not produce a string result"))},l.onerror=()=>{s(new Error("[ScreenCapture] FileReader failed to read blob"))},l.readAsDataURL(a)},i,r)}catch(a){s(new Error(`[ScreenCapture] Both toDataURL and toBlob failed for canvas export. toBlob error: ${a instanceof Error?a.message:String(a)}`))}})}static sanitizeClonedDocument(e){e.querySelectorAll("script").forEach(o=>{o.remove()});const r=e.querySelectorAll("*"),i=/^on/i;r.forEach(o=>{const s=Array.from(o.attributes);for(const a of s)i.test(a.name)&&o.removeAttribute(a.name)})}getAllTextNodes(){const e=[],n=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:i=>{const o=i.parentElement;if(!o)return NodeFilter.FILTER_REJECT;const s=window.getComputedStyle(o);return s.display==="none"||s.visibility==="hidden"||!i.textContent||!i.textContent.trim()?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let r;for(;r=n.nextNode();){const i=document.createRange();i.selectNode(r);const o=i.getBoundingClientRect();o.width>0&&o.height>0&&e.push({node:r,rect:o})}return e}containsPII(e){for(const[n,r]of Object.entries(this.piiPatterns))if(r.lastIndex=0,r.test(e))return{contains:!0,type:n};return{contains:!1}}applyBlur(e,n){const r=e.getImageData(n.x,n.y,n.width,n.height),i=r.data,o=5;for(let s=0;s<n.height;s++)for(let a=0;a<n.width;a++){let l=0,c=0,d=0,f=0,h=0;for(let y=-o;y<=o;y++)for(let g=-o;g<=o;g++){const S=a+g,v=s+y;if(S>=0&&S<n.width&&v>=0&&v<n.height){const w=(v*n.width+S)*4;l+=i[w],c+=i[w+1],d+=i[w+2],f+=i[w+3],h++}}const b=(s*n.width+a)*4;i[b]=l/h,i[b+1]=c/h,i[b+2]=d/h,i[b+3]=f/h}e.putImageData(r,n.x,n.y)}async captureWithRedaction(e={}){const{redact:n=!0,scale:r=.6,quality:i=.7,format:o="webp"}=e;if(!document.body)return console.warn("[ScreenCapture] Document body not available"),"";const s=[];if(n){const f=this.getAllTextNodes();for(const{node:h,rect:b}of f){const y=this.containsPII(h.textContent||"");y.contains&&s.push({x:b.left,y:b.top,width:b.width,height:b.height,type:y.type||"unknown"})}}const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return console.error("[ScreenCapture] Failed to get 2D canvas context"),Promise.reject(new Error("[ScreenCapture] Canvas 2D context unavailable"));const c=window.innerWidth*r,d=window.innerHeight*r;return a.width=c,a.height=d,new Promise((f,h)=>{const b=document.createElement("iframe");b.style.position="fixed",b.style.top="0",b.style.left="0",b.style.width="100%",b.style.height="100%",b.style.border="none",b.style.zIndex="-999999",document.body.appendChild(b);const y=b.contentDocument;if(y.open(),y.write(document.documentElement.outerHTML),y.close(),vd.sanitizeClonedDocument(y),n&&s.length>0){const S=y.createElement("style");if(S.textContent=`
|
|
805
800
|
.pii-redacted {
|
|
806
801
|
filter: blur(5px);
|
|
807
802
|
background: #000;
|
|
808
803
|
color: transparent !important;
|
|
809
804
|
}
|
|
810
|
-
`,y.head.appendChild(S),!y.body){console.warn("[ScreenCapture] Cloned document has no body"),document.body.removeChild(b),this.safeCanvasToDataURL(a,o,i).then(f,h);return}const v=y.createTreeWalker(y.body,NodeFilter.SHOW_TEXT);let w;for(;w=v.nextNode();)this.containsPII(w.textContent||"").contains&&w.parentElement&&w.parentElement.classList.add("pii-redacted")}const m=()=>{try{document.body.removeChild(b)}catch{}};setTimeout(()=>{try{if(!b.contentWindow){console.warn("[ScreenCapture] iframe contentWindow not available"),m(),this.safeCanvasToDataURL(a,o,i).then(f,h);return}const w=new XMLSerializer().serializeToString(y.documentElement),k=`<svg xmlns="http://www.w3.org/2000/svg" width="${window.innerWidth}" height="${window.innerHeight}"><foreignObject width="100%" height="100%">`+w+"</foreignObject></svg>",C=new Blob([k],{type:"image/svg+xml;charset=utf-8"}),T=URL.createObjectURL(C),O=new Image;O.onload=()=>{if(l.save(),l.scale(r,r),l.drawImage(O,0,0),l.restore(),URL.revokeObjectURL(T),n&&s.length>0)for(const P of s)this.applyBlur(l,{x:P.x*r,y:P.y*r,width:P.width*r,height:P.height*r});m(),this.safeCanvasToDataURL(a,o,i).then(f,h)},O.onerror=()=>{URL.revokeObjectURL(T),console.warn("[ScreenCapture] SVG image render failed, returning blank canvas"),m(),this.safeCanvasToDataURL(a,o,i).then(f,h)},O.src=T}catch(S){console.error("[ScreenCapture] Failed to render iframe content:",S),m(),this.safeCanvasToDataURL(a,o,i).then(f,h)}},100)})}async captureSimple(e={}){return this.captureWithRedaction({...e,redact:!1})}}class Rx{constructor(e){D(this,"sdk");D(this,"domIntrospector",null);D(this,"lastUrl","");D(this,"clickHandler",null);D(this,"focusHandler",null);D(this,"blurHandler",null);D(this,"inputHandler",null);D(this,"keydownHandler",null);D(this,"inputDebounceTimers",new Map);D(this,"isTracking",!1);D(this,"scrollHandler",null);D(this,"scrollDebounceTimer",null);D(this,"urlCheckInterval",null);D(this,"popstateHandler",null);this.sdk=e,this.lastUrl=window.location.href}setDOMIntrospector(e){this.domIntrospector=e,console.log("[PageTracker] DOMIntrospector set for sync captures")}start(){this.isTracking||(this.isTracking=!0,console.log("[PageTracker] Starting page event tracking"),this.sendPageMetadata(),this.setupUrlTracking(),this.clickHandler=e=>{const n=e.target;if(!n||xt(n))return;const r=this.getElementMetadata(n),i=this.sdk._botActionDepth>0?"bot":"user";this.sdk.sendMetadata({type:"click",selector:r.selector,text:r.text,tagName:r.tagName,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now(),source:i}),console.log(`[PageTracker] Click (${i}):`,r.selector,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-click")},100)},document.addEventListener("click",this.clickHandler,!0),this.scrollHandler=()=>{this.sdk.fastExecutionMode||(this.scrollDebounceTimer&&clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=setTimeout(()=>{this.sdk.fastExecutionMode||(console.log("[PageTracker] Scroll detected, capturing DOM"),this.sdk.sendMetadata({type:"scroll",scrollY:window.scrollY,scrollX:window.scrollX,viewportHeight:window.innerHeight,documentHeight:document.documentElement.scrollHeight,timestamp:Date.now()}),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-scroll"))},200))},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.focusHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||xt(n))return;const r=this.getElementMetadata(n),i=n.type||"";this.sdk.sendMetadata({type:"focus",selector:r.selector,tagName:r.tagName,inputType:i,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now()}),console.log("[PageTracker] Focus:",r.tagName,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-focus")},150)},document.addEventListener("focus",this.focusHandler,!0),this.blurHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||xt(n))return;const r=n.tagName.toLowerCase();this.sdk.sendMetadata({type:"blur",selector:this.getSelector(n),tagName:r,timestamp:Date.now()}),console.log("[PageTracker] Blur:",r),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var i;(i=this.domIntrospector)==null||i.captureAndSendImmediate("post-blur")},200)},document.addEventListener("blur",this.blurHandler,!0),this.inputHandler=e=>{const n=e.target;if(!n||xt(n))return;const r=this.inputDebounceTimers.get(n);r&&clearTimeout(r);const i=setTimeout(()=>{const o=this.getElementMetadata(n),s=n.name||n.id||n.placeholder||o.labelText||"field";this.sdk.sendMetadata({type:"form_input",selector:o.selector,field:s,inputType:n.type||"text",hasValue:!!n.value,role:o.role,ariaLabel:o.ariaLabel,placeholder:o.placeholder,labelText:o.labelText,timestamp:Date.now()}),console.log("[PageTracker] Form input:",s,o.labelText?`(label: ${o.labelText})`:""),this.inputDebounceTimers.delete(n),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-input")},500);this.inputDebounceTimers.set(n,i)},document.addEventListener("input",this.inputHandler,!0),this.keydownHandler=e=>{const n=e.target;if(!n||!(n instanceof HTMLElement)||xt(n)||!this.isInputElement(n)||!["Enter","Escape","Tab"].includes(e.key))return;const i=n.tagName.toLowerCase(),o=n.type||"";if(this.sdk.sendMetadata({type:"keydown",key:e.key,selector:this.getSelector(n),tagName:i,inputType:o,timestamp:Date.now()}),console.log("[PageTracker] Keydown:",e.key,"on",i),this.domIntrospector){const s=e.key==="Enter"?300:150;setTimeout(()=>{var a;(a=this.domIntrospector)==null||a.captureAndSendImmediate(`post-keydown-${e.key.toLowerCase()}`)},s)}},document.addEventListener("keydown",this.keydownHandler,!0),console.log("[PageTracker] Event listeners attached"))}stop(){this.isTracking&&(this.isTracking=!1,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null),this.focusHandler&&(document.removeEventListener("focus",this.focusHandler,!0),this.focusHandler=null),this.blurHandler&&(document.removeEventListener("blur",this.blurHandler,!0),this.blurHandler=null),this.inputHandler&&(document.removeEventListener("input",this.inputHandler,!0),this.inputHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler,!0),this.keydownHandler=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.scrollDebounceTimer&&(clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=null),this.urlCheckInterval&&(clearInterval(this.urlCheckInterval),this.urlCheckInterval=null),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.inputDebounceTimers.forEach(e=>{clearTimeout(e)}),this.inputDebounceTimers.clear(),console.log("[PageTracker] Stopped tracking"))}setupUrlTracking(){this.urlCheckInterval||(this.urlCheckInterval=setInterval(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},1e3),this.popstateHandler=()=>{setTimeout(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},100)},window.addEventListener("popstate",this.popstateHandler))}sendPageMetadata(){const e=Nr();this.sdk.sendMetadata({type:"page_metadata",url:e,title:document.title,pathname:window.location.pathname,timestamp:Date.now()}),console.log("[PageTracker] Page metadata sent:",e)}isInteractiveElement(e){const n=e.tagName.toLowerCase();return["input","textarea","select","button"].includes(n)||e.contentEditable==="true"}isInputElement(e){const n=e.tagName.toLowerCase();if(n==="textarea")return!0;if(n==="input"){const r=e.type||"text";return["text","search","email","password","tel","url","number"].includes(r)}return e.contentEditable==="true"}getSelector(e){if(e.id&&!e.id.match(/^(react-select-|:r|radix-)/))return`#${CSS.escape(e.id)}`;const n=e.getAttribute("role"),r=e.getAttribute("aria-label"),i=e.getAttribute("name"),o=e.getAttribute("data-testid")||e.getAttribute("data-test-id"),s=e.placeholder,a=e.tagName.toLowerCase();let l=a;if(o)return`[data-testid="${o}"]`;if(n)return l=`${a}[role="${n}"]`,r?l+=`[aria-label="${r}"]`:i&&(l+=`[name="${i}"]`),l;if(i)return`${a}[name="${i}"]`;if(s)return`${a}[placeholder="${s}"]`;if(r)return`${a}[aria-label="${r}"]`;const c=[];let d=e,f=0;for(;d&&d!==document.body&&f<5;){let h=d.tagName.toLowerCase();const b=d.getAttribute("role"),y=d.getAttribute("data-testid");if(y){c.unshift(`[data-testid="${y}"]`);break}if(b)h+=`[role="${b}"]`;else if(d.className&&typeof d.className=="string"){const m=d.className.split(" ").filter(S=>S&&!S.startsWith("css-")&&!S.startsWith("sc-")&&!S.startsWith("ng-")&&!S.startsWith("_")&&!S.match(/^[a-z]{6,}$/)&&!S.match(/^\d/)).slice(0,2);m.length>0&&(h+=`.${m.join(".")}`)}c.unshift(h),d=d.parentElement,f++}return c.join(" > ")}getElementMetadata(e){var h,b,y,m;const n=e,r=this.getSelector(e),i=((h=n.innerText)==null?void 0:h.trim().substring(0,100))||"",o=e.tagName.toLowerCase(),s=e.getAttribute("role")||void 0,a=e.getAttribute("aria-label")||void 0,l=e.placeholder||void 0;let c;const d=e.getAttribute("aria-labelledby");if(d){const S=document.getElementById(d.split(/\s+/)[0]);S&&(c=(b=S.textContent)==null?void 0:b.trim())}const f=e.getAttribute("id");if(!c&&f)try{const S=document.querySelector(`label[for="${CSS.escape(f)}"]`);S&&(c=(y=S.textContent)==null?void 0:y.trim().replace(/\*$/,"").trim())}catch{}if(!c){const S=e.closest('.MuiFormControl-root, fieldset, [class*="form-group"], [class*="form-field"], [class*="field-wrapper"]');if(S){const v=S.querySelector(":scope > label, :scope > .MuiFormLabel-root, :scope > div > label");if(v){const w=S.querySelectorAll('input, select, textarea, [role="combobox"]'),k=Array.from(w).some(C=>e.contains(C)||e===C);(w.length===1||k)&&(c=(m=v.textContent)==null?void 0:m.trim().replace(/\*$/,"").trim())}}}return{selector:r,text:i,tagName:o,role:s,ariaLabel:a,placeholder:l,labelText:c}}}class fy{constructor(){D(this,"loadingSelectors",['[role="progressbar"]',".loading",".spinner",".loader",'[aria-busy="true"]','[class*="loading"]','[class*="spinner"]','svg[class*="animate-spin"]','[data-loading="true"]',".MuiCircularProgress-root",".MuiLinearProgress-root"])}isLoading(){for(const e of this.loadingSelectors)try{const n=document.querySelector(e);if(n&&this.isVisible(n))return console.log("[LoadingDetector] Found loading indicator:",e),!0}catch{}return!1}async waitForLoadingComplete(e=5e3){const n=Date.now();for(console.log("[LoadingDetector] Waiting for loading to complete...");Date.now()-n<e;){if(!this.isLoading()&&(await new Promise(r=>setTimeout(r,100)),!this.isLoading()))return console.log("[LoadingDetector] Loading complete"),!0;await new Promise(r=>setTimeout(r,50))}return console.warn("[LoadingDetector] Timed out waiting for loading"),!1}isVisible(e){const n=getComputedStyle(e);if(n.visibility==="hidden"||n.display==="none"||n.opacity==="0")return!1;if(e.offsetParent===null){const i=n.position;if(i!=="fixed"&&i!=="sticky")return!1}const r=e.getBoundingClientRect();return r.width>0&&r.height>0}}class Nx{async waitForStable(e=300,n=5e3){return new Promise(r=>{let i,o;const s=()=>{clearTimeout(i),clearTimeout(o),a.disconnect()},a=new MutationObserver(()=>{clearTimeout(i),i=setTimeout(()=>{s(),console.log("[DOMStabilityChecker] DOM stable"),r()},e)});a.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(()=>{s(),console.log("[DOMStabilityChecker] DOM stable (no mutations)"),r()},e),o=setTimeout(()=>{s(),console.warn("[DOMStabilityChecker] Max wait time reached, proceeding anyway"),r()},n)})}}class $x{constructor(){D(this,"lastUrl","");D(this,"urlChangeCallback",null);D(this,"loadingDetector");D(this,"domStabilityChecker");D(this,"originalPushState",null);D(this,"originalReplaceState",null);D(this,"popstateHandler",null);D(this,"isStarted",!1);D(this,"handleUrlChange",async()=>{const e=window.location.href;if(e!==this.lastUrl){console.log("[NavigationCompleteDetector] URL changed:",e),this.lastUrl=e;try{await this.waitForPageStable()}catch(n){console.warn("[NavigationCompleteDetector] Error waiting for page stable:",n)}this.urlChangeCallback&&this.urlChangeCallback(Nr())}});this.lastUrl=window.location.href,this.loadingDetector=new fy,this.domStabilityChecker=new Nx}start(e){this.isStarted&&(console.warn("[NavigationCompleteDetector] Already started, stopping first"),this.stop()),console.log("[NavigationCompleteDetector] Starting navigation monitoring"),this.isStarted=!0,this.urlChangeCallback=e,this.lastUrl=window.location.href,this.setupUrlObserver(),this.popstateHandler=()=>this.handleUrlChange(),window.addEventListener("popstate",this.popstateHandler)}setupUrlObserver(){this.originalPushState||(this.originalPushState=history.pushState.bind(history)),this.originalReplaceState||(this.originalReplaceState=history.replaceState.bind(history));const e=this;history.pushState=function(...n){e.originalPushState(...n),e.handleUrlChange()},history.replaceState=function(...n){e.originalReplaceState(...n),e.handleUrlChange()}}async waitForPageStable(){console.log("[NavigationCompleteDetector] Waiting for page to stabilize...");const e=8e3,n=Date.now();await this.loadingDetector.waitForLoadingComplete(5e3);const r=e-(Date.now()-n);r>300&&await this.domStabilityChecker.waitForStable(300,Math.min(r,3e3)),console.log("[NavigationCompleteDetector] Page stable")}stop(){this.isStarted&&(console.log("[NavigationCompleteDetector] Stopping navigation monitoring"),this.isStarted=!1,this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),this.urlChangeCallback=null)}}class Fx{constructor(e,n){D(this,"overlay");D(this,"loadingDetector");D(this,"domIntrospector",null);D(this,"isExecuting",!1);this.overlay=e,this.loadingDetector=new fy}setDOMIntrospector(e){this.domIntrospector=e,console.log("[BatchedActionExecutor] DOMIntrospector set for step captures")}get isBusy(){return this.isExecuting}async executeBatch(e){if(this.isExecuting)return console.warn("[BatchedActionExecutor] Already executing a batch"),{success:!1,completedSteps:0};this.isExecuting=!0;let n=0;console.log(`[BatchedActionExecutor] ⚡ Starting fast batch with ${e.steps.length} steps`);try{for(let r=0;r<e.steps.length;r++){const i=e.steps[r];if(console.log(`[BatchedActionExecutor] Step ${r+1}/${e.steps.length}: ${i.action}`),!await this.executeStep(i))return console.error(`[BatchedActionExecutor] ❌ Step ${r+1} failed, aborting batch (completed ${n} steps)`),{success:!1,completedSteps:n};n++;const s=i.action==="wait"?100:300;await new Promise(a=>setTimeout(a,s))}return console.log("[BatchedActionExecutor] ✅ Batch completed successfully"),e.completionCallback&&e.completionCallback(),{success:!0,completedSteps:n}}finally{this.isExecuting=!1,this.overlay.clearHighlight()}}async executeStep(e){switch(e.action){case"click":return await this.executeClickStep(e);case"wait":return await this.executeWaitStep(e);case"scroll":return await this.executeScrollStep(e);default:return console.warn(`[BatchedActionExecutor] Unknown action: ${e.action}`),!1}}async executeClickStep(e){var a,l,c,d,f;if(!e.target)return console.error("[BatchedActionExecutor] Click step missing target"),!1;const n=(a=e.target.text)==null?void 0:a.toLowerCase().trim(),r=(l=e.target.tag)==null?void 0:l.toLowerCase();console.log("[BatchedActionExecutor] Looking for element:",{text:e.target.text,tag:e.target.tag,selector:e.target.selector,ariaLabel:e.target.ariaLabel,role:e.target.role,labelText:e.target.labelText,selectorFallbacks:(c=e.target.selectorFallbacks)!=null&&c.length?`${e.target.selectorFallbacks.length} fallback(s)`:void 0});let i=null;const o=3,s=[300,500,800];for(let h=0;h<=o;h++)if(h>0&&(console.log(`[BatchedActionExecutor] Retry ${h}/${o} in ${s[h-1]}ms...`),await new Promise(b=>setTimeout(b,s[h-1]))),i=Se.resolveTarget(e.target),i){const b=((d=i.textContent)==null?void 0:d.trim().toLowerCase())||"",y=i.tagName.toLowerCase();if(n&&!b.includes(n)){console.warn(`[BatchedActionExecutor] ⚠️ Found element text "${b.slice(0,50)}" doesn't match expected "${n}"`),i=null;continue}r&&y!==r&&console.log(`[BatchedActionExecutor] Note: Found ${y} instead of expected ${r} (acceptable if it contains the text)`);break}if(!i){if(console.error("[BatchedActionExecutor] ❌ Could not find matching element after retries:",e.target),n){const h=Array.from(document.querySelectorAll("*")).filter(b=>{var y;return(y=b.textContent)==null?void 0:y.toLowerCase().includes(n)}).slice(0,5).map(b=>{var y;return`${b.tagName.toLowerCase()}: "${(y=b.textContent)==null?void 0:y.trim().slice(0,50)}"`});h.length>0&&console.log("[BatchedActionExecutor] Similar elements found:",h)}return!1}return console.log("[BatchedActionExecutor] ✓ Found element:",i.tagName,(f=i.textContent)==null?void 0:f.slice(0,30)),i.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(h=>setTimeout(h,150)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(h=>setTimeout(h,100)),this.simulateClick(i),await new Promise(h=>setTimeout(h,100)),this.overlay.clearHighlight(),this.domIntrospector&&(await new Promise(h=>setTimeout(h,100)),this.domIntrospector.captureAndSendImmediate("post-batch-step-click")),!0}simulateClick(e){var n,r;try{const i=uy(e,{focus:!0,includePointerEvents:!0,includeMouseEnter:!0,nativeClickFallback:!1});i.tagName==="A"&&i.href&&console.log("[BatchedActionExecutor] Clicked link:",i.href)}catch(i){const o=((n=e.tagName)==null?void 0:n.toLowerCase())||"unknown",s=e.href||"",a=((r=e.textContent)==null?void 0:r.trim().slice(0,50))||"";console.error(`[BatchedActionExecutor] simulateClick failed on <${o}>${s?` href="${s}"`:""} "${a}":`,i);const l=i instanceof Error?i.message:String(i),c=new Error(`[BatchedActionExecutor] Click step failed on <${o}> "${a}": ${l}`);throw c.cause=i,c}}async executeWaitStep(e){const n=e.condition||"page_stable",r=e.waitMs||5e3;switch(n){case"page_stable":return await this.loadingDetector.waitForLoadingComplete(r),await new Promise(i=>setTimeout(i,400)),!0;case"loading_complete":return await this.loadingDetector.waitForLoadingComplete(r);case"element_visible":return e.target?await this.waitForElement(e.target,r):!0;default:return await new Promise(i=>setTimeout(i,e.waitMs||500)),!0}}async executeScrollStep(e){if(!e.target)return console.warn("[BatchedActionExecutor] Scroll step has no target"),!1;const n=Se.resolveTarget(e.target);return n?(n.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(r=>setTimeout(r,100)),!0):(console.warn("[BatchedActionExecutor] Scroll target not found:",e.target),!0)}async waitForElement(e,n){const r=Date.now();for(;Date.now()-r<n;){if(Se.resolveTarget(e))return!0;await new Promise(o=>setTimeout(o,100))}return!1}}class hy extends Px{constructor(n){super();D(this,"config");D(this,"sessionId");D(this,"overlay");D(this,"capture");D(this,"actionExecutor");D(this,"pipecatClient",null);D(this,"transport",null);D(this,"isInitialized",!1);D(this,"reactRoot",null);D(this,"reactContainer",null);D(this,"agentState","idle");D(this,"pausedSessionId",null);D(this,"pendingResumeSessionId",null);D(this,"botTranscript","");D(this,"userTranscript","");D(this,"transcriptHistory",[]);D(this,"lastUserTranscript","");D(this,"isConnected",!1);D(this,"connectInFlight",!1);D(this,"micEnabled",!0);D(this,"userIsSpeaking",!1);D(this,"botIsSpeaking",!1);D(this,"audioLevels",[]);D(this,"_discoveryPopupShown",!1);D(this,"_pendingDiscoveryStart",!1);D(this,"botAudioAnalyzer",null);D(this,"userAudioAnalyzer",null);D(this,"userMicStream",null);D(this,"userMicStreamRequestId",0);D(this,"audioElements",[]);D(this,"pageTracker");D(this,"screenShareEnabled",!1);D(this,"domIntrospector");D(this,"accessibleSnapshot");D(this,"fastExecutionMode",!1);D(this,"batchedActionExecutor",null);D(this,"navigationCompleteDetector",null);D(this,"_botActionDepth",0);D(this,"endUserStatus",null);D(this,"connectionProgress",null);D(this,"isReturningUser",!1);D(this,"hasSkippedOnboarding",!1);D(this,"_isMinimized",!1);if(!n.clientKey)throw new Error("Client key is required");const r="https://api.dev.floe.so";this.config={apiUrl:r,enableVideo:!1,enableAudio:!0,enableScreenCapture:!0,debug:!1,...n},this.micEnabled=this.config.enableAudio!==!1,this.sessionId=this.generateSessionId(),this.overlay=new Ix,this.capture=new md(this.config.redactionPatterns),this.actionExecutor=new Lx,this.pageTracker=new Rx(this),this.domIntrospector=new Dx,Se.setDOMIntrospector(this.domIntrospector),this.accessibleSnapshot=new gd,this.batchedActionExecutor=new Fx(this.overlay,this.actionExecutor),this.batchedActionExecutor.setDOMIntrospector(this.domIntrospector),window.__onboardingSDK=this,this.config.debug&&console.log("[OnboardingSDK] Initialized with config:",this.config)}generateSessionId(){return`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}async validateClientKeyAndBotStatus(){const n=new AbortController,r=setTimeout(()=>n.abort(),4e3);try{const i=await fetch(`${this.config.apiUrl}/sites/validate-client-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:this.config.clientKey,origin:window.location.origin}),signal:n.signal});if(clearTimeout(r),!i.ok){let s=null;try{s=await i.json()}catch{}return{valid:!1,error:(s==null?void 0:s.error)||i.statusText||`HTTP ${i.status}`}}const o=await i.json();return o.valid?{valid:!0}:{valid:!1,error:o.error||"Validation failed"}}catch(i){return clearTimeout(r),i instanceof TypeError||i instanceof DOMException&&i.name==="AbortError"?(console.warn("[OnboardingSDK] Client key validation failed due to network/timeout, proceeding anyway:",i),{valid:!0}):(console.warn("[OnboardingSDK] Unexpected error during client key validation:",i),{valid:!1})}}async startScreenShare(){try{this.pipecatClient&&(await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,console.log("[OnboardingSDK] Screen share enabled"),this.sendMetadata({type:"screen_share_status",active:!0}),this.renderReactUI())}catch(n){throw console.error("[OnboardingSDK] Screen share failed:",n),this.screenShareEnabled=!1,n}}async init(){if(this.isInitialized){console.warn("[OnboardingSDK] Already initialized");return}try{const n=await this.validateClientKeyAndBotStatus();if(!n.valid){this.config.debug&&console.log("[OnboardingSDK] Bot is disabled or invalid:",n.error);return}this.overlay.inject(),this.initReactUI(),this.config.userInfo&&(this.config.userInfo.externalId||this.config.userInfo.email)&&await this.checkEndUserStatus();const r=this.shouldSkipOnboardingModal();let i=!0;if(r)console.log("[OnboardingSDK] 🔄 Skipping onboarding modal for returning user"),this._discoveryPopupShown=!0,this.isReturningUser=!0,i=!1,console.log("[OnboardingSDK] Bot will stay closed - user clicks to start");else if(this.config.enableDiscoveryPopup!==!1){console.log("[OnboardingSDK] 🎉 Showing welcome popup before connect");const a=await this.showWelcomePopupAsync();this._discoveryPopupShown=!0,this.markUserVisited(),a?(this._pendingDiscoveryStart=!0,console.log("[OnboardingSDK] User chose guided discovery - will start after connect"),i=!0):(console.log("[OnboardingSDK] User skipped onboarding - bot will stay closed"),this.hasSkippedOnboarding=!0,i=!1)}if(!i){console.log("[OnboardingSDK] 📍 Initialized in minimized state - user clicks to connect"),this._isMinimized=!0,this.agentState="idle",this.isInitialized=!0,this.renderReactUI(),this.emit("ready");return}this.transport=new gn,this.pipecatClient=new Nt({transport:this.transport,enableMic:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback();const o=`${this.config.apiUrl}/sites/start-session`;console.log("[OnboardingSDK] Starting session via floe-api proxy:",o);const s={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};if(this.config.userInfo&&(s.sessionData.userInfo=this.config.userInfo),await this.pipecatClient.startBotAndConnect({endpoint:o,requestData:s}),this.config.enableScreenCapture)if(await this.overlay.showScreenShareModal())try{await this.startScreenShare()}catch(l){console.error("[OnboardingSDK] Screen share failed:",l)}else console.log("[OnboardingSDK] Screen share declined by user");this.isInitialized=!0,this.emit("ready")}catch(n){throw console.error("[OnboardingSDK] Initialization failed:",n),this.emit("error",n),n}}setupAudioPlayback(){this.pipecatClient&&(this.botAudioAnalyzer||(this.botAudioAnalyzer=new dy),this.userAudioAnalyzer||(this.userAudioAnalyzer=new dy),this.setupUserMicAnalysis(),this.navigationCompleteDetector||(this.navigationCompleteDetector=new $x),this.navigationCompleteDetector.start(n=>{console.log("[OnboardingSDK] Navigation complete detected:",n),this.sendMetadata({type:"navigation_complete",url:n,timestamp:Date.now()})}),console.log("[OnboardingSDK] NavigationCompleteDetector started"),this.pipecatClient.on("trackStarted",(n,r)=>{if(!(r!=null&&r.local)&&n.kind==="audio"){console.log("[OnboardingSDK] 🔊 Bot audio track started");const i=new MediaStream([n]),o=document.createElement("audio");o.autoplay=!0,o.srcObject=i,document.body.appendChild(o),this.botAudioAnalyzer&&this.botAudioAnalyzer.start(i,s=>{this.botIsSpeaking&&(this.audioLevels=s,this.renderReactUI())}),this.audioElements||(this.audioElements=[]),this.audioElements.push(o)}}),this.pipecatClient.on("trackStopped",(n,r)=>{!(r!=null&&r.local)&&n.kind==="audio"&&(console.log("[OnboardingSDK] 🔇 Bot audio track stopped"),this.botAudioAnalyzer&&this.botAudioAnalyzer.stop(),this.audioLevels=[]),r!=null&&r.local&&n.kind==="video"&&this.screenShareEnabled&&(console.log("[OnboardingSDK] 🖥️ Screen share track stopped (browser stop button)"),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1}),this.renderReactUI())}))}async setupUserMicAnalysis(){const n=++this.userMicStreamRequestId;try{const r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});if(n!==this.userMicStreamRequestId||!this.userAudioAnalyzer){console.log("[OnboardingSDK] 🎤 Mic stream request invalidated (disconnect/reconnect occurred), stopping tracks"),r.getTracks().forEach(i=>i.stop());return}this.userMicStream&&this.userMicStream.getTracks().forEach(i=>i.stop()),this.userMicStream=r,console.log("[OnboardingSDK] 🎤 User mic stream captured for visualization"),this.userAudioAnalyzer&&this.userAudioAnalyzer.start(r,i=>{this.userIsSpeaking&&(this.audioLevels=i,this.renderReactUI())})}catch(r){console.warn("[OnboardingSDK] Could not capture mic for visualization:",r)}}initReactUI(){this.reactContainer=document.createElement("div"),this.reactContainer.id="onboarding-sdk-react-ui",this.reactContainer.setAttribute(Ai,"react-ui"),this.reactContainer.style.cssText=`
|
|
805
|
+
`,y.head.appendChild(S),!y.body){console.warn("[ScreenCapture] Cloned document has no body"),document.body.removeChild(b),this.safeCanvasToDataURL(a,o,i).then(f,h);return}const v=y.createTreeWalker(y.body,NodeFilter.SHOW_TEXT);let w;for(;w=v.nextNode();)this.containsPII(w.textContent||"").contains&&w.parentElement&&w.parentElement.classList.add("pii-redacted")}const g=()=>{try{document.body.removeChild(b)}catch{}};setTimeout(()=>{try{if(!b.contentWindow){console.warn("[ScreenCapture] iframe contentWindow not available"),g(),this.safeCanvasToDataURL(a,o,i).then(f,h);return}const w=new XMLSerializer().serializeToString(y.documentElement),k=`<svg xmlns="http://www.w3.org/2000/svg" width="${window.innerWidth}" height="${window.innerHeight}"><foreignObject width="100%" height="100%">`+w+"</foreignObject></svg>",C=new Blob([k],{type:"image/svg+xml;charset=utf-8"}),E=URL.createObjectURL(C),A=new Image;A.onload=()=>{if(l.save(),l.scale(r,r),l.drawImage(A,0,0),l.restore(),URL.revokeObjectURL(E),n&&s.length>0)for(const D of s)this.applyBlur(l,{x:D.x*r,y:D.y*r,width:D.width*r,height:D.height*r});g(),this.safeCanvasToDataURL(a,o,i).then(f,h)},A.onerror=()=>{URL.revokeObjectURL(E),console.warn("[ScreenCapture] SVG image render failed, returning blank canvas"),g(),this.safeCanvasToDataURL(a,o,i).then(f,h)},A.src=E}catch(S){console.error("[ScreenCapture] Failed to render iframe content:",S),g(),this.safeCanvasToDataURL(a,o,i).then(f,h)}},100)})}async captureSimple(e={}){return this.captureWithRedaction({...e,redact:!1})}}class Rx{constructor(e){P(this,"sdk");P(this,"domIntrospector",null);P(this,"lastUrl","");P(this,"clickHandler",null);P(this,"focusHandler",null);P(this,"blurHandler",null);P(this,"inputHandler",null);P(this,"keydownHandler",null);P(this,"inputDebounceTimers",new Map);P(this,"isTracking",!1);P(this,"scrollHandler",null);P(this,"scrollDebounceTimer",null);P(this,"urlCheckInterval",null);P(this,"popstateHandler",null);this.sdk=e,this.lastUrl=window.location.href}setDOMIntrospector(e){this.domIntrospector=e,console.log("[PageTracker] DOMIntrospector set for sync captures")}start(){this.isTracking||(this.isTracking=!0,console.log("[PageTracker] Starting page event tracking"),this.sendPageMetadata(),this.setupUrlTracking(),this.clickHandler=e=>{const n=e.target;if(!n||xt(n))return;const r=this.getElementMetadata(n),i=this.sdk._botActionDepth>0?"bot":"user";this.sdk.sendMetadata({type:"click",selector:r.selector,text:r.text,tagName:r.tagName,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now(),source:i}),console.log(`[PageTracker] Click (${i}):`,r.selector,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-click")},100)},document.addEventListener("click",this.clickHandler,!0),this.scrollHandler=()=>{this.sdk.fastExecutionMode||(this.scrollDebounceTimer&&clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=setTimeout(()=>{this.sdk.fastExecutionMode||(console.log("[PageTracker] Scroll detected, capturing DOM"),this.sdk.sendMetadata({type:"scroll",scrollY:window.scrollY,scrollX:window.scrollX,viewportHeight:window.innerHeight,documentHeight:document.documentElement.scrollHeight,timestamp:Date.now()}),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-scroll"))},200))},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.focusHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||xt(n))return;const r=this.getElementMetadata(n),i=n.type||"";this.sdk.sendMetadata({type:"focus",selector:r.selector,tagName:r.tagName,inputType:i,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now()}),console.log("[PageTracker] Focus:",r.tagName,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-focus")},150)},document.addEventListener("focus",this.focusHandler,!0),this.blurHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||xt(n))return;const r=n.tagName.toLowerCase();this.sdk.sendMetadata({type:"blur",selector:this.getSelector(n),tagName:r,timestamp:Date.now()}),console.log("[PageTracker] Blur:",r),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var i;(i=this.domIntrospector)==null||i.captureAndSendImmediate("post-blur")},200)},document.addEventListener("blur",this.blurHandler,!0),this.inputHandler=e=>{const n=e.target;if(!n||xt(n))return;const r=this.inputDebounceTimers.get(n);r&&clearTimeout(r);const i=setTimeout(()=>{const o=this.getElementMetadata(n),s=n.name||n.id||n.placeholder||o.labelText||"field";this.sdk.sendMetadata({type:"form_input",selector:o.selector,field:s,inputType:n.type||"text",hasValue:!!n.value,role:o.role,ariaLabel:o.ariaLabel,placeholder:o.placeholder,labelText:o.labelText,timestamp:Date.now()}),console.log("[PageTracker] Form input:",s,o.labelText?`(label: ${o.labelText})`:""),this.inputDebounceTimers.delete(n),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-input")},500);this.inputDebounceTimers.set(n,i)},document.addEventListener("input",this.inputHandler,!0),this.keydownHandler=e=>{const n=e.target;if(!n||!(n instanceof HTMLElement)||xt(n)||!this.isInputElement(n)||!["Enter","Escape","Tab"].includes(e.key))return;const i=n.tagName.toLowerCase(),o=n.type||"";if(this.sdk.sendMetadata({type:"keydown",key:e.key,selector:this.getSelector(n),tagName:i,inputType:o,timestamp:Date.now()}),console.log("[PageTracker] Keydown:",e.key,"on",i),this.domIntrospector){const s=e.key==="Enter"?300:150;setTimeout(()=>{var a;(a=this.domIntrospector)==null||a.captureAndSendImmediate(`post-keydown-${e.key.toLowerCase()}`)},s)}},document.addEventListener("keydown",this.keydownHandler,!0),console.log("[PageTracker] Event listeners attached"))}stop(){this.isTracking&&(this.isTracking=!1,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null),this.focusHandler&&(document.removeEventListener("focus",this.focusHandler,!0),this.focusHandler=null),this.blurHandler&&(document.removeEventListener("blur",this.blurHandler,!0),this.blurHandler=null),this.inputHandler&&(document.removeEventListener("input",this.inputHandler,!0),this.inputHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler,!0),this.keydownHandler=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.scrollDebounceTimer&&(clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=null),this.urlCheckInterval&&(clearInterval(this.urlCheckInterval),this.urlCheckInterval=null),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.inputDebounceTimers.forEach(e=>{clearTimeout(e)}),this.inputDebounceTimers.clear(),console.log("[PageTracker] Stopped tracking"))}setupUrlTracking(){this.urlCheckInterval||(this.urlCheckInterval=setInterval(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},1e3),this.popstateHandler=()=>{setTimeout(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},100)},window.addEventListener("popstate",this.popstateHandler))}sendPageMetadata(){const e=En();this.sdk.sendMetadata({type:"page_metadata",url:e,title:document.title,pathname:window.location.pathname,timestamp:Date.now()}),console.log("[PageTracker] Page metadata sent:",e)}isInteractiveElement(e){const n=e.tagName.toLowerCase();return["input","textarea","select","button"].includes(n)||e.contentEditable==="true"}isInputElement(e){const n=e.tagName.toLowerCase();if(n==="textarea")return!0;if(n==="input"){const r=e.type||"text";return["text","search","email","password","tel","url","number"].includes(r)}return e.contentEditable==="true"}getSelector(e){if(e.id&&!e.id.match(/^(react-select-|:r|radix-)/))return`#${CSS.escape(e.id)}`;const n=e.getAttribute("role"),r=e.getAttribute("aria-label"),i=e.getAttribute("name"),o=e.getAttribute("data-testid")||e.getAttribute("data-test-id"),s=e.placeholder,a=e.tagName.toLowerCase();let l=a;if(o)return`[data-testid="${o}"]`;if(n)return l=`${a}[role="${n}"]`,r?l+=`[aria-label="${r}"]`:i&&(l+=`[name="${i}"]`),l;if(i)return`${a}[name="${i}"]`;if(s)return`${a}[placeholder="${s}"]`;if(r)return`${a}[aria-label="${r}"]`;const c=[];let d=e,f=0;for(;d&&d!==document.body&&f<5;){let h=d.tagName.toLowerCase();const b=d.getAttribute("role"),y=d.getAttribute("data-testid");if(y){c.unshift(`[data-testid="${y}"]`);break}if(b)h+=`[role="${b}"]`;else if(d.className&&typeof d.className=="string"){const g=d.className.split(" ").filter(S=>S&&!S.startsWith("css-")&&!S.startsWith("sc-")&&!S.startsWith("ng-")&&!S.startsWith("_")&&!S.match(/^[a-z]{6,}$/)&&!S.match(/^\d/)).slice(0,2);g.length>0&&(h+=`.${g.join(".")}`)}c.unshift(h),d=d.parentElement,f++}return c.join(" > ")}getElementMetadata(e){var h,b,y,g;const n=e,r=this.getSelector(e),i=((h=n.innerText)==null?void 0:h.trim().substring(0,100))||"",o=e.tagName.toLowerCase(),s=e.getAttribute("role")||void 0,a=e.getAttribute("aria-label")||void 0,l=e.placeholder||void 0;let c;const d=e.getAttribute("aria-labelledby");if(d){const S=document.getElementById(d.split(/\s+/)[0]);S&&(c=(b=S.textContent)==null?void 0:b.trim())}const f=e.getAttribute("id");if(!c&&f)try{const S=document.querySelector(`label[for="${CSS.escape(f)}"]`);S&&(c=(y=S.textContent)==null?void 0:y.trim().replace(/\*$/,"").trim())}catch{}if(!c){const S=e.closest('.MuiFormControl-root, fieldset, [class*="form-group"], [class*="form-field"], [class*="field-wrapper"]');if(S){const v=S.querySelector(":scope > label, :scope > .MuiFormLabel-root, :scope > div > label");if(v){const w=S.querySelectorAll('input, select, textarea, [role="combobox"]'),k=Array.from(w).some(C=>e.contains(C)||e===C);(w.length===1||k)&&(c=(g=v.textContent)==null?void 0:g.trim().replace(/\*$/,"").trim())}}}return{selector:r,text:i,tagName:o,role:s,ariaLabel:a,placeholder:l,labelText:c}}}class hy{constructor(){P(this,"loadingSelectors",['[role="progressbar"]',".loading",".spinner",".loader",'[aria-busy="true"]','[class*="loading"]','[class*="spinner"]','svg[class*="animate-spin"]','[data-loading="true"]',".MuiCircularProgress-root",".MuiLinearProgress-root"])}isLoading(){for(const e of this.loadingSelectors)try{const n=document.querySelector(e);if(n&&this.isVisible(n))return console.log("[LoadingDetector] Found loading indicator:",e),!0}catch{}return!1}async waitForLoadingComplete(e=5e3){const n=Date.now();for(console.log("[LoadingDetector] Waiting for loading to complete...");Date.now()-n<e;){if(!this.isLoading()&&(await new Promise(r=>setTimeout(r,100)),!this.isLoading()))return console.log("[LoadingDetector] Loading complete"),!0;await new Promise(r=>setTimeout(r,50))}return console.warn("[LoadingDetector] Timed out waiting for loading"),!1}isVisible(e){const n=getComputedStyle(e);if(n.visibility==="hidden"||n.display==="none"||n.opacity==="0")return!1;if(e.offsetParent===null){const i=n.position;if(i!=="fixed"&&i!=="sticky")return!1}const r=e.getBoundingClientRect();return r.width>0&&r.height>0}}class Nx{async waitForStable(e=300,n=5e3){return new Promise(r=>{let i,o;const s=()=>{clearTimeout(i),clearTimeout(o),a.disconnect()},a=new MutationObserver(()=>{clearTimeout(i),i=setTimeout(()=>{s(),console.log("[DOMStabilityChecker] DOM stable"),r()},e)});a.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(()=>{s(),console.log("[DOMStabilityChecker] DOM stable (no mutations)"),r()},e),o=setTimeout(()=>{s(),console.warn("[DOMStabilityChecker] Max wait time reached, proceeding anyway"),r()},n)})}}class $x{constructor(){P(this,"lastUrl","");P(this,"urlChangeCallback",null);P(this,"loadingDetector");P(this,"domStabilityChecker");P(this,"originalPushState",null);P(this,"originalReplaceState",null);P(this,"popstateHandler",null);P(this,"isStarted",!1);P(this,"handleUrlChange",async()=>{const e=window.location.href;if(e!==this.lastUrl){console.log("[NavigationCompleteDetector] URL changed:",e),this.lastUrl=e;try{await this.waitForPageStable()}catch(n){console.warn("[NavigationCompleteDetector] Error waiting for page stable:",n)}this.urlChangeCallback&&this.urlChangeCallback(En())}});this.lastUrl=window.location.href,this.loadingDetector=new hy,this.domStabilityChecker=new Nx}start(e){this.isStarted&&(console.warn("[NavigationCompleteDetector] Already started, stopping first"),this.stop()),console.log("[NavigationCompleteDetector] Starting navigation monitoring"),this.isStarted=!0,this.urlChangeCallback=e,this.lastUrl=window.location.href,this.setupUrlObserver(),this.popstateHandler=()=>this.handleUrlChange(),window.addEventListener("popstate",this.popstateHandler)}setupUrlObserver(){this.originalPushState||(this.originalPushState=history.pushState.bind(history)),this.originalReplaceState||(this.originalReplaceState=history.replaceState.bind(history));const e=this;history.pushState=function(...n){e.originalPushState(...n),e.handleUrlChange()},history.replaceState=function(...n){e.originalReplaceState(...n),e.handleUrlChange()}}async waitForPageStable(){console.log("[NavigationCompleteDetector] Waiting for page to stabilize...");const e=8e3,n=Date.now();await this.loadingDetector.waitForLoadingComplete(5e3);const r=e-(Date.now()-n);r>300&&await this.domStabilityChecker.waitForStable(300,Math.min(r,3e3)),console.log("[NavigationCompleteDetector] Page stable")}stop(){this.isStarted&&(console.log("[NavigationCompleteDetector] Stopping navigation monitoring"),this.isStarted=!1,this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),this.urlChangeCallback=null)}}class Fx{constructor(e,n){P(this,"overlay");P(this,"loadingDetector");P(this,"domIntrospector",null);P(this,"isExecuting",!1);this.overlay=e,this.loadingDetector=new hy}setDOMIntrospector(e){this.domIntrospector=e,console.log("[BatchedActionExecutor] DOMIntrospector set for step captures")}get isBusy(){return this.isExecuting}async executeBatch(e){if(this.isExecuting)return console.warn("[BatchedActionExecutor] Already executing a batch"),{success:!1,completedSteps:0};this.isExecuting=!0;let n=0;console.log(`[BatchedActionExecutor] ⚡ Starting fast batch with ${e.steps.length} steps`);try{for(let r=0;r<e.steps.length;r++){const i=e.steps[r];if(console.log(`[BatchedActionExecutor] Step ${r+1}/${e.steps.length}: ${i.action}`),!await this.executeStep(i))return console.error(`[BatchedActionExecutor] ❌ Step ${r+1} failed, aborting batch (completed ${n} steps)`),{success:!1,completedSteps:n};n++;const s=i.action==="wait"?100:300;await new Promise(a=>setTimeout(a,s))}return console.log("[BatchedActionExecutor] ✅ Batch completed successfully"),e.completionCallback&&e.completionCallback(),{success:!0,completedSteps:n}}finally{this.isExecuting=!1,this.overlay.clearHighlight()}}async executeStep(e){switch(e.action){case"click":return await this.executeClickStep(e);case"wait":return await this.executeWaitStep(e);case"scroll":return await this.executeScrollStep(e);default:return console.warn(`[BatchedActionExecutor] Unknown action: ${e.action}`),!1}}async executeClickStep(e){var a,l,c,d,f;if(!e.target)return console.error("[BatchedActionExecutor] Click step missing target"),!1;const n=(a=e.target.text)==null?void 0:a.toLowerCase().trim(),r=(l=e.target.tag)==null?void 0:l.toLowerCase();console.log("[BatchedActionExecutor] Looking for element:",{text:e.target.text,tag:e.target.tag,selector:e.target.selector,ariaLabel:e.target.ariaLabel,role:e.target.role,labelText:e.target.labelText,selectorFallbacks:(c=e.target.selectorFallbacks)!=null&&c.length?`${e.target.selectorFallbacks.length} fallback(s)`:void 0});let i=null;const o=3,s=[300,500,800];for(let h=0;h<=o;h++)if(h>0&&(console.log(`[BatchedActionExecutor] Retry ${h}/${o} in ${s[h-1]}ms...`),await new Promise(b=>setTimeout(b,s[h-1]))),i=Se.resolveTarget(e.target),i){const b=((d=i.textContent)==null?void 0:d.trim().toLowerCase())||"",y=i.tagName.toLowerCase();if(n&&!b.includes(n)){console.warn(`[BatchedActionExecutor] ⚠️ Found element text "${b.slice(0,50)}" doesn't match expected "${n}"`),i=null;continue}r&&y!==r&&console.log(`[BatchedActionExecutor] Note: Found ${y} instead of expected ${r} (acceptable if it contains the text)`);break}if(!i){if(console.error("[BatchedActionExecutor] ❌ Could not find matching element after retries:",e.target),n){const h=Array.from(document.querySelectorAll("*")).filter(b=>{var y;return(y=b.textContent)==null?void 0:y.toLowerCase().includes(n)}).slice(0,5).map(b=>{var y;return`${b.tagName.toLowerCase()}: "${(y=b.textContent)==null?void 0:y.trim().slice(0,50)}"`});h.length>0&&console.log("[BatchedActionExecutor] Similar elements found:",h)}return!1}return console.log("[BatchedActionExecutor] ✓ Found element:",i.tagName,(f=i.textContent)==null?void 0:f.slice(0,30)),i.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(h=>setTimeout(h,150)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(h=>setTimeout(h,100)),this.simulateClick(i),await new Promise(h=>setTimeout(h,100)),this.overlay.clearHighlight(),this.domIntrospector&&(await new Promise(h=>setTimeout(h,100)),this.domIntrospector.captureAndSendImmediate("post-batch-step-click")),!0}simulateClick(e){var n,r;try{const i=dy(e,{focus:!0,includePointerEvents:!0,includeMouseEnter:!0,nativeClickFallback:!1});i.tagName==="A"&&i.href&&console.log("[BatchedActionExecutor] Clicked link:",i.href)}catch(i){const o=((n=e.tagName)==null?void 0:n.toLowerCase())||"unknown",s=e.href||"",a=((r=e.textContent)==null?void 0:r.trim().slice(0,50))||"";console.error(`[BatchedActionExecutor] simulateClick failed on <${o}>${s?` href="${s}"`:""} "${a}":`,i);const l=i instanceof Error?i.message:String(i),c=new Error(`[BatchedActionExecutor] Click step failed on <${o}> "${a}": ${l}`);throw c.cause=i,c}}async executeWaitStep(e){const n=e.condition||"page_stable",r=e.waitMs||5e3;switch(n){case"page_stable":return await this.loadingDetector.waitForLoadingComplete(r),await new Promise(i=>setTimeout(i,400)),!0;case"loading_complete":return await this.loadingDetector.waitForLoadingComplete(r);case"element_visible":return e.target?await this.waitForElement(e.target,r):!0;default:return await new Promise(i=>setTimeout(i,e.waitMs||500)),!0}}async executeScrollStep(e){if(!e.target)return console.warn("[BatchedActionExecutor] Scroll step has no target"),!1;const n=Se.resolveTarget(e.target);return n?(n.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(r=>setTimeout(r,100)),!0):(console.warn("[BatchedActionExecutor] Scroll target not found:",e.target),!0)}async waitForElement(e,n){const r=Date.now();for(;Date.now()-r<n;){if(Se.resolveTarget(e))return!0;await new Promise(o=>setTimeout(o,100))}return!1}}class py extends Dx{constructor(n){super();P(this,"config");P(this,"sessionId");P(this,"overlay");P(this,"capture");P(this,"actionExecutor");P(this,"pipecatClient",null);P(this,"transport",null);P(this,"isInitialized",!1);P(this,"reactRoot",null);P(this,"reactContainer",null);P(this,"agentState","idle");P(this,"pausedSessionId",null);P(this,"pendingResumeSessionId",null);P(this,"botTranscript","");P(this,"userTranscript","");P(this,"transcriptHistory",[]);P(this,"lastUserTranscript","");P(this,"isConnected",!1);P(this,"connectInFlight",!1);P(this,"micEnabled",!0);P(this,"userIsSpeaking",!1);P(this,"botIsSpeaking",!1);P(this,"audioLevels",[]);P(this,"_discoveryPopupShown",!1);P(this,"_pendingDiscoveryStart",!1);P(this,"botAudioAnalyzer",null);P(this,"userAudioAnalyzer",null);P(this,"userMicStream",null);P(this,"userMicStreamRequestId",0);P(this,"audioElements",[]);P(this,"pageTracker");P(this,"screenShareEnabled",!1);P(this,"domIntrospector");P(this,"accessibleSnapshot");P(this,"fastExecutionMode",!1);P(this,"batchedActionExecutor",null);P(this,"navigationCompleteDetector",null);P(this,"_botActionDepth",0);P(this,"endUserStatus",null);P(this,"connectionProgress",null);P(this,"isReturningUser",!1);P(this,"hasSkippedOnboarding",!1);P(this,"_isMinimized",!1);if(!n.clientKey)throw new Error("Client key is required");const r="https://api.dev.floe.so";this.config={apiUrl:r,enableVideo:!1,enableAudio:!0,enableScreenCapture:!0,debug:!1,...n},this.micEnabled=this.config.enableAudio!==!1,this.sessionId=this.generateSessionId(),this.overlay=new Ix,this.capture=new vd(this.config.redactionPatterns),this.actionExecutor=new Lx,this.pageTracker=new Rx(this),this.domIntrospector=new Px,Se.setDOMIntrospector(this.domIntrospector),this.accessibleSnapshot=new md,this.batchedActionExecutor=new Fx(this.overlay,this.actionExecutor),this.batchedActionExecutor.setDOMIntrospector(this.domIntrospector),window.__onboardingSDK=this,this.config.debug&&console.log("[OnboardingSDK] Initialized with config:",this.config)}generateSessionId(){return`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}async validateClientKeyAndBotStatus(){const n=new AbortController,r=setTimeout(()=>n.abort(),4e3);try{const i=await fetch(`${this.config.apiUrl}/sites/validate-client-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:this.config.clientKey,origin:window.location.origin}),signal:n.signal});if(clearTimeout(r),!i.ok){let s=null;try{s=await i.json()}catch{}return{valid:!1,error:(s==null?void 0:s.error)||i.statusText||`HTTP ${i.status}`}}const o=await i.json();return o.valid?{valid:!0}:{valid:!1,error:o.error||"Validation failed"}}catch(i){return clearTimeout(r),i instanceof TypeError||i instanceof DOMException&&i.name==="AbortError"?(console.warn("[OnboardingSDK] Client key validation failed due to network/timeout, proceeding anyway:",i),{valid:!0}):(console.warn("[OnboardingSDK] Unexpected error during client key validation:",i),{valid:!1})}}async startScreenShare(){try{this.pipecatClient&&(await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,console.log("[OnboardingSDK] Screen share enabled"),this.sendMetadata({type:"screen_share_status",active:!0}),this.renderReactUI())}catch(n){throw console.error("[OnboardingSDK] Screen share failed:",n),this.screenShareEnabled=!1,n}}async init(){if(this.isInitialized){console.warn("[OnboardingSDK] Already initialized");return}try{const n=await this.validateClientKeyAndBotStatus();if(!n.valid){this.config.debug&&console.log("[OnboardingSDK] Bot is disabled or invalid:",n.error);return}this._finalizePendingNavigation(),this.overlay.inject(),this.initReactUI(),this.config.userInfo&&(this.config.userInfo.externalId||this.config.userInfo.email)&&await this.checkEndUserStatus();const r=this.shouldSkipOnboardingModal();let i=!0;if(r)console.log("[OnboardingSDK] 🔄 Skipping onboarding modal for returning user"),this._discoveryPopupShown=!0,this.isReturningUser=!0,i=!1,console.log("[OnboardingSDK] Bot will stay closed - user clicks to start");else if(this.config.enableDiscoveryPopup!==!1){console.log("[OnboardingSDK] 🎉 Showing welcome popup before connect");const a=await this.showWelcomePopupAsync();this._discoveryPopupShown=!0,this.markUserVisited(),a?(this._pendingDiscoveryStart=!0,console.log("[OnboardingSDK] User chose guided discovery - will start after connect"),i=!0):(console.log("[OnboardingSDK] User skipped onboarding - bot will stay closed"),this.hasSkippedOnboarding=!0,i=!1)}if(!i){console.log("[OnboardingSDK] 📍 Initialized in minimized state - user clicks to connect"),this._isMinimized=!0,this.agentState="idle",this.isInitialized=!0,this.renderReactUI(),this.emit("ready");return}this.transport=new gn,this.pipecatClient=new Nt({transport:this.transport,enableMic:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback();const o=`${this.config.apiUrl}/sites/start-session`;console.log("[OnboardingSDK] Starting session via floe-api proxy:",o);const s={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};if(this.config.userInfo&&(s.sessionData.userInfo=this.config.userInfo),await this.pipecatClient.startBotAndConnect({endpoint:o,requestData:s}),this.config.enableScreenCapture)if(await this.overlay.showScreenShareModal())try{await this.startScreenShare()}catch(l){console.error("[OnboardingSDK] Screen share failed:",l)}else console.log("[OnboardingSDK] Screen share declined by user");this.isInitialized=!0,this.emit("ready")}catch(n){throw console.error("[OnboardingSDK] Initialization failed:",n),this.emit("error",n),n}}setupAudioPlayback(){this.pipecatClient&&(this.botAudioAnalyzer||(this.botAudioAnalyzer=new fy),this.userAudioAnalyzer||(this.userAudioAnalyzer=new fy),this.setupUserMicAnalysis(),this.navigationCompleteDetector||(this.navigationCompleteDetector=new $x),this.navigationCompleteDetector.start(n=>{console.log("[OnboardingSDK] Navigation complete detected:",n),this.sendMetadata({type:"navigation_complete",url:n,timestamp:Date.now()})}),console.log("[OnboardingSDK] NavigationCompleteDetector started"),this.pipecatClient.on("trackStarted",(n,r)=>{if(!(r!=null&&r.local)&&n.kind==="audio"){console.log("[OnboardingSDK] 🔊 Bot audio track started");const i=new MediaStream([n]),o=document.createElement("audio");o.autoplay=!0,o.srcObject=i,document.body.appendChild(o),this.botAudioAnalyzer&&this.botAudioAnalyzer.start(i,s=>{this.botIsSpeaking&&(this.audioLevels=s,this.renderReactUI())}),this.audioElements||(this.audioElements=[]),this.audioElements.push(o)}}),this.pipecatClient.on("trackStopped",(n,r)=>{!(r!=null&&r.local)&&n.kind==="audio"&&(console.log("[OnboardingSDK] 🔇 Bot audio track stopped"),this.botAudioAnalyzer&&this.botAudioAnalyzer.stop(),this.audioLevels=[]),r!=null&&r.local&&n.kind==="video"&&this.screenShareEnabled&&(console.log("[OnboardingSDK] 🖥️ Screen share track stopped (browser stop button)"),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1}),this.renderReactUI())}))}async setupUserMicAnalysis(){const n=++this.userMicStreamRequestId;try{const r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});if(n!==this.userMicStreamRequestId||!this.userAudioAnalyzer){console.log("[OnboardingSDK] 🎤 Mic stream request invalidated (disconnect/reconnect occurred), stopping tracks"),r.getTracks().forEach(i=>i.stop());return}this.userMicStream&&this.userMicStream.getTracks().forEach(i=>i.stop()),this.userMicStream=r,console.log("[OnboardingSDK] 🎤 User mic stream captured for visualization"),this.userAudioAnalyzer&&this.userAudioAnalyzer.start(r,i=>{this.userIsSpeaking&&(this.audioLevels=i,this.renderReactUI())})}catch(r){console.warn("[OnboardingSDK] Could not capture mic for visualization:",r)}}initReactUI(){this.reactContainer=document.createElement("div"),this.reactContainer.id="onboarding-sdk-react-ui",this.reactContainer.setAttribute(Ai,"react-ui"),this.reactContainer.style.cssText=`
|
|
811
806
|
position: fixed;
|
|
812
807
|
top: 0;
|
|
813
808
|
left: 0;
|
|
@@ -815,7 +810,7 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
815
810
|
height: 100%;
|
|
816
811
|
pointer-events: none;
|
|
817
812
|
z-index: 2147483646;
|
|
818
|
-
`,document.body.appendChild(this.reactContainer),this.reactRoot=ac.createRoot(this.reactContainer),this.renderReactUI()}renderReactUI(){var n,r,i;this.reactRoot&&this.reactRoot.render(Qp.createElement(Mx,{connected:this.isConnected,voiceEnabled:this.micEnabled,agentState:this.agentState,botTranscript:this.botTranscript,userTranscript:this.userTranscript,transcriptHistory:[...this.transcriptHistory],screenShareEnabled:this.screenShareEnabled,userIsSpeaking:this.userIsSpeaking,botIsSpeaking:this.botIsSpeaking,audioLevels:[...this.audioLevels],onToggleConnection:()=>this.handleToggleConnection(),onToggleMute:()=>this.toggleMute(),onToggleScreenShare:()=>this.handleToggleScreenShare(),onResume:this.pausedSessionId?()=>this.resumeSession(this.pausedSessionId):void 0,pausedSessionId:this.pausedSessionId||void 0,onStop:this.agentState==="paused"?()=>this.stopSession():void 0,connectionProgress:this.connectionProgress||void 0,isReturningUser:this.isReturningUser,hasSkippedOnboarding:this.hasSkippedOnboarding,onMinimize:()=>this.handleMinimize(),onExpand:()=>this.handleExpand(),nudgeText:(n=this.config.nudge)==null?void 0:n.text,nudgeAutoHideDelay:(r=this.config.nudge)==null?void 0:r.autoHideDelay,nudgeAutoShow:(i=this.config.nudge)==null?void 0:i.autoShow}))}handleMinimize(){this._isMinimized=!0,console.log("[OnboardingSDK] UI minimized"),this.renderReactUI(),this.emit("minimized")}handleExpand(){this._isMinimized=!1,console.log("[OnboardingSDK] UI expanded"),this.renderReactUI(),this.emit("expanded")}setConnectionProgress(n,r,i){this.connectionProgress={stage:n,message:r,progress:i},this.renderReactUI()}clearConnectionProgress(){this.connectionProgress=null,this.renderReactUI()}async handleToggleConnection(){if(this.isConnected){console.log("[OnboardingSDK] Disconnecting and minimizing...");try{await this.disconnectAndMinimize()}catch(n){console.error("[OnboardingSDK] Error during disconnect and minimize:",n),this.emit("error",n)}return}if(this.connectInFlight){console.log("[OnboardingSDK] Connection operation already in progress, ignoring...");return}try{await this.connectWithProgress()}catch(n){console.log("[OnboardingSDK] Connection error handled in handleToggleConnection:",n)}}async disconnectAndMinimize(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.clearHighlight(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.isConnected=!1,this.agentState="idle",this._isMinimized=!0,this.botTranscript="",this.userTranscript="",this.renderReactUI(),console.log("[OnboardingSDK] Disconnected and minimized"),this.emit("disconnected"),this.emit("minimized")}async connectWithProgress(){if(this.connectInFlight){console.log("[OnboardingSDK] Connection already in progress, ignoring...");return}this.connectInFlight=!0;try{this.agentState="connecting",this._isMinimized=!1,this.setConnectionProgress("initializing","Initializing...",10),this.transport=new gn,this.setConnectionProgress("authenticating","Authenticating...",30),this.pipecatClient=new Nt({transport:this.transport,enableMic:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback(),this.setConnectionProgress("connecting","Connecting to server...",50);const n=`${this.config.apiUrl}/sites/start-session`;console.log("[OnboardingSDK] Starting session via floe-api proxy:",n);const r={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};this.config.userInfo&&(r.sessionData.userInfo=this.config.userInfo),this.setConnectionProgress("joining","Joining session...",70),await this.pipecatClient.startBotAndConnect({endpoint:n,requestData:r}),this.setConnectionProgress("ready","Connected!",100),setTimeout(()=>{this.clearConnectionProgress()},500)}catch(n){console.error("[OnboardingSDK] Connection failed:",n),this.setConnectionProgress("error","Connection failed",0),this.agentState="idle",setTimeout(()=>{this.clearConnectionProgress(),this.renderReactUI()},3e3),this.emit("error",n)}finally{this.connectInFlight=!1}}createPipecatCallbacks(){return{onConnected:()=>{var n;console.log("[OnboardingSDK] Connected to Pipecat"),this.isConnected=!0,this.agentState="listening",this.micEnabled=((n=this.pipecatClient)==null?void 0:n.isMicEnabled)??this.config.enableAudio!==!1,console.log("[OnboardingSDK] 🎤 Mic state on connect:",this.micEnabled?"ON":"MUTED"),this.clearConnectionProgress(),this.renderReactUI(),this.emit("connected")},onDisconnected:()=>{console.log("[OnboardingSDK] Disconnected from Pipecat"),this.isConnected=!1,this.agentState="idle",this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.clearHighlight(),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(console.log("[OnboardingSDK] 🎤 Stopping user microphone stream"),this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.renderReactUI(),this.emit("disconnected")},onBotReady:()=>{var n;if(console.log("[OnboardingSDK] Bot ready - transport is now in ready state"),this.domIntrospector.startCapturing(1500,r=>{const i=this.accessibleSnapshot.capture(r.captureReason);this.sendAccessibleSnapshot(i),this.sendDOMSnapshot(r)}),console.log("[OnboardingSDK] DOM Introspection Layer started (with Accessible Snapshot)"),this.pageTracker.setDOMIntrospector(this.domIntrospector),this.pageTracker.start(),console.log("[OnboardingSDK] PageTracker started"),this.config.clientKey){console.log("[OnboardingSDK] Sending site initialization with client key");const r={clientKey:this.config.clientKey,origin:window.location.origin,userInfo:this.config.userInfo};this.pendingResumeSessionId&&(r.resumeSessionId=this.pendingResumeSessionId,console.log(`[OnboardingSDK] Resuming session: ${this.pendingResumeSessionId}`),this.pendingResumeSessionId=null),(n=this.pipecatClient)==null||n.sendClientMessage("site_init",r)}this.emit("botReady"),this._pendingDiscoveryStart&&(console.log("[OnboardingSDK] 🔍 Starting pending guided discovery"),this._pendingDiscoveryStart=!1,setTimeout(()=>{this.isConnected&&this.startGuidedDiscovery()},500))},onUserTranscript:n=>{console.log("[OnboardingSDK] 🎤 User transcript:",n.text,n.final?"(final)":"(interim)"),n.text&&(this.userTranscript=n.text),n.final&&n.text&&(this.lastUserTranscript=n.text),this.emit("userTranscript",n),this.handleUserInput(n.text),this.renderReactUI()},onBotTtsText:n=>{console.log("[OnboardingSDK] 🤖 Bot TTS text:",n.text),n.text&&(this.botTranscript&&!this.botTranscript.endsWith(" ")&&!n.text.startsWith(" ")&&(this.botTranscript+=" "),this.botTranscript+=n.text,this.renderReactUI())},onUserStartedSpeaking:()=>{console.log("[OnboardingSDK] 🎤 User started speaking"),this.agentState="listening",this.userIsSpeaking=!0,this.renderReactUI(),this.emit("userSpeaking",!0)},onUserStoppedSpeaking:()=>{console.log("[OnboardingSDK] 🛑 User stopped speaking"),this.agentState="thinking",this.userIsSpeaking=!1,this.lastUserTranscript&&(this.transcriptHistory.push({id:`user-${Date.now()}`,role:"user",content:this.lastUserTranscript,timestamp:Date.now()}),console.log("[OnboardingSDK] 📝 Added user message to history:",this.lastUserTranscript),this.lastUserTranscript=""),this.userTranscript="",this.renderReactUI(),this.emit("userSpeaking",!1)},onBotStartedSpeaking:()=>{console.log("[OnboardingSDK] 🔊 Bot started speaking"),this.agentState="speaking",this.botIsSpeaking=!0,this.userTranscript="",this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!0)},onBotStoppedSpeaking:()=>{console.log("[OnboardingSDK] 🔇 Bot stopped speaking"),this.agentState="listening",this.botIsSpeaking=!1,this.botTranscript&&(this.transcriptHistory.push({id:`assistant-${Date.now()}`,role:"assistant",content:this.botTranscript,timestamp:Date.now()}),console.log("[OnboardingSDK] 📝 Added assistant message to history:",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!1)},onServerMessage:n=>{console.log("[OnboardingSDK] Server message:",n),this.handleServerMessage(n)},onError:n=>{console.error("[OnboardingSDK] Error:",n),this.emit("error",n)}}}async resumeSession(n){console.log(`[OnboardingSDK] Resuming session: ${n}`),this.pendingResumeSessionId=n,this.agentState="idle",console.log("[OnboardingSDK] Forcing full reconnect for resume (bot pipeline was cancelled)"),this.isConnected&&await this.disconnect(),await new Promise(r=>setTimeout(r,100)),await this.init()}async stopSession(){console.log("[OnboardingSDK] Stopping paused session"),this.agentState="idle",this.pausedSessionId=null,this.pendingResumeSessionId=null,this.isConnected&&await this.disconnect(),this.renderReactUI(),this.emit("sessionStopped")}async handleToggleScreenShare(){if(!this.pipecatClient){console.warn("[OnboardingSDK] Cannot toggle screen share: client not initialized");return}try{this.screenShareEnabled?(console.log("[OnboardingSDK] Stopping screen share"),await this.pipecatClient.enableScreenShare(!1),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1})):(console.log("[OnboardingSDK] Starting screen share"),await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,this.sendMetadata({type:"screen_share_status",active:!0})),this.renderReactUI()}catch(n){console.error("[OnboardingSDK] Failed to toggle screen share:",n),this.emit("error",n)}}sendMetadata(n){if(this.pipecatClient&&this.isConnected){const r=n.type||"metadata";console.log(`[OnboardingSDK] Sending metadata: ${r}`,n),this.pipecatClient.sendClientMessage(r,n)}else console.warn("[OnboardingSDK] Cannot send metadata - not connected")}sendDOMSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.2&&console.log(`[OnboardingSDK] Sending DOM snapshot: ${n.totalElements} elements`),this.pipecatClient.sendClientMessage("dom_snapshot",{type:"dom_snapshot",...n}))}sendAccessibleSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.3&&(console.log(`[OnboardingSDK] Sending accessible snapshot: ${n.elementCount} elements (reduced from DOM)`),this.config.debug&&console.log("[OnboardingSDK] Accessible elements:",n.elements.slice(0,5).map(r=>`${r.ref}: ${r.role} "${r.name}"`).join(", "),n.elements.length>5?"...":"")),this.pipecatClient.sendClientMessage("accessible_snapshot",{type:"accessible_snapshot",...n}))}async handleUserInput(n){await this.extractIntent(n),this.config.enableScreenCapture&&await this.captureContext()}handleServerMessage(n){console.log("[OnboardingSDK] 📥 Server message received:",JSON.stringify(n,null,2));let r=n;if(n.data&&typeof n.data=="object"&&(console.log("[OnboardingSDK] Unwrapping RTVIServerMessageFrame data"),r=n.data),r.type==="ui_action"&&r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received UI action from bot:",r.action),console.log("[OnboardingSDK] Target:",JSON.stringify(r.target,null,2)),this.handleHybridAction({action:r.action,target:r.target,value:r.value,description:r.description,precondition:r.precondition});return}if(r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received direct hybrid action:",r.action),this.handleHybridAction(r);return}r.type==="highlight"?(console.log("[OnboardingSDK] Handling highlight command"),r.target?this.overlay.highlightTarget(r.target,r.options):r.selector&&this.overlay.highlight(r.selector,r.options)):r.type==="tooltip"&&r.text?this.overlay.showTooltip(r.text,r.options):r.type==="action"?r.target?this.handleHybridAction(r):this.actionExecutor.executeWithConsent(r.action):r.type==="clear_highlight"?this.overlay.clearHighlight():r.type==="batched_navigation"?this.handleBatchedNavigation(r):r.type==="fast_action"?this.executeActionFast(r):r.type==="execute_api"||r.action==="execute_api"?this.handleExecuteApi(r):r.type==="session_paused"?(console.log("[OnboardingSDK] Session paused:",r),this.agentState="paused",this.pausedSessionId=r.session_id||null,this.overlay.clearHighlight(),this.renderReactUI(),this.emit("sessionPaused",r)):console.log("[OnboardingSDK] Unhandled server message type:",r.type||"unknown")}async handleHybridAction(n){switch(console.log("[OnboardingSDK] 🎯 Handling hybrid action:",n.action),console.log("[OnboardingSDK] Target strategies:",n.target.strategy||"auto-detect"),console.log("[OnboardingSDK] Target text:",n.target.text),console.log("[OnboardingSDK] Target selector:",n.target.selector),console.log("[OnboardingSDK] Target tag:",n.target.tag),n.action){case"highlight":console.log("[OnboardingSDK] 💡 Executing HIGHLIGHT action"),this.overlay.highlightTarget(n.target,{color:"rgba(0, 170, 255, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element highlighted successfully"),n.description&&this.overlay.showTooltip(n.description,{}),this.emit("elementHighlighted",{target:n.target,description:n.description})):(console.warn("[OnboardingSDK] ⚠️ Failed to find element for highlight"),setTimeout(()=>{this.overlay.highlightTarget(n.target,{color:"rgba(255, 193, 7, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element found on retry"),n.description&&this.overlay.showTooltip(n.description,{})):console.error("[OnboardingSDK] ❌ Element not found even after retry:",n.target)},500));break;case"click":console.log("[OnboardingSDK] 👆 Executing CLICK action with Floe cursor");const i=Nr();if(n.target.optionText){console.log("[OnboardingSDK] 🎯 Dropdown option selection detected:",n.target.optionText),await this.handleDropdownOptionClick(n);break}let o=Se.resolveTarget(n.target);if(!o){console.warn("[OnboardingSDK] ⚠️ Click target not found"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element not found",timestamp:Date.now()});break}Se.scrollIntoView(o),setTimeout(async()=>{var h,b;const a=this.findCollapsedSidebar(o);if(a){console.log("[OnboardingSDK] 🔍 Element is in collapsed sidebar, expanding first...");const y=a.getBoundingClientRect();await this.overlay.animateFloeCursorTo(y.left+y.width/2,y.top+y.height/3,400),a.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),a.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0})),await new Promise(m=>setTimeout(m,450)),console.log("[OnboardingSDK] 📂 Sidebar expanded")}if(!await Se.waitForPositionStability(o,800)){console.error("[OnboardingSDK] ❌ Element disappeared during stability wait"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element disappeared during animation",timestamp:Date.now()});return}const c=Se.reResolveAndVerify(n.target,o);c?(o=c,console.log("[OnboardingSDK] 🔄 Re-resolved element after stability wait")):console.warn("[OnboardingSDK] ⚠️ Could not re-resolve element, using original"),await this.overlay.moveToElementAndClick(o),await new Promise(y=>setTimeout(y,150)),this._botActionDepth++;const d={...n,target:{text:n.target.text,selector:n.target.selector,selectorFallbacks:n.target.selectorFallbacks,tag:n.target.tag,ariaLabel:n.target.ariaLabel,placeholder:n.target.placeholder,role:n.target.role,strategy:(h=n.target.strategy)==null?void 0:h.filter(y=>y!=="boundingBox"&&y!=="domIndex")}};let f=!1;try{f=await this.actionExecutor.executeHybridAction(d,!1)}finally{this._botActionDepth--}if(f){console.log("[OnboardingSDK] ✅ Click executed successfully");const y=(n.target.text||"").toLowerCase().trim(),m=((b=o==null?void 0:o.textContent)==null?void 0:b.toLowerCase().trim())||"",S=(o==null?void 0:o.tagName.toLowerCase())||"unknown";let v=!1,w="";y&&m&&!m.includes(y)&&!y.includes(m)&&(v=!0,w=`Expected "${n.target.text}", but clicked "${m.slice(0,50)}"`,console.error(`[OnboardingSDK] ❌ CLICK MISMATCH: ${w}`)),this.domIntrospector&&(await new Promise(k=>setTimeout(k,150)),this.domIntrospector.captureAndSendImmediate("post-bot-click"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after bot click")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!v,target:n.target.text||n.target.selector||"unknown",actualClicked:v?m.slice(0,100):void 0,clickedTag:S,mismatch:v,mismatchDetails:w||void 0,previousUrl:i,currentUrl:Nr(),timestamp:Date.now()}),v?console.warn("[OnboardingSDK] ⚠️ Click mismatch reported to server"):console.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance")}else{const y=this.actionExecutor.lastError||"unknown";console.warn("[OnboardingSDK] ⚠️ Click action failed:",y),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:y,timestamp:Date.now()})}await new Promise(y=>setTimeout(y,100)),setTimeout(()=>{this.overlay.clearHighlight(),this.overlay.hideFloeCursor()},800)},350);break;case"type":console.log("[OnboardingSDK] ⌨️ Executing TYPE action, value:",n.value);const s=Se.resolveTarget(n.target);s&&this.overlay.highlightResolvedElement(s,{color:"rgba(76, 175, 80, 0.6)",padding:4}),setTimeout(async()=>{await this.actionExecutor.executeHybridAction(n,!1),setTimeout(()=>this.overlay.clearHighlight(),1500)},300);break;case"focus":console.log("[OnboardingSDK] 🎯 Executing FOCUS action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"hover":console.log("[OnboardingSDK] 🖱️ Executing HOVER action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"scroll":console.log("[OnboardingSDK] 📜 Executing SCROLL action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"multi_select":console.log("[OnboardingSDK] 📋 Executing MULTI_SELECT action"),await this.handleMultiSelectAction(n);break;case"check_precondition":console.log("[OnboardingSDK] 🔍 Checking precondition"),await this.handleCheckPrecondition(n);break;default:console.warn("[OnboardingSDK] ⚠️ Unknown hybrid action:",n.action)}}async handleCheckPrecondition(n){const r=n.precondition;if(!r){console.warn("[OnboardingSDK] ⚠️ No precondition specified"),this.sendMetadata({type:"precondition_result",preconditionType:"unknown",optionText:"",result:!1,details:"No precondition specified in action",timestamp:Date.now()});return}const{type:i,optionText:o,selector:s}=r;let a=!1,l="";switch(i){case"option_exists":{if(!o){l="No optionText provided for option_exists";break}const c=this.findDropdownTrigger(n.target);if(c){console.log("[OnboardingSDK] 🔍 Opening dropdown to check for option:",o),this._botActionDepth++;try{this.actionExecutor.openDropdown(c)}finally{this._botActionDepth--}await new Promise(f=>setTimeout(f,400)),a=!!this.findVisibleDropdownOption(o),a||(a=!!await this.scrollToDropdownOption(o)),l=a?`Option "${o}" found in dropdown`:`Option "${o}" NOT found in dropdown`,this._botActionDepth++;try{await new Promise(h=>setTimeout(h,100));const f=document.activeElement instanceof HTMLElement?document.activeElement:document.body;f&&f.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(h=>setTimeout(h,100)),document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight()}else l="Could not find dropdown trigger"}break;case"element_visible":{const c=s||n.target.selector;if(!c){l="No selector provided for element_visible";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_visible: "${c}"`;break}a=!!(d&&Se.isVisible(d)),l=a?`Element "${c}" is visible`:`Element "${c}" is NOT visible or not found`}break;case"element_enabled":{const c=s||n.target.selector;if(!c){l="No selector provided for element_enabled";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_enabled: "${c}"`;break}d?(a=!(d.hasAttribute("disabled")||d.getAttribute("aria-disabled")==="true"||d.classList.contains("disabled")||d.disabled===!0),l=a?`Element "${c}" is enabled`:`Element "${c}" is disabled`):l=`Element "${c}" not found`}break;default:l=`Unknown precondition type: ${i}`}console.log(`[OnboardingSDK] 🔍 Precondition check result: ${a} - ${l}`),this.sendMetadata({type:"precondition_result",preconditionType:i,optionText:o,result:a,details:l,timestamp:Date.now()})}async handleMultiSelectAction(n){const r=n.target.selectedValues||[];if(console.log("[OnboardingSDK] 📋 handleMultiSelectAction for:",r),r.length===0){console.warn("[OnboardingSDK] ⚠️ No values to select in multi_select action"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"No values provided for multi-select",timestamp:Date.now()});return}const i=this.findDropdownTrigger(n.target);if(!i){console.error("[OnboardingSDK] ❌ Could not find dropdown trigger for multi-select"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Dropdown trigger not found",timestamp:Date.now()});return}Se.scrollIntoView(i),await new Promise(l=>setTimeout(l,200)),await this.overlay.moveToElementAndClick(i),console.log("[OnboardingSDK] 📂 Opening multi-select dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}await new Promise(l=>setTimeout(l,300));const o=[],s=[];for(let l=0;l<r.length;l++){const c=r[l];console.log(`[OnboardingSDK] 📋 Selecting option ${l+1}/${r.length}: "${c}"`);let d=this.findVisibleDropdownOption(c);if(!d){console.log("[OnboardingSDK] ⚠️ Option not visible, checking if dropdown closed..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}if(await new Promise(f=>setTimeout(f,300)),d=this.findVisibleDropdownOption(c),!d){const f=await this.scrollToDropdownOption(c);f&&(d=f)}}if(d)if(d.getAttribute("aria-selected")==="true"||d.classList.contains("selected")||d.closest('[aria-selected="true"]')!==null)o.push(c),console.log(`[OnboardingSDK] ✅ Already selected: "${c}"`);else{this._botActionDepth++;try{const h=d.getBoundingClientRect(),b=h.left+h.width/2,y=h.top+h.height/2,m={bubbles:!0,cancelable:!0,view:window,clientX:b,clientY:y};d.dispatchEvent(new MouseEvent("mousedown",m)),d.dispatchEvent(new MouseEvent("mouseup",m)),d.dispatchEvent(new MouseEvent("click",m)),await new Promise(S=>setTimeout(S,200)),o.push(c),console.log(`[OnboardingSDK] ✅ Selected: "${c}"`)}finally{this._botActionDepth--}}else s.push(c),console.warn(`[OnboardingSDK] ⚠️ Option not found after retries: "${c}"`)}await new Promise(l=>setTimeout(l,200)),this._botActionDepth++;try{const l=document.activeElement instanceof HTMLElement?document.activeElement:document.body;l&&l.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(d=>setTimeout(d,100));const c=document.querySelector('[class*="backdrop"], [class*="overlay"], .MuiBackdrop-root');c&&c instanceof HTMLElement?c.click():document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight();const a=o.length>0;console.log(`[OnboardingSDK] 📋 Multi-select complete: ${o.length} selected, ${s.length} failed`),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:a,target:n.target.text||n.target.selector||"unknown",selectedValues:o,failedValues:s,timestamp:Date.now()})}async handleDropdownOptionClick(n){const r=n.target.optionText;console.log("[OnboardingSDK] 🎯 handleDropdownOptionClick for:",r);let i=this.findVisibleDropdownOption(r);if(i){console.log("[OnboardingSDK] ✅ Option already visible, clicking directly"),await this.clickDropdownOption(i,n);return}console.log("[OnboardingSDK] 🔍 Option not visible, opening dropdown first");const o=this.findDropdownTrigger(n.target);if(!o){console.error("[OnboardingSDK] ❌ Could not find dropdown trigger"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:"Dropdown trigger not found",timestamp:Date.now()});return}Se.scrollIntoView(o),await new Promise(c=>setTimeout(c,200)),await this.overlay.moveToElementAndClick(o),console.log("[OnboardingSDK] 📂 Opening dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(o)}finally{this._botActionDepth--}await new Promise(c=>setTimeout(c,200));const s=3e3,a=150;let l=0;for(;l<s;){if(i=this.findVisibleDropdownOption(r),i){console.log("[OnboardingSDK] ✅ Option appeared after",l,"ms");break}await new Promise(c=>setTimeout(c,a)),l+=a}if(!i){console.error("[OnboardingSDK] ❌ Option did not appear after",s,"ms"),console.error("[OnboardingSDK] Looking for:",r);const c=document.querySelectorAll('[role="option"], [class*="option"]'),d=Array.from(c).slice(0,10).map(f=>{var h;return(h=f.textContent)==null?void 0:h.trim().slice(0,50)}).filter(Boolean);d.length>0?console.log("[OnboardingSDK] Available options:",d):console.log("[OnboardingSDK] No options visible - dropdown may not have opened"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:`Option "${r}" not found in dropdown`,timestamp:Date.now()}),this.overlay.clearHighlight();return}await this.clickDropdownOption(i,n)}findVisibleDropdownOption(n){var a;const r=n.toLowerCase().trim(),i=['[role="listbox"]','[role="menu"]','[class*="-menu"]:not([aria-hidden="true"])','[class*="listbox"]','[class*="options-container"]',".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"];let o=null,s=null;for(const l of i){let c;try{c=document.querySelectorAll(l)}catch{continue}for(const d of c){const f=d;if(!Se.isVisible(f)||f.getBoundingClientRect().height<20)continue;const b=d.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]):not([class*="placeholder"]), nz-option-item, .ant-select-item-option, .ant-select-item-option-content');for(const y of b){const m=y,S=m.className||"";if(S.toLowerCase().includes("singlevalue")||S.toLowerCase().includes("placeholder"))continue;const v=((a=m.textContent)==null?void 0:a.trim().toLowerCase())||"";if(v===r){console.log(`[OnboardingSDK] Found EXACT match for option: "${n}"`),o=m;break}if(!s&&v.includes(r)){const w=r.length/v.length;w>.7&&(console.log(`[OnboardingSDK] Found partial match (${(w*100).toFixed(0)}%): "${v.slice(0,50)}"`),s=m)}}if(o)break}if(o)break}return o||(s?(console.warn(`[OnboardingSDK] ⚠️ Using partial match for "${n}" - verify this is correct`),s):(console.log(`[OnboardingSDK] No option found for: "${n}"`),null))}async scrollToDropdownOption(n){var o;const r=n.toLowerCase().trim();console.log(`[OnboardingSDK] 🔍 Scrolling dropdown to find: "${n}"`);const i=document.querySelectorAll('[role="listbox"], [class*="-menu"] [class*="menu-list"], [class*="options-container"], [class*="virtual-list"]');for(const s of i){const a=s;if(!Se.isVisible(a)||a.scrollHeight<=a.clientHeight)continue;console.log(`[OnboardingSDK] Found scrollable container, scrollHeight: ${a.scrollHeight}`);const l=200,c=Math.ceil(a.scrollHeight/l);for(let d=0;d<c;d++){a.scrollTop=d*l,await new Promise(h=>setTimeout(h,100));const f=a.querySelectorAll('[role="option"], [class*="option"]');for(const h of f){const b=h,y=((o=b.textContent)==null?void 0:o.trim().toLowerCase())||"";if(y===r||y.includes(r))return console.log(`[OnboardingSDK] ✅ Found option after scrolling: "${n}"`),b.scrollIntoView({block:"center"}),await new Promise(m=>setTimeout(m,100)),b}}}return console.log(`[OnboardingSDK] Option not found after scrolling: "${n}"`),null}isValidDropdownElement(n,r=!1){if(!n)return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is null"),!1;if(xt(n))return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is inside SDK widget",{id:n.id,className:n.className,tagName:n.tagName}),!1;if(n.getAttribute("aria-hidden")==="true"||n.closest('[aria-hidden="true"]'))return console.warn('[OnboardingSDK] ⚠️ Dropdown validation: element or ancestor has aria-hidden="true"',{id:n.id,className:n.className}),!1;const i=window.getComputedStyle(n);if(i.display==="none")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has display:none",{id:n.id,className:n.className}),!1;if(i.visibility==="hidden")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has visibility:hidden",{id:n.id,className:n.className}),!1;if(i.pointerEvents==="none")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has pointer-events:none",{id:n.id,className:n.className}),!1;if(i.opacity==="0")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has opacity:0",{id:n.id,className:n.className}),!1;const o=i.position;if(n.offsetParent===null&&o!=="fixed"&&o!=="sticky"){let a=n.parentElement,l=!1;for(;a;){const c=window.getComputedStyle(a);if(c.position==="fixed"||c.position==="sticky"){l=!0;break}a=a.parentElement}if(!l)return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has null offsetParent (not rendered)",{id:n.id,className:n.className}),!1}const s=n.getBoundingClientRect();return s.width<=0||s.height<=0?(console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has zero dimensions",{id:n.id,className:n.className,width:s.width,height:s.height}),!1):r&&!(n.closest('[role="combobox"]')!==null||n.closest('[aria-haspopup="listbox"]')!==null||n.closest('[aria-haspopup="true"]')!==null||n.closest('[class*="select"]')!==null||n.closest('[class*="Select"]')!==null||n.closest('[class*="dropdown"]')!==null||n.closest('[class*="Dropdown"]')!==null||n.closest("select")!==null)?(console.warn("[OnboardingSDK] ⚠️ Dropdown validation (Strategy 5): element lacks dropdown-like ancestor",{id:n.id,className:n.className,tagName:n.tagName}),!1):!0}findDropdownTrigger(n){var o;if(n.dropdownTriggerSelector){console.log("[OnboardingSDK] 🎯 Using dropdownTriggerSelector:",n.dropdownTriggerSelector);try{const s=cy(n.dropdownTriggerSelector);if(s){const a=this.getClickableDropdownContainer(s);if(this.isValidDropdownElement(a))return console.log("[OnboardingSDK] ✅ Found trigger via dropdownTriggerSelector"),a;console.warn("[OnboardingSDK] ⚠️ Strategy 1: dropdownTriggerSelector element failed validation")}}catch(s){console.warn("[OnboardingSDK] Invalid dropdownTriggerSelector:",s)}}if(n.labelText){console.log("[OnboardingSDK] 🔍 Finding dropdown by label:",n.labelText);const s=this.findDropdownByLabel(n.labelText);if(s)return console.log("[OnboardingSDK] ✅ Found trigger via labelText"),s}const r=document.querySelector('input[role="combobox"]:focus');if(r){const s=this.getClickableDropdownContainer(r);if(this.isValidDropdownElement(s))return console.log("[OnboardingSDK] ✅ Found focused combobox"),s;console.warn("[OnboardingSDK] ⚠️ Strategy 3: focused combobox failed validation")}const i=document.querySelector('input[role="combobox"][aria-expanded="true"]');if(i){const s=this.getClickableDropdownContainer(i);if(this.isValidDropdownElement(s))return console.log("[OnboardingSDK] ✅ Found expanded combobox"),s;console.warn("[OnboardingSDK] ⚠️ Strategy 3: expanded combobox failed validation")}if(n.selector){const a=n.selector.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[role="option"\]/g,"").trim();if(a&&a!=="")try{const l=document.querySelector(a);if(l){const c=this.getClickableDropdownContainer(l);if(this.isValidDropdownElement(c))return console.log("[OnboardingSDK] ✅ Found trigger via cleaned selector"),c;console.warn("[OnboardingSDK] ⚠️ Strategy 4: selector element failed validation")}}catch{console.warn("[OnboardingSDK] Invalid selector:",a)}}if(n.text||n.optionText){const s=(n.text||n.optionText||"").toLowerCase(),a=['[class*="singleValue"]','[class*="single-value"]','[class*="select__single-value"]',".MuiSelect-select",'[class*="placeholder"]'];for(const l of a){const c=document.querySelectorAll(l);for(const d of c){const f=((o=d.textContent)==null?void 0:o.trim().toLowerCase())||"";if(f===s||f.includes(s)){const h=this.getClickableDropdownContainer(d);if(this.isValidDropdownElement(h,!0))return console.log("[OnboardingSDK] ✅ Found trigger via display value match"),h;console.warn("[OnboardingSDK] ⚠️ Strategy 5: display value match element failed validation",{searchText:s,selector:l,elementText:f})}}}}return console.warn("[OnboardingSDK] ❌ Could not find dropdown trigger"),null}findDropdownByLabel(n){var o;const r=n.toLowerCase().trim(),i=["label",'[class*="label"]','[class*="Label"]','[class*="form-label"]',".MuiFormLabel-root",".MuiInputLabel-root"];for(const s of i){const a=document.querySelectorAll(s);for(const l of a){const c=((o=l.textContent)==null?void 0:o.trim().toLowerCase().replace(/\*$/,"").trim())||"";if(c===r||c.includes(r)){const d=l;if(d.tagName==="LABEL"&&d.htmlFor){const b=document.getElementById(d.htmlFor);if(b)return this.getClickableDropdownContainer(b)}const f=d.id;if(f){const b=document.querySelector(`[aria-labelledby="${f}"]`);if(b)return this.getClickableDropdownContainer(b)}const h=d.closest('[class*="field"], [class*="form-group"], [class*="FormControl"]')||d.parentElement;if(h){const b=h.querySelector('input[role="combobox"], select, [aria-haspopup="listbox"], [class*="control"]');if(b)return this.getClickableDropdownContainer(b)}}}}return null}getClickableDropdownContainer(n){var i;return n.closest('[class*="-control"]')||n.closest('[class*="control"]')||n.closest('[class*="trigger"]')||n.closest("[aria-haspopup]")||((i=n.closest(".MuiSelect-select"))==null?void 0:i.parentElement)||n.closest('[class*="select"]')||n}async clickDropdownOption(n,r){var i;await this.overlay.moveToElementAndClick(n),await new Promise(o=>setTimeout(o,150)),console.log("[OnboardingSDK] 👆 Clicking dropdown option:",(i=n.textContent)==null?void 0:i.trim()),this._botActionDepth++;try{if(this.actionExecutor.triggerReactOnClickPublic(n))console.log("[OnboardingSDK] ✅ React onClick triggered for option");else{const s=n.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l};n.dispatchEvent(new MouseEvent("mousedown",c)),n.dispatchEvent(new MouseEvent("mouseup",c)),n.dispatchEvent(new MouseEvent("click",c))}}finally{this._botActionDepth--}console.log("[OnboardingSDK] ✅ Dropdown option clicked successfully"),this.domIntrospector&&(await new Promise(o=>setTimeout(o,150)),this.domIntrospector.captureAndSendImmediate("post-dropdown-select"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after dropdown selection")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!0,target:r.target.optionText||r.target.text||"dropdown option",timestamp:Date.now()}),console.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance"),await new Promise(o=>setTimeout(o,200)),setTimeout(()=>{this.overlay.clearHighlight(),this.overlay.hideFloeCursor()},600)}findCollapsedSidebar(n){let r=n.parentElement;for(;r&&r!==document.body;){const i=window.getComputedStyle(r),o=r.getBoundingClientRect().width,s=r.getBoundingClientRect().height,a=i.transition.includes("width")||i.transitionProperty.includes("width")||i.transitionProperty==="all",l=o<80,c=s>window.innerHeight*.5,d=typeof r.className=="string"?r.className:"",f=d.includes("sidebar")||d.includes("nav")||d.includes("menu"),h=d.includes("w-12")||d.includes("w-14")||d.includes("w-16");if(l&&c&&(a||f)||h)return console.log("[OnboardingSDK] Detected collapsed sidebar:",{width:o,height:s,hasTransition:a,hasTailwindCollapsed:h,classes:r.className.substring(0,100)}),r;r=r.parentElement}return null}async executeActionFast(n){console.log("[OnboardingSDK] ⚡ Fast executing action:",n.action);let r=Se.resolveTarget(n.target);if(!r&&(await new Promise(o=>setTimeout(o,150)),r=Se.resolveTarget(n.target),!r))return console.warn("[OnboardingSDK] ⚠️ Fast action target not found"),!1;r.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(o=>setTimeout(o,50)),this.overlay.highlightResolvedElement(r,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(o=>setTimeout(o,80)),this._botActionDepth++;let i=!1;try{i=await this.actionExecutor.executeHybridAction(n,!1)}finally{this._botActionDepth--}return await new Promise(o=>setTimeout(o,50)),this.overlay.clearHighlight(),i}async handleExecuteApi(n){var b;console.log("[OnboardingSDK] 🔌 Executing API call:",n.method,n.url);const{method:r="GET",url:i,base_url:o,body:s,query_params:a,success_indicator:l,result_extractor:c,error_message_path:d}=n;let f=i;if(o&&(f=`${o.replace(/\/$/,"")}/${i.replace(/^\//,"")}`),a&&r==="GET"){const y=new URLSearchParams(a);f=`${f}?${y.toString()}`}try{const y=new URL(f,window.location.href);if(y.origin!==window.location.origin){console.error("[OnboardingSDK] ❌ Cross-origin API request blocked:",y.origin),this.sendMetadata({type:"api_execution_result",success:!1,error:`Cross-origin request blocked: ${y.origin} does not match ${window.location.origin}`,url:f,method:r,timestamp:Date.now()});return}}catch{console.error("[OnboardingSDK] ❌ Invalid URL:",f),this.sendMetadata({type:"api_execution_result",success:!1,error:`Invalid URL: ${f}`,url:f,method:r,timestamp:Date.now()});return}if(!["GET","HEAD","POST","PUT","PATCH","DELETE"].includes(r.toUpperCase())){console.error("[OnboardingSDK] ❌ HTTP method not allowed:",r),this.sendMetadata({type:"api_execution_result",success:!1,error:`HTTP method not allowed: ${r}`,url:f,method:r,timestamp:Date.now()});return}try{const y={method:r.toUpperCase(),headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"};s&&r!=="GET"&&(y.body=JSON.stringify(s)),console.log("[OnboardingSDK] 📤 Making API request:",f);const m=await fetch(f,y);let S;const v=await m.text();try{S=JSON.parse(v)}catch{S={raw:v}}console.log("[OnboardingSDK] 📥 API response:",m.status,S);const w=m.ok&&this.evaluateJsonPathCondition(S,l),k=this.extractJsonPath(S,c);let C;w||(C=this.extractJsonPath(S,d)||((b=S.error)==null?void 0:b.message)||S.message||`Request failed with status ${m.status}`),this.sendMetadata({type:"api_execution_result",success:w,status_code:m.status,data:S,result_text:k,error:C,url:f,method:r,timestamp:Date.now()}),console.log(`[OnboardingSDK] ${w?"✅":"❌"} API execution ${w?"succeeded":"failed"}:`,k||C)}catch(y){console.error("[OnboardingSDK] ❌ API execution error:",y),this.sendMetadata({type:"api_execution_result",success:!1,error:y instanceof Error?y.message:"Unknown error",url:f,method:r,timestamp:Date.now()})}}evaluateJsonPathCondition(n,r){if(!r)return!0;try{if(r.includes(" == ")){const[i,o]=r.split(" == "),s=this.extractJsonPath(n,i.trim()),a=o.trim().replace(/^["']|["']$/g,"");return String(s)===a}return!!this.extractJsonPath(n,r)}catch{return!0}}extractJsonPath(n,r){if(!r||!n)return;const o=r.replace(/^\$\.?/,"").split(".");let s=n;for(const a of o){if(s==null)return;s=s[a]}return s}async handleBatchedNavigation(n){if(console.log("[OnboardingSDK] ⚡ Received batched navigation request"),!this.batchedActionExecutor){console.error("[OnboardingSDK] BatchedActionExecutor not initialized");return}const r=(n.steps||[]).map(i=>{const o=i.target||i,a=o.text||o.selector||o.tag?{text:o.text,tag:o.tag,selector:o.selector,ariaLabel:o.aria_label||o.ariaLabel,role:o.role,labelText:o.label_text||o.labelText,selectorFallbacks:o.selector_fallbacks||o.selectorFallbacks}:void 0;return{action:i.action,target:a,condition:i.condition,waitMs:i.wait_ms||i.waitMs}});if(r.length===0){console.warn("[OnboardingSDK] No steps in batched navigation request");return}this.fastExecutionMode=!0,this._botActionDepth++;try{console.log("[OnboardingSDK] ⚡ Executing batched navigation with steps:",r.map(o=>{var s;return`${o.action}${(s=o.target)!=null&&s.text?` "${o.target.text}"`:""}`}).join(" → "));const i=await this.batchedActionExecutor.executeBatch({steps:r});this.domIntrospector&&(await new Promise(o=>setTimeout(o,200)),this.domIntrospector.captureAndSendImmediate("post-batched-navigation"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after batched navigation")),i.success?(console.log("[OnboardingSDK] ✅ Batched navigation complete, sending success"),this.sendMetadata({type:"batched_navigation_complete",success:!0,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()})):(console.log(`[OnboardingSDK] ❌ Batched navigation failed at step ${i.completedSteps+1}, sending failure`),this.sendMetadata({type:"batched_navigation_complete",success:!1,error:`Step ${i.completedSteps+1} failed - check console for details`,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()}))}finally{this.fastExecutionMode=!1,this._botActionDepth--}}startNavigationDetection(n){this.navigationCompleteDetector&&this.navigationCompleteDetector.start(r=>{console.log("[OnboardingSDK] Navigation complete detected:",r),this.sendMetadata({type:"navigation_complete",url:r,timestamp:Date.now()}),n(r)})}stopNavigationDetection(){this.navigationCompleteDetector&&this.navigationCompleteDetector.stop()}isInFastMode(){return this.fastExecutionMode}async extractIntent(n){const r={"get started":"onboarding",help:"assistance","show me":"demonstration","how do":"tutorial",where:"navigation",what:"information"},i=n.toLowerCase();for(const[o,s]of Object.entries(r))if(i.includes(o))return s;return"unknown"}async captureContext(){const n=this.config.enableScreenCapture?await this.capture.captureWithRedaction():void 0,r=this.extractPageStructure();return{screenshot:n,url:Nr(),structure:r,timestamp:Date.now()}}extractPageStructure(){const n=[];return["button","a","input","select","textarea",'[role="button"]',"[onclick]"].forEach(i=>{document.querySelectorAll(i).forEach(o=>{const s=o.getBoundingClientRect(),a=s.width>0&&s.height>0&&s.top<window.innerHeight&&s.bottom>0;a&&n.push({selector:this.getSelector(o),type:o.tagName.toLowerCase(),text:(o.textContent||"").trim().substring(0,100),visible:a,position:s,attributes:this.getAttributes(o)})})}),{title:document.title,url:Nr(),elements:n,viewport:{width:window.innerWidth,height:window.innerHeight}}}getSelector(n){if(n.id)return`#${n.id}`;const r=[];let i=n;for(;i&&i!==document.body;){let o=i.tagName.toLowerCase();if(i.className){const s=Array.from(i.classList).slice(0,2).join(".");s&&(o+=`.${s}`)}r.unshift(o),i=i.parentElement}return r.join(" > ")}getAttributes(n){const r={};return["href","type","name","placeholder","aria-label","role"].forEach(o=>{const s=n.getAttribute(o);s&&(r[o]=s)}),r}async sendText(n){this.pipecatClient&&this.isConnected&&await this.pipecatClient.sendText(n)}toggleMute(){if(this.pipecatClient){const r=!this.pipecatClient.isMicEnabled;return this.pipecatClient.enableMic(r),this.micEnabled=r,console.log("[OnboardingSDK] 🎤 Mic toggled:",r?"ON":"MUTED"),this.renderReactUI(),r}return!1}highlight(n,r){this.overlay.highlight(n,r)}clearHighlight(){this.overlay.clearHighlight()}showTooltip(n,r){this.overlay.showTooltip(n,r)}hideTooltip(){this.overlay.hideTooltip()}async executeAction(n){return this.actionExecutor.executeWithConsent(n)}async takeScreenshot(n){return this.capture.captureWithRedaction(n)}getSessionId(){return this.sessionId}getStatus(){return{initialized:this.isInitialized,connected:this.isConnected,sessionId:this.sessionId,microphoneMuted:this.pipecatClient?!this.pipecatClient.isMicEnabled:!1}}startGuidedDiscovery(){return!this.pipecatClient||!this.isConnected?(console.warn("[OnboardingSDK] Cannot start discovery - not connected"),!1):(console.log("[OnboardingSDK] 🔍 Starting guided discovery mode"),this.pipecatClient.sendClientMessage("start_discovery",{type:"start_discovery",timestamp:Date.now()}),this.hideWelcomePopup(),!0)}skipDiscovery(){console.log("[OnboardingSDK] Skipping discovery - standard greeting flow"),this.hideWelcomePopup()}showWelcomePopupAsync(){return new Promise(n=>{if(document.getElementById("floe-welcome-popup")){n(!1);return}const r=document.createElement("div");r.id="floe-welcome-popup",r.setAttribute("data-floe-widget","true"),r.style.cssText=`
|
|
813
|
+
`,document.body.appendChild(this.reactContainer),this.reactRoot=lc.createRoot(this.reactContainer),this.renderReactUI()}renderReactUI(){var n,r,i;this.reactRoot&&this.reactRoot.render(Yp.createElement(Mx,{connected:this.isConnected,voiceEnabled:this.micEnabled,agentState:this.agentState,botTranscript:this.botTranscript,userTranscript:this.userTranscript,transcriptHistory:[...this.transcriptHistory],screenShareEnabled:this.screenShareEnabled,userIsSpeaking:this.userIsSpeaking,botIsSpeaking:this.botIsSpeaking,audioLevels:[...this.audioLevels],onToggleConnection:()=>this.handleToggleConnection(),onToggleMute:()=>this.toggleMute(),onToggleScreenShare:()=>this.handleToggleScreenShare(),onResume:this.pausedSessionId?()=>this.resumeSession(this.pausedSessionId):void 0,pausedSessionId:this.pausedSessionId||void 0,onStop:this.agentState==="paused"?()=>this.stopSession():void 0,connectionProgress:this.connectionProgress||void 0,isReturningUser:this.isReturningUser,hasSkippedOnboarding:this.hasSkippedOnboarding,onMinimize:()=>this.handleMinimize(),onExpand:()=>this.handleExpand(),nudgeText:(n=this.config.nudge)==null?void 0:n.text,nudgeAutoHideDelay:(r=this.config.nudge)==null?void 0:r.autoHideDelay,nudgeAutoShow:(i=this.config.nudge)==null?void 0:i.autoShow}))}handleMinimize(){this._isMinimized=!0,console.log("[OnboardingSDK] UI minimized"),this.renderReactUI(),this.emit("minimized")}handleExpand(){this._isMinimized=!1,console.log("[OnboardingSDK] UI expanded"),this.renderReactUI(),this.emit("expanded")}setConnectionProgress(n,r,i){this.connectionProgress={stage:n,message:r,progress:i},this.renderReactUI()}clearConnectionProgress(){this.connectionProgress=null,this.renderReactUI()}async handleToggleConnection(){if(this.isConnected){console.log("[OnboardingSDK] Disconnecting and minimizing...");try{await this.disconnectAndMinimize()}catch(n){console.error("[OnboardingSDK] Error during disconnect and minimize:",n),this.emit("error",n)}return}if(this.connectInFlight){console.log("[OnboardingSDK] Connection operation already in progress, ignoring...");return}try{await this.connectWithProgress()}catch(n){console.log("[OnboardingSDK] Connection error handled in handleToggleConnection:",n)}}async disconnectAndMinimize(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.clearHighlight(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.isConnected=!1,this.agentState="idle",this._isMinimized=!0,this.botTranscript="",this.userTranscript="",this.renderReactUI(),console.log("[OnboardingSDK] Disconnected and minimized"),this.emit("disconnected"),this.emit("minimized")}async connectWithProgress(){if(this.connectInFlight){console.log("[OnboardingSDK] Connection already in progress, ignoring...");return}this.connectInFlight=!0;try{this.agentState="connecting",this._isMinimized=!1,this.setConnectionProgress("initializing","Initializing...",10),this.transport=new gn,this.setConnectionProgress("authenticating","Authenticating...",30),this.pipecatClient=new Nt({transport:this.transport,enableMic:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback(),this.setConnectionProgress("connecting","Connecting to server...",50);const n=`${this.config.apiUrl}/sites/start-session`;console.log("[OnboardingSDK] Starting session via floe-api proxy:",n);const r={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};this.config.userInfo&&(r.sessionData.userInfo=this.config.userInfo),this.setConnectionProgress("joining","Joining session...",70),await this.pipecatClient.startBotAndConnect({endpoint:n,requestData:r}),this.setConnectionProgress("ready","Connected!",100),setTimeout(()=>{this.clearConnectionProgress()},500)}catch(n){console.error("[OnboardingSDK] Connection failed:",n),this.setConnectionProgress("error","Connection failed",0),this.agentState="idle",setTimeout(()=>{this.clearConnectionProgress(),this.renderReactUI()},3e3),this.emit("error",n)}finally{this.connectInFlight=!1}}createPipecatCallbacks(){return{onConnected:()=>{var n;console.log("[OnboardingSDK] Connected to Pipecat"),this.isConnected=!0,this.agentState="listening",this.micEnabled=((n=this.pipecatClient)==null?void 0:n.isMicEnabled)??this.config.enableAudio!==!1,console.log("[OnboardingSDK] 🎤 Mic state on connect:",this.micEnabled?"ON":"MUTED"),this.clearConnectionProgress(),this.renderReactUI(),this.emit("connected")},onDisconnected:()=>{console.log("[OnboardingSDK] Disconnected from Pipecat"),this.isConnected=!1,this.agentState="idle",this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.clearHighlight(),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(console.log("[OnboardingSDK] 🎤 Stopping user microphone stream"),this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.renderReactUI(),this.emit("disconnected")},onBotReady:()=>{var n;if(console.log("[OnboardingSDK] Bot ready - transport is now in ready state"),this.domIntrospector.startCapturing(1500,r=>{const i=this.accessibleSnapshot.capture(r.captureReason);this.sendAccessibleSnapshot(i),this.sendDOMSnapshot(r)}),console.log("[OnboardingSDK] DOM Introspection Layer started (with Accessible Snapshot)"),this.pageTracker.setDOMIntrospector(this.domIntrospector),this.pageTracker.start(),console.log("[OnboardingSDK] PageTracker started"),this.config.clientKey){console.log("[OnboardingSDK] Sending site initialization with client key");const r={clientKey:this.config.clientKey,origin:window.location.origin,userInfo:this.config.userInfo};this.pendingResumeSessionId&&(r.resumeSessionId=this.pendingResumeSessionId,console.log(`[OnboardingSDK] Resuming session: ${this.pendingResumeSessionId}`),this.pendingResumeSessionId=null),(n=this.pipecatClient)==null||n.sendClientMessage("site_init",r)}this.emit("botReady"),this._pendingDiscoveryStart&&(console.log("[OnboardingSDK] 🔍 Starting pending guided discovery"),this._pendingDiscoveryStart=!1,setTimeout(()=>{this.isConnected&&this.startGuidedDiscovery()},500))},onUserTranscript:n=>{console.log("[OnboardingSDK] 🎤 User transcript:",n.text,n.final?"(final)":"(interim)"),n.text&&(this.userTranscript=n.text),n.final&&n.text&&(this.lastUserTranscript=n.text),this.emit("userTranscript",n),this.handleUserInput(n.text),this.renderReactUI()},onBotTtsText:n=>{console.log("[OnboardingSDK] 🤖 Bot TTS text:",n.text),n.text&&(this.botTranscript&&!this.botTranscript.endsWith(" ")&&!n.text.startsWith(" ")&&(this.botTranscript+=" "),this.botTranscript+=n.text,this.renderReactUI())},onUserStartedSpeaking:()=>{console.log("[OnboardingSDK] 🎤 User started speaking"),this.agentState="listening",this.userIsSpeaking=!0,this.renderReactUI(),this.emit("userSpeaking",!0)},onUserStoppedSpeaking:()=>{console.log("[OnboardingSDK] 🛑 User stopped speaking"),this.agentState="thinking",this.userIsSpeaking=!1,this.lastUserTranscript&&(this.transcriptHistory.push({id:`user-${Date.now()}`,role:"user",content:this.lastUserTranscript,timestamp:Date.now()}),console.log("[OnboardingSDK] 📝 Added user message to history:",this.lastUserTranscript),this.lastUserTranscript=""),this.userTranscript="",this.renderReactUI(),this.emit("userSpeaking",!1)},onBotStartedSpeaking:()=>{console.log("[OnboardingSDK] 🔊 Bot started speaking"),this.agentState="speaking",this.botIsSpeaking=!0,this.userTranscript="",this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!0)},onBotStoppedSpeaking:()=>{console.log("[OnboardingSDK] 🔇 Bot stopped speaking"),this.agentState="listening",this.botIsSpeaking=!1,this.botTranscript&&(this.transcriptHistory.push({id:`assistant-${Date.now()}`,role:"assistant",content:this.botTranscript,timestamp:Date.now()}),console.log("[OnboardingSDK] 📝 Added assistant message to history:",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!1)},onServerMessage:n=>{console.log("[OnboardingSDK] Server message:",n),this.handleServerMessage(n)},onError:n=>{console.error("[OnboardingSDK] Error:",n),this.emit("error",n)}}}async resumeSession(n){console.log(`[OnboardingSDK] Resuming session: ${n}`),this.pendingResumeSessionId=n,this.agentState="idle",console.log("[OnboardingSDK] Forcing full reconnect for resume (bot pipeline was cancelled)"),this.isConnected&&await this.disconnect(),await new Promise(r=>setTimeout(r,100)),await this.init()}async stopSession(){console.log("[OnboardingSDK] Stopping paused session"),this.agentState="idle",this.pausedSessionId=null,this.pendingResumeSessionId=null,this.isConnected&&await this.disconnect(),this.renderReactUI(),this.emit("sessionStopped")}async handleToggleScreenShare(){if(!this.pipecatClient){console.warn("[OnboardingSDK] Cannot toggle screen share: client not initialized");return}try{this.screenShareEnabled?(console.log("[OnboardingSDK] Stopping screen share"),await this.pipecatClient.enableScreenShare(!1),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1})):(console.log("[OnboardingSDK] Starting screen share"),await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,this.sendMetadata({type:"screen_share_status",active:!0})),this.renderReactUI()}catch(n){console.error("[OnboardingSDK] Failed to toggle screen share:",n),this.emit("error",n)}}sendMetadata(n){if(this.pipecatClient&&this.isConnected){const r=n.type||"metadata";console.log(`[OnboardingSDK] Sending metadata: ${r}`,n),this.pipecatClient.sendClientMessage(r,n)}else console.warn("[OnboardingSDK] Cannot send metadata - not connected")}sendDOMSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.2&&console.log(`[OnboardingSDK] Sending DOM snapshot: ${n.totalElements} elements`),this.pipecatClient.sendClientMessage("dom_snapshot",{type:"dom_snapshot",...n}))}sendAccessibleSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.3&&(console.log(`[OnboardingSDK] Sending accessible snapshot: ${n.elementCount} elements (reduced from DOM)`),this.config.debug&&console.log("[OnboardingSDK] Accessible elements:",n.elements.slice(0,5).map(r=>`${r.ref}: ${r.role} "${r.name}"`).join(", "),n.elements.length>5?"...":"")),this.pipecatClient.sendClientMessage("accessible_snapshot",{type:"accessible_snapshot",...n}))}async handleUserInput(n){await this.extractIntent(n),this.config.enableScreenCapture&&await this.captureContext()}handleServerMessage(n){console.log("[OnboardingSDK] 📥 Server message received:",JSON.stringify(n,null,2));let r=n;if(n.data&&typeof n.data=="object"&&(console.log("[OnboardingSDK] Unwrapping RTVIServerMessageFrame data"),r=n.data),r.type==="ui_action"&&r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received UI action from bot:",r.action),console.log("[OnboardingSDK] Target:",JSON.stringify(r.target,null,2)),this.handleHybridAction({action:r.action,target:r.target,value:r.value,description:r.description,precondition:r.precondition});return}if(r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received direct hybrid action:",r.action),this.handleHybridAction(r);return}r.type==="highlight"?(console.log("[OnboardingSDK] Handling highlight command"),r.target?this.overlay.highlightTarget(r.target,r.options):r.selector&&this.overlay.highlight(r.selector,r.options)):r.type==="tooltip"&&r.text?this.overlay.showTooltip(r.text,r.options):r.type==="action"?r.target?this.handleHybridAction(r):this.actionExecutor.executeWithConsent(r.action):r.type==="clear_highlight"?this.overlay.clearHighlight():r.type==="batched_navigation"?this.handleBatchedNavigation(r):r.type==="fast_action"?this.executeActionFast(r):r.type==="execute_api"||r.action==="execute_api"?this.handleExecuteApi(r):r.type==="session_paused"?(console.log("[OnboardingSDK] Session paused:",r),this.agentState="paused",this.pausedSessionId=r.session_id||null,this.overlay.clearHighlight(),this.renderReactUI(),this.emit("sessionPaused",r)):console.log("[OnboardingSDK] Unhandled server message type:",r.type||"unknown")}async handleHybridAction(n){switch(console.log("[OnboardingSDK] 🎯 Handling hybrid action:",n.action),console.log("[OnboardingSDK] Target strategies:",n.target.strategy||"auto-detect"),console.log("[OnboardingSDK] Target text:",n.target.text),console.log("[OnboardingSDK] Target selector:",n.target.selector),console.log("[OnboardingSDK] Target tag:",n.target.tag),n.action){case"highlight":console.log("[OnboardingSDK] 💡 Executing HIGHLIGHT action"),this.overlay.highlightTarget(n.target,{color:"rgba(0, 170, 255, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element highlighted successfully"),n.description&&this.overlay.showTooltip(n.description,{}),this.emit("elementHighlighted",{target:n.target,description:n.description})):(console.warn("[OnboardingSDK] ⚠️ Failed to find element for highlight"),setTimeout(()=>{this.overlay.highlightTarget(n.target,{color:"rgba(255, 193, 7, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element found on retry"),n.description&&this.overlay.showTooltip(n.description,{})):console.error("[OnboardingSDK] ❌ Element not found even after retry:",n.target)},500));break;case"click":console.log("[OnboardingSDK] 👆 Executing CLICK action with Floe cursor");const i=En();if(n.target.optionText){console.log("[OnboardingSDK] 🎯 Dropdown option selection detected:",n.target.optionText),await this.handleDropdownOptionClick(n);break}let o=Se.resolveTarget(n.target);if(!o){console.warn("[OnboardingSDK] ⚠️ Click target not found"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element not found",timestamp:Date.now()});break}Se.scrollIntoView(o),setTimeout(async()=>{var h,b;const a=this.findCollapsedSidebar(o);if(a){console.log("[OnboardingSDK] 🔍 Element is in collapsed sidebar, expanding first...");const y=a.getBoundingClientRect();await this.overlay.animateFloeCursorTo(y.left+y.width/2,y.top+y.height/3,400),a.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),a.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0})),await new Promise(g=>setTimeout(g,450)),console.log("[OnboardingSDK] 📂 Sidebar expanded")}if(!await Se.waitForPositionStability(o,800)){console.error("[OnboardingSDK] ❌ Element disappeared during stability wait"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element disappeared during animation",timestamp:Date.now()});return}const c=Se.reResolveAndVerify(n.target,o);c?(o=c,console.log("[OnboardingSDK] 🔄 Re-resolved element after stability wait")):console.warn("[OnboardingSDK] ⚠️ Could not re-resolve element, using original"),await this.overlay.moveToElementAndClick(o),await new Promise(y=>setTimeout(y,150)),this._botActionDepth++;const d={...n,target:{text:n.target.text,selector:n.target.selector,selectorFallbacks:n.target.selectorFallbacks,tag:n.target.tag,ariaLabel:n.target.ariaLabel,placeholder:n.target.placeholder,role:n.target.role,strategy:(h=n.target.strategy)==null?void 0:h.filter(y=>y!=="boundingBox"&&y!=="domIndex")}};let f=!1;try{f=await this.actionExecutor.executeHybridAction(d,!1)}finally{this._botActionDepth--}if(f){console.log("[OnboardingSDK] ✅ Click executed successfully");const y=(n.target.text||"").toLowerCase().trim(),g=((b=o==null?void 0:o.textContent)==null?void 0:b.toLowerCase().trim())||"",S=(o==null?void 0:o.tagName.toLowerCase())||"unknown";let v=!1,w="";y&&g&&!g.includes(y)&&!y.includes(g)&&(v=!0,w=`Expected "${n.target.text}", but clicked "${g.slice(0,50)}"`,console.error(`[OnboardingSDK] ❌ CLICK MISMATCH: ${w}`)),this.domIntrospector&&(await new Promise(k=>setTimeout(k,150)),this.domIntrospector.captureAndSendImmediate("post-bot-click"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after bot click")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!v,target:n.target.text||n.target.selector||"unknown",actualClicked:v?g.slice(0,100):void 0,clickedTag:S,mismatch:v,mismatchDetails:w||void 0,previousUrl:i,currentUrl:En(),timestamp:Date.now()}),v?console.warn("[OnboardingSDK] ⚠️ Click mismatch reported to server"):console.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance")}else{const y=this.actionExecutor.lastError||"unknown";console.warn("[OnboardingSDK] ⚠️ Click action failed:",y),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:y,timestamp:Date.now()})}await new Promise(y=>setTimeout(y,100)),setTimeout(()=>{this.overlay.clearHighlight(),this.overlay.hideFloeCursor()},800)},350);break;case"type":console.log("[OnboardingSDK] ⌨️ Executing TYPE action, value:",n.value);const s=Se.resolveTarget(n.target);s&&this.overlay.highlightResolvedElement(s,{color:"rgba(76, 175, 80, 0.6)",padding:4}),setTimeout(async()=>{await this.actionExecutor.executeHybridAction(n,!1),setTimeout(()=>this.overlay.clearHighlight(),1500)},300);break;case"focus":console.log("[OnboardingSDK] 🎯 Executing FOCUS action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"hover":console.log("[OnboardingSDK] 🖱️ Executing HOVER action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"scroll":console.log("[OnboardingSDK] 📜 Executing SCROLL action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"multi_select":console.log("[OnboardingSDK] 📋 Executing MULTI_SELECT action"),await this.handleMultiSelectAction(n);break;case"navigate":console.log("[OnboardingSDK] 🧭 Executing NAVIGATE action to URL:",n.value);{const a=n.value;if(!a){console.warn("[OnboardingSDK] ⚠️ Navigate action missing URL"),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:"Missing target URL",timestamp:Date.now()});break}let l;try{const y=new URL(a,window.location.href);if(y.protocol!=="http:"&&y.protocol!=="https:"){console.warn("[OnboardingSDK] ⚠️ Navigate blocked — disallowed scheme:",y.protocol),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:`Blocked: disallowed URL scheme "${y.protocol}"`,timestamp:Date.now()});break}l=y.href}catch{console.warn("[OnboardingSDK] ⚠️ Navigate blocked — invalid URL"),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:"Blocked: invalid URL",timestamp:Date.now()});break}const c=window.location.href,d=Date.now(),f={resolvedUrl:za(l),beforeUrl:za(c),timestamp:d};try{sessionStorage.setItem("floe_pending_navigation",JSON.stringify(f))}catch{}const h=()=>{const y={type:"bot_action_complete",action:"navigate",target:f.resolvedUrl,success:!0,previousUrl:f.beforeUrl,currentUrl:f.resolvedUrl,timestamp:d,beacon:!0};try{const g=this.config.apiUrl||"";g&&navigator.sendBeacon&&navigator.sendBeacon(`${g}/api/v1/events/beacon`,new Blob([JSON.stringify(y)],{type:"application/json"}))}catch{}};window.addEventListener("pagehide",h,{once:!0}),window.location.href=l;const b=await this.waitForNavigation(l,1e4);window.removeEventListener("pagehide",h);try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata({type:"bot_action_complete",action:"navigate",target:za(l),success:b,previousUrl:za(c),currentUrl:En(),...b?{}:{error:"Navigation timed out waiting for URL change"},timestamp:d})}break;case"check_precondition":console.log("[OnboardingSDK] 🔍 Checking precondition"),await this.handleCheckPrecondition(n);break;default:console.warn("[OnboardingSDK] ⚠️ Unknown hybrid action:",n.action)}}async waitForNavigation(n,r){const i=Date.now(),o=200,s=h=>h.length>1&&h.endsWith("/")?h.slice(0,-1):h;let a;try{a=new URL(n)}catch{return console.warn("[OnboardingSDK] ⚠️ waitForNavigation: could not parse expectedUrl, using exact match"),new Promise(h=>{const b=()=>{if(window.location.href===n){h(!0);return}if(Date.now()-i>=r){h(!1);return}setTimeout(b,o)};b()})}const l=a.origin,c=s(a.pathname),d=a.search,f=a.hash;return new Promise(h=>{const b=()=>{const y=Date.now()-i;try{const g=new URL(window.location.href);if(g.origin===l&&s(g.pathname)===c&&(!d||g.search===d)&&(!f||g.hash===f)){console.log(`[OnboardingSDK] ✅ Navigation completed to: ${window.location.href}`),h(!0);return}}catch{}if(y>=r){console.warn(`[OnboardingSDK] ⏱️ Navigation timeout after ${r}ms. Current: ${window.location.href}, Expected: ${n}`),h(!1);return}setTimeout(b,o)};b()})}_finalizePendingNavigation(){let n;try{n=sessionStorage.getItem("floe_pending_navigation")}catch{return}if(!n)return;let r;try{if(r=JSON.parse(n),!r.resolvedUrl||!r.timestamp)return}catch{try{sessionStorage.removeItem("floe_pending_navigation")}catch{}return}if(Date.now()-r.timestamp>6e4){try{sessionStorage.removeItem("floe_pending_navigation")}catch{}return}const i=En(),o=i===r.resolvedUrl,s={type:"bot_action_complete",action:"navigate",target:r.resolvedUrl,success:o,previousUrl:r.beforeUrl,currentUrl:i,...o?{}:{error:"Full-page navigation did not reach expected URL"},timestamp:r.timestamp,finalized:!0};try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata(s),setTimeout(()=>{this.isConnected&&this.sendMetadata(s)},3e3),console.log(`[OnboardingSDK] 🔄 Finalized pending navigation: ${r.resolvedUrl} (success=${o})`)}async handleCheckPrecondition(n){const r=n.precondition;if(!r){console.warn("[OnboardingSDK] ⚠️ No precondition specified"),this.sendMetadata({type:"precondition_result",preconditionType:"unknown",optionText:"",result:!1,details:"No precondition specified in action",timestamp:Date.now()});return}const{type:i,optionText:o,selector:s}=r;let a=!1,l="";switch(i){case"option_exists":{if(!o){l="No optionText provided for option_exists";break}const c=this.findDropdownTrigger(n.target);if(c){console.log("[OnboardingSDK] 🔍 Opening dropdown to check for option:",o),this._botActionDepth++;try{this.actionExecutor.openDropdown(c)}finally{this._botActionDepth--}await new Promise(f=>setTimeout(f,400)),a=!!this.findVisibleDropdownOption(o),a||(a=!!await this.scrollToDropdownOption(o)),l=a?`Option "${o}" found in dropdown`:`Option "${o}" NOT found in dropdown`,this._botActionDepth++;try{await new Promise(h=>setTimeout(h,100));const f=document.activeElement instanceof HTMLElement?document.activeElement:document.body;f&&f.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(h=>setTimeout(h,100)),document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight()}else l="Could not find dropdown trigger"}break;case"element_visible":{const c=s||n.target.selector;if(!c){l="No selector provided for element_visible";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_visible: "${c}"`;break}a=!!(d&&Se.isVisible(d)),l=a?`Element "${c}" is visible`:`Element "${c}" is NOT visible or not found`}break;case"element_enabled":{const c=s||n.target.selector;if(!c){l="No selector provided for element_enabled";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_enabled: "${c}"`;break}d?(a=!(d.hasAttribute("disabled")||d.getAttribute("aria-disabled")==="true"||d.classList.contains("disabled")||d.disabled===!0),l=a?`Element "${c}" is enabled`:`Element "${c}" is disabled`):l=`Element "${c}" not found`}break;default:l=`Unknown precondition type: ${i}`}console.log(`[OnboardingSDK] 🔍 Precondition check result: ${a} - ${l}`),this.sendMetadata({type:"precondition_result",preconditionType:i,optionText:o,result:a,details:l,timestamp:Date.now()})}async handleMultiSelectAction(n){const r=n.target.selectedValues||[];if(console.log("[OnboardingSDK] 📋 handleMultiSelectAction for:",r),r.length===0){console.warn("[OnboardingSDK] ⚠️ No values to select in multi_select action"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"No values provided for multi-select",timestamp:Date.now()});return}const i=this.findDropdownTrigger(n.target);if(!i){console.error("[OnboardingSDK] ❌ Could not find dropdown trigger for multi-select"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Dropdown trigger not found",timestamp:Date.now()});return}Se.scrollIntoView(i),await new Promise(l=>setTimeout(l,200)),await this.overlay.moveToElementAndClick(i),console.log("[OnboardingSDK] 📂 Opening multi-select dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}await new Promise(l=>setTimeout(l,300));const o=[],s=[];for(let l=0;l<r.length;l++){const c=r[l];console.log(`[OnboardingSDK] 📋 Selecting option ${l+1}/${r.length}: "${c}"`);let d=this.findVisibleDropdownOption(c);if(!d){console.log("[OnboardingSDK] ⚠️ Option not visible, checking if dropdown closed..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}if(await new Promise(f=>setTimeout(f,300)),d=this.findVisibleDropdownOption(c),!d){const f=await this.scrollToDropdownOption(c);f&&(d=f)}}if(d)if(d.getAttribute("aria-selected")==="true"||d.classList.contains("selected")||d.closest('[aria-selected="true"]')!==null)o.push(c),console.log(`[OnboardingSDK] ✅ Already selected: "${c}"`);else{this._botActionDepth++;try{const h=d.getBoundingClientRect(),b=h.left+h.width/2,y=h.top+h.height/2,g={bubbles:!0,cancelable:!0,view:window,clientX:b,clientY:y};d.dispatchEvent(new MouseEvent("mousedown",g)),d.dispatchEvent(new MouseEvent("mouseup",g)),d.dispatchEvent(new MouseEvent("click",g)),await new Promise(S=>setTimeout(S,200)),o.push(c),console.log(`[OnboardingSDK] ✅ Selected: "${c}"`)}finally{this._botActionDepth--}}else s.push(c),console.warn(`[OnboardingSDK] ⚠️ Option not found after retries: "${c}"`)}await new Promise(l=>setTimeout(l,200)),this._botActionDepth++;try{const l=document.activeElement instanceof HTMLElement?document.activeElement:document.body;l&&l.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(d=>setTimeout(d,100));const c=document.querySelector('[class*="backdrop"], [class*="overlay"], .MuiBackdrop-root');c&&c instanceof HTMLElement?c.click():document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight();const a=o.length>0;console.log(`[OnboardingSDK] 📋 Multi-select complete: ${o.length} selected, ${s.length} failed`),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:a,target:n.target.text||n.target.selector||"unknown",selectedValues:o,failedValues:s,timestamp:Date.now()})}async handleDropdownOptionClick(n){const r=n.target.optionText;console.log("[OnboardingSDK] 🎯 handleDropdownOptionClick for:",r);let i=this.findVisibleDropdownOption(r);if(i){console.log("[OnboardingSDK] ✅ Option already visible, clicking directly"),await this.clickDropdownOption(i,n);return}console.log("[OnboardingSDK] 🔍 Option not visible, opening dropdown first");const o=this.findDropdownTrigger(n.target);if(!o){console.error("[OnboardingSDK] ❌ Could not find dropdown trigger"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:"Dropdown trigger not found",timestamp:Date.now()});return}Se.scrollIntoView(o),await new Promise(c=>setTimeout(c,200)),await this.overlay.moveToElementAndClick(o),console.log("[OnboardingSDK] 📂 Opening dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(o)}finally{this._botActionDepth--}await new Promise(c=>setTimeout(c,200));const s=3e3,a=150;let l=0;for(;l<s;){if(i=this.findVisibleDropdownOption(r),i){console.log("[OnboardingSDK] ✅ Option appeared after",l,"ms");break}await new Promise(c=>setTimeout(c,a)),l+=a}if(!i){console.error("[OnboardingSDK] ❌ Option did not appear after",s,"ms"),console.error("[OnboardingSDK] Looking for:",r);const c=document.querySelectorAll('[role="option"], [class*="option"]'),d=Array.from(c).slice(0,10).map(f=>{var h;return(h=f.textContent)==null?void 0:h.trim().slice(0,50)}).filter(Boolean);d.length>0?console.log("[OnboardingSDK] Available options:",d):console.log("[OnboardingSDK] No options visible - dropdown may not have opened"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:`Option "${r}" not found in dropdown`,timestamp:Date.now()}),this.overlay.clearHighlight();return}await this.clickDropdownOption(i,n)}findVisibleDropdownOption(n){var a;const r=n.toLowerCase().trim(),i=['[role="listbox"]','[role="menu"]','[class*="-menu"]:not([aria-hidden="true"])','[class*="listbox"]','[class*="options-container"]',".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"];let o=null,s=null;for(const l of i){let c;try{c=document.querySelectorAll(l)}catch{continue}for(const d of c){const f=d;if(!Se.isVisible(f)||f.getBoundingClientRect().height<20)continue;const b=d.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]):not([class*="placeholder"]), nz-option-item, .ant-select-item-option, .ant-select-item-option-content');for(const y of b){const g=y,S=g.className||"";if(S.toLowerCase().includes("singlevalue")||S.toLowerCase().includes("placeholder"))continue;const v=((a=g.textContent)==null?void 0:a.trim().toLowerCase())||"";if(v===r){console.log(`[OnboardingSDK] Found EXACT match for option: "${n}"`),o=g;break}if(!s&&v.includes(r)){const w=r.length/v.length;w>.7&&(console.log(`[OnboardingSDK] Found partial match (${(w*100).toFixed(0)}%): "${v.slice(0,50)}"`),s=g)}}if(o)break}if(o)break}return o||(s?(console.warn(`[OnboardingSDK] ⚠️ Using partial match for "${n}" - verify this is correct`),s):(console.log(`[OnboardingSDK] No option found for: "${n}"`),null))}async scrollToDropdownOption(n){var o;const r=n.toLowerCase().trim();console.log(`[OnboardingSDK] 🔍 Scrolling dropdown to find: "${n}"`);const i=document.querySelectorAll('[role="listbox"], [class*="-menu"] [class*="menu-list"], [class*="options-container"], [class*="virtual-list"]');for(const s of i){const a=s;if(!Se.isVisible(a)||a.scrollHeight<=a.clientHeight)continue;console.log(`[OnboardingSDK] Found scrollable container, scrollHeight: ${a.scrollHeight}`);const l=200,c=Math.ceil(a.scrollHeight/l);for(let d=0;d<c;d++){a.scrollTop=d*l,await new Promise(h=>setTimeout(h,100));const f=a.querySelectorAll('[role="option"], [class*="option"]');for(const h of f){const b=h,y=((o=b.textContent)==null?void 0:o.trim().toLowerCase())||"";if(y===r||y.includes(r))return console.log(`[OnboardingSDK] ✅ Found option after scrolling: "${n}"`),b.scrollIntoView({block:"center"}),await new Promise(g=>setTimeout(g,100)),b}}}return console.log(`[OnboardingSDK] Option not found after scrolling: "${n}"`),null}isValidDropdownElement(n,r=!1){if(!n)return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is null"),!1;if(xt(n))return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is inside SDK widget",{id:n.id,className:n.className,tagName:n.tagName}),!1;if(n.getAttribute("aria-hidden")==="true"||n.closest('[aria-hidden="true"]'))return console.warn('[OnboardingSDK] ⚠️ Dropdown validation: element or ancestor has aria-hidden="true"',{id:n.id,className:n.className}),!1;const i=window.getComputedStyle(n);if(i.display==="none")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has display:none",{id:n.id,className:n.className}),!1;if(i.visibility==="hidden")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has visibility:hidden",{id:n.id,className:n.className}),!1;if(i.pointerEvents==="none")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has pointer-events:none",{id:n.id,className:n.className}),!1;if(i.opacity==="0")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has opacity:0",{id:n.id,className:n.className}),!1;const o=i.position;if(n.offsetParent===null&&o!=="fixed"&&o!=="sticky"){let a=n.parentElement,l=!1;for(;a;){const c=window.getComputedStyle(a);if(c.position==="fixed"||c.position==="sticky"){l=!0;break}a=a.parentElement}if(!l)return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has null offsetParent (not rendered)",{id:n.id,className:n.className}),!1}const s=n.getBoundingClientRect();return s.width<=0||s.height<=0?(console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has zero dimensions",{id:n.id,className:n.className,width:s.width,height:s.height}),!1):r&&!(n.closest('[role="combobox"]')!==null||n.closest('[aria-haspopup="listbox"]')!==null||n.closest('[aria-haspopup="true"]')!==null||n.closest('[class*="select"]')!==null||n.closest('[class*="Select"]')!==null||n.closest('[class*="dropdown"]')!==null||n.closest('[class*="Dropdown"]')!==null||n.closest("select")!==null)?(console.warn("[OnboardingSDK] ⚠️ Dropdown validation (Strategy 5): element lacks dropdown-like ancestor",{id:n.id,className:n.className,tagName:n.tagName}),!1):!0}findDropdownTrigger(n){var o;if(n.dropdownTriggerSelector){console.log("[OnboardingSDK] 🎯 Using dropdownTriggerSelector:",n.dropdownTriggerSelector);try{const s=uy(n.dropdownTriggerSelector);if(s){const a=this.getClickableDropdownContainer(s);if(this.isValidDropdownElement(a))return console.log("[OnboardingSDK] ✅ Found trigger via dropdownTriggerSelector"),a;console.warn("[OnboardingSDK] ⚠️ Strategy 1: dropdownTriggerSelector element failed validation")}}catch(s){console.warn("[OnboardingSDK] Invalid dropdownTriggerSelector:",s)}}if(n.labelText){console.log("[OnboardingSDK] 🔍 Finding dropdown by label:",n.labelText);const s=this.findDropdownByLabel(n.labelText);if(s)return console.log("[OnboardingSDK] ✅ Found trigger via labelText"),s}const r=document.querySelector('input[role="combobox"]:focus');if(r){const s=this.getClickableDropdownContainer(r);if(this.isValidDropdownElement(s))return console.log("[OnboardingSDK] ✅ Found focused combobox"),s;console.warn("[OnboardingSDK] ⚠️ Strategy 3: focused combobox failed validation")}const i=document.querySelector('input[role="combobox"][aria-expanded="true"]');if(i){const s=this.getClickableDropdownContainer(i);if(this.isValidDropdownElement(s))return console.log("[OnboardingSDK] ✅ Found expanded combobox"),s;console.warn("[OnboardingSDK] ⚠️ Strategy 3: expanded combobox failed validation")}if(n.selector){const a=n.selector.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[role="option"\]/g,"").trim();if(a&&a!=="")try{const l=document.querySelector(a);if(l){const c=this.getClickableDropdownContainer(l);if(this.isValidDropdownElement(c))return console.log("[OnboardingSDK] ✅ Found trigger via cleaned selector"),c;console.warn("[OnboardingSDK] ⚠️ Strategy 4: selector element failed validation")}}catch{console.warn("[OnboardingSDK] Invalid selector:",a)}}if(n.text||n.optionText){const s=(n.text||n.optionText||"").toLowerCase(),a=['[class*="singleValue"]','[class*="single-value"]','[class*="select__single-value"]',".MuiSelect-select",'[class*="placeholder"]'];for(const l of a){const c=document.querySelectorAll(l);for(const d of c){const f=((o=d.textContent)==null?void 0:o.trim().toLowerCase())||"";if(f===s||f.includes(s)){const h=this.getClickableDropdownContainer(d);if(this.isValidDropdownElement(h,!0))return console.log("[OnboardingSDK] ✅ Found trigger via display value match"),h;console.warn("[OnboardingSDK] ⚠️ Strategy 5: display value match element failed validation",{searchText:s,selector:l,elementText:f})}}}}return console.warn("[OnboardingSDK] ❌ Could not find dropdown trigger"),null}findDropdownByLabel(n){var o;const r=n.toLowerCase().trim(),i=["label",'[class*="label"]','[class*="Label"]','[class*="form-label"]',".MuiFormLabel-root",".MuiInputLabel-root"];for(const s of i){const a=document.querySelectorAll(s);for(const l of a){const c=((o=l.textContent)==null?void 0:o.trim().toLowerCase().replace(/\*$/,"").trim())||"";if(c===r||c.includes(r)){const d=l;if(d.tagName==="LABEL"&&d.htmlFor){const b=document.getElementById(d.htmlFor);if(b)return this.getClickableDropdownContainer(b)}const f=d.id;if(f){const b=document.querySelector(`[aria-labelledby="${f}"]`);if(b)return this.getClickableDropdownContainer(b)}const h=d.closest('[class*="field"], [class*="form-group"], [class*="FormControl"]')||d.parentElement;if(h){const b=h.querySelector('input[role="combobox"], select, [aria-haspopup="listbox"], [class*="control"]');if(b)return this.getClickableDropdownContainer(b)}}}}return null}getClickableDropdownContainer(n){var i;return n.closest('[class*="-control"]')||n.closest('[class*="control"]')||n.closest('[class*="trigger"]')||n.closest("[aria-haspopup]")||((i=n.closest(".MuiSelect-select"))==null?void 0:i.parentElement)||n.closest('[class*="select"]')||n}async clickDropdownOption(n,r){var i;await this.overlay.moveToElementAndClick(n),await new Promise(o=>setTimeout(o,150)),console.log("[OnboardingSDK] 👆 Clicking dropdown option:",(i=n.textContent)==null?void 0:i.trim()),this._botActionDepth++;try{if(this.actionExecutor.triggerReactOnClickPublic(n))console.log("[OnboardingSDK] ✅ React onClick triggered for option");else{const s=n.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l};n.dispatchEvent(new MouseEvent("mousedown",c)),n.dispatchEvent(new MouseEvent("mouseup",c)),n.dispatchEvent(new MouseEvent("click",c))}}finally{this._botActionDepth--}console.log("[OnboardingSDK] ✅ Dropdown option clicked successfully"),this.domIntrospector&&(await new Promise(o=>setTimeout(o,150)),this.domIntrospector.captureAndSendImmediate("post-dropdown-select"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after dropdown selection")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!0,target:r.target.optionText||r.target.text||"dropdown option",timestamp:Date.now()}),console.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance"),await new Promise(o=>setTimeout(o,200)),setTimeout(()=>{this.overlay.clearHighlight(),this.overlay.hideFloeCursor()},600)}findCollapsedSidebar(n){let r=n.parentElement;for(;r&&r!==document.body;){const i=window.getComputedStyle(r),o=r.getBoundingClientRect().width,s=r.getBoundingClientRect().height,a=i.transition.includes("width")||i.transitionProperty.includes("width")||i.transitionProperty==="all",l=o<80,c=s>window.innerHeight*.5,d=typeof r.className=="string"?r.className:"",f=d.includes("sidebar")||d.includes("nav")||d.includes("menu"),h=d.includes("w-12")||d.includes("w-14")||d.includes("w-16");if(l&&c&&(a||f)||h)return console.log("[OnboardingSDK] Detected collapsed sidebar:",{width:o,height:s,hasTransition:a,hasTailwindCollapsed:h,classes:r.className.substring(0,100)}),r;r=r.parentElement}return null}async executeActionFast(n){console.log("[OnboardingSDK] ⚡ Fast executing action:",n.action);let r=Se.resolveTarget(n.target);if(!r&&(await new Promise(o=>setTimeout(o,150)),r=Se.resolveTarget(n.target),!r))return console.warn("[OnboardingSDK] ⚠️ Fast action target not found"),!1;r.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(o=>setTimeout(o,50)),this.overlay.highlightResolvedElement(r,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(o=>setTimeout(o,80)),this._botActionDepth++;let i=!1;try{i=await this.actionExecutor.executeHybridAction(n,!1)}finally{this._botActionDepth--}return await new Promise(o=>setTimeout(o,50)),this.overlay.clearHighlight(),i}async handleExecuteApi(n){var b;console.log("[OnboardingSDK] 🔌 Executing API call:",n.method,n.url);const{method:r="GET",url:i,base_url:o,body:s,query_params:a,success_indicator:l,result_extractor:c,error_message_path:d}=n;let f=i;if(o&&(f=`${o.replace(/\/$/,"")}/${i.replace(/^\//,"")}`),a&&r==="GET"){const y=new URLSearchParams(a);f=`${f}?${y.toString()}`}try{const y=new URL(f,window.location.href);if(y.origin!==window.location.origin){console.error("[OnboardingSDK] ❌ Cross-origin API request blocked:",y.origin),this.sendMetadata({type:"api_execution_result",success:!1,error:`Cross-origin request blocked: ${y.origin} does not match ${window.location.origin}`,url:f,method:r,timestamp:Date.now()});return}}catch{console.error("[OnboardingSDK] ❌ Invalid URL:",f),this.sendMetadata({type:"api_execution_result",success:!1,error:`Invalid URL: ${f}`,url:f,method:r,timestamp:Date.now()});return}if(!["GET","HEAD","POST","PUT","PATCH","DELETE"].includes(r.toUpperCase())){console.error("[OnboardingSDK] ❌ HTTP method not allowed:",r),this.sendMetadata({type:"api_execution_result",success:!1,error:`HTTP method not allowed: ${r}`,url:f,method:r,timestamp:Date.now()});return}try{const y={method:r.toUpperCase(),headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"};s&&r!=="GET"&&(y.body=JSON.stringify(s)),console.log("[OnboardingSDK] 📤 Making API request:",f);const g=await fetch(f,y);let S;const v=await g.text();try{S=JSON.parse(v)}catch{S={raw:v}}console.log("[OnboardingSDK] 📥 API response:",g.status,S);const w=g.ok&&this.evaluateJsonPathCondition(S,l),k=this.extractJsonPath(S,c);let C;w||(C=this.extractJsonPath(S,d)||((b=S.error)==null?void 0:b.message)||S.message||`Request failed with status ${g.status}`),this.sendMetadata({type:"api_execution_result",success:w,status_code:g.status,data:S,result_text:k,error:C,url:f,method:r,timestamp:Date.now()}),console.log(`[OnboardingSDK] ${w?"✅":"❌"} API execution ${w?"succeeded":"failed"}:`,k||C)}catch(y){console.error("[OnboardingSDK] ❌ API execution error:",y),this.sendMetadata({type:"api_execution_result",success:!1,error:y instanceof Error?y.message:"Unknown error",url:f,method:r,timestamp:Date.now()})}}evaluateJsonPathCondition(n,r){if(!r)return!0;try{if(r.includes(" == ")){const[i,o]=r.split(" == "),s=this.extractJsonPath(n,i.trim()),a=o.trim().replace(/^["']|["']$/g,"");return String(s)===a}return!!this.extractJsonPath(n,r)}catch{return!0}}extractJsonPath(n,r){if(!r||!n)return;const o=r.replace(/^\$\.?/,"").split(".");let s=n;for(const a of o){if(s==null)return;s=s[a]}return s}async handleBatchedNavigation(n){if(console.log("[OnboardingSDK] ⚡ Received batched navigation request"),!this.batchedActionExecutor){console.error("[OnboardingSDK] BatchedActionExecutor not initialized");return}const r=(n.steps||[]).map(i=>{const o=i.target||i,a=o.text||o.selector||o.tag?{text:o.text,tag:o.tag,selector:o.selector,ariaLabel:o.aria_label||o.ariaLabel,role:o.role,labelText:o.label_text||o.labelText,selectorFallbacks:o.selector_fallbacks||o.selectorFallbacks}:void 0;return{action:i.action,target:a,condition:i.condition,waitMs:i.wait_ms||i.waitMs}});if(r.length===0){console.warn("[OnboardingSDK] No steps in batched navigation request");return}this.fastExecutionMode=!0,this._botActionDepth++;try{console.log("[OnboardingSDK] ⚡ Executing batched navigation with steps:",r.map(o=>{var s;return`${o.action}${(s=o.target)!=null&&s.text?` "${o.target.text}"`:""}`}).join(" → "));const i=await this.batchedActionExecutor.executeBatch({steps:r});this.domIntrospector&&(await new Promise(o=>setTimeout(o,200)),this.domIntrospector.captureAndSendImmediate("post-batched-navigation"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after batched navigation")),i.success?(console.log("[OnboardingSDK] ✅ Batched navigation complete, sending success"),this.sendMetadata({type:"batched_navigation_complete",success:!0,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()})):(console.log(`[OnboardingSDK] ❌ Batched navigation failed at step ${i.completedSteps+1}, sending failure`),this.sendMetadata({type:"batched_navigation_complete",success:!1,error:`Step ${i.completedSteps+1} failed - check console for details`,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()}))}finally{this.fastExecutionMode=!1,this._botActionDepth--}}startNavigationDetection(n){this.navigationCompleteDetector&&this.navigationCompleteDetector.start(r=>{console.log("[OnboardingSDK] Navigation complete detected:",r),this.sendMetadata({type:"navigation_complete",url:r,timestamp:Date.now()}),n(r)})}stopNavigationDetection(){this.navigationCompleteDetector&&this.navigationCompleteDetector.stop()}isInFastMode(){return this.fastExecutionMode}async extractIntent(n){const r={"get started":"onboarding",help:"assistance","show me":"demonstration","how do":"tutorial",where:"navigation",what:"information"},i=n.toLowerCase();for(const[o,s]of Object.entries(r))if(i.includes(o))return s;return"unknown"}async captureContext(){const n=this.config.enableScreenCapture?await this.capture.captureWithRedaction():void 0,r=this.extractPageStructure();return{screenshot:n,url:En(),structure:r,timestamp:Date.now()}}extractPageStructure(){const n=[];return["button","a","input","select","textarea",'[role="button"]',"[onclick]"].forEach(i=>{document.querySelectorAll(i).forEach(o=>{const s=o.getBoundingClientRect(),a=s.width>0&&s.height>0&&s.top<window.innerHeight&&s.bottom>0;a&&n.push({selector:this.getSelector(o),type:o.tagName.toLowerCase(),text:(o.textContent||"").trim().substring(0,100),visible:a,position:s,attributes:this.getAttributes(o)})})}),{title:document.title,url:En(),elements:n,viewport:{width:window.innerWidth,height:window.innerHeight}}}getSelector(n){if(n.id)return`#${n.id}`;const r=[];let i=n;for(;i&&i!==document.body;){let o=i.tagName.toLowerCase();if(i.className){const s=Array.from(i.classList).slice(0,2).join(".");s&&(o+=`.${s}`)}r.unshift(o),i=i.parentElement}return r.join(" > ")}getAttributes(n){const r={};return["href","type","name","placeholder","aria-label","role"].forEach(o=>{const s=n.getAttribute(o);s&&(r[o]=s)}),r}async sendText(n){this.pipecatClient&&this.isConnected&&await this.pipecatClient.sendText(n)}toggleMute(){if(this.pipecatClient){const r=!this.pipecatClient.isMicEnabled;return this.pipecatClient.enableMic(r),this.micEnabled=r,console.log("[OnboardingSDK] 🎤 Mic toggled:",r?"ON":"MUTED"),this.renderReactUI(),r}return!1}highlight(n,r){this.overlay.highlight(n,r)}clearHighlight(){this.overlay.clearHighlight()}showTooltip(n,r){this.overlay.showTooltip(n,r)}hideTooltip(){this.overlay.hideTooltip()}async executeAction(n){return this.actionExecutor.executeWithConsent(n)}async takeScreenshot(n){return this.capture.captureWithRedaction(n)}getSessionId(){return this.sessionId}getStatus(){return{initialized:this.isInitialized,connected:this.isConnected,sessionId:this.sessionId,microphoneMuted:this.pipecatClient?!this.pipecatClient.isMicEnabled:!1}}startGuidedDiscovery(){return!this.pipecatClient||!this.isConnected?(console.warn("[OnboardingSDK] Cannot start discovery - not connected"),!1):(console.log("[OnboardingSDK] 🔍 Starting guided discovery mode"),this.pipecatClient.sendClientMessage("start_discovery",{type:"start_discovery",timestamp:Date.now()}),this.hideWelcomePopup(),!0)}skipDiscovery(){console.log("[OnboardingSDK] Skipping discovery - standard greeting flow"),this.hideWelcomePopup()}showWelcomePopupAsync(){return new Promise(n=>{if(document.getElementById("floe-welcome-popup")){n(!1);return}const r=document.createElement("div");r.id="floe-welcome-popup",r.setAttribute("data-floe-widget","true"),r.style.cssText=`
|
|
819
814
|
position: fixed;
|
|
820
815
|
top: 0;
|
|
821
816
|
left: 0;
|
|
@@ -973,5 +968,5 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
973
968
|
">
|
|
974
969
|
I'll explore on my own
|
|
975
970
|
</button>
|
|
976
|
-
`,r.appendChild(i),document.body.appendChild(r);const o=r.querySelector("#floe-start-guided"),s=r.querySelector("#floe-skip-guided");o&&(o.onmouseenter=()=>{o.style.background="rgba(255, 255, 255, 1)",o.style.transform="translateY(-1px)",o.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)"},o.onmouseleave=()=>{o.style.background="rgba(255, 255, 255, 0.95)",o.style.transform="translateY(0)",o.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.2)"},o.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!0)},200)}),s&&(s.onmouseenter=()=>{s.style.color="rgba(255, 255, 255, 0.8)"},s.onmouseleave=()=>{s.style.color="rgba(255, 255, 255, 0.4)"},s.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!1)},200)}),console.log("[OnboardingSDK] Welcome popup shown (async)")})}showWelcomePopup(){this.showWelcomePopupAsync().then(n=>{n?this.startGuidedDiscovery():this.skipDiscovery()})}hideWelcomePopup(){const n=document.getElementById("floe-welcome-popup");n&&(n.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>n.remove(),200)),console.log("[OnboardingSDK] Welcome popup hidden")}shouldShowDiscoveryPrompt(){const n=localStorage.getItem("floe_has_visited"),r=localStorage.getItem("floe_onboarding_complete");return!n||!r}async checkEndUserStatus(){var n,r,i,o,s;try{const a=`${this.config.apiUrl}/end-users/check-status`,l={clientKey:this.config.clientKey,origin:window.location.origin};(n=this.config.userInfo)!=null&&n.externalId&&(l.externalId=this.config.userInfo.externalId),(r=this.config.userInfo)!=null&&r.email&&(l.email=this.config.userInfo.email),this.config.debug&&console.log("[OnboardingSDK] Checking EndUser status...",{externalId:l.externalId?"***":void 0,email:l.email?"***":void 0});const c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){console.warn(`[OnboardingSDK] EndUser status check failed: ${c.status}`);return}this.endUserStatus=await c.json(),console.log(`[OnboardingSDK] EndUser status: found=${(i=this.endUserStatus)==null?void 0:i.found}, isNewUser=${(o=this.endUserStatus)==null?void 0:o.isNewUser}, hasPreferences=${(s=this.endUserStatus)==null?void 0:s.hasPreferences}`)}catch(a){console.warn("[OnboardingSDK] Error checking EndUser status:",a)}}getEndUserPreferences(){var n;return((n=this.endUserStatus)==null?void 0:n.preferences)||null}shouldSkipOnboardingModal(){var o,s;if(typeof this.config.skipOnboardingModal=="boolean")return console.log(`[OnboardingSDK] skipOnboardingModal explicitly set to: ${this.config.skipOnboardingModal}`),this.config.skipOnboardingModal;if(((o=this.endUserStatus)==null?void 0:o.isNewUser)===!0)return console.log("[OnboardingSDK] Showing modal: API indicates isNewUser=true"),!1;if((s=this.endUserStatus)!=null&&s.found&&this.endUserStatus.isNewUser===!1)return console.log("[OnboardingSDK] Skipping modal: existing EndUser (isNewUser=false)"),!0;const n=localStorage.getItem("floe_has_visited")==="true",r=localStorage.getItem("floe_onboarding_complete")==="true",i=n&&r;return console.log(`[OnboardingSDK] Fallback to localStorage: skip=${i} (hasVisited: ${n}, hasCompletedOnboarding: ${r})`),i}markUserVisited(){localStorage.setItem("floe_has_visited","true")}markOnboardingComplete(){localStorage.setItem("floe_onboarding_complete","true")}async disconnect(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.clearHighlight(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.reactRoot&&(this.reactRoot.unmount(),this.reactRoot=null),this.reactContainer&&(this.reactContainer.remove(),this.reactContainer=null),this.overlay.remove(),this.isInitialized=!1,this.isConnected=!1,this.agentState="idle",console.log("[OnboardingSDK] Disconnected"),this.emit("disconnected")}}typeof window<"u"&&(window.OnboardingSDK=
|
|
971
|
+
`,r.appendChild(i),document.body.appendChild(r);const o=r.querySelector("#floe-start-guided"),s=r.querySelector("#floe-skip-guided");o&&(o.onmouseenter=()=>{o.style.background="rgba(255, 255, 255, 1)",o.style.transform="translateY(-1px)",o.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)"},o.onmouseleave=()=>{o.style.background="rgba(255, 255, 255, 0.95)",o.style.transform="translateY(0)",o.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.2)"},o.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!0)},200)}),s&&(s.onmouseenter=()=>{s.style.color="rgba(255, 255, 255, 0.8)"},s.onmouseleave=()=>{s.style.color="rgba(255, 255, 255, 0.4)"},s.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!1)},200)}),console.log("[OnboardingSDK] Welcome popup shown (async)")})}showWelcomePopup(){this.showWelcomePopupAsync().then(n=>{n?this.startGuidedDiscovery():this.skipDiscovery()})}hideWelcomePopup(){const n=document.getElementById("floe-welcome-popup");n&&(n.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>n.remove(),200)),console.log("[OnboardingSDK] Welcome popup hidden")}shouldShowDiscoveryPrompt(){const n=localStorage.getItem("floe_has_visited"),r=localStorage.getItem("floe_onboarding_complete");return!n||!r}async checkEndUserStatus(){var n,r,i,o,s;try{const a=`${this.config.apiUrl}/end-users/check-status`,l={clientKey:this.config.clientKey,origin:window.location.origin};(n=this.config.userInfo)!=null&&n.externalId&&(l.externalId=this.config.userInfo.externalId),(r=this.config.userInfo)!=null&&r.email&&(l.email=this.config.userInfo.email),this.config.debug&&console.log("[OnboardingSDK] Checking EndUser status...",{externalId:l.externalId?"***":void 0,email:l.email?"***":void 0});const c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){console.warn(`[OnboardingSDK] EndUser status check failed: ${c.status}`);return}this.endUserStatus=await c.json(),console.log(`[OnboardingSDK] EndUser status: found=${(i=this.endUserStatus)==null?void 0:i.found}, isNewUser=${(o=this.endUserStatus)==null?void 0:o.isNewUser}, hasPreferences=${(s=this.endUserStatus)==null?void 0:s.hasPreferences}`)}catch(a){console.warn("[OnboardingSDK] Error checking EndUser status:",a)}}getEndUserPreferences(){var n;return((n=this.endUserStatus)==null?void 0:n.preferences)||null}shouldSkipOnboardingModal(){var o,s;if(typeof this.config.skipOnboardingModal=="boolean")return console.log(`[OnboardingSDK] skipOnboardingModal explicitly set to: ${this.config.skipOnboardingModal}`),this.config.skipOnboardingModal;if(((o=this.endUserStatus)==null?void 0:o.isNewUser)===!0)return console.log("[OnboardingSDK] Showing modal: API indicates isNewUser=true"),!1;if((s=this.endUserStatus)!=null&&s.found&&this.endUserStatus.isNewUser===!1)return console.log("[OnboardingSDK] Skipping modal: existing EndUser (isNewUser=false)"),!0;const n=localStorage.getItem("floe_has_visited")==="true",r=localStorage.getItem("floe_onboarding_complete")==="true",i=n&&r;return console.log(`[OnboardingSDK] Fallback to localStorage: skip=${i} (hasVisited: ${n}, hasCompletedOnboarding: ${r})`),i}markUserVisited(){localStorage.setItem("floe_has_visited","true")}markOnboardingComplete(){localStorage.setItem("floe_onboarding_complete","true")}async disconnect(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.clearHighlight(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.reactRoot&&(this.reactRoot.unmount(),this.reactRoot=null),this.reactContainer&&(this.reactContainer.remove(),this.reactContainer=null),this.overlay.remove(),this.isInitialized=!1,this.isConnected=!1,this.agentState="idle",console.log("[OnboardingSDK] Disconnected"),this.emit("disconnected")}}typeof window<"u"&&(window.OnboardingSDK=py);function Bx(t){return{clientKey:t.clientKey,...t.apiUrl!==void 0&&{apiUrl:t.apiUrl},enableVideo:!1,enableAudio:t.enableAudio??!0,enableScreenCapture:t.enableScreenCapture??!0,debug:t.debug??!1,industry:t.industry,useCase:t.useCase,companyName:t.companyName,companySize:t.companySize,role:t.role,userInfo:t.userInfo,skipOnboardingModal:t.skipOnboardingModal,enableDiscoveryPopup:!0,nudge:t.nudge?{text:t.nudge.text??"Hi 👋 How can I help you today?",autoShow:t.nudge.autoShow??!0,autoHideDelay:t.nudge.autoHideDelay??0}:void 0}}function gy(t){if(!t.clientKey)throw new Error("[Floe] clientKey is required");const e=Bx(t),n=new py(e);return n.ready=n.init().catch(r=>{throw console.error("[Floe] Initialization failed:",r),r}),n}return typeof window<"u"&&(window.Floe=gy),ln.Floe=gy,Object.defineProperty(ln,Symbol.toStringTag,{value:"Module"}),ln}({});
|
|
977
972
|
//# sourceMappingURL=floe-sdk.iife.js.map
|