@floe-ai/sdk 0.1.0-dev.2
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/LICENSE +36 -0
- package/README.md +144 -0
- package/dist-sdk/floe-sdk.es.js +18107 -0
- package/dist-sdk/floe-sdk.es.js.map +1 -0
- package/dist-sdk/floe-sdk.iife.js +918 -0
- package/dist-sdk/floe-sdk.iife.js.map +1 -0
- package/dist-sdk/floe-sdk.umd.js +918 -0
- package/dist-sdk/floe-sdk.umd.js.map +1 -0
- package/dist-sdk/index.d.ts +561 -0
- package/package.json +75 -0
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
(function(_t,ot){typeof exports=="object"&&typeof module<"u"?ot(exports):typeof define=="function"&&define.amd?define(["exports"],ot):(_t=typeof globalThis<"u"?globalThis:_t||self,ot(_t.FloeSDK={}))})(this,function(_t){"use strict";var Dx=Object.defineProperty;var Lx=(_t,ot,En)=>ot in _t?Dx(_t,ot,{enumerable:!0,configurable:!0,writable:!0,value:En}):_t[ot]=En;var L=(_t,ot,En)=>Lx(_t,typeof ot!="symbol"?ot+"":ot,En);function ot(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var En={exports:{}},jr=typeof Reflect=="object"?Reflect:null,pd=jr&&typeof jr.apply=="function"?jr.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},jo;jr&&typeof jr.ownKeys=="function"?jo=jr.ownKeys:Object.getOwnPropertySymbols?jo=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:jo=function(e){return Object.getOwnPropertyNames(e)};function ly(t){console&&console.warn&&console.warn(t)}var hd=Number.isNaN||function(e){return e!==e};function ce(){ce.init.call(this)}En.exports=ce,En.exports.once=fy,ce.EventEmitter=ce,ce.prototype._events=void 0,ce.prototype._eventsCount=0,ce.prototype._maxListeners=void 0;var gd=10;function Fo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ce,"defaultMaxListeners",{enumerable:!0,get:function(){return gd},set:function(t){if(typeof t!="number"||t<0||hd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");gd=t}}),ce.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},ce.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hd(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 md(t){return t._maxListeners===void 0?ce.defaultMaxListeners:t._maxListeners}ce.prototype.getMaxListeners=function(){return md(this)},ce.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")pd(l,this,n);else for(var c=l.length,d=Sd(l,c),r=0;r<c;++r)pd(d[r],this,n);return!0};function vd(t,e,n,r){var i,o,s;if(Fo(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=md(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,ly(a)}return t}ce.prototype.addListener=function(e,n){return vd(this,e,n,!1)},ce.prototype.on=ce.prototype.addListener,ce.prototype.prependListener=function(e,n){return vd(this,e,n,!0)};function cy(){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 yd(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=cy.bind(r);return i.listener=n,r.wrapFn=i,i}ce.prototype.once=function(e,n){return Fo(n),this.on(e,yd(this,e,n)),this},ce.prototype.prependOnceListener=function(e,n){return Fo(n),this.prependListener(e,yd(this,e,n)),this},ce.prototype.removeListener=function(e,n){var r,i,o,s,a;if(Fo(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():uy(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this},ce.prototype.off=ce.prototype.removeListener,ce.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 bd(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?dy(i):Sd(i,i.length)}ce.prototype.listeners=function(e){return bd(this,e,!0)},ce.prototype.rawListeners=function(e){return bd(this,e,!1)},ce.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):wd.call(t,e)},ce.prototype.listenerCount=wd;function wd(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}ce.prototype.eventNames=function(){return this._eventsCount>0?jo(this._events):[]};function Sd(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function uy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function dy(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function fy(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))}kd(t,e,o,{once:!0}),e!=="error"&&py(t,i,{once:!0})})}function py(t,e,n){typeof t.on=="function"&&kd(t,"error",e,n)}function kd(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 hy=En.exports;const gy=ot(hy);for(var je=[],za=0;za<256;++za)je.push((za+256).toString(16).slice(1));function my(t,e=0){return(je[t[e+0]]+je[t[e+1]]+je[t[e+2]]+je[t[e+3]]+"-"+je[t[e+4]]+je[t[e+5]]+"-"+je[t[e+6]]+je[t[e+7]]+"-"+je[t[e+8]]+je[t[e+9]]+"-"+je[t[e+10]]+je[t[e+11]]+je[t[e+12]]+je[t[e+13]]+je[t[e+14]]+je[t[e+15]]).toLowerCase()}var Bo,vy=new Uint8Array(16);function yy(){if(!Bo&&(Bo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Bo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Bo(vy)}var by=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const xd={randomUUID:by};function wy(t,e,n){if(xd.randomUUID&&!e&&!t)return xd.randomUUID();t=t||{};var r=t.random||(t.rng||yy)();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 my(r)}const Sy={"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","Pale Moon":"pale_moon",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"},_d={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",pale_moon:"Pale Moon",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"},xe={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv",bot:"bot"},Qe={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"},Tn={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class P{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(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)){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=P.getVersionPrecision(e),o=P.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=P.map([e,n],c=>{const d=s-P.getVersionPrecision(c),f=c+new Array(d+1).join(".0");return P.map(f.split("."),p=>new Array(20-p.length).join("0")+p).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 Sy[e]}static getBrowserTypeByAlias(e){return _d[e]||""}}const ue=/version\/(\d+(\.?_?\d+)+)/i,ky=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=P.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=P.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=P.getFirstMatch(ue,t)||P.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=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/PaleMoon/i],describe(t){const e={name:"Pale Moon"},n=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=P.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=P.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=P.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=P.getFirstMatch(ue,t)||P.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=P.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=P.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=P.getFirstMatch(ue,t)||P.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=P.getFirstMatch(ue,t)||P.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=P.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||P.getFirstMatch(ue,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=P.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=P.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=P.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=P.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=P.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=P.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=P.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=P.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=P.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=P.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=P.getFirstMatch(ue,t)||P.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=P.getFirstMatch(ue,t)||P.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=P.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=P.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=P.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=P.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=P.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=P.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=P.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=P.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=P.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=P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=P.getFirstMatch(ue,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=t.search("\\(")!==-1?n:e;return{name:P.getFirstMatch(i,t),version:P.getSecondMatch(i,t)}}}],xy=[{test:[/Roku\/DVP/],describe(t){const e=P.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Qe.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=P.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Qe.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=P.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=P.getWindowsVersionName(e);return{name:Qe.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Qe.iOS},n=P.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=P.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=P.getMacOSVersionName(e),r={name:Qe.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=P.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Qe.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=P.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=P.getAndroidVersionName(e),r={name:Qe.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=P.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:Qe.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=P.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||P.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||P.getFirstMatch(/\bbb(\d+)/i,t);return{name:Qe.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=P.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Qe.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=P.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Qe.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Qe.Linux}}},{test:[/CrOS/],describe(){return{name:Qe.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=P.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Qe.PlayStation4,version:e}}}],_y=[{test:[/googlebot/i],describe(){return{type:xe.bot,vendor:"Google"}}},{test:[/huawei/i],describe(t){const e=P.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:xe.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:xe.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:xe.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:xe.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:xe.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:xe.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:xe.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=P.getFirstMatch(/(ipod|iphone)/i,t);return{type:xe.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:xe.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=P.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:xe.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:xe.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:xe.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:xe.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:xe.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:xe.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:xe.mobile}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:xe.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:xe.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:xe.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:xe.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:xe.tv}}}],Cy=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Tn.Blink};const n=P.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Tn.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:Tn.Trident},n=P.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=P.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=P.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=P.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class Cd{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=P.find(ky,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.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=P.find(xy,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=P.find(_y,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=P.find(Cy,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 P.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=P.find(a,d=>this.isOS(d));if(l){const d=this.satisfies(n[l]);if(d!==void 0)return d}const c=P.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=P.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=P.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(P.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
|
+
* Bowser - a browser detector
|
|
3
|
+
* https://github.com/lancedikson/bowser
|
|
4
|
+
* MIT License | (c) Dustin Diaz 2012-2015
|
|
5
|
+
* MIT License | (c) Denis Demchenko 2015-2019
|
|
6
|
+
*/class Ey{static getParser(e,n=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Cd(e,n)}static parse(e){return new Cd(e).getResult()}static get BROWSER_MAP(){return _d}static get ENGINE_MAP(){return Tn}static get OS_MAP(){return Qe}static get PLATFORMS_MAP(){return xe}}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 Ty(t){return t&&t.__esModule?t.default:t}function ve(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Fr={},Ed={};ve(Ed,"PipecatClient",()=>$t);var Br={};Br=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.4.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 zo={},Td={};ve(Td,"TransportStateEnum",()=>Ua);var Ua;(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"})(Ua||(Ua={}));var Yt={};ve(Yt,"RTVIError",()=>ft),ve(Yt,"ConnectionTimeoutError",()=>My),ve(Yt,"StartBotError",()=>Md),ve(Yt,"TransportStartError",()=>Ad),ve(Yt,"InvalidTransportParamsError",()=>Ay),ve(Yt,"BotNotReadyError",()=>Od),ve(Yt,"BotAlreadyStartedError",()=>Pd),ve(Yt,"UnsupportedFeatureError",()=>Oy),ve(Yt,"DeviceError",()=>cn);class ft extends Error{constructor(e,n){super(e),this.status=n}}class My extends ft{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class Md extends ft{constructor(e,n){super(e??"Failed to connect / invalid auth bundle from base url",n??500),this.error="invalid-request-error"}}class Ad extends ft{constructor(e){super(e??"Unable to connect to transport")}}class Ay extends ft{constructor(e){super(e??"Invalid transport connection parameters")}}class Od extends ft{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class Pd extends ft{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class Oy 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 Dd={};ve(Dd,"RTVIEvent",()=>K);var K;(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.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"})(K||(K={}));var zr={};ve(zr,"RTVI_PROTOCOL_VERSION",()=>Ld),ve(zr,"RTVI_MESSAGE_LABEL",()=>Id),ve(zr,"RTVIMessageType",()=>X),ve(zr,"setAboutClient",()=>Rd),ve(zr,"RTVIMessage",()=>Ye);const Ld="1.0.0",Id="rtvi-ai";var X;(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_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"})(X||(X={}));let Pi;function Rd(t){Pi?Pi={...Pi,...t}:Pi=t}class Ye{constructor(e,n,r){this.label=Id,this.type=e,this.data=n,this.id=r||wy().slice(0,8)}static clientReady(){return new Ye(X.CLIENT_READY,{version:Ld,about:Pi||{library:Br.name,library_version:Br.version}})}static disconnectBot(){return new Ye(X.DISCONNECT_BOT,{})}static error(e,n=!1){return new Ye(X.ERROR,{message:e,fatal:n})}}Qt(zo,Td),Qt(zo,Yt),Qt(zo,Dd),Qt(zo,zr);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 Od(`Attempt to call ${e.toString()} when transport not in ready state. Await connect() first.`)},n}function Ha(t,e,n){const r=n.value,i=["authenticating","connecting","connected","ready"];return n.value=function(...o){if(i.includes(this.state))throw new Pd(`Attempt to call ${e.toString()} when client already started. Please call disconnect() before starting again.`);return r.apply(this,o)},n}var Nd={};ve(Nd,"MessageDispatcher",()=>$d);var Va={};ve(Va,"LogLevel",()=>Mn),ve(Va,"logger",()=>se);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 Ur{constructor(){this.level=Mn.DEBUG}static getInstance(){return Ur.instance||(Ur.instance=new Ur),Ur.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 se=Ur.getInstance();class $d{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=X.CLIENT_MESSAGE,r=1e4){this._gcInterval||(this._gcInterval=setInterval(()=>{this._gc()},2e3));const i=new Ye(n,e),o=new Promise((s,a)=>{this._queue.push({message:i,timestamp:Date.now(),timeout:r,resolve:s,reject:a})});se.debug("[MessageDispatcher] dispatch",i);try{this._sendMethod(i)}catch(s){return se.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?(se.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(se.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(i=>i.message.id!==e.id),se.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===X.CLIENT_MESSAGE&&n.reject(new Ye(X.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:n.message.data.t,data:n.message.data.d,fatal:!1}))}),se.debug("[MessageDispatcher] GC",this._queue)}}var Wa={};ve(Wa,"isAPIRequest",()=>jd),ve(Wa,"makeRequest",()=>Fd);function jd(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 Fd(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)),se.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=>{se.debug(`[Pipecat Client] Received response from ${t.endpoint}`,o),o.ok||i(o),o.json().then(s=>r(s))}).catch(o=>{se.error(`[Pipecat Client] Error fetching: ${o}`),i(o)}).finally(()=>{n&&clearTimeout(n)})))()})}var Ka={};ve(Ka,"Transport",()=>Bd),ve(Ka,"TransportWrapper",()=>zd);class Bd{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 zd{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 Ud={};ve(Ud,"learnAboutClient",()=>Hd);function Hd(){var n,r,i,o,s,a;let t={library:Br.name,library_version:Br.version,platform_details:{}},e=null;if((n=window==null?void 0:window.navigator)!=null&&n.userAgent)try{e=Ey.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 Py extends gy{}class $t extends Py{constructor(e){super(),this._functionCallCallbacks={},Rd(Hd()),this._transport=e.transport,this._transportWrapper=new zd(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(K.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(K.Error,r)}catch{se.debug("Could not emit error",r)}const i=r.data;i!=null&&i.fatal&&(se.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(K.Connected)},onDisconnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onDisconnected)==null||i.call(r),this.emit(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.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(K.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStoppedSpeaking)==null||i.call(r),this.emit(K.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(K.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(K.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStoppedSpeaking)==null||i.call(r),this.emit(K.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(K.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(K.UserTranscript,r)},onBotTranscript:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTranscript)==null||o.call(i,r),this.emit(K.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(K.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(K.BotLlmStarted)},onBotLlmStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStopped)==null||i.call(r),this.emit(K.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(K.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(K.BotTtsStarted)},onBotTtsStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStopped)==null||i.call(r),this.emit(K.BotTtsStopped)}};this._options={...e,callbacks:n,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),se.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){se.setLevel(e)}async initDevices(){se.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 Fd(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 Ye(X.ERROR_RESPONSE,{message:l,fatal:!0})),new Md(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&&jd(e)?(se.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 $d(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 Ty(Br).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 Ye(X.CLIENT_MESSAGE,{t:e,d:n}))}async sendClientRequest(e,n,r){const i={t:e,d:n};return(await this._messageDispatcher.dispatch(i,X.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 se.warn("appendToContext() is deprecated. Use sendText() instead."),await this._transport.sendMessage(new Ye(X.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,n={}){await this._transport.sendMessage(new Ye(X.SEND_TEXT,{content:e,options:n}))}disconnectBot(){this._transport.sendMessage(new Ye(X.DISCONNECT_BOT,{}))}handleMessage(e){var n,r,i,o,s,a,l,c,d,f,p,m,b,v,S,y,w,k,C,E,M,O,I,H,z,te,he,Y,Ge,Me,Rt,dt,j,V,J,le,ke,u,g;switch(se.debug("[RTVI Message]",e),e.type){case X.BOT_READY:{const h=e.data,x=h.version?h.version.split(".").map(Number):[0,0,0];se.debug(`[Pipecat Client] Bot is ready. Version: ${h.version}`),x[0]<1&&se.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 X.ERROR:(s=(o=this._options.callbacks)==null?void 0:o.onError)==null||s.call(o,e);break;case X.SERVER_RESPONSE:this._messageDispatcher.resolve(e);break;case X.ERROR_RESPONSE:{const h=this._messageDispatcher.reject(e);(l=(a=this._options.callbacks)==null?void 0:a.onMessageError)==null||l.call(a,h);break}case X.USER_STARTED_SPEAKING:(d=(c=this._options.callbacks)==null?void 0:c.onUserStartedSpeaking)==null||d.call(c);break;case X.USER_STOPPED_SPEAKING:(p=(f=this._options.callbacks)==null?void 0:f.onUserStoppedSpeaking)==null||p.call(f);break;case X.BOT_STARTED_SPEAKING:(b=(m=this._options.callbacks)==null?void 0:m.onBotStartedSpeaking)==null||b.call(m);break;case X.BOT_STOPPED_SPEAKING:(S=(v=this._options.callbacks)==null?void 0:v.onBotStoppedSpeaking)==null||S.call(v);break;case X.USER_TRANSCRIPTION:{const h=e.data;(w=(y=this._options.callbacks)==null?void 0:y.onUserTranscript)==null||w.call(y,h);break}case X.BOT_TRANSCRIPTION:(C=(k=this._options.callbacks)==null?void 0:k.onBotTranscript)==null||C.call(k,e.data);break;case X.BOT_LLM_TEXT:(M=(E=this._options.callbacks)==null?void 0:E.onBotLlmText)==null||M.call(E,e.data);break;case X.BOT_LLM_STARTED:(I=(O=this._options.callbacks)==null?void 0:O.onBotLlmStarted)==null||I.call(O);break;case X.BOT_LLM_STOPPED:(z=(H=this._options.callbacks)==null?void 0:H.onBotLlmStopped)==null||z.call(H);break;case X.BOT_TTS_TEXT:(he=(te=this._options.callbacks)==null?void 0:te.onBotTtsText)==null||he.call(te,e.data);break;case X.BOT_TTS_STARTED:(Ge=(Y=this._options.callbacks)==null?void 0:Y.onBotTtsStarted)==null||Ge.call(Y);break;case X.BOT_TTS_STOPPED:(Rt=(Me=this._options.callbacks)==null?void 0:Me.onBotTtsStopped)==null||Rt.call(Me);break;case X.METRICS:(j=(dt=this._options.callbacks)==null?void 0:dt.onMetrics)==null||j.call(dt,e.data),this.emit(K.Metrics,e.data);break;case X.SERVER_MESSAGE:(J=(V=this._options.callbacks)==null?void 0:V.onServerMessage)==null||J.call(V,e.data),this.emit(K.ServerMessage,e.data);break;case X.LLM_FUNCTION_CALL:{const h=e.data,x=this._functionCallCallbacks[h.function_name];if(x){const _={functionName:h.function_name,arguments:h.args};x(_).then(A=>{A!=null&&this._transport.sendMessage(new Ye(X.LLM_FUNCTION_CALL_RESULT,{function_name:h.function_name,tool_call_id:h.tool_call_id,arguments:h.args,result:A}))})}(ke=(le=this._options.callbacks)==null?void 0:le.onLLMFunctionCall)==null||ke.call(le,h),this.emit(K.LLMFunctionCall,h);break}case X.BOT_LLM_SEARCH_RESPONSE:{const h=e.data;(g=(u=this._options.callbacks)==null?void 0:u.onBotLlmSearchResponse)==null||g.call(u,h),this.emit(K.BotLlmSearchResponse,h);break}default:se.debug("[Pipecat Client] Unrecognized message type",e.type);break}}}An([Ha],$t.prototype,"startBot",null),An([Ha],$t.prototype,"connect",null),An([Ha],$t.prototype,"startBotAndConnect",null),An([Di],$t.prototype,"sendClientMessage",null),An([Di],$t.prototype,"sendClientRequest",null),An([Di],$t.prototype,"appendToContext",null),An([Di],$t.prototype,"sendText",null),An([Di],$t.prototype,"disconnectBot",null),Qt(Fr,Ed),Qt(Fr,Nd),Qt(Fr,Va),Qt(Fr,Wa),Qt(Fr,Ka),Qt(Fr,Ud);function Vd(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 pt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function re(t){return re=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},re(t)}function Wd(t){var e=function(n,r){if(re(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r);if(re(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return re(e)=="symbol"?e:e+""}function Kd(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,Wd(r.key),r)}}function ht(t,e,n){return e&&Kd(t.prototype,e),n&&Kd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Uo(t,e){if(e&&(re(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 jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jt(t)}function Li(t,e){return Li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Li(t,e)}function Ho(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=Wd(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qd(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 W(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(l){qd(o,r,i,s,a,"next",l)}function a(l){qd(o,r,i,s,a,"throw",l)}s(void 0)})}}function Jd(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 He(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(p){f=!0,s=p}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 Jd(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)?Jd(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 Dy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gd,Vo={exports:{}},qa=function(){if(Gd)return Vo.exports;Gd=1;var t,e=typeof Reflect=="object"?Reflect:null,n=e&&typeof e.apply=="function"?e.apply:function(v,S,y){return Function.prototype.apply.call(v,S,y)};t=e&&typeof e.ownKeys=="function"?e.ownKeys:Object.getOwnPropertySymbols?function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:function(v){return Object.getOwnPropertyNames(v)};var r=Number.isNaN||function(v){return v!=v};function i(){i.init.call(this)}Vo.exports=i,Vo.exports.once=function(v,S){return new Promise(function(y,w){function k(E){v.removeListener(S,C),w(E)}function C(){typeof v.removeListener=="function"&&v.removeListener("error",k),y([].slice.call(arguments))}b(v,S,C,{once:!0}),S!=="error"&&function(E,M,O){typeof E.on=="function"&&b(E,"error",M,O)}(v,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(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}function a(v){return v._maxListeners===void 0?i.defaultMaxListeners:v._maxListeners}function l(v,S,y,w){var k,C,E,M;if(s(y),(C=v._events)===void 0?(C=v._events=Object.create(null),v._eventsCount=0):(C.newListener!==void 0&&(v.emit("newListener",S,y.listener?y.listener:y),C=v._events),E=C[S]),E===void 0)E=C[S]=y,++v._eventsCount;else if(typeof E=="function"?E=C[S]=w?[y,E]:[E,y]:w?E.unshift(y):E.push(y),(k=a(v))>0&&E.length>k&&!E.warned){E.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+E.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=v,O.type=S,O.count=E.length,M=O,console&&console.warn&&console.warn(M)}return v}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(v,S,y){var w={fired:!1,wrapFn:void 0,target:v,type:S,listener:y},k=c.bind(w);return k.listener=y,w.wrapFn=k,k}function f(v,S,y){var w=v._events;if(w===void 0)return[];var k=w[S];return k===void 0?[]:typeof k=="function"?y?[k.listener||k]:[k]:y?function(C){for(var E=new Array(C.length),M=0;M<E.length;++M)E[M]=C[M].listener||C[M];return E}(k):m(k,k.length)}function p(v){var S=this._events;if(S!==void 0){var y=S[v];if(typeof y=="function")return 1;if(y!==void 0)return y.length}return 0}function m(v,S){for(var y=new Array(S),w=0;w<S;++w)y[w]=v[w];return y}function b(v,S,y,w){if(typeof v.on=="function")w.once?v.once(S,y):v.on(S,y);else{if(typeof v.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v);v.addEventListener(S,function k(C){w.once&&v.removeEventListener(S,k),y(C)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");o=v}}),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(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(v){for(var S=[],y=1;y<arguments.length;y++)S.push(arguments[y]);var w=v==="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 M=k[v];if(M===void 0)return!1;if(typeof M=="function")n(M,this,S);else{var O=M.length,I=m(M,O);for(y=0;y<O;++y)n(I[y],this,S)}return!0},i.prototype.addListener=function(v,S){return l(this,v,S,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(v,S){return l(this,v,S,!0)},i.prototype.once=function(v,S){return s(S),this.on(v,d(this,v,S)),this},i.prototype.prependOnceListener=function(v,S){return s(S),this.prependListener(v,d(this,v,S)),this},i.prototype.removeListener=function(v,S){var y,w,k,C,E;if(s(S),(w=this._events)===void 0)return this;if((y=w[v])===void 0)return this;if(y===S||y.listener===S)--this._eventsCount==0?this._events=Object.create(null):(delete w[v],w.removeListener&&this.emit("removeListener",v,y.listener||S));else if(typeof y!="function"){for(k=-1,C=y.length-1;C>=0;C--)if(y[C]===S||y[C].listener===S){E=y[C].listener,k=C;break}if(k<0)return this;k===0?y.shift():function(M,O){for(;O+1<M.length;O++)M[O]=M[O+1];M.pop()}(y,k),y.length===1&&(w[v]=y[0]),w.removeListener!==void 0&&this.emit("removeListener",v,E||S)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(v){var S,y,w;if((y=this._events)===void 0)return this;if(y.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):y[v]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete y[v]),this;if(arguments.length===0){var k,C=Object.keys(y);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=y[v])=="function")this.removeListener(v,S);else if(S!==void 0)for(w=S.length-1;w>=0;w--)this.removeListener(v,S[w]);return this},i.prototype.listeners=function(v){return f(this,v,!0)},i.prototype.rawListeners=function(v){return f(this,v,!1)},i.listenerCount=function(v,S){return typeof v.listenerCount=="function"?v.listenerCount(S):p.call(v,S)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},Vo.exports}(),Wo=Dy(qa),Qd=Object.prototype.hasOwnProperty;function Yd(t,e,n){for(n of t.keys())if(Xe(n,e))return n}function Xe(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--&&Xe(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=Yd(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=Yd(e,i))||!Xe(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(Qd.call(t,n)&&++r&&!Qd.call(e,n)||!(n in e)||!Xe(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!=t&&e!=e}const Ly={"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"},Xd={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"},Ae={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Ze={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 D=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("."),p=>new Array(20-p.length).join("0")+p).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 Ly[e]}static getBrowserTypeByAlias(e){return Xd[e]||""}};const de=/version\/(\d+(\.?_?\d+)+)/i,Iy=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=D.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=D.getFirstMatch(de,t)||D.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=D.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=D.getFirstMatch(de,t)||D.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=D.getFirstMatch(de,t)||D.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=D.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=D.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=D.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=D.getFirstMatch(de,t)||D.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=D.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=D.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=D.getFirstMatch(de,t)||D.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=D.getFirstMatch(de,t)||D.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=D.getFirstMatch(de,t)||D.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=D.getFirstMatch(de,t)||D.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=D.getFirstMatch(de,t)||D.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=D.getFirstMatch(de,t)||D.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=D.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||D.getFirstMatch(de,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=D.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=D.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=D.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=D.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=D.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=D.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=D.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=D.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=D.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=D.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=D.getFirstMatch(de,t)||D.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=D.getFirstMatch(de,t)||D.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=D.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=D.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=D.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=D.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=D.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=D.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=D.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=D.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=D.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=D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=D.getFirstMatch(de,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:D.getFirstMatch(e,t),version:D.getSecondMatch(e,t)}}}];var Ry=[{test:[/Roku\/DVP/],describe(t){const e=D.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Ze.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=D.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Ze.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=D.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=D.getWindowsVersionName(e);return{name:Ze.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Ze.iOS},n=D.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=D.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=D.getMacOSVersionName(e),r={name:Ze.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=D.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Ze.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=D.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=D.getAndroidVersionName(e),r={name:Ze.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=D.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:Ze.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=D.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||D.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||D.getFirstMatch(/\bbb(\d+)/i,t);return{name:Ze.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=D.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Ze.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=D.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Ze.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:Ze.Linux})},{test:[/CrOS/],describe:()=>({name:Ze.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=D.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Ze.PlayStation4,version:e}}}],Ny=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=D.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Ae.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Ae.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Ae.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Ae.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Ae.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Ae.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Ae.tablet})},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=D.getFirstMatch(/(ipod|iphone)/i,t);return{type:Ae.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Ae.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Ae.mobile})},{test:t=>t.getBrowserName(!0)==="blackberry",describe:()=>({type:Ae.mobile,vendor:"BlackBerry"})},{test:t=>t.getBrowserName(!0)==="bada",describe:()=>({type:Ae.mobile})},{test:t=>t.getBrowserName()==="windows phone",describe:()=>({type:Ae.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe:()=>({type:Ae.tablet})},{test:t=>t.getOSName(!0)==="android",describe:()=>({type:Ae.mobile})},{test:t=>t.getOSName(!0)==="macos",describe:()=>({type:Ae.desktop,vendor:"Apple"})},{test:t=>t.getOSName(!0)==="windows",describe:()=>({type:Ae.desktop})},{test:t=>t.getOSName(!0)==="linux",describe:()=>({type:Ae.desktop})},{test:t=>t.getOSName(!0)==="playstation 4",describe:()=>({type:Ae.tv})},{test:t=>t.getOSName(!0)==="roku",describe:()=>({type:Ae.tv})}],$y=[{test:t=>t.getBrowserName(!0)==="microsoft edge",describe(t){if(/\sedg\//i.test(t))return{name:On.Blink};const e=D.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:On.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:On.Trident},n=D.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=D.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=D.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=D.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];let Zd=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=D.find(Iy,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=D.find(Ry,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=D.find(Ny,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=D.find($y,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 D.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=D.find(s,c=>this.isOS(c));if(a){const c=this.satisfies(n[a]);if(c!==void 0)return c}const l=D.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=D.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=D.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(D.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
|
+
* Bowser - a browser detector
|
|
9
|
+
* https://github.com/lancedikson/bowser
|
|
10
|
+
* MIT License | (c) Dustin Diaz 2012-2015
|
|
11
|
+
* MIT License | (c) Denis Demchenko 2015-2019
|
|
12
|
+
*/let jy=class{static getParser(e,n=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Zd(e,n)}static parse(e){return new Zd(e).getResult()}static get BROWSER_MAP(){return Xd}static get ENGINE_MAP(){return On}static get OS_MAP(){return Ze}static get PLATFORMS_MAP(){return Ae}};function Ko(){return Date.now()+Math.random().toString()}function Ii(){throw new Error("Method must be implemented in subclass")}function ef(t,e){return e!=null&&e.proxyUrl?e.proxyUrl+(e.proxyUrl.slice(-1)==="/"?"":"/")+t.substring(8):t}function qo(t){return t!=null&&t.callObjectBundleUrlOverride?t.callObjectBundleUrlOverride:ef("https://c.daily.co/call-machine/versioned/".concat("0.84.0","/static/call-machine-object-bundle.js"),t)}function Jo(t){try{new URL(t)}catch{return!1}return!0}const ge=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,or="8.55.0",oe=globalThis;function Go(t,e,n){const r=oe,i=r.__SENTRY__=r.__SENTRY__||{},o=i[or]=i[or]||{};return o[t]||(o[t]=e())}const sr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ja=["debug","info","warn","error","log","assert","trace"],Qo={};function Ri(t){if(!("console"in oe))return t();const e=oe.console,n={},r=Object.keys(Qo);r.forEach(i=>{const o=Qo[i];n[i]=e[i],e[i]=o});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}const q=Go("logger",function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return sr?Ja.forEach(n=>{e[n]=(...r)=>{t&&Ri(()=>{oe.console[n](`Sentry Logger [${n}]:`,...r)})}}):Ja.forEach(n=>{e[n]=()=>{}}),e}),ar="?",tf=/\(error: (.*)\)/,nf=/captureMessage|captureException/;function Yo(t){return t[t.length-1]||{}}const rf="<anonymous>";function Pn(t){try{return t&&typeof t=="function"&&t.name||rf}catch{return rf}}function of(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 Xo={},sf={};function lr(t,e){Xo[t]=Xo[t]||[],Xo[t].push(e)}function cr(t,e){if(!sf[t]){sf[t]=!0;try{e()}catch(n){sr&&q.error(`Error while instrumenting ${t}`,n)}}}function Ft(t,e){const n=t&&Xo[t];if(n)for(const r of n)try{r(e)}catch(i){sr&&q.error(`Error while triggering instrumentation handler.
|
|
13
|
+
Type: ${t}
|
|
14
|
+
Name: ${Pn(r)}
|
|
15
|
+
Error:`,i)}}let Ga=null;function Fy(){Ga=oe.onerror,oe.onerror=function(t,e,n,r,i){return Ft("error",{column:r,error:i,line:n,msg:t,url:e}),!!Ga&&Ga.apply(this,arguments)},oe.onerror.__SENTRY_INSTRUMENTED__=!0}let Qa=null;function By(){Qa=oe.onunhandledrejection,oe.onunhandledrejection=function(t){return Ft("unhandledrejection",t),!Qa||Qa.apply(this,arguments)},oe.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Zo(){return Ya(oe),oe}function Ya(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||or,e[or]=e[or]||{}}const af=Object.prototype.toString;function Xa(t){switch(af.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 af.call(t)===`[object ${e}]`}function lf(t){return Hr(t,"ErrorEvent")}function cf(t){return Hr(t,"DOMError")}function un(t){return Hr(t,"String")}function Za(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function el(t){return t===null||Za(t)||typeof t!="object"&&typeof t!="function"}function Vr(t){return Hr(t,"Object")}function es(t){return typeof Event<"u"&&ur(t,Event)}function ts(t){return!!(t&&t.then&&typeof t.then=="function")}function ur(t,e){try{return t instanceof e}catch{return!1}}function uf(t){return!(typeof t!="object"||t===null||!t.__isVue&&!t._isVue)}const tl=oe;function df(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=zy(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 zy(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(tl.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 ff(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{uf(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Uy(t,e,n=!1){return!!un(t)&&(Hr(e,"RegExp")?e.test(t):!!un(e)&&(n?t===e:t.includes(e)))}function ns(t,e=[],n=!1){return e.some(r=>Uy(t,r,n))}function gt(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&pf(i,r);try{t[e]=i}catch{sr&&q.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&&q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function pf(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,dr(t,"__sentry_original__",e)}catch{}}function nl(t){return t.__sentry_original__}function hf(t){if(Xa(t))return{message:t.message,name:t.name,stack:t.stack,...mf(t)};if(es(t)){const e={type:t.type,target:gf(t.target),currentTarget:gf(t.currentTarget),...mf(t)};return typeof CustomEvent<"u"&&ur(t,CustomEvent)&&(e.detail=t.detail),e}return t}function gf(t){try{return e=t,typeof Element<"u"&&ur(e,Element)?df(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var e}function mf(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 rl(t,new Map)}function rl(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]=rl(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(rl(i,e))}),r}return t}function Ni(){return Date.now()/1e3}const dn=function(){const{performance:t}=oe;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=oe,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 vf(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=vf(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function il(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=vf(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 yf(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 rs(t){return new Tt((e,n)=>{n(t)})}(()=>{const{performance:t}=oe;!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&&(ts(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 Hy(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 bf(){return Et()}function ol(){return Et().substring(16)}function is(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]=is(r[i],e[i],n-1));return r}const sl="_sentrySpan";function wf(t,e){e?dr(t,sl,e):delete t[sl]}function Sf(t){return t[sl]}class al{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:bf(),spanId:ol()}}clone(){const e=new al;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,wf(e,Sf(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,wf(this,void 0),this._attachments=[],this.setPropagationContext({traceId:bf()}),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:Sf(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=is(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:ol(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:Et();if(!this._client)return q.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 q.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):(q.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=al;class Vy{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 ts(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=Ya(Zo());return t.stack=t.stack||new Vy(Go("defaultCurrentScope",()=>new Ln),Go("defaultIsolationScope",()=>new Ln))}function Wy(t){return Jr().withScope(t)}function Ky(t,e){const n=Jr();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function kf(t){return Jr().withScope(()=>t(Jr().getIsolationScope()))}function ll(t){const e=Ya(t);return e.acs?e.acs:{withIsolationScope:kf,withScope:Wy,withSetScope:Ky,withSetIsolationScope:(n,r)=>kf(r),getCurrentScope:()=>Jr().getScope(),getIsolationScope:()=>Jr().getIsolationScope()}}function pr(){return ll(Zo()).getCurrentScope()}function $i(){return ll(Zo()).getIsolationScope()}function Ve(){return pr().getClient()}function qy(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 Jy(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 Gy=/^sentry-/;function Qy(t){const e=function(r){if(!(!r||!un(r)&&!Array.isArray(r)))return Array.isArray(r)?r.reduce((i,o)=>{const s=xf(o);return Object.entries(s).forEach(([a,l])=>{i[a]=l}),i},{}):xf(r)}(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,o])=>(i.match(Gy)&&(r[i.slice(7)]=o),r),{});return Object.keys(n).length>0?n:void 0}function xf(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}let _f=!1;function Yy(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext();return Ct({parent_span_id:r?e:cl(t).parent_span_id,span_id:r?ol():e,trace_id:n})}function Cf(t){return typeof t=="number"?Ef(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Ef(t.getTime()):dn()}function Ef(t){return t>9999999999?t/1e3:t}function cl(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:Cf(i),timestamp:Cf(s)||void 0,status:Xy(l),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:Jy(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function Xy(t){if(t&&t.code!==0)return t.code===1?"ok":t.message||"unknown_error"}function Tf(t){return t._sentryRootSpan||t}function Zy(){_f||(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.")}),_f=!0)}const ul="production";function Mf(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Ct({environment:n.environment||ul,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function eb(t){const e=Ve();if(!e)return{};const n=Tf(t),r=n._frozenDsc;if(r)return r;const i=n.spanContext().traceState,o=i&&i.get("sentry.dsc"),s=o&&Qy(o);if(s)return s;const a=Mf(t.spanContext().traceId,e),l=cl(n),c=l.data||{},d=c["sentry.sample_rate"];d!=null&&(a.sample_rate=`${d}`);const f=c["sentry.source"],p=l.description;return f!=="url"&&p&&(a.transaction=p),function(m){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const b=Ve(),v=b&&b.getOptions();return!!v&&(v.enableTracing||"tracesSampleRate"in v||"tracesSampler"in v)}()&&(a.sampled=String(function(m){const{traceFlags:b}=m.spanContext();return b===1}(n))),e.emit("createDsc",a,n),a}const tb=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function os(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 Af(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function nb(t){const e=typeof t=="string"?function(n){const r=tb.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 p=f.split("/");if(p.length>1&&(d=p.slice(0,-1).join("/"),f=p.pop()),f){const m=f.match(/^\d+/);m&&(f=m[0])}return Af({host:a,pass:s,path:d,projectId:f,port:l,protocol:i,publicKey:o})}(t):Af(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]&&(q.error(`Invalid Sentry Dsn: ${s} missing`),!0))||(i.match(/^\d+$/)?function(s){return s==="http"||s==="https"}(o)?r&&isNaN(parseInt(r,10))&&(q.error(`Invalid Sentry Dsn: Invalid port ${r}`),1):(q.error(`Invalid Sentry Dsn: Invalid protocol ${o}`),1):(q.error(`Invalid Sentry Dsn: Invalid projectId ${i}`),1)))}(e))return e}function pn(t,e=100,n=1/0){try{return dl("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Of(t,e=3,n=102400){const r=pn(t,e);return i=r,function(o){return~-encodeURI(o).split(/%..|./).length}(JSON.stringify(i))>n?Of(t,e-1,n):r;var i}function dl(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(m,b){try{if(m==="domain"&&b&&typeof b=="object"&&b._events)return"[Domain]";if(m==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&b===global)return"[Global]";if(typeof window<"u"&&b===window)return"[Window]";if(typeof document<"u"&&b===document)return"[Document]";if(uf(b))return"[VueViewModel]";if(Vr(v=b)&&"nativeEvent"in v&&"preventDefault"in v&&"stopPropagation"in v)return"[SyntheticEvent]";if(typeof b=="number"&&!Number.isFinite(b))return`[${b}]`;if(typeof b=="function")return`[Function: ${Pn(b)}]`;if(typeof b=="symbol")return`[${String(b)}]`;if(typeof b=="bigint")return`[BigInt: ${String(b)}]`;const S=function(y){const w=Object.getPrototypeOf(y);return w?w.constructor.name:"null prototype"}(b);return/^HTML(\w*)Element$/.test(S)?`[HTMLElement: ${S}]`:`[object ${S}]`}catch(S){return`**non-serializable** (${S})`}var v}(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 dl("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const p=hf(e);for(const m in p){if(!Object.prototype.hasOwnProperty.call(p,m))continue;if(f>=r){d[m]="[MaxProperties ~]";break}const b=p[m];d[m]=dl(m,b,l-1,r,i),f++}return s(e),d}function ji(t,e=[]){return[t,e]}function rb(t,e){const[n,r]=t;return[n,[...r,e]]}function Pf(t,e){const n=t[1];for(const r of n)if(e(r,r[0].type))return!0;return!1}function fl(t){return oe.__SENTRY__&&oe.__SENTRY__.encodePolyfill?oe.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function ib(t){const[e,n]=t;let r=JSON.stringify(e);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[fl(r),o]:r.push(typeof o=="string"?fl(o):o)}for(const o of n){const[s,a]=o;if(i(`
|
|
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(pn(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 ob(t){const e=typeof t.data=="string"?fl(t.data):t.data;return[Ct({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const sb={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 Df(t){return sb[t]}function Lf(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function ab(t,e,n,r){const i=Lf(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:os(d)},...f&&{trace:Ct({...f})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,ji(s,[[{type:o},t]])}function pl(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);ge&&s.id&&a===null&&q.log(`Event processor "${s.id}" dropped event`),ts(a)?a.then(l=>pl(t,l,n,r+1).then(i)).then(null,o):pl(t,a,n,r+1).then(i).then(null,o)}})}let ss,If,hl;function lb(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:p,transactionName:m}=a,b=Ct(l);b&&Object.keys(b).length&&(s.extra={...b,...s.extra});const v=Ct(c);v&&Object.keys(v).length&&(s.tags={...v,...s.tags});const S=Ct(d);S&&Object.keys(S).length&&(s.user={...S,...s.user});const y=Ct(f);y&&Object.keys(y).length&&(s.contexts={...y,...s.contexts}),p&&(s.level=p),m&&s.type!=="transaction"&&(s.transaction=m)})(t,e),r&&function(s,a){s.contexts={trace:Yy(a),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:eb(a),...s.sdkProcessingMetadata};const l=Tf(a),c=cl(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 Rf(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:b}=e;as(t,"extra",n),as(t,"tags",r),as(t,"user",i),as(t,"contexts",o),t.sdkProcessingMetadata=is(t.sdkProcessingMetadata,a,2),s&&(t.level=s),m&&(t.transactionName=m),b&&(t.span=b),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,...p}}function as(t,e,n){t[e]=is(t[e],n,1)}function cb(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(b=>b.name);(function(b,v){const{environment:S,release:y,dist:w,maxValueLength:k=250}=v;b.environment=b.environment||S||ul,!b.release&&y&&(b.release=y),!b.dist&&w&&(b.dist=w),b.message&&(b.message=Wr(b.message,k));const C=b.exception&&b.exception.values&&b.exception.values[0];C&&C.value&&(C.value=Wr(C.value,k));const E=b.request;E&&E.url&&(E.url=Wr(E.url,k))})(l,t),function(b,v){v.length>0&&(b.sdk=b.sdk||{},b.sdk.integrations=[...b.sdk.integrations||[],...v])}(l,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&function(b,v){const S=function(y){const w=oe._sentryDebugIds;if(!w)return{};const k=Object.keys(w);return hl&&k.length===If||(If=k.length,hl=k.reduce((C,E)=>{ss||(ss={});const M=ss[E];if(M)C[M[0]]=M[1];else{const O=y(E);for(let I=O.length-1;I>=0;I--){const H=O[I],z=H&&H.filename,te=w[E];if(z&&te){C[z]=te,ss[E]=[z,te];break}}}return C},{})),hl}(v);try{b.exception.values.forEach(y=>{y.stacktrace.frames.forEach(w=>{S&&w.filename&&(w.debug_id=S[w.filename])})})}catch{}}(l,t.stackParser);const d=function(b,v){if(!v)return b;const S=b?b.clone():new Ln;return S.update(v),S}(r,n.captureContext);n.mechanism&&Kr(l,n.mechanism);const f=i?i.getEventProcessors():[],p=Go("globalScope",()=>new Ln).getScopeData();o&&Rf(p,o.getScopeData()),d&&Rf(p,d.getScopeData());const m=[...n.attachments||[],...p.attachments];return m.length&&(n.attachments=m),lb(l,p),pl([...f,...p.eventProcessors],l,n).then(b=>(b&&function(v){const S={};try{v.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;v.debug_meta=v.debug_meta||{},v.debug_meta.images=v.debug_meta.images||[];const y=v.debug_meta.images;Object.entries(S).forEach(([w,k])=>{y.push({type:"sourcemap",code_file:w,debug_id:k})})}(b),typeof s=="number"&&s>0?function(v,S,y){if(!v)return null;const w={...v,...v.breadcrumbs&&{breadcrumbs:v.breadcrumbs.map(k=>({...k,...k.data&&{data:pn(k.data,S,y)}}))},...v.user&&{user:pn(v.user,S,y)},...v.contexts&&{contexts:pn(v.contexts,S,y)},...v.extra&&{extra:pn(v.extra,S,y)}};return v.contexts&&v.contexts.trace&&w.contexts&&(w.contexts.trace=v.contexts.trace,v.contexts.trace.data&&(w.contexts.trace.data=pn(v.contexts.trace.data,S,y))),v.spans&&(w.spans=v.spans.map(k=>({...k,...k.data&&{data:pn(k.data,S,y)}}))),v.contexts&&v.contexts.flags&&w.contexts&&(w.contexts.flags=pn(v.contexts.flags,3,y)),w}(b,s,a):b))}function Ix(t){}function Nf(t,e){return pr().captureEvent(t,e)}function $f(t){const e=Ve(),n=$i(),r=pr(),{release:i,environment:o=ul}=e&&e.getOptions()||{},{userAgent:s}=oe.navigator||{},a=Hy({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"}),jf(),n.setSession(a),r.setSession(a),a}function jf(){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),Ff(),t.setSession(),e.setSession()}function Ff(){const t=$i(),e=pr(),n=Ve(),r=e.getSession()||t.getSession();r&&n&&n.captureSession(r)}function Bf(t=!1){t?jf():Ff()}function ub(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 zf=[];function Uf(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function Hf(t,e,n){if(n[e.name])ge&&q.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,zf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),zf.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)}ge&&q.log(`Integration installed: ${e.name}`)}}class Bt extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const Vf="Not capturing exception because it's already been captured.";class db{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=nb(e.dsn):ge&&q.warn("No DSN provided, client will not send events."),this._dsn){const r=ub(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(yf(e))return ge&&q.log(Vf),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=Za(e)?e:String(e),a=el(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&&yf(n.originalException))return ge&&q.log(Vf),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"?ge&&q.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];Hf(this,e,this._integrations),n||Uf(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=ab(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])r=rb(r,ob(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=Lf(o);return ji({sent_at:new Date().toISOString(),...a&&{sdk:a},...!!s&&i&&{dsn:os(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}`;ge&&q.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=>(ge&&q.error("Error while sending envelope:",n),n)):(ge&&q.error("Transport disabled"),fr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(n,r){const i={};return r.forEach(o=>{o&&Hf(n,o,i)}),i}(this,e),Uf(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),cb(o,e,n,r,this,i).then(a=>{if(a===null)return a;a.contexts={trace:qy(r),...a.contexts};const l=function(c,d){const f=d.getPropagationContext();return f.dsc||Mf(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=>{ge&&(i instanceof Bt&&i.logLevel==="log"?q.log(i.message):q.warn(i))})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Kf(e),a=Wf(e),l=e.type||"error",c=`before send for type \`${l}\``,d=o===void 0?void 0:function(m){if(typeof m=="boolean")return Number(m);const b=typeof m=="string"?parseFloat(m):m;if(!(typeof b!="number"||isNaN(b)||b<0||b>1))return b;ge&&q.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(m)} of type ${JSON.stringify(typeof m)}.`)}(o);if(a&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),rs(new Bt(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const f=l==="replay_event"?"replay":l,p=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,p).then(m=>{if(m===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 m;const b=function(v,S,y,w){const{beforeSend:k,beforeSendTransaction:C,beforeSendSpan:E}=S;if(Wf(y)&&k)return k(y,w);if(Kf(y)){if(y.spans&&E){const M=[];for(const O of y.spans){const I=E(O);I?M.push(I):(Zy(),v.recordDroppedEvent("before_send","span"))}y.spans=M}if(C){if(y.spans){const M=y.spans.length;y.sdkProcessingMetadata={...y.sdkProcessingMetadata,spanCountBeforeProcessing:M}}return C(y,w)}}return y}(this,i,m,n);return function(v,S){const y=`${S} must return \`null\` or a valid event.`;if(ts(v))return v.then(w=>{if(!Vr(w)&&w!==null)throw new Bt(y);return w},w=>{throw new Bt(`${S} rejected with ${w}`)});if(!Vr(v)&&v!==null)throw new Bt(y);return v}(b,c)}).then(m=>{if(m===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 b=r&&r.getSession();if(!s&&b&&this._updateSessionFromEvent(b,m),s){const S=(m.sdkProcessingMetadata&&m.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(m.spans?m.spans.length:0);S>0&&this.recordDroppedEvent("before_send","span",S)}const v=m.transaction_info;if(s&&v&&m.transaction!==e.transaction){const S="custom";m.transaction_info={...v,source:S}}return this.sendEvent(m,n),m}).then(null,m=>{throw m instanceof Bt?m:(this.captureException(m,{data:{__sentry__:!0},originalException:m}),new Bt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
18
|
+
Reason: ${m}`))})}_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(){ge&&q.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0)return void(ge&&q.log("No outcomes to send"));if(!this._dsn)return void(ge&&q.log("No dsn provided, will not send outcomes"));ge&&q.log("Sending outcomes:",e);const n=(r=e,ji((i=this._options.tunnel&&os(this._dsn))?{dsn:i}:{},[[{type:"client_report"},{timestamp:o||Ni(),discarded_events:r}]]));var r,i,o;this.sendEnvelope(n)}}function Wf(t){return t.type===void 0}function Kf(t){return t.type==="transaction"}function fb(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 rs(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=>{fr(l).then(()=>{--s||(clearTimeout(a),i(!0))},o)})})}}}function pb(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),p=1e3*(isNaN(f)?60:f);if(c)for(const m of c.split(";"))m==="metric_bucket"&&d&&!d.split(";").includes("custom")||(i[m]=r+p);else i.all=r+p}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 hb(t,e,n=fb(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Pf(i,(l,c)=>{const d=Df(c);if(function(f,p,m=Date.now()){return function(b,v){return b[v]||b.all||0}(f,p)>m}(r,d)){const f=qf(l,c);t.recordDroppedEvent("ratelimit_backoff",d,f)}else o.push(l)}),o.length===0)return fr({});const s=ji(i[0],o),a=l=>{Pf(s,(c,d)=>{const f=qf(c,d);t.recordDroppedEvent(l,Df(d),f)})};return n.add(()=>e({body:ib(s)}).then(l=>(l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&ge&&q.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=pb(r,l),l),l=>{throw a("network_error"),l})).then(l=>l,l=>{if(l instanceof Bt)return ge&&q.error("Skipped sending event because buffer is full."),a("queue_overflow"),fr({});throw l})},flush:i=>n.drain(i)}}function qf(t,e){if(e==="event"||e==="transaction")return Array.isArray(t)?t[1]:void 0}const gb=100;function hr(t,e){const n=Ve(),r=$i();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=gb}=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 Jf;const Gf=new WeakMap,mb=()=>({name:"FunctionToString",setupOnce(){Jf=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=nl(this),n=Gf.has(Ve())&&e!==void 0?e:this;return Jf.apply(n,t)}}catch{}},setup(t){Gf.set(t,!0)}}),vb=[/^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+$/],yb=(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?[]:vb],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)?(ge&&q.warn(`Event dropped due to being internal Sentry Error.
|
|
19
|
+
Event: ${Dn(s)}`),!0):function(l,c){return l.type||!c||!c.length?!1:function(d){const f=[];d.message&&f.push(d.message);let p;try{p=d.exception.values[d.exception.values.length-1]}catch{}return p&&p.value&&(f.push(p.value),p.type&&f.push(`${p.type}: ${p.value}`)),f}(l).some(d=>ns(d,c))}(s,a.ignoreErrors)?(ge&&q.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
20
|
+
Event: ${Dn(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)?(ge&&q.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
21
|
+
Event: ${Dn(s)}`),!0):function(l,c){if(l.type!=="transaction"||!c||!c.length)return!1;const d=l.transaction;return!!d&&ns(d,c)}(s,a.ignoreTransactions)?(ge&&q.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
22
|
+
Event: ${Dn(s)}`),!0):function(l,c){if(!c||!c.length)return!1;const d=ls(l);return!!d&&ns(d,c)}(s,a.denyUrls)?(ge&&q.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
23
|
+
Event: ${Dn(s)}.
|
|
24
|
+
Url: ${ls(s)}`),!0):function(l,c){if(!c||!c.length)return!0;const d=ls(l);return!d||ns(d,c)}(s,a.allowUrls)?!1:(ge&&q.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
25
|
+
Event: ${Dn(s)}.
|
|
26
|
+
Url: ${ls(s)}`),!0)}(e,o)?null:e}});function ls(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 ge&&q.error(`Cannot extract url for event ${Dn(t)}`),null}}function bb(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=gl(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 gl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(ur(r[i],Error)){Qf(s,a);const c=t(e,r[i]),d=l.length;Yf(c,i,d,a),l=gl(t,e,n,r[i],i,[c,...l],c,d)}return Array.isArray(r.errors)&&r.errors.forEach((c,d)=>{if(ur(c,Error)){Qf(s,a);const f=t(e,c),p=l.length;Yf(f,`errors[${d}]`,p,a),l=gl(t,e,n,c,i,[f,...l],f,p)}}),l}function Qf(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 Yf(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 ml(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 wb(){"console"in oe&&Ja.forEach(function(t){t in oe.console&>(oe.console,t,function(e){return Qo[t]=e,function(...n){Ft("console",{args:n,level:t});const r=Qo[t];r&&r.apply(oe.console,n)}})})}function Sb(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const kb=()=>{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||!Zf(i,o)||!Xf(i,o))}(n,r)||function(i,o){const s=ep(o),a=ep(i);return!(!s||!a||s.type!==a.type||s.value!==a.value||!Zf(i,o)||!Xf(i,o))}(n,r)):!1}(e,t))return ge&&q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function Xf(t,e){let n=of(t),r=of(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 Zf(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 ep(t){return t.exception&&t.exception.values&&t.exception.values[0]}function tp(t){return t===void 0?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const vl=oe;function yl(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function xb(){if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in vl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(yl(vl.fetch))return!0;let t=!1;const e=vl.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=yl(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){sr&&q.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function _b(t,e){const n="fetch";lr(n,t),cr(n,()=>function(r,i=!1){i&&!xb()||gt(oe,"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[m,b]=f;return{url:np(m),method:bl(b,"method")?String(b.method).toUpperCase():"GET"}}const p=f[0];return{url:np(p),method:bl(p,"method")?String(p.method).toUpperCase():"GET"}}(s),d={args:s,fetchData:{method:l,url:c},startTimestamp:1e3*dn(),virtualError:a};return r||Ft("fetch",{...d}),o.apply(oe,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}),Xa(f)&&f.stack===void 0&&(f.stack=a.stack,dr(f,"framesToPop",1)),f})}})}(void 0,e))}function bl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function np(t){return typeof t=="string"?t:t?bl(t,"url")?t.url:t.toString?t.toString():"":""}const cs=oe,Ie=oe;let wl=0;function rp(){return wl>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(nl(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 wl++,setTimeout(()=>{wl--}),function(...o){const s=ll(Zo());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&&(il(a,void 0),Kr(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{}pf(n,t),dr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}const us=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Sl(t,e){const n=xl(t,e),r={type:Tb(e),value:Mb(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function Cb(t,e,n,r){const i=Ve(),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__:Of(e,o)};if(s)return{exception:{values:[Sl(t,s)]},extra:a};const l={exception:{values:[{type:es(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Ab(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=xl(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function kl(t,e){return{exception:{values:[Sl(t,e)]}}}function xl(t,e){const n=e.stacktrace||e.stack||"",r=function(o){return o&&Eb.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 Eb=/Minified React error #\d+;/i;function ip(t){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&t instanceof WebAssembly.Exception}function Tb(t){const e=t&&t.name;return!e&&ip(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Mb(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:ip(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function _l(t,e,n,r,i){let o;if(lf(e)&&e.error)return kl(t,e.error);if(cf(e)||Hr(e,"DOMException")){const s=e;if("stack"in e)o=kl(t,e);else{const a=s.name||(cf(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=Cl(t,l,n,r),il(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return Xa(e)?kl(t,e):Vr(e)||es(e)?(o=Cb(t,e,n,i),Kr(o,{synthetic:!0}),o):(o=Cl(t,e,n,r),il(o,`${e}`),Kr(o,{synthetic:!0}),o)}function Cl(t,e,n,r){const i={};if(r&&n){const o=xl(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Kr(i,{synthetic:!0})}if(Za(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 Ab(t,{isUnhandledRejection:e}){const n=function(i,o=40){const s=Object.keys(hf(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 lf(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:es(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 Ob extends db{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"],Ie.SENTRY_SDK_SOURCE||"npm"),super(n),n.sendClientReports&&Ie.document&&Ie.document.addEventListener("visibilitychange",()=>{Ie.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return function(r,i,o,s){const a=_l(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=Cl(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(us&&q.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:os(s)}};return ji(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 Pb=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,et=oe;let op,El,Tl,ds;function Db(){if(!et.document)return;const t=Ft.bind(null,"dom"),e=sp(t,!0);et.document.addEventListener("click",e,!1),et.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=et[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=sp(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 sp(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!==El)return!1;try{if(!o.target||o.target._sentryId!==Tl)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),El=n.type,Tl=r?r._sentryId:void 0),clearTimeout(op),op=et.setTimeout(()=>{Tl=void 0,El=void 0},1e3)}}function ap(t){const e="history";lr(e,t),cr(e,Lb)}function Lb(){if(!function(){const n=cs.chrome,r=n&&n.app&&n.app.runtime,i="history"in cs&&!!cs.history.pushState&&!!cs.history.replaceState;return!r&&i}())return;const t=et.onpopstate;function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const o=ds,s=String(i);ds=s,Ft("history",{from:o,to:s})}return n.apply(this,r)}}et.onpopstate=function(...n){const r=et.location.href,i=ds;if(ds=r,Ft("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}},gt(et.history,"pushState",e),gt(et.history,"replaceState",e)}const fs={};function lp(t){fs[t]=void 0}const Fi="__sentry_xhr_v3__";function Ib(){if(!et.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[Fi]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[Fi];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[p,m]=f,b=d[Fi];return b&&un(p)&&un(m)&&(b.request_headers[p.toLowerCase()]=m),c.apply(d,f)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[Fi];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 Rb(t,e=function(n){const r=fs[n];if(r)return r;let i=et[n];if(yl(i))return fs[n]=i.bind(et);const o=et.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){Pb&&q.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,s)}return i&&(fs[n]=i.bind(et))}("fetch")){let n=0,r=0;return hb(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 lp("fetch"),rs("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 lp("fetch"),n-=o,r--,rs(a)}})}function Ml(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 Nb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$b=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,jb=/\((\S*)(?::(\d+))(?::(\d+))\)/,Fb=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Bb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zb=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=tf.test(l)?l.replace(tf,"$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(Yo(l).function||"")&&l.pop(),l.reverse(),nf.test(Yo(l).function||"")&&(l.pop(),nf.test(Yo(l).function||"")&&l.pop()),l.slice(0,50).map(c=>({...c,filename:c.filename||Yo(l).filename,function:c.function||ar}))}(o.slice(i))}}([30,t=>{const e=Nb.exec(t);if(e){const[,r,i,o]=e;return Ml(r,ar,+i,+o)}const n=$b.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=jb.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,i]=cp(n[1]||ar,n[2]);return Ml(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=Fb.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=Bb.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]=cp(r,n),Ml(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),cp=(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]},up=1024,Ub=(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,wb)}(function(i){return function(o){if(Ve()!==i)return;const s={category:"console",data:{arguments:o.args,logger:"console"},level:Sb(o.level),message:ff(o.args," ")};if(o.level==="assert"){if(o.args[0]!==!1)return;s.message=`Assertion failed: ${ff(o.args.slice(1)," ")||"console.assert"}`,s.data.arguments=o.args.slice(1)}hr(s,{input:o.args,level:o.level})}}(n)),e.dom&&(r=function(i,o){return function(s){if(Ve()!==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>up&&(us&&q.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${d} was configured. Sentry will use 1024 instead.`),d=up),typeof c=="string"&&(c=[c]);try{const p=s.event,m=function(b){return!!b&&!!b.target}(p)?p.target:p;a=df(m,{keyAttrs:c,maxStringLength:d}),l=function(b){if(!tl.HTMLElement)return null;let v=b;for(let S=0;S<5;S++){if(!v)return null;if(v instanceof HTMLElement){if(v.dataset.sentryComponent)return v.dataset.sentryComponent;if(v.dataset.sentryElement)return v.dataset.sentryElement}v=v.parentNode}return null}(m)}catch{a="<unknown>"}if(a.length===0)return;const f={category:`ui.${s.name}`,message:a};l&&(f.data={"ui.component_name":l}),hr(f,{event:s.event,name:s.name,global:s.global})}}(n,e.dom),lr("dom",r),cr("dom",Db)),e.xhr&&function(i){lr("xhr",i),cr("xhr",Ib)}(function(i){return function(o){if(Ve()!==i)return;const{startTimestamp:s,endTimestamp:a}=o,l=o.xhr[Fi];if(!s||!a||!l)return;const{method:c,url:d,status_code:f,body:p}=l,m={method:c,url:d,status_code:f},b={xhr:o.xhr,input:p,startTimestamp:s,endTimestamp:a};hr({category:"xhr",data:m,type:"http",level:tp(f)},b)}}(n)),e.fetch&&_b(function(i){return function(o){if(Ve()!==i)return;const{startTimestamp:s,endTimestamp:a}=o;if(a&&(!o.fetchData.url.match(/sentry_key/)||o.fetchData.method!=="POST"))if(o.error)hr({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};hr({category:"fetch",data:c,type:"http",level:tp(c.status_code)},d)}}}(n)),e.history&&ap(function(i){return function(o){if(Ve()!==i)return;let s=o.from,a=o.to;const l=ml(Ie.location.href);let c=s?ml(s):void 0;const d=ml(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),hr({category:"navigation",data:{from:s,to:a}})}}(n)),e.sentry&&n.on("beforeSendEvent",function(i){return function(o){Ve()===i&&hr({category:"sentry."+(o.type==="transaction"?"transaction":"event"),event_id:o.event_id,level:o.level,message:Dn(o)},{event:o})}}(n))}}},Hb=["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"],Vb=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&>(Ie,"setTimeout",dp),e.setInterval&>(Ie,"setInterval",dp),e.requestAnimationFrame&>(Ie,"requestAnimationFrame",Wb),e.XMLHttpRequest&&"XMLHttpRequest"in Ie&>(XMLHttpRequest.prototype,"send",Kb);const n=e.eventTarget;n&&(Array.isArray(n)?n:Hb).forEach(qb)}}};function dp(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 Wb(t){return function(e){return t.apply(this,[Gr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Pn(t)},handled:!1,type:"instrument"}})])}}function Kb(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=nl(i);return s&&(o.mechanism.data.handler=Pn(s)),Gr(i,o)})}),t.apply(this,e)}}function qb(t){const e=Ie[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 Jb=()=>({name:"BrowserSession",setupOnce(){Ie.document!==void 0?($f({ignoreDuration:!0}),Bf(),ap(({from:t,to:e})=>{t!==void 0&&t!==e&&($f({ignoreDuration:!0}),Bf())})):us&&q.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),Gb=(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,Fy)})(i=>{const{stackParser:o,attachStacktrace:s}=pp();if(Ve()!==r||rp())return;const{msg:a,url:l,line:c,column:d,error:f}=i,p=function(m,b,v,S){const y=m.exception=m.exception||{},w=y.values=y.values||[],k=w[0]=w[0]||{},C=k.stacktrace=k.stacktrace||{},E=C.frames=C.frames||[],M=S,O=v,I=un(b)&&b.length>0?b:function(){try{return tl.document.location.href}catch{return""}}();return E.length===0&&E.push({colno:M,filename:I,function:ar,in_app:!0,lineno:O}),m}(_l(o,f||a,void 0,s,!1),l,c,d);p.level="error",Nf(p,{originalException:f,mechanism:{handled:!1,type:"onerror"}})})}(n),fp("onerror")),e.onunhandledrejection&&(function(r){(function(i){const o="unhandledrejection";lr(o,i),cr(o,By)})(i=>{const{stackParser:o,attachStacktrace:s}=pp();if(Ve()!==r||rp())return;const a=function(c){if(el(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=el(a)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`}]}}:_l(o,a,void 0,s,!0);l.level="error",Nf(l,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(n),fp("onunhandledrejection"))}}};function fp(t){us&&q.log(`Global Handler attached: ${t}`)}function pp(){const t=Ve();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const Qb=()=>({name:"HttpContext",preprocessEvent(t){if(!Ie.navigator&&!Ie.location&&!Ie.document)return;const e=t.request&&t.request.url||Ie.location&&Ie.location.href,{referrer:n}=Ie.document||{},{userAgent:r}=Ie.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}}),Yb=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(r,i,o){const s=o.getOptions();bb(Sl,s.stackParser,s.maxValueLength,n,e,r,i)}}};var hp="new",gp="loading",mp="loaded",Al="joining-meeting",gr="joined-meeting",mr="left-meeting",In="error",Xb="playable",Ol="unknown",Zb="full",e0="base",vp="no-room",t0="end-of-life",n0="connection-error",r0="iframe-ready-for-launch-config",i0="iframe-launch-config",o0="theme-updated",s0="loading",a0="load-attempt-failed",yp="loaded",l0="started-camera",c0="camera-error",u0="joining-meeting",d0="joined-meeting",f0="left-meeting",p0="participant-joined",h0="participant-updated",g0="participant-left",m0="participant-counts-updated",v0="access-state-updated",y0="meeting-session-summary-updated",b0="meeting-session-state-updated",w0="waiting-participant-added",S0="waiting-participant-updated",k0="waiting-participant-removed",x0="track-started",_0="track-stopped",C0="transcription-started",E0="transcription-stopped",T0="transcription-error",bp="recording-started",wp="recording-stopped",M0="recording-stats",A0="recording-error",O0="recording-upload-completed",P0="recording-data",D0="app-message",L0="transcription-message",I0="remote-media-player-started",R0="remote-media-player-updated",N0="remote-media-player-stopped",$0="local-screen-share-started",j0="local-screen-share-stopped",F0="local-screen-share-canceled",B0="active-speaker-change",z0="active-speaker-mode-change",U0="network-quality-change",H0="network-connection",V0="cpu-load-change",W0="face-counts-updated",ps="fullscreen",hs="exited-fullscreen",K0="live-streaming-started",q0="live-streaming-updated",J0="live-streaming-stopped",G0="live-streaming-error",Q0="lang-updated",Y0="receive-settings-updated",Sp="input-settings-updated",kp="nonfatal-error",xp="error",Pl=4096,_p=102400,Dl="iframe-call-message",Cp="local-screen-start",Ep="daily-method-update-live-streaming-endpoints",gs="transmit-log",hn="daily-custom-track",ms={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},Tp={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},Ll={PLAY:"play",PAUSE:"pause"},Il=["jpg","png","jpeg"],X0="add-endpoints",Z0="remove-endpoints",Mp="sip-call-transfer";function Mt(){return!Z()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function Z(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function Ap(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function ew(){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(),vs())||Z())}function Op(){if(Z()||!document)return!1;var t=document.createElement("iframe");return!!t.requestFullscreen||!!t.webkitRequestFullscreen}var Rl="none",tw="software",nw="hardware",rw=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?tw:nw:Rl}catch{return Rl}}();function Pp(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!Z()&&rw!==Rl&&(t?function(){return Ip()?!1:["Chrome","Firefox"].includes(vr())}():function(){if(Ip())return!1;var e=vr();if(e==="Safari"){var n=jl();if(n.major<15||n.major===15&&n.minor<4)return!1}return e==="Chrome"?$l().major>=77:e==="Firefox"?Fl().major>=97:["Chrome","Firefox","Safari"].includes(e)}())}function Dp(){if(Z()||Lp()||typeof AudioWorkletNode>"u")return!1;switch(vr()){case"Chrome":case"Firefox":return!0;case"Safari":var t=vs();return t.major>17||t.major===17&&t.minor>=4}return!1}function Nl(){return Ap()&&typeof MediaStreamTrack<"u"&&!function(){var t,e=vr();if(!Mt())return!0;switch(e){case"Chrome":return(t=$l()).major&&t.major>0&&t.major<75;case"Firefox":return(t=Fl()).major<91;case"Safari":return(t=jl()).major<13||t.major===13&&t.minor<1;default:return!0}}()}function Lp(){return Mt().match(/Linux; Android/)}function Ip(){var t,e=Mt(),n=e.match(/Mac/)&&(!Z()&&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 Rp()?"Safari":t.indexOf("Edge")>-1?"Edge":t.match(/Chrome\//)?"Chrome":t.indexOf("Safari")>-1||Np()?"Safari":t.indexOf("Firefox")>-1?"Firefox":t.indexOf("MSIE")>-1||t.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function vs(){switch(vr()){case"Chrome":return $l();case"Safari":return jl();case"Firefox":return Fl();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 $l(){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 Rp(){return!!Mt().match(/iPad|iPhone|iPod/i)&&Ap()}function Np(){return Mt().indexOf("AppleWebKit/605.1.15")>-1}function jl(){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(Rp()||Np())&&(t=14,e=0,n=3)}return{major:t,minor:e,point:n}}function Fl(){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 $p=function(){return ht(function t(){pt(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 jp(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 Bl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jp(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Fp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Fp=function(){return!!t})()}var iw=function(){function t(){var e,n,r,i;return pt(this,t),n=this,r=jt(r=t),(e=Uo(n,Fp()?Reflect.construct(r,[],jt(n).constructor):r.apply(n,i)))._wrappedListeners={},e._messageCallbacks={},e}return Ho(t,$p),ht(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=Bl({},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!==Dl||!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=Bl({},e);if(o.what=Dl,o.from="module",o.callClientId=r,n){var s=Ko();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=Dl,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=Bl({},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 Bp(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 zp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zp=function(){return!!t})()}var ow=function(){function t(){var e,n,r,i;return pt(this,t),n=this,r=jt(r=t),e=Uo(n,zp()?Reflect.construct(r,[],jt(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 Ho(t,$p),ht(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?Bp(Object(d),!0).forEach(function(f){Xt(l,f,d[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):Bp(Object(d)).forEach(function(f){Object.defineProperty(l,f,Object.getOwnPropertyDescriptor(d,f))})}return l}({},e);if(s.callClientId=r,i){var a=Ko();this._messageCallbacks[a]=i,s.callbackStamp=a}n.emit("message",s)}}])}(),zl="replace",Ul="shallow-merge",Up=[zl,Ul],sw=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.data,r=e.mergeStrategy,i=r===void 0?zl:r;pt(this,t),t._validateMergeStrategy(i),t._validateData(n,i),this.mergeStrategy=i,this.data=n}return ht(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===Ul}},{key:"_validateMergeStrategy",value:function(e){if(!Up.includes(e))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(Up,"]"))}},{key:"_validateData",value:function(e,n){if(!function(a){if(a==null||re(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===zl){var i=JSON.parse(r);Xe(i,e)||console.warn("The meeting session data provided will be modified when serialized.",i,e)}else if(n===Ul){for(var o in e)if(Object.hasOwnProperty.call(e,o)&&e[o]!==void 0){var s=JSON.parse(JSON.stringify(e[o]));Xe(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>_p)throw Error("Meeting session data is too large (".concat(r.length," characters). Maximum size suppported is ").concat(_p,"."))}}])}();function Hp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hp=function(){return!!t})()}function Hl(t){var e=typeof Map=="function"?new Map:void 0;return Hl=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(Hp())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,jt(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Li(r,n)},Hl(t)}function Vp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vp=function(){return!!t})()}function Wp(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 aw=function(){return ht(function t(e){pt(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 lw(n,function(){r(!1)},function(o,s){s||Wp(e._callClientId),i(o,s)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),Wp(this._callClientId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}])}(),lw=function(){return ht(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;pt(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 Kp(t._dailyConfig,t._successCallback,e),t._currentAttempt.start())},3e3))};this._currentAttempt=new Kp(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}}])}(),Vl=function(){function t(){return pt(this,t),e=this,r=arguments,n=jt(n=t),Uo(e,Vp()?Reflect.construct(n,r||[],jt(e).constructor):n.apply(e,r));var e,n,r}return Ho(t,Hl(Error)),ht(t)}(),ys=2e4,Kp=function(){return ht(function e(n,r,i){pt(this,e),this._loadAttemptImpl=Z()||!n.avoidEval?new cw(n,r,i):new uw(n,r,i)},[{key:"start",value:(t=W(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}(),cw=function(){return ht(function i(o,s,a){pt(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=W(function*(){var i=qo(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=W(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=W(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(ys," ms) when loading call object bundle ").concat(i),type:"timeout"})},ys);try{var s=this._refetchHeaders?{headers:this._refetchHeaders}:{},a=yield fetch(i,s);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new Vl;var l=yield this._getBundleCodeFromResponse(i,a);if(this.cancelled)throw new Vl;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 Vl||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=W(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}(),uw=function(){return ht(function t(e,n,r){pt(this,t),this.cancelled=!1,this.succeeded=!1,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r,this._attemptId=Ko(),this._networkTimeout=null,this._scriptElement=null},[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=qo(this._dailyConfig);(typeof document>"u"?"undefined":re(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(ys," ms) when loading call object bundle ").concat(t),type:"timeout"})},ys);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)}}])}(),bs=function(t,e,n){return fw(t.local,e,n)===!0},dw=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=pw(t,e,n,r);return i&&i.pendingTrack},fw=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)},pw=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]},hw=function(t,e){var n=t.local.public.customTracks;if(n&&n[e])return n[e].track};function qp(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?dw(n,o,l):Qr(n,t.session_id,o,l);d.state==="playable"&&(d.track=f),d.persistentTrack=f}}}function Jp(t,e){try{var n=e.getState();for(var r in t.tracks)if(!gw(r)){var i=t.tracks[r].kind;if(i){var o=t.tracks[r];if(o){var s=t.local?hw(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 gw(t){return["video","audio","screenVideo","screenAudio"].includes(t)}function Gp(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&&bs(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&&bs(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&&bs(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&&bs(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 mw(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 Qp(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)?Qp(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 Qp(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 vw(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 Yp(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)?Yp(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 Yp(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,Bi=null;function yw(t){Xp()?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=W(function*(){var i,o=yield navigator.mediaDevices.enumerateDevices(),s=mw(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),Bi||(Bi=setInterval(W(function*(){var r,i=yield navigator.mediaDevices.enumerateDevices(),o=vw(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 bw(t){Xp()?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&&Bi&&(clearInterval(Bi),Bi=null))}(t)}function Xp(){var t;return Z()||((t=navigator.mediaDevices)===null||t===void 0?void 0:t.ondevicechange)!==void 0}var ww=new Set;function Sw(t,e){return t&&t.readyState==="live"&&!function(n,r){return n.muted&&!ww.has(n.id)}(t)}function Zp(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?Zp(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var zi=Object.freeze({VIDEO:"video",AUDIO:"audio",SCREEN_VIDEO:"screenVideo",SCREEN_AUDIO:"screenAudio",CUSTOM_VIDEO:"customVideo",CUSTOM_AUDIO:"customAudio"}),kw=Object.freeze({PARTICIPANTS:"participants",STREAMING:"streaming",TRANSCRIPTION:"transcription"}),Ui=Object.values(zi),eh=["v","a","sv","sa","cv","ca"];Object.freeze(Ui.reduce(function(t,e,n){return t[e]=eh[n],t},{})),Object.freeze(eh.reduce(function(t,e,n){return t[e]=Ui[n],t},{}));var xw=[zi.VIDEO,zi.AUDIO,zi.SCREEN_VIDEO,zi.SCREEN_AUDIO],th=Object.values(kw),nh=["p","s","t"];Object.freeze(th.reduce(function(t,e,n){return t[e]=nh[n],t},{})),Object.freeze(nh.reduce(function(t,e,n){return t[e]=th[n],t},{}));var rh=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.base,r=e.byUserId,i=e.byParticipantId;pt(this,t),this.base=n,this.byUserId=r,this.byParticipantId=i}return ht(t,[{key:"clone",value:function(){var e=new t;if(this.base instanceof Fe?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 Fe?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 Fe?o.clone():o}return e}},{key:"toJSONObject",value:function(){var e={};if(typeof this.base=="boolean"?e.base=this.base:this.base instanceof Fe&&(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 Fe?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 Fe?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 Fe&&(this.base=this.base.normalize()),this.byUserId&&(this.byUserId=Object.fromEntries(Object.entries(this.byUserId).map(function(e){var n=He(e,2),r=n[0],i=n[1];return[r,i instanceof Fe?i.normalize():i]}))),this.byParticipantId&&(this.byParticipantId=Object.fromEntries(Object.entries(this.byParticipantId).map(function(e){var n=He(e,2),r=n[0],i=n[1];return[r,i instanceof Fe?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:Fe.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:Fe.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:Fe.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:Fe.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:Fe.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:Fe.fromMinifiedJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"validateJSONObject",value:function(e){if(re(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=He(Fe.validateJSONObject(e.base,!0),2),a=s[0],l=s[1];if(!a)return[!1,l]}else{if(re(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],p=He(Fe.validateJSONObject(f),2),m=p[0],b=p[1];if(!m)return[!1,b]}}}return[!0]}}])}(),Fe=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;pt(this,t),this.video=n,this.audio=r,this.screenVideo=i,this.screenAudio=o,this.customVideo=s,this.customAudio=a}return ht(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(re(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(!Ui.includes(s))return[!1,"invalid media type '".concat(s,"' in canReceive")];if(xw.includes(s)){if(typeof e[s]!="boolean")return[!1,"invalid (non-boolean) value for media type '".concat(s,"' in canReceive")]}else{if(re(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!==Ui.length?[!1,'canReceive "base" permission must specify all media types: '.concat(Ui.join(", ")," (or be set to a boolean shorthand)")]:[!0]}}])}(),_w=["result"],Cw=["preserveIframe"];function ih(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 U(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ih(Object(n),!0).forEach(function(r){Xt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ih(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oh=function(){return!!t})()}function sh(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 ah(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)?ah(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 ah(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={},lh="video",Ew="voice",ch=Z()?{data:{}}:{data:{},topology:"none"},uh={present:0,hidden:0},dh={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},Wl=Object.keys(dh),fh=["state","volume","simulcastEncodings"],ph={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},ws={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string",visualState:"'default' | 'sidebar-open' | 'active'"}},Kl={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:xh,help:Sh()},customTrayButtons:{validate:kh,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(ws))},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 _h(t,ph)},help:"reactNativeConfig should look like ".concat(JSON.stringify(ph),", 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 gh(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:hn};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:hn};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 re(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 mh(t,{allowAllParticipantsKey:!1})},help:wh({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!!vh(t)&&(e._inputSettings||(e._inputSettings={}),yh(t,(n=e.properties)===null||n===void 0?void 0:n.dailyConfig,e._sharedTracks),e._updatePreloadCacheInputSettings(t,!0),!0)},help:Gl()},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},Ss={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)||!Z()&&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(Z()?"":" | '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=He(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=sh(o);try{for(l.s();!(s=l.n()).done;){var c=s.value;if(!a.includes(c))return!1}}catch(y){l.e(y)}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=He(rh.validateJSONObject(o),2),f=d[0],p=d[1];if(!f)return console.error(p),!1;break;case"canAdmin":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var m,b=["participants","streaming","transcription"],v=sh(o);try{for(v.s();!(m=v.n()).done;){var S=m.value;if(!b.includes(S))return!1}}catch(y){v.e(y)}finally{v.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=W(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 Tw=function(){function t(u){var g,h,x,_,A,R,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(pt(this,t),x=this,_=jt(_=t),Xt(h=Uo(x,oh()?Reflect.construct(_,[],jt(x).constructor):_.apply(x,A)),"startListeningForDeviceChanges",function(){yw(h.handleDeviceChange)}),Xt(h,"stopListeningForDeviceChanges",function(){bw(h.handleDeviceChange)}),Xt(h,"handleDeviceChange",function(G){G=G.map(function(ne){return JSON.parse(JSON.stringify(ne))}),h.emitDailyJSEvent({action:"available-devices-updated",availableDevices:G})}),Xt(h,"handleNativeAppStateChange",function(){var G=W(function*(ne){if(ne==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield h.destroy());var ln=ne==="active";h.disableReactNativeAutoDeviceManagement("video")||(ln?h.camUnmutedBeforeLosingNativeActiveState&&h.setLocalVideo(!0):(h.camUnmutedBeforeLosingNativeActiveState=h.localVideo(),h.camUnmutedBeforeLosingNativeActiveState&&h.setLocalVideo(!1)))});return function(ne){return G.apply(this,arguments)}}()),Xt(h,"handleNativeAudioFocusChange",function(G){h.disableReactNativeAutoDeviceManagement("audio")||(h._hasNativeAudioFocus=G,h.toggleParticipantAudioBasedOnNativeAudioFocus(),h._hasNativeAudioFocus?h.micUnmutedBeforeLosingNativeAudioFocus&&h.setLocalAudio(!0):(h.micUnmutedBeforeLosingNativeAudioFocus=h.localAudio(),h.setLocalAudio(!1)))}),Xt(h,"handleNativeSystemScreenCaptureStop",function(){h.stopScreenShare()}),!Nl()&&!Z())throw new Error("WebRTC not supported or suppressed");if(h.strictMode=$.strictMode===void 0||$.strictMode,h.allowMultipleCallInstances=(g=$.allowMultipleCallInstances)!==null&&g!==void 0&&g,Object.keys(yr).length&&(h._logDuplicateInstanceAttempt(),!h.allowMultipleCallInstances)){if(h.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:{}}),h.callClientId=Ko(),yr[(R=h).callClientId]=R,window._daily.instances[h.callClientId]={},h._sharedTracks={},window._daily.instances[h.callClientId].tracks=h._sharedTracks,$.dailyJsVersion=t.version(),h._iframe=u,h._callObjectMode=$.layout==="none"&&!h._iframe,h._preloadCache={subscribeToTracksAutomatically:!0,outputDeviceId:null,inputSettings:null,sendSettings:null,videoTrackForNetworkConnectivityTest:null,videoTrackForConnectionQualityTest:null},$.showLocalVideo!==void 0?h._callObjectMode?console.error("showLocalVideo is not available in call object mode"):h._showLocalVideo=!!$.showLocalVideo:h._showLocalVideo=!0,$.showParticipantsBar!==void 0?h._callObjectMode?console.error("showParticipantsBar is not available in call object mode"):h._showParticipantsBar=!!$.showParticipantsBar:h._showParticipantsBar=!0,$.customIntegrations!==void 0?h._callObjectMode?console.error("customIntegrations is not available in call object mode"):h._customIntegrations=$.customIntegrations:h._customIntegrations={},$.customTrayButtons!==void 0?h._callObjectMode?console.error("customTrayButtons is not available in call object mode"):h._customTrayButtons=$.customTrayButtons:h._customTrayButtons={},$.activeSpeakerMode!==void 0?h._callObjectMode?console.error("activeSpeakerMode is not available in call object mode"):h._activeSpeakerMode=!!$.activeSpeakerMode:h._activeSpeakerMode=!1,$.receiveSettings?h._callObjectMode?h._receiveSettings=$.receiveSettings:console.error("receiveSettings is only available in call object mode"):h._receiveSettings={},h.validateProperties($),h.properties=U({},$),h._inputSettings||(h._inputSettings={}),h._callObjectLoader=h._callObjectMode?new aw(h.callClientId):null,h._callState=hp,h._isPreparingToJoin=!1,h._accessState={access:Ol},h._meetingSessionSummary={},h._finalSummaryOfPrevSession={},h._meetingSessionState=Ql(ch,h._callObjectMode),h._nativeInCallAudioMode=lh,h._participants={},h._isScreenSharing=!1,h._participantCounts=uh,h._rmpPlayerState={},h._waitingParticipants={},h._network={threshold:"good",quality:100,networkState:"unknown",stats:{}},h._activeSpeaker={},h._localAudioLevel=0,h._isLocalAudioLevelObserverRunning=!1,h._remoteParticipantsAudioLevel={},h._isRemoteParticipantsAudioLevelObserverRunning=!1,h._maxAppMessageSize=Pl,h._messageChannel=Z()?new ow:new iw,h._iframe&&(h._iframe.requestFullscreen?h._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===h._iframe?(h.emitDailyJSEvent({action:ps}),h.sendMessageToCallMachine({action:ps})):(h.emitDailyJSEvent({action:hs}),h.sendMessageToCallMachine({action:hs}))}):h._iframe.webkitRequestFullscreen&&h._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===h._iframe?(h.emitDailyJSEvent({action:ps}),h.sendMessageToCallMachine({action:ps})):(h.emitDailyJSEvent({action:hs}),h.sendMessageToCallMachine({action:hs}))})),Z()){var B=h.nativeUtils();B.addAudioFocusChangeListener&&B.removeAudioFocusChangeListener&&B.addAppStateChangeListener&&B.removeAppStateChangeListener&&B.addSystemScreenCaptureStopListener&&B.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),h._hasNativeAudioFocus=!0,B.addAudioFocusChangeListener(h.handleNativeAudioFocusChange),B.addAppStateChangeListener(h.handleNativeAppStateChange),B.addSystemScreenCaptureStopListener(h.handleNativeSystemScreenCaptureStop)}return h._callObjectMode&&h.startListeningForDeviceChanges(),h._messageChannel.addListenerForMessagesFromCallMachine(h.handleMessageFromCallMachine,h.callClientId,h),h}return Ho(t,Wo),ht(t,[{key:"destroy",value:(ke=W(function*(){var u;try{yield this.leave()}catch{}var g=this._iframe;if(g){var h=g.parentElement;h&&h.removeChild(g)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),Z()){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 ke.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(u){var g=u.bodyClass,h=u.cssFile,x=u.cssText;return ee(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl(h),bodyClass:g,cssText:x}),this}},{key:"iframe",value:function(){return ee(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return zt(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return zt(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(u,g){for(var h in g){if(!Ss[h])throw new Error("unrecognized updateParticipant property ".concat(h));if(Ss[h].validate&&!Ss[h].validate(g[h],this,this._participants[u]))throw new Error(Ss[h].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 h in u)h===g&&(h="local"),h&&u[h]&&this.validateParticipantProperties(h,u[h]);return this.sendMessageToCallMachine({action:"update-participants",participants:u}),this}},{key:"updateWaitingParticipant",value:(le=W(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(zt(this._callObjectMode,"updateWaitingParticipant()"),fe(this._callState,"updateWaitingParticipant()"),typeof g!="string"||re(h)!=="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:h},function(A){A.error&&_(A.error),A.id||_(new Error("unknown error in updateWaitingParticipant()")),x({id:A.id})})})}),function(){return le.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(J=W(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(this._callObjectMode,"updateWaitingParticipants()"),fe(this._callState,"updateWaitingParticipants()"),re(g)!=="object")throw new Error("updateWaitingParticipants() must take a mapping between ids and update objects");return new Promise(function(h,x){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participants",updatesById:g},function(_){_.error&&x(_.error),_.ids||x(new Error("unknown error in updateWaitingParticipants()")),h({ids:_.ids})})})}),function(){return J.apply(this,arguments)})},{key:"requestAccess",value:(V=W(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h=g.access,x=h===void 0?{level:Zb}:h,_=g.name,A=_===void 0?"":_;return zt(this._callObjectMode,"requestAccess()"),fe(this._callState,"requestAccess()"),new Promise(function(R,$){u.sendMessageToCallMachine({action:"daily-method-request-access",access:x,name:A},function(B){B.error&&$(B.error),B.access||$(new Error("unknown error in requestAccess()")),R({access:B.access,granted:B.granted})})})}),function(){return V.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&&(Z()?(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:(j=W(function*(u){var g=this,h=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,x=h!==void 0&&h;if(zt(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(re(u)){case"string":return new Promise(function(_){g.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:u,showInheritedValues:x},function(A){_(A.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 j.apply(this,arguments)})},{key:"updateReceiveSettings",value:(dt=W(function*(u){var g=this;if(zt(this._callObjectMode,"updateReceiveSettings()"),!mh(u,{allowAllParticipantsKey:!0}))throw new Error(wh({allowAllParticipantsKey:!0}));return fe(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function(h){g.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:u},function(x){h({receiveSettings:x.receiveSettings})})})}),function(u){return dt.apply(this,arguments)})},{key:"_prepInputSettingsForSharing",value:function(u,g){if(u){var h={};if(u.audio){var x,_,A;u.audio.settings&&(!Object.keys(u.audio.settings).length&&g||(h.audio={settings:U({},u.audio.settings)})),g&&(x=h.audio)!==null&&x!==void 0&&(x=x.settings)!==null&&x!==void 0&&x.customTrack&&(h.audio.settings={customTrack:this._sharedTracks.audioTrack});var R=((_=u.audio.processor)===null||_===void 0?void 0:_.type)==="none"&&((A=u.audio.processor)===null||A===void 0?void 0:A._isDefaultWhenNone);if(u.audio.processor&&!R){var $=U({},u.audio.processor);delete $._isDefaultWhenNone,h.audio=U(U({},h.audio),{},{processor:$})}}if(u.video){var B,G,ne;u.video.settings&&(!Object.keys(u.video.settings).length&&g||(h.video={settings:U({},u.video.settings)})),g&&(B=h.video)!==null&&B!==void 0&&(B=B.settings)!==null&&B!==void 0&&B.customTrack&&(h.video.settings={customTrack:this._sharedTracks.videoTrack});var ln=((G=u.video.processor)===null||G===void 0?void 0:G.type)==="none"&&((ne=u.video.processor)===null||ne===void 0?void 0:ne._isDefaultWhenNone);if(u.video.processor&&!ln){var Nr=U({},u.video.processor);delete Nr._isDefaultWhenNone,h.video=U(U({},h.video),{},{processor:Nr})}}return h}}},{key:"getInputSettings",value:function(){var u=this;return ee(),new Promise(function(g){g(u._getInputSettings())})}},{key:"_getInputSettings",value:function(){var u,g,h,x,_,A,R={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(u=((h=this._inputSettings)===null||h===void 0?void 0:h.video)||R,g=((x=this._inputSettings)===null||x===void 0?void 0:x.audio)||R):(u=((_=this._preloadCache)===null||_===void 0||(_=_.inputSettings)===null||_===void 0?void 0:_.video)||R,g=((A=this._preloadCache)===null||A===void 0||(A=A.inputSettings)===null||A===void 0?void 0:A.audio)||R);var $={audio:g,video:u};return this._prepInputSettingsForSharing($,!0)}},{key:"_updatePreloadCacheInputSettings",value:function(u,g){var h=this._inputSettings||{},x={};if(u.video){var _,A,R;x.video={},u.video.settings?(x.video.settings={},g||u.video.settings.customTrack||(R=h.video)===null||R===void 0||!R.settings?x.video.settings=u.video.settings:x.video.settings=U(U({},h.video.settings),u.video.settings),Object.keys(x.video.settings).length||delete x.video.settings):(_=h.video)!==null&&_!==void 0&&_.settings&&(x.video.settings=h.video.settings),u.video.processor?x.video.processor=u.video.processor:(A=h.video)!==null&&A!==void 0&&A.processor&&(x.video.processor=h.video.processor)}else h.video&&(x.video=h.video);if(u.audio){var $,B,G;x.audio={},u.audio.settings?(x.audio.settings={},g||u.audio.settings.customTrack||(G=h.audio)===null||G===void 0||!G.settings?x.audio.settings=u.audio.settings:x.audio.settings=U(U({},h.audio.settings),u.audio.settings),Object.keys(x.audio.settings).length||delete x.audio.settings):($=h.audio)!==null&&$!==void 0&&$.settings&&(x.audio.settings=h.audio.settings),u.audio.processor?x.audio.processor=u.audio.processor:(B=h.audio)!==null&&B!==void 0&&B.processor&&(x.audio.processor=h.audio.processor)}else h.audio&&(x.audio=h.audio);this._maybeUpdateInputSettings(x)}},{key:"_devicesFromInputSettings",value:function(u){var g,h,x=(u==null||(g=u.video)===null||g===void 0||(g=g.settings)===null||g===void 0?void 0:g.deviceId)||null,_=(u==null||(h=u.audio)===null||h===void 0||(h=h.settings)===null||h===void 0?void 0:h.deviceId)||null,A=this._preloadCache.outputDeviceId||null;return{camera:x?{deviceId:x}:{},mic:_?{deviceId:_}:{},speaker:A?{deviceId:A}:{}}}},{key:"updateInputSettings",value:(Rt=W(function*(u){var g=this;return ee(),vh(u)?u.video||u.audio?(yh(u,this.properties.dailyConfig,this._sharedTracks),this._callObjectMode&&!this._callMachineInitialized?(this._updatePreloadCacheInputSettings(u,!0),this._getInputSettings()):new Promise(function(h,x){g.sendMessageToCallMachine({action:"update-input-settings",inputSettings:u},function(_){if(_.error)x(_.error);else{if(_.returnPreloadCache)return g._updatePreloadCacheInputSettings(u,!0),void h(g._getInputSettings());g._maybeUpdateInputSettings(_.inputSettings),h(g._prepInputSettingsForSharing(_.inputSettings,!0))}})})):this._getInputSettings():(console.error(Gl()),Promise.reject(Gl()))}),function(u){return Rt.apply(this,arguments)})},{key:"setBandwidth",value:function(u){var g=u.kbs,h=u.trackConstraints;if(ee(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:g,trackConstraints:h}),this}},{key:"getDailyLang",value:function(){var u=this;if(ee(),this._callMachineInitialized)return new Promise(function(g){u.sendMessageToCallMachine({action:"get-daily-lang"},function(h){delete h.action,delete h.callbackStamp,g(h)})})}},{key:"setDailyLang",value:function(u){return ee(),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:(Me=W(function*(){var u=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),fe(this._callState,"getMeetingSession()"),new Promise(function(g){u.sendMessageToCallMachine({action:"get-meeting-session"},function(h){delete h.action,delete h.callbackStamp,g(h)})})}),function(){return Me.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return fe(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";zt(this._callObjectMode,"setMeetingSessionData()"),fe(this._callState,"setMeetingSessionData");try{(function(h,x){new sw({data:h,mergeStrategy:x})})(u,g)}catch(h){throw console.error(h),h}try{this.sendMessageToCallMachine({action:"set-session-data",data:u,mergeStrategy:g})}catch(h){throw new Error("Error setting meeting session data: ".concat(h))}}},{key:"setUserName",value:function(u,g){var h=this;return this.properties.userName=u,new Promise(function(x){h.sendMessageToCallMachine({action:"set-user-name",name:u??"",thisMeetingOnly:Z()||!!g&&!!g.thisMeetingOnly},function(_){delete _.action,delete _.callbackStamp,x(_)})})}},{key:"setUserData",value:(Ge=W(function*(u){var g=this;try{gh(u)}catch(h){throw console.error(h),h}if(this.properties.userData=u,this._callMachineInitialized)return new Promise(function(h){try{g.sendMessageToCallMachine({action:"set-user-data",userData:u},function(x){delete x.action,delete x.callbackStamp,h(x)})}catch(x){throw new Error("Error setting user data: ".concat(x))}})}),function(u){return Ge.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"&&!Z())throw new Error("startLocalAudioLevelObserver() is not supported on this browser");if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isLocalAudioLevelObserverRunning=!0,new Promise(function(h,x){g.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:u},function(_){g._isLocalAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):h()})});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(h,x){g.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:u},function(_){g._isRemoteParticipantsAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):h()})});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:(Y=W(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(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(h){return Promise.reject(h)}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=U(U({},this.properties),g)}return new Promise(function(h){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){h({camera:x.camera,mic:x.mic,speaker:x.speaker})})})}),function(){return Y.apply(this,arguments)})},{key:"validateCustomTrack",value:function(u,g,h){if(h&&h.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(h&&["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo","customVideoDefaults"].includes(h))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 ee(),fe(this._callState,"startCustomTrack()"),this.validateCustomTrack(g.track,g.mode,g.trackName),new Promise(function(h,x){u._sharedTracks.customTrack=g.track,g.track=hn,u.sendMessageToCallMachine({action:"start-custom-track",properties:g},function(_){_.error?x({error:_.error}):h(_.mediaTag)})})}},{key:"stopCustomTrack",value:function(u){var g=this;return ee(),fe(this._callState,"stopCustomTrack()"),new Promise(function(h){g.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:u},function(x){h(x.mediaTag)})})}},{key:"setCamera",value:function(u){var g=this;return Hi(),xs(this._callMachineInitialized,"setCamera()"),new Promise(function(h){g.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:u},function(x){h({device:x.device})})})}},{key:"setAudioDevice",value:(he=W(function*(u){return Hi(),this.nativeUtils().setAudioDevice(u),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(u){return he.apply(this,arguments)})},{key:"cycleCamera",value:function(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(h){u.sendMessageToCallMachine({action:"cycle-camera",properties:g},function(x){h({device:x.device})})})}},{key:"cycleMic",value:function(){var u=this;return ee(),new Promise(function(g){u.sendMessageToCallMachine({action:"cycle-mic"},function(h){g({device:h.device})})})}},{key:"getCameraFacingMode",value:function(){var u=this;return Hi(),new Promise(function(g){u.sendMessageToCallMachine({action:"get-camera-facing-mode"},function(h){g(h.facingMode)})})}},{key:"setInputDevicesAsync",value:(te=W(function*(u){var g=this,h=u.audioDeviceId,x=u.videoDeviceId,_=u.audioSource,A=u.videoSource;if(ee(),_!==void 0&&(h=_),A!==void 0&&(x=A),typeof h=="boolean"&&(this._setAllowLocalAudio(h),h=void 0),typeof x=="boolean"&&(this._setAllowLocalVideo(x),x=void 0),!h&&!x)return yield this.getInputDevices();var R={};return h&&(h instanceof MediaStreamTrack?(this._sharedTracks.audioTrack=h,h=hn,R.audio={settings:{customTrack:h}}):(delete this._sharedTracks.audioTrack,R.audio={settings:{deviceId:h}})),x&&(x instanceof MediaStreamTrack?(this._sharedTracks.videoTrack=x,x=hn,R.video={settings:{customTrack:x}}):(delete this._sharedTracks.videoTrack,R.video={settings:{deviceId:x}})),this._callObjectMode&&this.needsLoad()?(this._updatePreloadCacheInputSettings(R,!1),this._devicesFromInputSettings(this._inputSettings)):new Promise(function($){g.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:h,videoDeviceId:x},function(B){if(delete B.action,delete B.callbackStamp,B.returnPreloadCache)return g._updatePreloadCacheInputSettings(R,!1),void $(g._devicesFromInputSettings(g._inputSettings));$(B)})})}),function(u){return te.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(z=W(function*(u){var g=this,h=u.outputDeviceId;if(ee(),!h||typeof h!="string")throw new Error("outputDeviceId must be provided and must be a valid device id");return this._preloadCache.outputDeviceId=h,this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(x,_){g.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:h},function(A){if(delete A.action,delete A.callbackStamp,A.error){var R=new Error(A.error.message);return R.type=A.error.type,void _(R)}A.returnPreloadCache?x(g._devicesFromInputSettings(g._inputSettings)):x(A)})})}),function(u){return z.apply(this,arguments)})},{key:"getInputDevices",value:(H=W(function*(){var u=this;return this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(g){u.sendMessageToCallMachine({action:"get-input-devices"},function(h){h.returnPreloadCache?g(u._devicesFromInputSettings(u._inputSettings)):g({camera:h.camera,mic:h.mic,speaker:h.speaker})})})}),function(){return H.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return Hi(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(u){if(Hi(),[lh,Ew].includes(u)){if(u!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=u,!this.disableReactNativeAutoDeviceManagement("audio")&&ks(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMode(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",u)}},{key:"preAuth",value:(I=W(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(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=U(U({},this.properties),g),new Promise(function(h,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 h({access:_.access})):x(new Error("unknown error in preAuth()"))})})}),function(){return I.apply(this,arguments)})},{key:"load",value:(O=W(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=U(U({},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(gp),this.emitDailyJSEvent({action:s0}),this._callObjectMode?new Promise(function(h,x){g._callObjectLoader.cancel();var _=Date.now();g._callObjectLoader.load(g.properties.dailyConfig,function(A){g._bundleLoadTime=A?"no-op":Date.now()-_,g._updateCallState(mp),A&&g.emitDailyJSEvent({action:yp}),h()},function(A,R){if(g.emitDailyJSEvent({action:a0}),!R){g._updateCallState(In),g.resetMeetingDependentVars();var $={action:xp,errorMsg:A.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:A,bundleUrl:qo(g.properties.dailyConfig)}}};g._maybeSendToSentry($),g.emitDailyJSEvent($),x(A.msg)}})}):(this._iframe.src=ef(this.assembleMeetingUrl(),this.properties.dailyConfig),new Promise(function(h,x){g._loadedCallback=function(_){g._callState!==In?(g._updateCallState(mp),(g.properties.cssFile||g.properties.cssText)&&g.loadCss(g.properties),h()):x(_)}}))}}),function(u){return O.apply(this,arguments)})},{key:"join",value:(M=W(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._testCallInProgress&&this.stopTestCallQuality();var h=!1;if(this.needsLoad()){this.updateIsPreparingToJoin(!0);try{yield this.load(g)}catch(x){return this.updateIsPreparingToJoin(!1),Promise.reject(x)}}else{if(h=!(!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=U(U({},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===Al?(console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1)):(this._updateCallState(Al,!1),this.emitDailyJSEvent({action:u0}),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(A,R){if(u._callState!==In){if(u._updateCallState(gr),A)for(var $ in A){if(u._callObjectMode){var B=u._callMachine().store;qp(A[$],B),Jp(A[$],B),Gp(A[$],u._participants[$],B)}u._participants[$]=U({},A[$]),u.toggleParticipantAudioBasedOnNativeAudioFocus()}h&&u.loadCss(u.properties),x(A)}else _(R)}}))}),function(){return M.apply(this,arguments)})},{key:"leave",value:(E=W(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 E.apply(this,arguments)})},{key:"startScreenShare",value:(C=W(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(xs(this._callMachineInitialized,"startScreenShare()"),g.screenVideoSendSettings&&this._validateVideoSendSettings("screenVideo",g.screenVideoSendSettings),g.mediaStream&&(this._sharedTracks.screenMediaStream=g.mediaStream,g.mediaStream=hn),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var h=this.nativeUtils();if(yield h.isScreenBeingCaptured())return void this.emitDailyJSEvent({action:kp,type:"screen-share-error",errorMsg:"Could not start the screen sharing. The screen is already been captured!"});h.setSystemScreenCaptureStartCallback(function(){h.setSystemScreenCaptureStartCallback(null),u.sendMessageToCallMachine({action:Cp,captureOptions:g})}),h.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:Cp,captureOptions:g})}),function(){return C.apply(this,arguments)})},{key:"stopScreenShare",value:function(){xs(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(U({action:"local-recording-start"},u))}},{key:"updateRecording",value:function(u){var g=u.layout,h=g===void 0?{preset:"default"}:g,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-recording",layout:h,instanceId:x})}},{key:"stopRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(U({action:"local-recording-stop"},u))}},{key:"startLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(U({action:"daily-method-start-live-streaming"},u))}},{key:"updateLiveStreaming",value:function(u){var g=u.layout,h=g===void 0?{preset:"default"}:g,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:h,instanceId:x})}},{key:"addLiveStreamingEndpoints",value:function(u){var g=u.endpoints,h=u.instanceId;this.sendMessageToCallMachine({action:Ep,endpointsOp:X0,endpoints:g,instanceId:h})}},{key:"removeLiveStreamingEndpoints",value:function(u){var g=u.endpoints,h=u.instanceId;this.sendMessageToCallMachine({action:Ep,endpointsOp:Z0,endpoints:g,instanceId:h})}},{key:"stopLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(U({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."),Lp()&&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,h=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(!Th(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 A in this._validateEncodingLayerHasValidProperties(_),_)if(Wl.includes(A)){if(typeof _[A]!="number")throw new Error("".concat(A," must be a number"));if(g){var R=g[A],$=R.min,B=R.max;if(!Th(_[A],$,B))throw new Error("".concat(A," value not in range. valid range: ").concat($," to ").concat(B))}}else if(!["active","scalabilityMode"].includes(A))throw new Error("Invalid key ".concat(A,", valid keys are:")+Object.values(Wl));if(h&&!_.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(k=W(function*(u){var g=this,h=u.url,x=u.settings,_=x===void 0?{state:Ll.PLAY}:x;try{(function(A){if(typeof A!="string")throw new Error('url parameter must be "string" type')})(h),Eh(_),function(A){for(var R in A)if(!fh.includes(R))throw new Error("Invalid key ".concat(R,", valid keys are: ").concat(fh));A.simulcastEncodings&&this.validateSimulcastEncodings(A.simulcastEncodings,dh,!0)}(_)}catch(A){throw console.error("invalid argument Error: ".concat(A)),console.error(`startRemoteMediaPlayer arguments must be of the form:
|
|
31
|
+
{ url: "playback url",
|
|
32
|
+
settings?:
|
|
33
|
+
{state: "play"|"pause", simulcastEncodings?: [{}] } }`),A}return new Promise(function(A,R){g.sendMessageToCallMachine({action:"daily-method-start-remote-media-player",url:h,settings:_},function($){$.error?R({error:$.error,errorMsg:$.errorMsg}):A({session_id:$.session_id,remoteMediaPlayerState:{state:$.state,settings:$.settings}})})})}),function(u){return k.apply(this,arguments)})},{key:"stopRemoteMediaPlayer",value:(w=W(function*(u){var g=this;if(typeof u!="string")throw new Error(" remotePlayerID must be of type string");return new Promise(function(h,x){g.sendMessageToCallMachine({action:"daily-method-stop-remote-media-player",session_id:u},function(_){_.error?x({error:_.error,errorMsg:_.errorMsg}):h()})})}),function(u){return w.apply(this,arguments)})},{key:"updateRemoteMediaPlayer",value:(y=W(function*(u){var g=this,h=u.session_id,x=u.settings;try{Eh(x)}catch(_){throw console.error("invalid argument Error: ".concat(_)),console.error(`updateRemoteMediaPlayer arguments must be of the form:
|
|
34
|
+
session_id: "participant session",
|
|
35
|
+
{ settings?: {state: "play"|"pause"} }`),_}return new Promise(function(_,A){g.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:h,settings:x},function(R){R.error?A({error:R.error,errorMsg:R.errorMsg}):_({session_id:R.session_id,remoteMediaPlayerState:{state:R.state,settings:R.settings}})})})}),function(u){return y.apply(this,arguments)})},{key:"startTranscription",value:function(u){fe(this._callState,"startTranscription()"),this.sendMessageToCallMachine(U({action:"daily-method-start-transcription"},u))}},{key:"updateTranscription",value:function(u){if(fe(this._callState,"updateTranscription()"),!u)throw new Error("updateTranscription Error: options is mandatory");if(re(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(U({action:"daily-method-update-transcription"},u))}},{key:"stopTranscription",value:function(u){if(fe(this._callState,"stopTranscription()"),u&&re(u)!=="object")throw new Error("stopTranscription Error: options must be object type");if(u&&!u.instanceId)throw new Error('"instanceId" not provided');this.sendMessageToCallMachine(U({action:"daily-method-stop-transcription"},u))}},{key:"startDialOut",value:(S=W(function*(u){var g=this;fe(this._callState,"startDialOut()");var h=function(R){if(R){if(!Array.isArray(R))throw new Error("Error starting dial out: audio codec must be an array");if(R.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");R.forEach(function($){if(typeof $!="string")throw new Error("Error starting dial out: audio codec must be a string");if($!=="OPUS"&&$!=="PCMU"&&$!=="PCMA"&&$!=="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(R){if(R&&(h(R.audio),R.video)){if(!Array.isArray(R.video))throw new Error("Error starting dial out: video codec must be an array");if(R.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");R.video.forEach(function($){if(typeof $!="string")throw new Error("Error starting dial out: video codec must be a string");if($!=="H264"&&$!=="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&&h(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(hh(u),u.permissions&&u.permissions.canReceive){var x=He(rh.validateJSONObject(u.permissions.canReceive),2),_=x[0],A=x[1];if(!_)throw new Error(A)}return new Promise(function(R,$){g.sendMessageToCallMachine(U({action:"dialout-start"},u),function(B){B.error?$(B.error):R(B)})})}),function(u){return S.apply(this,arguments)})},{key:"stopDialOut",value:function(u){var g=this;return fe(this._callState,"stopDialOut()"),new Promise(function(h,x){g.sendMessageToCallMachine(U({action:"dialout-stop"},u),function(_){_.error?x(_.error):h(_)})})}},{key:"sipCallTransfer",value:(v=W(function*(u){var g=this;if(fe(this._callState,"sipCallTransfer()"),!u)throw new Error("sipCallTransfer() requires a sessionId and toEndPoint");return u.useSipRefer=!1,Ch(u,"sipCallTransfer"),hh(u),new Promise(function(h,x){g.sendMessageToCallMachine(U({action:Mp},u),function(_){_.error?x(_.error):h(_)})})}),function(u){return v.apply(this,arguments)})},{key:"sipRefer",value:(b=W(function*(u){var g=this;if(fe(this._callState,"sipRefer()"),!u)throw new Error("sessionId and toEndPoint are mandatory parameter");return u.useSipRefer=!0,Ch(u,"sipRefer"),new Promise(function(h,x){g.sendMessageToCallMachine(U({action:Mp},u),function(_){_.error?x(_.error):h(_)})})}),function(u){return b.apply(this,arguments)})},{key:"sendDTMF",value:(m=W(function*(u){var g=this;return fe(this._callState,"sendDTMF()"),function(h){var x=h.sessionId,_=h.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 A=/[^0-9A-D*#]/g,R=_.match(A);if(R&&R[0])throw new Error("".concat(R[0]," is not valid DTMF tone"))}(u),new Promise(function(h,x){g.sendMessageToCallMachine(U({action:"send-dtmf"},u),function(_){_.error?x(_.error):h(_)})})}),function(u){return m.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var u=this;return this._callState!==gr?Promise.resolve(U({stats:{latest:{}}},this._network)):new Promise(function(g){u.sendMessageToCallMachine({action:"get-calc-stats"},function(h){g(U(U({},u._network),{},{stats:h.stats}))})})}},{key:"testWebsocketConnectivity",value:(p=W(function*(){var u=this;if(Jl(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(g){return Promise.reject(g)}return new Promise(function(g,h){u.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(x){x.error?h(x.error):g(x.results)})})}),function(){return p.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(u){return u?u instanceof MediaStreamTrack?!!Sw(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=W(function*(){var u=this;ee(),zt(this._callObjectMode,"testCallQuality()"),xs(this._callMachineInitialized,"testCallQuality()",null,!0),ql(this._callState,this._isPreparingToJoin,"testCallQuality()");var g=this._testCallAlreadyInProgress,h=function(_){g||(u._testCallInProgress=_)};if(h(!0),this.needsLoad())try{var x=this._callState;yield this.load(),this._callState=x}catch(_){return h(!1),Promise.reject(_)}return new Promise(function(_){u.sendMessageToCallMachine({action:"test-call-quality",dailyJsVersion:u.properties.dailyJsVersion},function(A){var R=A.results,$=R.result,B=Vd(R,_w);if($==="failed"){var G,ne=U({},B);(G=B.error)!==null&&G!==void 0&&G.details?(B.error.details=JSON.parse(B.error.details),ne.error=U(U({},ne.error),{},{details:U({},ne.error.details)}),ne.error.details.duringTest="testCallQuality"):(ne.error=ne.error?U({},ne.error):{},ne.error.details={duringTest:"testCallQuality"}),u._maybeSendToSentry(ne)}h(!1),_(U({result:$},B))})})}),function(){return f.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(d=W(function*(u){var g;Z()?(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 h={result:g.result,secondsElapsed:g.secondsElapsed};return g.data&&(h.data={maxRTT:g.data.maxRoundTripTime,packetLoss:g.data.avgRecvPacketLoss}),h}),function(u){return d.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(c=W(function*(u){var g=this;if(Jl(this._testCallInProgress,"testPeerToPeerCallQuality()"),this.needsLoad())try{yield this.load()}catch(_){return Promise.reject(_)}var h=u.videoTrack,x=u.duration;if(!this._validateVideoTrackForNetworkTests(h))throw new Error("Video track error");return this._sharedTracks.videoTrackForConnectionQualityTest=h,new Promise(function(_,A){g.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:x},function(R){R.error?A(R.error):_(R.results)})})}),function(u){return c.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){Z()?(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=W(function*(u){var g=this;if(Jl(this._testCallInProgress,"testNetworkConnectivity()"),this.needsLoad())try{yield this.load()}catch(h){return Promise.reject(h)}if(!this._validateVideoTrackForNetworkTests(u))throw new Error("Video track error");return this._sharedTracks.videoTrackForNetworkConnectivityTest=u,new Promise(function(h,x){g.sendMessageToCallMachine({action:"test-network-connectivity"},function(_){_.error?x(_.error):h(_.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(h){g(h.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(Wl))}},{key:"_validateVideoSendSettings",value:function(u,g){var h=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(h.join());if(typeof g=="string"){if(!h.includes(g))throw new Error(x)}else{if(re(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(h){var x=He(h,2),_=x[0],A=x[1];g._validateVideoSendSettings(_,A)})}},{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(h,x){g.sendMessageToCallMachine({action:"update-send-settings",sendSettings:u},function(_){_.error?x(_.error):h(_.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 ee(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(u){return ee(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:u}),this}},{key:"activeSpeakerMode",value:function(){return ee(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(u){return fe(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=W(function*(){var u=this;if(this._callObjectMode){var g=yield navigator.mediaDevices.enumerateDevices();return vr()==="Firefox"&&vs().major>115&&vs().major<123&&(g=g.filter(function(h){return h.kind!=="audiooutput"})),{devices:g.map(function(h){var x=JSON.parse(JSON.stringify(h));if(!Z()&&h.kind==="videoinput"&&h.getCapabilities){var _,A=h.getCapabilities();x.facing=(A==null||(_=A.facingMode)===null||_===void 0?void 0:_.length)>=1?A.facingMode[0]:void 0}return x})}}return new Promise(function(h){u.sendMessageToCallMachine({action:"enumerate-devices"},function(x){h({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(fe(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 ee(),fe(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(U({action:"add-fake-participant"},u)),this}},{key:"setShowNamesMode",value:function(u){return mt(this._callObjectMode,"setShowNamesMode()"),ee(),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()"),ee(),fe(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()"),ee(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return mt(this._callObjectMode,"setShowParticipantsBar()"),ee(),fe(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()"),ee(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return ee(),mt(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(u){return ee(),mt(this._callObjectMode,"setCustomIntegrations()"),fe(this._callState,"setCustomIntegrations()"),xh(u)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:u}),this._customIntegrations=u,this):this}},{key:"startCustomIntegrations",value:function(u){var g=this;if(ee(),mt(this._callObjectMode,"startCustomIntegrations()"),fe(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 h=typeof u=="string"?[u]:u,x=h.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:h}),this)}},{key:"stopCustomIntegrations",value:function(u){var g=this;if(ee(),mt(this._callObjectMode,"stopCustomIntegrations()"),fe(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 h=typeof u=="string"?[u]:u,x=h.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:h}),this)}},{key:"customTrayButtons",value:function(){return mt(this._callObjectMode,"customTrayButtons()"),ee(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(u){return mt(this._callObjectMode,"updateCustomTrayButtons()"),ee(),fe(this._callState,"updateCustomTrayButtons()"),kh(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(ws))),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(h,x){try{g.validateProperties({theme:u}),g.properties.theme=U({},u),g.sendMessageToCallMachine({action:"set-theme",theme:g.properties.theme});try{g.emitDailyJSEvent({action:o0,theme:g.properties.theme})}catch(_){console.log("could not emit 'theme-updated'",_)}h(g.properties.theme)}catch(_){x(_)}})}},{key:"requestFullscreen",value:(s=W(function*(){if(ee(),this._iframe&&!document.fullscreenElement&&Op())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(){ee(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(o=W(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(h){g(h.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=W(function*(){var u=this,g=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,h=g===void 0||g;return this._accessState.access===Ol||this.needsLoad()?this.properties.url?{roomUrlPendingJoin:this.properties.url}:null:new Promise(function(x){u.sendMessageToCallMachine({action:"lib-room-info",includeRoomConfigDefaults:h},function(_){delete _.action,delete _.callbackStamp,x(_)})})}),function(){return i.apply(this,arguments)})},{key:"geo",value:(r=W(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=W(function*(u){var g=this;return ee(),fe(this._callState,"setNetworkTopology()"),new Promise(function(h,x){g.sendMessageToCallMachine({action:"set-network-topology",opts:u},function(_){_.error?x({error:_.error}):h({workerId:_.workerId})})})}),function(u){return n.apply(this,arguments)})},{key:"getNetworkTopology",value:(e=W(function*(){var u=this;return new Promise(function(g,h){u.needsLoad()&&g({topology:"none"}),u.sendMessageToCallMachine({action:"get-network-topology"},function(x){x.error?h({error:x.error}):g({topology:x.topology})})})}),function(){return e.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(u){if(ee(),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 Wo.prototype.on.call(this,u,g)}},{key:"once",value:function(u,g){return Wo.prototype.once.call(this,u,g)}},{key:"off",value:function(u,g){return Wo.prototype.off.call(this,u,g)}},{key:"validateProperties",value:function(u){var g,h;if(u!=null&&(g=u.dailyConfig)!==null&&g!==void 0&&g.userMediaAudioConstraints){var x,_;Z()||console.warn("userMediaAudioConstraints is deprecated. You can override constraints with inputSettings.audio.settings, found in DailyCallOptions.");var A=u.inputSettings||{};A.audio=((x=u.inputSettings)===null||x===void 0?void 0:x.audio)||{},A.audio.settings=((_=u.inputSettings)===null||_===void 0||(_=_.audio)===null||_===void 0?void 0:_.settings)||{},A.audio.settings=U(U({},A.audio.settings),u.dailyConfig.userMediaAudioConstraints),u.inputSettings=A,delete u.dailyConfig.userMediaAudioConstraints}if(u!=null&&(h=u.dailyConfig)!==null&&h!==void 0&&h.userMediaVideoConstraints){var R,$;Z()||console.warn("userMediaVideoConstraints is deprecated. You can override constraints with inputSettings.video.settings, found in DailyCallOptions.");var B=u.inputSettings||{};B.video=((R=u.inputSettings)===null||R===void 0?void 0:R.video)||{},B.video.settings=(($=u.inputSettings)===null||$===void 0||($=$.video)===null||$===void 0?void 0:$.settings)||{},B.video.settings=U(U({},B.video.settings),u.dailyConfig.userMediaVideoConstraints),u.inputSettings=B,delete u.dailyConfig.userMediaVideoConstraints}for(var G in u)if(br[G]){if(br[G].validate&&!br[G].validate(u[G],this))throw new Error("property '".concat(G,"': ").concat(br[G].help))}else console.warn("Ignoring unrecognized property '".concat(G,"'")),delete u[G]}},{key:"assembleMeetingUrl",value:function(){var u,g,h=U(U({},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=h.url.match(/\?/)?"&":"?";return h.url+x+Object.keys(br).filter(function(_){return br[_].queryString&&h[_]!==void 0}).map(function(_){return"".concat(br[_].queryString,"=").concat(h[_])}).join("&")}},{key:"needsLoad",value:function(){return[hp,gp,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 r0:this.sendMessageToCallMachine(U({action:i0},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var g={action:gs,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:qo(this.properties.dailyConfig)}};this.sendMessageToCallMachine(g),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case yp:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emitDailyJSEvent(u);break;case d0:var h,x=U({},u);delete x.internal,this._maxAppMessageSize=((h=u.internal)===null||h===void 0?void 0:h._maxAppMessageSize)||Pl,this._joinedCallback&&(this._joinedCallback(u.participants),this._joinedCallback=null),this.emitDailyJSEvent(x);break;case p0:case h0: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 A=this._callMachine().store;qp(u.participant,A),Jp(u.participant,A),Gp(u.participant,this._participants[_],A)}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(Px){console.error("track events error",Px)}this.compareEqualForParticipantUpdateEvent(u.participant,this._participants[_])||(this._participants[_]=U({},u.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus(),this.emitDailyJSEvent(u))}break;case g0:if(u.participant&&u.participant.session_id){var R=this._participants[u.participant.session_id];R&&this.maybeParticipantTracksStopped(R,null),delete this._participants[u.participant.session_id],this.emitDailyJSEvent(u)}break;case m0:Xe(this._participantCounts,u.participantCounts)||(this._participantCounts=u.participantCounts,this.emitDailyJSEvent(u));break;case v0:var $={access:u.access};u.awaitingAccess&&($.awaitingAccess=u.awaitingAccess),Xe(this._accessState,$)||(this._accessState=$,this.emitDailyJSEvent(u));break;case y0:if(u.meetingSession){this._meetingSessionSummary=u.meetingSession,this.emitDailyJSEvent(u);var B=U(U({},u),{},{action:"meeting-session-updated"});this.emitDailyJSEvent(B)}break;case xp:var G;this._iframe&&!u.preserveIframe&&(this._iframe.src=""),this._updateCallState(In),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(u.errorMsg),this._loadedCallback=null),u.preserveIframe;var ne=Vd(u,Cw);ne!=null&&(G=ne.error)!==null&&G!==void 0&&G.details&&(ne.error.details=JSON.parse(ne.error.details)),this._maybeSendToSentry(u),this._joinedCallback&&(this._joinedCallback(null,ne),this._joinedCallback=null),this.emitDailyJSEvent(ne);break;case f0: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 U0:var ln=u.state,Nr=u.threshold,Io=u.quality,$e=ln.state,Nt=ln.reasons;$e===this._network.networkState&&Xe(Nt,this._network.networkStateReasons)&&Nr===this._network.threshold&&Io===this._network.quality||(this._network.networkState=$e,this._network.networkStateReasons=Nt,this._network.quality=Io,this._network.threshold=Nr,u.networkState=$e,Nt.length&&(u.networkStateReasons=Nt),delete u.state,this.emitDailyJSEvent(u));break;case V0:u&&u.cpuLoadState&&this.emitDailyJSEvent(u);break;case W0:u&&u.faceCounts!==void 0&&this.emitDailyJSEvent(u);break;case B0:var $r=u.activeSpeaker;this._activeSpeaker.peerId!==$r.peerId&&(this._activeSpeaker.peerId=$r.peerId,this.emitDailyJSEvent({action:u.action,activeSpeaker:this._activeSpeaker}));break;case"show-local-video-changed":if(this._callObjectMode)return;var Ro=u.show;this._showLocalVideo=Ro,this.emitDailyJSEvent({action:u.action,show:Ro});break;case z0:var Ba=u.enabled;this._activeSpeakerMode!==Ba&&(this._activeSpeakerMode=Ba,this.emitDailyJSEvent({action:u.action,enabled:this._activeSpeakerMode}));break;case w0:case S0:case k0:this._waitingParticipants=u.allWaitingParticipants,this.emitDailyJSEvent({action:u.action,participant:u.participant});break;case Y0:Xe(this._receiveSettings,u.receiveSettings)||(this._receiveSettings=u.receiveSettings,this.emitDailyJSEvent({action:u.action,receiveSettings:u.receiveSettings}));break;case Sp:this._maybeUpdateInputSettings(u.inputSettings);break;case"send-settings-updated":Xe(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 I0:var No=u.session_id;this._rmpPlayerState[No]=u.playerState,this.emitDailyJSEvent(u);break;case N0:delete this._rmpPlayerState[u.session_id],this.emitDailyJSEvent(u);break;case R0:var $o=u.session_id,ay=this._rmpPlayerState[$o];ay&&this.compareEqualForRMPUpdateEvent(ay,u.remoteMediaPlayerState)||(this._rmpPlayerState[$o]=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 b0:var Ox=this._meetingSessionState.topology!==(u.meetingSessionState&&u.meetingSessionState.topology);this._meetingSessionState=Ql(u.meetingSessionState,this._callObjectMode),(this._callObjectMode||Ox)&&this.emitDailyJSEvent(u);break;case $0:this._isScreenSharing=!0,this.emitDailyJSEvent(u);break;case j0:case F0:this._isScreenSharing=!1,this.emitDailyJSEvent(u);break;case bp:case wp:case M0:case A0:case O0:case C0:case E0:case T0:case l0:case c0:case D0:case L0:case"test-completed":case H0:case P0:case K0:case q0:case J0:case G0:case kp:case Q0: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 h="record";u&&(g.local||g[h]!==!1||u[h]===g[h]||this.emitDailyJSEvent({action:wp}))}},{key:"maybeEventRecordingStarted",value:function(u,g){var h="record";u&&(g.local||g[h]!==!0||u[h]===g[h]||this.emitDailyJSEvent({action:bp}))}},{key:"_trackStatePlayable",value:function(u){return!(!u||u.state!==Xb)}},{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,h){var x,_,A=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,R=(_=h==null?void 0:h.tracks[u])!==null&&_!==void 0?_:null,$=A==null?void 0:A.track;if($){var B=this._trackStatePlayable(A),G=this._trackStatePlayable(R),ne=this._trackChanged($,R==null?void 0:R.track);B&&(G&&!ne||this.emitDailyJSEvent({action:_0,track:$,participant:h??g,type:u}))}}},{key:"maybeEventTrackStarted",value:function(u,g,h){var x,_,A=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,R=(_=h==null?void 0:h.tracks[u])!==null&&_!==void 0?_:null,$=R==null?void 0:R.track;if($){var B=this._trackStatePlayable(A),G=this._trackStatePlayable(R),ne=this._trackChanged(A==null?void 0:A.track,$);G&&(B&&!ne||this.emitDailyJSEvent({action:x0,track:$,participant:h,type:u}))}}},{key:"maybeParticipantTracksStopped",value:function(u,g){if(u)for(var h in u.tracks)this.maybeEventTrackStopped(h,u,g)}},{key:"maybeParticipantTracksStarted",value:function(u,g){if(g)for(var h in g.tracks)this.maybeEventTrackStarted(h,u,g)}},{key:"compareEqualForRMPUpdateEvent",value:function(u,g){var h,x;return u.state===g.state&&((h=u.settings)===null||h===void 0?void 0:h.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!!Xe(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 Z()?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 h=this._callState,x=this._isPreparingToJoin;this._callState=u,this._isPreparingToJoin=g;var _=this._callState===gr;this.updateShowAndroidOngoingMeetingNotification(_);var A=ks(h,x),R=ks(this._callState,this._isPreparingToJoin);A!==R&&(this.updateKeepDeviceAwake(R),this.updateDeviceAudioMode(R),this.updateNoOpRecordingEnsuringBackgroundContinuity(R))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=uh,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:Ol},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=Ql(ch,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=Pl,this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(u){Z()&&this.nativeUtils().setKeepDeviceAwake(u,this.callClientId)}},{key:"updateDeviceAudioMode",value:function(u){if(Z()&&!this.disableReactNativeAutoDeviceManagement("audio")){var g=u?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(g)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(u){if(Z()&&this.nativeUtils().setShowOngoingMeetingNotification){var g,h,x,_;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var A=this.properties.reactNativeConfig.androidInCallNotification;g=A.title,h=A.subtitle,x=A.iconName,_=A.disableForCustomOverride}_&&(u=!1),this.nativeUtils().setShowOngoingMeetingNotification(u,g,h,x,this.callClientId)}}},{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(u){Z()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(u)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var u;if(Z()){var g=(u=this._callMachine())===null||u===void 0||(u=u.store)===null||u===void 0?void 0:u.getState();for(var h in g==null?void 0:g.streams){var x=g.streams[h];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:gs,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 h={action:gs,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(h,null,this.callClientId,this._iframe)}}},{key:"_logDuplicateInstanceAttempt",value:function(){for(var u=0,g=Object.values(yr);u<g.length;u++){var h=g[u];h._callMachineInitialized?(h.sendMessageToCallMachine({action:gs,level:"warn",code:this.allowMultipleCallInstances?9993:9992}),h._delayDuplicateInstanceLog=!1):h._delayDuplicateInstanceLog=!0}}},{key:"_maybeSendToSentry",value:function(u){var g,h,x,_;if(!((g=u.error)!==null&&g!==void 0&&g.type&&(![n0,t0,vp].includes(u.error.type)||u.error.type===vp&&u.error.msg.includes("deleted")))){var A=(h=this.properties)!==null&&h!==void 0&&h.url?new URL(this.properties.url):void 0,R="production";A&&A.host.includes(".staging.daily")&&(R="staging");var $,B,G,ne,ln,Nr=function(No){const $o=[yb(),mb(),Vb(),Ub(),Gb(),Yb(),kb(),Qb()];return No.autoSessionTracking!==!1&&$o.push(Jb()),$o}({}).filter(function(No){return!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(No.name)}),Io=new Ob({dsn:"https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844",transport:Rb,stackParser:zb,integrations:Nr,environment:R}),$e=new Ln;if($e.setClient(Io),Io.init(),this.session_id&&$e.setExtra("sessionId",this.session_id),this.properties){var Nt=U({},this.properties);Nt.userName=Nt.userName?"[Filtered]":void 0,Nt.userData=Nt.userData?"[Filtered]":void 0,Nt.token=Nt.token?"[Filtered]":void 0,$e.setExtra("properties",Nt)}if(A){var $r=A.searchParams.get("domain");if(!$r){var Ro=A.host.match(/(.*?)\./);$r=Ro&&Ro[1]||""}$r&&$e.setTag("domain",$r)}u.error&&($e.setTag("fatalErrorType",u.error.type),$e.setExtra("errorDetails",u.error.details),!(($=u.error.details)===null||$===void 0)&&$.uri&&$e.setTag("serverAddress",u.error.details.uri),!((B=u.error.details)===null||B===void 0)&&B.workerGroup&&$e.setTag("workerGroup",u.error.details.workerGroup),!((G=u.error.details)===null||G===void 0)&&G.geoGroup&&$e.setTag("geoGroup",u.error.details.geoGroup),!((ne=u.error.details)===null||ne===void 0)&&ne.on&&$e.setTag("connectionAttempt",u.error.details.on),(ln=u.error.details)!==null&&ln!==void 0&&ln.bundleUrl&&($e.setTag("bundleUrl",u.error.details.bundleUrl),$e.setTag("bundleError",u.error.details.sourceError.type))),$e.setTags({callMode:this._callObjectMode?Z()?"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 Ba=((_=u.error)===null||_===void 0?void 0:_.msg)||u.errorMsg;$e.captureException(new Error(Ba))}}},{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(!Xe(this._inputSettings,u)){var g=this._getInputSettings();this._inputSettings=u;var h=this._getInputSettings();Xe(g,h)||this.emitDailyJSEvent({action:Sp,inputSettings:h})}}}],[{key:"supportedBrowser",value:function(){if(Z())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var u=jy.getParser(Mt());return{supported:!!Nl(),mobile:u.getPlatformType()==="mobile",name:u.getBrowserName(),version:u.getBrowserVersion(),supportsFullscreen:!!Op(),supportsScreenShare:!!ew(),supportsSfu:!!Nl(),supportsVideoProcessing:Pp(),supportsAudioProcessing:Dp()}}},{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(ee(),!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 h,x;ee(),u&&g?(h=u,x=g):u&&u.append?(h=u,x={}):(h=document.body,x=u||{});var _=x.iframeStyle;_||(_=h===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 A=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?A.allow="microphone, camera":A.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",A.style.visibility="hidden",h.appendChild(A),A.style.visibility=null,Object.keys(_).forEach(function(R){return A.style[R]=_[R]}),x.layout||(x.customLayout?x.layout="custom-v1":x.layout="browser");try{return new t(A,x)}catch(R){throw h.removeChild(A),R}}},{key:"createTransparentFrame",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ee();var g=document.createElement("iframe");return g.allow="microphone; camera; autoplay",g.style.cssText=`
|
|
36
|
+
position: fixed;
|
|
37
|
+
top: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
border: 0;
|
|
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,p,m,b,v,S,y,w,k,C,E,M,O,I,H,z,te,he,Y,Ge,Me,Rt,dt,j,V,J,le,ke}();function hh(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]=hn;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 fe(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 ks(t,e){return[Al,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(ks(t,e)){var i="".concat(n," not supported after joining a meeting.");throw r&&(i+=" ".concat(r)),console.error(i),new Error(i)}}function xs(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 Jl(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 zt(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 ee(){if(Z())throw new Error("This daily-js method is not currently supported in React Native")}function Hi(){if(!Z())throw new Error("This daily-js method is only supported in React Native")}function gh(t){if(t===void 0)return!0;var e;if(typeof t=="string")e=t;else try{e=JSON.stringify(t),Xe(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 mh(t,e){for(var n=e.allowAllParticipantsKey,r=function(f){var p=["local"];return n||p.push("*"),f&&!p.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=He(a[s],2),c=l[0],d=l[1];if(!r(c)||!o(d))return!1}return!0}function vh(t){if(re(t)!=="object")return!1;for(var e=0,n=Object.entries(t);e<n.length;e++){var r=He(n[e],2),i=r[0],o=r[1];switch(i){case"video":if(re(o)!=="object")return!1;for(var s=0,a=Object.entries(o);s<a.length;s++){var l=He(a[s],2),c=l[0],d=l[1];switch(c){case"processor":if(!Aw(d))return!1;break;case"settings":if(!bh(d))return!1;break;default:return!1}}break;case"audio":if(re(o)!=="object")return!1;for(var f=0,p=Object.entries(o);f<p.length;f++){var m=He(p[f],2),b=m[0],v=m[1];switch(b){case"processor":if(!Mw(v))return!1;break;case"settings":if(!bh(v))return!1;break;default:return!1}}break;default:return!1}}return!0}function yh(t,e,n){var r,i=[];t.video&&t.video.processor&&(Pp((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&&(Dp()||(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:hn}):delete n.audioTrack),t.video&&t.video.settings&&(t.video.settings.customTrack?(n.videoTrack=t.video.settings.customTrack,t.video.settings={customTrack:hn}):delete n.videoTrack)}function Mw(t){if(Z())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type"];return!!t&&re(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(Tp).includes(n)?!0:(console.error("inputSettings audio processor type invalid"),!1)}(t.type))}function Aw(t){if(Z())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type","config"];return!t||re(t)!=="object"||!function(n){return typeof n!="string"?!1:Object.values(ms).includes(n)?!0:(console.error("inputSettings video processor type invalid"),!1)}(t.type)||t.config&&(re(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 ms.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 ms.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(Jo(s.source))return s.type="url",!!function(c){var d=new URL(c),f=d.pathname;if(d.protocol==="data:")try{var p=f.substring(f.indexOf(":")+1,f.indexOf(";")).split("/")[1];return Il.includes(p)}catch(b){return console.error("failed to deduce blob content type",b),!1}var m=f.split(".").at(-1).toLowerCase().trim();return Il.includes(m)}(s.source)||(console.error("invalid image type; supported types: [".concat(Il.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 bh(t){return re(t)==="object"&&(!t.customTrack||t.customTrack instanceof MediaStreamTrack)}function Gl(){var t=Object.values(ms).join(" | "),e=Object.values(Tp).join(" | ");return"inputSettings must be of the form: { video?: { processor?: { type: [ ".concat(t," ], config?: {} } }, audio?: { processor: {type: [ ").concat(e," ] } } }")}function wh(t){var e=t.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(e0).concat(e?' | "'.concat("*",'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function Sh(){return"customIntegrations should be an object of type ".concat(JSON.stringify(Kl),".")}function kh(t){if(t&&re(t)!=="object"||Array.isArray(t))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(ws),".")),!1;if(t)for(var e=0,n=Object.entries(t);e<n.length;e++)for(var r=He(n[e],1)[0],i=0,o=Object.entries(t[r]);i<o.length;i++){var s=He(o[i],2),a=s[0],l=s[1],c=ws.id[a];if(!c)return console.error("customTrayButton does not support key ".concat(a)),!1;switch(a){case"iconPath":case"iconPathDarkMode":if(!Jo(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(re(l)!==c)return console.error("customTrayButton ".concat(a," should be a ").concat(c,".")),!1}}return!0}function xh(t){if(!t||t&&re(t)!=="object"||Array.isArray(t))return console.error(Sh()),!1;for(var e=function(f){return"".concat(f," should be ").concat(Kl.id[f])},n=function(f,p){return console.error("customIntegration ".concat(f,": ").concat(p))},r=0,i=Object.entries(t);r<i.length;r++){var o=He(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=He(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(!Jo(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(!Jo(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(!Kl.id[c])return console.error("customIntegration does not support key ".concat(c)),!1}}}return!0}function _h(t,e){if(e===void 0)return!1;switch(re(e)){case"string":return re(t)===e;case"object":if(re(t)!=="object")return!1;for(var n in t)if(!_h(t[n],e[n]))return!1;return!0;default:return!1}}function Ch(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 Eh(t){if(re(t)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(t.state&&!Object.values(Ll).includes(t.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify(Ll));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 Th(t,e,n){return!(typeof t!="number"||t<e||t>n)}function Ql(t,e){return t&&!e&&delete t.data,t}function Ow(t){return t&&t.__esModule?t.default:t}function Mh(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Ah={};Mh(Ah,"DailyRTVIMessageType",()=>Xl),Mh(Ah,"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 Oh=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],Pw=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Nn=[],Yl=[];for(let t=1;t<=8;t++)for(let e=0;e<Oh.length;e++){const n=Oh[e];Nn.push(n/Math.pow(2,8-t)),Yl.push(Pw[e]+t)}const _s=[32,2e3],Ph=Nn.filter((t,e)=>Nn[e]>_s[0]&&Nn[e]<_s[1]),Dw=Yl.filter((t,e)=>Nn[e]>_s[0]&&Nn[e]<_s[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 b=i==="voice"?Ph:Nn,v=Array(b.length).fill(o);for(let S=0;S<r.length;S++){const y=S*l,w=r[S];for(let k=b.length-1;k>=0;k--)if(y>b[k]){v[k]=Math.max(v[k],w);break}}c=v,d=i==="voice"?Ph:Nn,f=i==="voice"?Dw:Yl}else c=Array.from(r),d=c.map((b,v)=>l*v),f=d.map(b=>`${b.toFixed(2)} Hz`);const p=c.map(b=>Math.max(0,Math.min((b-o)/(s-o),1)));return{values:new Float32Array(p),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 p=l*f;p<c&&o.suspend(p).then(()=>{const m=new Float32Array(a.frequencyBinCount);a.getFloatFrequencyData(m),this.fftResults.push(m),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 Lw=`
|
|
44
|
+
class StreamProcessor extends AudioWorkletProcessor {
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
this.hasStarted = false;
|
|
48
|
+
this.hasInterrupted = false;
|
|
49
|
+
this.outputBuffers = [];
|
|
50
|
+
this.bufferLength = 128;
|
|
51
|
+
this.write = { buffer: new Float32Array(this.bufferLength), trackId: null };
|
|
52
|
+
this.writeOffset = 0;
|
|
53
|
+
this.trackSampleOffsets = {};
|
|
54
|
+
this.port.onmessage = (event) => {
|
|
55
|
+
if (event.data) {
|
|
56
|
+
const payload = event.data;
|
|
57
|
+
if (payload.event === 'write') {
|
|
58
|
+
const int16Array = payload.buffer;
|
|
59
|
+
const float32Array = new Float32Array(int16Array.length);
|
|
60
|
+
for (let i = 0; i < int16Array.length; i++) {
|
|
61
|
+
float32Array[i] = int16Array[i] / 0x8000; // Convert Int16 to Float32
|
|
62
|
+
}
|
|
63
|
+
this.writeData(float32Array, payload.trackId);
|
|
64
|
+
} else if (
|
|
65
|
+
payload.event === 'offset' ||
|
|
66
|
+
payload.event === 'interrupt'
|
|
67
|
+
) {
|
|
68
|
+
const requestId = payload.requestId;
|
|
69
|
+
const trackId = this.write.trackId;
|
|
70
|
+
const offset = this.trackSampleOffsets[trackId] || 0;
|
|
71
|
+
this.port.postMessage({
|
|
72
|
+
event: 'offset',
|
|
73
|
+
requestId,
|
|
74
|
+
trackId,
|
|
75
|
+
offset,
|
|
76
|
+
});
|
|
77
|
+
if (payload.event === 'interrupt') {
|
|
78
|
+
this.hasInterrupted = true;
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
throw new Error(\`Unhandled event "\${payload.event}"\`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
writeData(float32Array, trackId = null) {
|
|
88
|
+
let { buffer } = this.write;
|
|
89
|
+
let offset = this.writeOffset;
|
|
90
|
+
for (let i = 0; i < float32Array.length; i++) {
|
|
91
|
+
buffer[offset++] = float32Array[i];
|
|
92
|
+
if (offset >= buffer.length) {
|
|
93
|
+
this.outputBuffers.push(this.write);
|
|
94
|
+
this.write = { buffer: new Float32Array(this.bufferLength), trackId };
|
|
95
|
+
buffer = this.write.buffer;
|
|
96
|
+
offset = 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
this.writeOffset = offset;
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
process(inputs, outputs, parameters) {
|
|
104
|
+
const output = outputs[0];
|
|
105
|
+
const outputChannelData = output[0];
|
|
106
|
+
const outputBuffers = this.outputBuffers;
|
|
107
|
+
if (this.hasInterrupted) {
|
|
108
|
+
this.port.postMessage({ event: 'stop' });
|
|
109
|
+
return false;
|
|
110
|
+
} else if (outputBuffers.length) {
|
|
111
|
+
this.hasStarted = true;
|
|
112
|
+
const { buffer, trackId } = outputBuffers.shift();
|
|
113
|
+
for (let i = 0; i < outputChannelData.length; i++) {
|
|
114
|
+
outputChannelData[i] = buffer[i] || 0;
|
|
115
|
+
}
|
|
116
|
+
if (trackId) {
|
|
117
|
+
this.trackSampleOffsets[trackId] =
|
|
118
|
+
this.trackSampleOffsets[trackId] || 0;
|
|
119
|
+
this.trackSampleOffsets[trackId] += buffer.length;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
} else if (this.hasStarted) {
|
|
123
|
+
this.port.postMessage({ event: 'stop' });
|
|
124
|
+
return false;
|
|
125
|
+
} else {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
registerProcessor('stream_processor', StreamProcessor);
|
|
132
|
+
`,Iw=new Blob([Lw],{type:"application/javascript"}),Rw=URL.createObjectURL(Iw);class Nw{constructor({sampleRate:e=44100}={}){this.scriptSrc=Rw,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=Nw;const $w=`
|
|
133
|
+
class AudioProcessor extends AudioWorkletProcessor {
|
|
134
|
+
|
|
135
|
+
constructor() {
|
|
136
|
+
super();
|
|
137
|
+
this.port.onmessage = this.receive.bind(this);
|
|
138
|
+
this.initialize();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
initialize() {
|
|
142
|
+
this.foundAudio = false;
|
|
143
|
+
this.recording = false;
|
|
144
|
+
this.chunks = [];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Concatenates sampled chunks into channels
|
|
149
|
+
* Format is chunk[Left[], Right[]]
|
|
150
|
+
*/
|
|
151
|
+
readChannelData(chunks, channel = -1, maxChannels = 9) {
|
|
152
|
+
let channelLimit;
|
|
153
|
+
if (channel !== -1) {
|
|
154
|
+
if (chunks[0] && chunks[0].length - 1 < channel) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
\`Channel \${channel} out of range: max \${chunks[0].length}\`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
channelLimit = channel + 1;
|
|
160
|
+
} else {
|
|
161
|
+
channel = 0;
|
|
162
|
+
channelLimit = Math.min(chunks[0] ? chunks[0].length : 1, maxChannels);
|
|
163
|
+
}
|
|
164
|
+
const channels = [];
|
|
165
|
+
for (let n = channel; n < channelLimit; n++) {
|
|
166
|
+
const length = chunks.reduce((sum, chunk) => {
|
|
167
|
+
return sum + chunk[n].length;
|
|
168
|
+
}, 0);
|
|
169
|
+
const buffers = chunks.map((chunk) => chunk[n]);
|
|
170
|
+
const result = new Float32Array(length);
|
|
171
|
+
let offset = 0;
|
|
172
|
+
for (let i = 0; i < buffers.length; i++) {
|
|
173
|
+
result.set(buffers[i], offset);
|
|
174
|
+
offset += buffers[i].length;
|
|
175
|
+
}
|
|
176
|
+
channels[n] = result;
|
|
177
|
+
}
|
|
178
|
+
return channels;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Combines parallel audio data into correct format,
|
|
183
|
+
* channels[Left[], Right[]] to float32Array[LRLRLRLR...]
|
|
184
|
+
*/
|
|
185
|
+
formatAudioData(channels) {
|
|
186
|
+
if (channels.length === 1) {
|
|
187
|
+
// Simple case is only one channel
|
|
188
|
+
const float32Array = channels[0].slice();
|
|
189
|
+
const meanValues = channels[0].slice();
|
|
190
|
+
return { float32Array, meanValues };
|
|
191
|
+
} else {
|
|
192
|
+
const float32Array = new Float32Array(
|
|
193
|
+
channels[0].length * channels.length
|
|
194
|
+
);
|
|
195
|
+
const meanValues = new Float32Array(channels[0].length);
|
|
196
|
+
for (let i = 0; i < channels[0].length; i++) {
|
|
197
|
+
const offset = i * channels.length;
|
|
198
|
+
let meanValue = 0;
|
|
199
|
+
for (let n = 0; n < channels.length; n++) {
|
|
200
|
+
float32Array[offset + n] = channels[n][i];
|
|
201
|
+
meanValue += channels[n][i];
|
|
202
|
+
}
|
|
203
|
+
meanValues[i] = meanValue / channels.length;
|
|
204
|
+
}
|
|
205
|
+
return { float32Array, meanValues };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Converts 32-bit float data to 16-bit integers
|
|
211
|
+
*/
|
|
212
|
+
floatTo16BitPCM(float32Array) {
|
|
213
|
+
const buffer = new ArrayBuffer(float32Array.length * 2);
|
|
214
|
+
const view = new DataView(buffer);
|
|
215
|
+
let offset = 0;
|
|
216
|
+
for (let i = 0; i < float32Array.length; i++, offset += 2) {
|
|
217
|
+
let s = Math.max(-1, Math.min(1, float32Array[i]));
|
|
218
|
+
view.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7fff, true);
|
|
219
|
+
}
|
|
220
|
+
return buffer;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Retrieves the most recent amplitude values from the audio stream
|
|
225
|
+
* @param {number} channel
|
|
226
|
+
*/
|
|
227
|
+
getValues(channel = -1) {
|
|
228
|
+
const channels = this.readChannelData(this.chunks, channel);
|
|
229
|
+
const { meanValues } = this.formatAudioData(channels);
|
|
230
|
+
return { meanValues, channels };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Exports chunks as an audio/wav file
|
|
235
|
+
*/
|
|
236
|
+
export() {
|
|
237
|
+
const channels = this.readChannelData(this.chunks);
|
|
238
|
+
const { float32Array, meanValues } = this.formatAudioData(channels);
|
|
239
|
+
const audioData = this.floatTo16BitPCM(float32Array);
|
|
240
|
+
return {
|
|
241
|
+
meanValues: meanValues,
|
|
242
|
+
audio: {
|
|
243
|
+
bitsPerSample: 16,
|
|
244
|
+
channels: channels,
|
|
245
|
+
data: audioData,
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
receive(e) {
|
|
251
|
+
const { event, id } = e.data;
|
|
252
|
+
let receiptData = {};
|
|
253
|
+
switch (event) {
|
|
254
|
+
case 'start':
|
|
255
|
+
this.recording = true;
|
|
256
|
+
break;
|
|
257
|
+
case 'stop':
|
|
258
|
+
this.recording = false;
|
|
259
|
+
break;
|
|
260
|
+
case 'clear':
|
|
261
|
+
this.initialize();
|
|
262
|
+
break;
|
|
263
|
+
case 'export':
|
|
264
|
+
receiptData = this.export();
|
|
265
|
+
break;
|
|
266
|
+
case 'read':
|
|
267
|
+
receiptData = this.getValues();
|
|
268
|
+
break;
|
|
269
|
+
default:
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
// Always send back receipt
|
|
273
|
+
this.port.postMessage({ event: 'receipt', id, data: receiptData });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
sendChunk(chunk) {
|
|
277
|
+
const channels = this.readChannelData([chunk]);
|
|
278
|
+
const { float32Array, meanValues } = this.formatAudioData(channels);
|
|
279
|
+
const rawAudioData = this.floatTo16BitPCM(float32Array);
|
|
280
|
+
const monoAudioData = this.floatTo16BitPCM(meanValues);
|
|
281
|
+
this.port.postMessage({
|
|
282
|
+
event: 'chunk',
|
|
283
|
+
data: {
|
|
284
|
+
mono: monoAudioData,
|
|
285
|
+
raw: rawAudioData,
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
process(inputList, outputList, parameters) {
|
|
291
|
+
// Copy input to output (e.g. speakers)
|
|
292
|
+
// Note that this creates choppy sounds with Mac products
|
|
293
|
+
const sourceLimit = Math.min(inputList.length, outputList.length);
|
|
294
|
+
for (let inputNum = 0; inputNum < sourceLimit; inputNum++) {
|
|
295
|
+
const input = inputList[inputNum];
|
|
296
|
+
const output = outputList[inputNum];
|
|
297
|
+
const channelCount = Math.min(input.length, output.length);
|
|
298
|
+
for (let channelNum = 0; channelNum < channelCount; channelNum++) {
|
|
299
|
+
input[channelNum].forEach((sample, i) => {
|
|
300
|
+
output[channelNum][i] = sample;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
const inputs = inputList[0];
|
|
305
|
+
// There's latency at the beginning of a stream before recording starts
|
|
306
|
+
// Make sure we actually receive audio data before we start storing chunks
|
|
307
|
+
let sliceIndex = 0;
|
|
308
|
+
if (!this.foundAudio) {
|
|
309
|
+
for (const channel of inputs) {
|
|
310
|
+
sliceIndex = 0; // reset for each channel
|
|
311
|
+
if (this.foundAudio) {
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
if (channel) {
|
|
315
|
+
for (const value of channel) {
|
|
316
|
+
if (value !== 0) {
|
|
317
|
+
// find only one non-zero entry in any channel
|
|
318
|
+
this.foundAudio = true;
|
|
319
|
+
break;
|
|
320
|
+
} else {
|
|
321
|
+
sliceIndex++;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (inputs && inputs[0] && this.foundAudio && this.recording) {
|
|
328
|
+
// We need to copy the TypedArray, because the \`process\`
|
|
329
|
+
// internals will reuse the same buffer to hold each input
|
|
330
|
+
const chunk = inputs.map((input) => input.slice(sliceIndex));
|
|
331
|
+
this.chunks.push(chunk);
|
|
332
|
+
this.sendChunk(chunk);
|
|
333
|
+
}
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
registerProcessor('audio_processor', AudioProcessor);
|
|
339
|
+
`,jw=new Blob([$w],{type:"application/javascript"}),Dh=URL.createObjectURL(jw);class Fw{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Dh,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 v=0;v<e.length;v++)d[v]=e[v]/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 p={bitsPerSample:16,channels:[d],data:f};s=new Ut().pack(r,p).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 p=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Ut.mergeBuffers(p.raw,f.raw),mono:Ut.mergeBuffers(p.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
|
+
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=Fw;class Bw{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Dh,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
|
+
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 Lh={};Lh=JSON.parse('{"name":"@pipecat-ai/daily-transport","version":"1.4.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.4.0","eslint":"9.11.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1"},"peerDependencies":{"@pipecat-ai/client-js":"~1.4.0"},"dependencies":{"@daily-co/daily-js":"^0.83.1"},"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 Xl;(function(t){t.AUDIO_BUFFERING_STARTED="audio-buffering-started",t.AUDIO_BUFFERING_STOPPED="audio-buffering-stopped"})(Xl||(Xl={}));class zw{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 Bd{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=Tw.createCallObject({...this._dailyFactoryOptions,allowMultipleCallInstances:!0}),this._dailyWrapper=new zw(this._daily)}setupRecorder(){this._mediaStreamRecorder=new Bw({sampleRate:gn.RECORDER_SAMPLE_RATE})}handleUserAudioStream(e){this._audioQueue.push(e)}flushAudioQueue(){if(this._audioQueue.length!==0)for(se.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",se.debug("[Daily Transport] Initialized",Ow(Lh).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,p,m,b,v,S,y,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:(p=(f=(d=e==null?void 0:e.local)==null?void 0:d.tracks)==null?void 0:f.screenVideo)==null?void 0:p.persistentTrack,video:(v=(b=(m=e==null?void 0:e.local)==null?void 0:m.tracks)==null?void 0:b.video)==null?void 0:v.persistentTrack}};return n&&(r.bot={audio:(y=(S=n==null?void 0:n.tracks)==null?void 0:S.audio)==null?void 0:y.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{se.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),se.info("[Daily Transport] Recording Initialized")}catch(r){r.message.includes("Already recording")||se.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,p,m,b,v,S,y;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),(m=(p=this._callbacks).onCamUpdated)==null||m.call(p,e.camera),(v=(b=this._callbacks).onMicUpdated)==null||v.call(b,e.mic),(y=(S=this._callbacks).onSpeakerUpdated)==null||y.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 se.error("Failed to join room",o),this.state="error",new Ad}(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(Ye.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()?(se.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 se.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;se.error("Daily fatal error",e.errorMsg),this.state="error",this._botId="",(r=(n=this._callbacks).onError)==null||r.call(n,Ye.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 Ih={exports:{}},Q={};/**
|
|
344
|
+
* @license React
|
|
345
|
+
* react.production.min.js
|
|
346
|
+
*
|
|
347
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the MIT license found in the
|
|
350
|
+
* LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/var Vi=Symbol.for("react.element"),Uw=Symbol.for("react.portal"),Hw=Symbol.for("react.fragment"),Vw=Symbol.for("react.strict_mode"),Ww=Symbol.for("react.profiler"),Kw=Symbol.for("react.provider"),qw=Symbol.for("react.context"),Jw=Symbol.for("react.forward_ref"),Gw=Symbol.for("react.suspense"),Qw=Symbol.for("react.memo"),Yw=Symbol.for("react.lazy"),Rh=Symbol.iterator;function Xw(t){return t===null||typeof t!="object"?null:(t=Rh&&t[Rh]||t["@@iterator"],typeof t=="function"?t:null)}var Nh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$h=Object.assign,jh={};function ei(t,e,n){this.props=t,this.context=e,this.refs=jh,this.updater=n||Nh}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 Fh(){}Fh.prototype=ei.prototype;function Zl(t,e,n){this.props=t,this.context=e,this.refs=jh,this.updater=n||Nh}var ec=Zl.prototype=new Fh;ec.constructor=Zl,$h(ec,ei.prototype),ec.isPureReactComponent=!0;var Bh=Array.isArray,zh=Object.prototype.hasOwnProperty,tc={current:null},Uh={key:!0,ref:!0,__self:!0,__source:!0};function Hh(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)zh.call(e,r)&&!Uh.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:tc.current}}function Zw(t,e){return{$$typeof:Vi,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function nc(t){return typeof t=="object"&&t!==null&&t.$$typeof===Vi}function eS(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Vh=/\/+/g;function rc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?eS(""+t.key):e.toString(36)}function Cs(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 Uw:s=!0}}if(s)return s=t,i=i(s),t=r===""?"."+rc(s,0):r,Bh(i)?(n="",t!=null&&(n=t.replace(Vh,"$&/")+"/"),Cs(i,e,n,"",function(c){return c})):i!=null&&(nc(i)&&(i=Zw(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(Vh,"$&/")+"/")+t)),e.push(i)),1;if(s=0,r=r===""?".":r+":",Bh(t))for(var a=0;a<t.length;a++){o=t[a];var l=r+rc(o,a);s+=Cs(o,e,n,l,i)}else if(l=Xw(t),typeof l=="function")for(t=l.call(t),a=0;!(o=t.next()).done;)o=o.value,l=r+rc(o,a++),s+=Cs(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 Es(t,e,n){if(t==null)return t;var r=[],i=0;return Cs(t,r,"","",function(o){return e.call(n,o,i++)}),r}function tS(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 tt={current:null},Ts={transition:null},nS={ReactCurrentDispatcher:tt,ReactCurrentBatchConfig:Ts,ReactCurrentOwner:tc};function Wh(){throw Error("act(...) is not supported in production builds of React.")}Q.Children={map:Es,forEach:function(t,e,n){Es(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Es(t,function(){e++}),e},toArray:function(t){return Es(t,function(e){return e})||[]},only:function(t){if(!nc(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},Q.Component=ei,Q.Fragment=Hw,Q.Profiler=Ww,Q.PureComponent=Zl,Q.StrictMode=Vw,Q.Suspense=Gw,Q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=nS,Q.act=Wh,Q.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=$h({},t.props),i=t.key,o=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,s=tc.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)zh.call(e,l)&&!Uh.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}},Q.createContext=function(t){return t={$$typeof:qw,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Kw,_context:t},t.Consumer=t},Q.createElement=Hh,Q.createFactory=function(t){var e=Hh.bind(null,t);return e.type=t,e},Q.createRef=function(){return{current:null}},Q.forwardRef=function(t){return{$$typeof:Jw,render:t}},Q.isValidElement=nc,Q.lazy=function(t){return{$$typeof:Yw,_payload:{_status:-1,_result:t},_init:tS}},Q.memo=function(t,e){return{$$typeof:Qw,type:t,compare:e===void 0?null:e}},Q.startTransition=function(t){var e=Ts.transition;Ts.transition={};try{t()}finally{Ts.transition=e}},Q.unstable_act=Wh,Q.useCallback=function(t,e){return tt.current.useCallback(t,e)},Q.useContext=function(t){return tt.current.useContext(t)},Q.useDebugValue=function(){},Q.useDeferredValue=function(t){return tt.current.useDeferredValue(t)},Q.useEffect=function(t,e){return tt.current.useEffect(t,e)},Q.useId=function(){return tt.current.useId()},Q.useImperativeHandle=function(t,e,n){return tt.current.useImperativeHandle(t,e,n)},Q.useInsertionEffect=function(t,e){return tt.current.useInsertionEffect(t,e)},Q.useLayoutEffect=function(t,e){return tt.current.useLayoutEffect(t,e)},Q.useMemo=function(t,e){return tt.current.useMemo(t,e)},Q.useReducer=function(t,e,n){return tt.current.useReducer(t,e,n)},Q.useRef=function(t){return tt.current.useRef(t)},Q.useState=function(t){return tt.current.useState(t)},Q.useSyncExternalStore=function(t,e,n){return tt.current.useSyncExternalStore(t,e,n)},Q.useTransition=function(){return tt.current.useTransition()},Q.version="18.3.1",Ih.exports=Q;var ye=Ih.exports;const Kh=ot(ye);var ic={},qh={exports:{}},vt={},Jh={exports:{}},Gh={};/**
|
|
352
|
+
* @license React
|
|
353
|
+
* scheduler.production.min.js
|
|
354
|
+
*
|
|
355
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
356
|
+
*
|
|
357
|
+
* This source code is licensed under the MIT license found in the
|
|
358
|
+
* LICENSE file in the root directory of this source tree.
|
|
359
|
+
*/(function(t){function e(j,V){var J=j.length;j.push(V);e:for(;0<J;){var le=J-1>>>1,ke=j[le];if(0<i(ke,V))j[le]=V,j[J]=ke,J=le;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var V=j[0],J=j.pop();if(J!==V){j[0]=J;e:for(var le=0,ke=j.length,u=ke>>>1;le<u;){var g=2*(le+1)-1,h=j[g],x=g+1,_=j[x];if(0>i(h,J))x<ke&&0>i(_,h)?(j[le]=_,j[x]=J,le=x):(j[le]=h,j[g]=J,le=g);else if(x<ke&&0>i(_,J))j[le]=_,j[x]=J,le=x;else break e}}return V}function i(j,V){var J=j.sortIndex-V.sortIndex;return J!==0?J:j.id-V.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,p=3,m=!1,b=!1,v=!1,S=typeof setTimeout=="function"?setTimeout:null,y=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(j){for(var V=n(c);V!==null;){if(V.callback===null)r(c);else if(V.startTime<=j)r(c),V.sortIndex=V.expirationTime,e(l,V);else break;V=n(c)}}function C(j){if(v=!1,k(j),!b)if(n(l)!==null)b=!0,Rt(E);else{var V=n(c);V!==null&&dt(C,V.startTime-j)}}function E(j,V){b=!1,v&&(v=!1,y(I),I=-1),m=!0;var J=p;try{for(k(V),f=n(l);f!==null&&(!(f.expirationTime>V)||j&&!te());){var le=f.callback;if(typeof le=="function"){f.callback=null,p=f.priorityLevel;var ke=le(f.expirationTime<=V);V=t.unstable_now(),typeof ke=="function"?f.callback=ke:f===n(l)&&r(l),k(V)}else r(l);f=n(l)}if(f!==null)var u=!0;else{var g=n(c);g!==null&&dt(C,g.startTime-V),u=!1}return u}finally{f=null,p=J,m=!1}}var M=!1,O=null,I=-1,H=5,z=-1;function te(){return!(t.unstable_now()-z<H)}function he(){if(O!==null){var j=t.unstable_now();z=j;var V=!0;try{V=O(!0,j)}finally{V?Y():(M=!1,O=null)}}else M=!1}var Y;if(typeof w=="function")Y=function(){w(he)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,Me=Ge.port2;Ge.port1.onmessage=he,Y=function(){Me.postMessage(null)}}else Y=function(){S(he,0)};function Rt(j){O=j,M||(M=!0,Y())}function dt(j,V){I=S(function(){j(t.unstable_now())},V)}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(j){j.callback=null},t.unstable_continueExecution=function(){b||m||(b=!0,Rt(E))},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(j){switch(p){case 1:case 2:case 3:var V=3;break;default:V=p}var J=p;p=V;try{return j()}finally{p=J}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(j,V){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var J=p;p=j;try{return V()}finally{p=J}},t.unstable_scheduleCallback=function(j,V,J){var le=t.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?le+J:le):J=le,j){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=J+ke,j={id:d++,callback:V,priorityLevel:j,startTime:J,expirationTime:ke,sortIndex:-1},J>le?(j.sortIndex=J,e(c,j),n(l)===null&&j===n(c)&&(v?(y(I),I=-1):v=!0,dt(C,J-le))):(j.sortIndex=ke,e(l,j),b||m||(b=!0,Rt(E))),j},t.unstable_shouldYield=te,t.unstable_wrapCallback=function(j){var V=p;return function(){var J=p;p=V;try{return j.apply(this,arguments)}finally{p=J}}}})(Gh),Jh.exports=Gh;var rS=Jh.exports;/**
|
|
360
|
+
* @license React
|
|
361
|
+
* react-dom.production.min.js
|
|
362
|
+
*
|
|
363
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
364
|
+
*
|
|
365
|
+
* This source code is licensed under the MIT license found in the
|
|
366
|
+
* LICENSE file in the root directory of this source tree.
|
|
367
|
+
*/var iS=ye,yt=rS;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 Qh=new Set,Wi={};function Sr(t,e){ti(t,e),ti(t+"Capture",e)}function ti(t,e){for(Wi[t]=e,t=0;t<e.length;t++)Qh.add(e[t])}var mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=Object.prototype.hasOwnProperty,oS=/^[: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]*$/,Yh={},Xh={};function sS(t){return oc.call(Xh,t)?!0:oc.call(Yh,t)?!1:oS.test(t)?Xh[t]=!0:(Yh[t]=!0,!1)}function aS(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 lS(t,e,n,r){if(e===null||typeof e>"u"||aS(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 nt(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 Be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Be[t]=new nt(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Be[e]=new nt(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){Be[t]=new nt(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Be[t]=new nt(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){Be[t]=new nt(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){Be[t]=new nt(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){Be[t]=new nt(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){Be[t]=new nt(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){Be[t]=new nt(t,5,!1,t.toLowerCase(),null,!1,!1)});var sc=/[\-:]([a-z])/g;function ac(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(sc,ac);Be[e]=new nt(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(sc,ac);Be[e]=new nt(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(sc,ac);Be[e]=new nt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){Be[t]=new nt(t,1,!1,t.toLowerCase(),null,!1,!1)}),Be.xlinkHref=new nt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){Be[t]=new nt(t,1,!1,t.toLowerCase(),null,!0,!0)});function lc(t,e,n,r){var i=Be.hasOwnProperty(e)?Be[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(lS(e,n,i,r)&&(n=null),r||i===null?sS(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=iS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ms=Symbol.for("react.element"),ni=Symbol.for("react.portal"),ri=Symbol.for("react.fragment"),cc=Symbol.for("react.strict_mode"),uc=Symbol.for("react.profiler"),Zh=Symbol.for("react.provider"),eg=Symbol.for("react.context"),dc=Symbol.for("react.forward_ref"),fc=Symbol.for("react.suspense"),pc=Symbol.for("react.suspense_list"),hc=Symbol.for("react.memo"),$n=Symbol.for("react.lazy"),tg=Symbol.for("react.offscreen"),ng=Symbol.iterator;function Ki(t){return t===null||typeof t!="object"?null:(t=ng&&t[ng]||t["@@iterator"],typeof t=="function"?t:null)}var _e=Object.assign,gc;function qi(t){if(gc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);gc=e&&e[1]||""}return`
|
|
368
|
+
`+gc+t}var mc=!1;function vc(t,e){if(!t||mc)return"";mc=!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
|
+
`),o=r.stack.split(`
|
|
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{mc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?qi(t):""}function cS(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=vc(t.type,!1),t;case 11:return t=vc(t.type.render,!1),t;case 1:return t=vc(t.type,!0),t;default:return""}}function yc(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 uc:return"Profiler";case cc:return"StrictMode";case fc:return"Suspense";case pc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case eg:return(t.displayName||"Context")+".Consumer";case Zh:return(t._context.displayName||"Context")+".Provider";case dc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case hc:return e=t.displayName||null,e!==null?e:yc(t.type)||"Memo";case $n:e=t._payload,t=t._init;try{return yc(t(e))}catch{}}return null}function uS(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 yc(e);case 8:return e===cc?"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 jn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function rg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function dS(t){var e=rg(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 As(t){t._valueTracker||(t._valueTracker=dS(t))}function ig(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=rg(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Os(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 bc(t,e){var n=e.checked;return _e({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function og(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=jn(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 sg(t,e){e=e.checked,e!=null&&lc(t,"checked",e,!1)}function wc(t,e){sg(t,e);var n=jn(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")?Sc(t,e.type,n):e.hasOwnProperty("defaultValue")&&Sc(t,e.type,jn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function ag(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 Sc(t,e,n){(e!=="number"||Os(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=""+jn(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 kc(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(N(91));return _e({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function lg(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:jn(n)}}function cg(t,e){var n=jn(e.value),r=jn(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 ug(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function dg(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 xc(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?dg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ps,fg=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(Ps=Ps||document.createElement("div"),Ps.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Ps.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},fS=["Webkit","ms","Moz","O"];Object.keys(Qi).forEach(function(t){fS.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Qi[e]=Qi[t]})});function pg(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 hg(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=pg(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var pS=_e({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 _c(t,e){if(e){if(pS[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 Cc(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 Ec=null;function Tc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Mc=null,oi=null,si=null;function gg(t){if(t=bo(t)){if(typeof Mc!="function")throw Error(N(280));var e=t.stateNode;e&&(e=ea(e),Mc(t.stateNode,t.type,e))}}function mg(t){oi?si?si.push(t):si=[t]:oi=t}function vg(){if(oi){var t=oi,e=si;if(si=oi=null,gg(t),e)for(t=0;t<e.length;t++)gg(e[t])}}function yg(t,e){return t(e)}function bg(){}var Ac=!1;function wg(t,e,n){if(Ac)return t(e,n);Ac=!0;try{return yg(t,e,n)}finally{Ac=!1,(oi!==null||si!==null)&&(bg(),vg())}}function Yi(t,e){var n=t.stateNode;if(n===null)return null;var r=ea(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 Oc=!1;if(mn)try{var Xi={};Object.defineProperty(Xi,"passive",{get:function(){Oc=!0}}),window.addEventListener("test",Xi,Xi),window.removeEventListener("test",Xi,Xi)}catch{Oc=!1}function hS(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,Ds=null,Ls=!1,Pc=null,gS={onError:function(t){Zi=!0,Ds=t}};function mS(t,e,n,r,i,o,s,a,l){Zi=!1,Ds=null,hS.apply(gS,arguments)}function vS(t,e,n,r,i,o,s,a,l){if(mS.apply(this,arguments),Zi){if(Zi){var c=Ds;Zi=!1,Ds=null}else throw Error(N(198));Ls||(Ls=!0,Pc=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 Sg(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 kg(t){if(kr(t)!==t)throw Error(N(188))}function yS(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 kg(i),t;if(o===r)return kg(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 xg(t){return t=yS(t),t!==null?_g(t):null}function _g(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=_g(t);if(e!==null)return e;t=t.sibling}return null}var Cg=yt.unstable_scheduleCallback,Eg=yt.unstable_cancelCallback,bS=yt.unstable_shouldYield,wS=yt.unstable_requestPaint,Oe=yt.unstable_now,SS=yt.unstable_getCurrentPriorityLevel,Dc=yt.unstable_ImmediatePriority,Tg=yt.unstable_UserBlockingPriority,Is=yt.unstable_NormalPriority,kS=yt.unstable_LowPriority,Mg=yt.unstable_IdlePriority,Rs=null,tn=null;function xS(t){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Rs,t,void 0,(t.current.flags&128)===128)}catch{}}var Ht=Math.clz32?Math.clz32:ES,_S=Math.log,CS=Math.LN2;function ES(t){return t>>>=0,t===0?32:31-(_S(t)/CS|0)|0}var Ns=64,$s=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-Ht(e),i=1<<n,r|=t[n],e&=~i;return r}function TS(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 MS(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-Ht(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=TS(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}function Lc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Ag(){var t=Ns;return Ns<<=1,!(Ns&4194240)&&(Ns=64),t}function Ic(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-Ht(e),t[e]=n}function AS(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-Ht(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function Rc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Ht(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var ae=0;function Og(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Pg,Nc,Dg,Lg,Ig,$c=!1,Fs=[],Fn=null,Bn=null,zn=null,no=new Map,ro=new Map,Un=[],OS="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 Rg(t,e){switch(t){case"focusin":case"focusout":Fn=null;break;case"dragenter":case"dragleave":Bn=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&&Nc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function PS(t,e,n,r,i){switch(e){case"focusin":return Fn=io(Fn,t,e,n,r,i),!0;case"dragenter":return Bn=io(Bn,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 Ng(t){var e=xr(t.target);if(e!==null){var n=kr(e);if(n!==null){if(e=n.tag,e===13){if(e=Sg(n),e!==null){t.blockedOn=e,Ig(t.priority,function(){Dg(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 Bs(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Fc(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Ec=r,n.target.dispatchEvent(r),Ec=null}else return e=bo(n),e!==null&&Nc(e),t.blockedOn=n,!1;e.shift()}return!0}function $g(t,e,n){Bs(t)&&n.delete(e)}function DS(){$c=!1,Fn!==null&&Bs(Fn)&&(Fn=null),Bn!==null&&Bs(Bn)&&(Bn=null),zn!==null&&Bs(zn)&&(zn=null),no.forEach($g),ro.forEach($g)}function oo(t,e){t.blockedOn===e&&(t.blockedOn=null,$c||($c=!0,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,DS)))}function so(t){function e(i){return oo(i,t)}if(0<Fs.length){oo(Fs[0],t);for(var n=1;n<Fs.length;n++){var r=Fs[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Fn!==null&&oo(Fn,t),Bn!==null&&oo(Bn,t),zn!==null&&oo(zn,t),no.forEach(e),ro.forEach(e),n=0;n<Un.length;n++)r=Un[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Un.length&&(n=Un[0],n.blockedOn===null);)Ng(n),n.blockedOn===null&&Un.shift()}var ai=vn.ReactCurrentBatchConfig,zs=!0;function LS(t,e,n,r){var i=ae,o=ai.transition;ai.transition=null;try{ae=1,jc(t,e,n,r)}finally{ae=i,ai.transition=o}}function IS(t,e,n,r){var i=ae,o=ai.transition;ai.transition=null;try{ae=4,jc(t,e,n,r)}finally{ae=i,ai.transition=o}}function jc(t,e,n,r){if(zs){var i=Fc(t,e,n,r);if(i===null)nu(t,e,r,Us,n),Rg(t,r);else if(PS(i,t,e,n,r))r.stopPropagation();else if(Rg(t,r),e&4&&-1<OS.indexOf(t)){for(;i!==null;){var o=bo(i);if(o!==null&&Pg(o),o=Fc(t,e,n,r),o===null&&nu(t,e,r,Us,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else nu(t,e,r,null,n)}}var Us=null;function Fc(t,e,n,r){if(Us=null,t=Tc(r),t=xr(t),t!==null)if(e=kr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Sg(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 Us=t,null}function jg(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(SS()){case Dc:return 1;case Tg:return 4;case Is:case kS:return 16;case Mg:return 536870912;default:return 16}default:return 16}}var Hn=null,Bc=null,Hs=null;function Fg(){if(Hs)return Hs;var t,e=Bc,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 Hs=i.slice(t,1<r?1-r:void 0)}function Vs(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 Ws(){return!0}function Bg(){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)?Ws:Bg,this.isPropagationStopped=Bg,this}return _e(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=Ws)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),e}var li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zc=bt(li),ao=_e({},li,{view:0,detail:0}),RS=bt(ao),Uc,Hc,lo,Ks=_e({},ao,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wc,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"?(Uc=t.screenX-lo.screenX,Hc=t.screenY-lo.screenY):Hc=Uc=0,lo=t),Uc)},movementY:function(t){return"movementY"in t?t.movementY:Hc}}),zg=bt(Ks),NS=_e({},Ks,{dataTransfer:0}),$S=bt(NS),jS=_e({},ao,{relatedTarget:0}),Vc=bt(jS),FS=_e({},li,{animationName:0,elapsedTime:0,pseudoElement:0}),BS=bt(FS),zS=_e({},li,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),US=bt(zS),HS=_e({},li,{data:0}),Ug=bt(HS),VS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WS={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"},KS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qS(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=KS[t])?!!e[t]:!1}function Wc(){return qS}var JS=_e({},ao,{key:function(t){if(t.key){var e=VS[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Vs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?WS[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wc,charCode:function(t){return t.type==="keypress"?Vs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Vs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),GS=bt(JS),QS=_e({},Ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hg=bt(QS),YS=_e({},ao,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wc}),XS=bt(YS),ZS=_e({},li,{propertyName:0,elapsedTime:0,pseudoElement:0}),ek=bt(ZS),tk=_e({},Ks,{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}),nk=bt(tk),rk=[9,13,27,32],Kc=mn&&"CompositionEvent"in window,co=null;mn&&"documentMode"in document&&(co=document.documentMode);var ik=mn&&"TextEvent"in window&&!co,Vg=mn&&(!Kc||co&&8<co&&11>=co),Wg=" ",Kg=!1;function qg(t,e){switch(t){case"keyup":return rk.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ci=!1;function ok(t,e){switch(t){case"compositionend":return Jg(e);case"keypress":return e.which!==32?null:(Kg=!0,Wg);case"textInput":return t=e.data,t===Wg&&Kg?null:t;default:return null}}function sk(t,e){if(ci)return t==="compositionend"||!Kc&&qg(t,e)?(t=Fg(),Hs=Bc=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 Vg&&e.locale!=="ko"?null:e.data;default:return null}}var ak={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 Gg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!ak[t.type]:e==="textarea"}function Qg(t,e,n,r){mg(r),e=Ys(e,"onChange"),0<e.length&&(n=new zc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var uo=null,fo=null;function lk(t){hm(t,0)}function qs(t){var e=hi(t);if(ig(e))return t}function ck(t,e){if(t==="change")return e}var Yg=!1;if(mn){var qc;if(mn){var Jc="oninput"in document;if(!Jc){var Xg=document.createElement("div");Xg.setAttribute("oninput","return;"),Jc=typeof Xg.oninput=="function"}qc=Jc}else qc=!1;Yg=qc&&(!document.documentMode||9<document.documentMode)}function Zg(){uo&&(uo.detachEvent("onpropertychange",em),fo=uo=null)}function em(t){if(t.propertyName==="value"&&qs(fo)){var e=[];Qg(e,fo,t,Tc(t)),wg(lk,e)}}function uk(t,e,n){t==="focusin"?(Zg(),uo=e,fo=n,uo.attachEvent("onpropertychange",em)):t==="focusout"&&Zg()}function dk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return qs(fo)}function fk(t,e){if(t==="click")return qs(e)}function pk(t,e){if(t==="input"||t==="change")return qs(e)}function hk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Vt=typeof Object.is=="function"?Object.is:hk;function po(t,e){if(Vt(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(!oc.call(e,i)||!Vt(t[i],e[i]))return!1}return!0}function tm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function nm(t,e){var n=tm(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=tm(n)}}function rm(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?rm(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function im(){for(var t=window,e=Os();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Os(t.document)}return e}function Gc(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 gk(t){var e=im(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&rm(n.ownerDocument.documentElement,n)){if(r!==null&&Gc(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=nm(n,o);var s=nm(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 mk=mn&&"documentMode"in document&&11>=document.documentMode,ui=null,Qc=null,ho=null,Yc=!1;function om(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Yc||ui==null||ui!==Os(r)||(r=ui,"selectionStart"in r&&Gc(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}),ho&&po(ho,r)||(ho=r,r=Ys(Qc,"onSelect"),0<r.length&&(e=new zc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ui)))}function Js(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var di={animationend:Js("Animation","AnimationEnd"),animationiteration:Js("Animation","AnimationIteration"),animationstart:Js("Animation","AnimationStart"),transitionend:Js("Transition","TransitionEnd")},Xc={},sm={};mn&&(sm=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 Gs(t){if(Xc[t])return Xc[t];if(!di[t])return t;var e=di[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in sm)return Xc[t]=e[n];return t}var am=Gs("animationend"),lm=Gs("animationiteration"),cm=Gs("animationstart"),um=Gs("transitionend"),dm=new Map,fm="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){dm.set(t,e),Sr(e,[t])}for(var Zc=0;Zc<fm.length;Zc++){var eu=fm[Zc],vk=eu.toLowerCase(),yk=eu[0].toUpperCase()+eu.slice(1);Vn(vk,"on"+yk)}Vn(am,"onAnimationEnd"),Vn(lm,"onAnimationIteration"),Vn(cm,"onAnimationStart"),Vn("dblclick","onDoubleClick"),Vn("focusin","onFocus"),Vn("focusout","onBlur"),Vn(um,"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(" "),bk=new Set("cancel close invalid load scroll toggle".split(" ").concat(go));function pm(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,vS(r,e,void 0,t),t.currentTarget=null}function hm(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;pm(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;pm(i,a,c),o=l}}}if(Ls)throw t=Pc,Ls=!1,Pc=null,t}function be(t,e){var n=e[lu];n===void 0&&(n=e[lu]=new Set);var r=t+"__bubble";n.has(r)||(gm(e,t,2,!1),n.add(r))}function tu(t,e,n){var r=0;e&&(r|=4),gm(n,t,r,e)}var Qs="_reactListening"+Math.random().toString(36).slice(2);function mo(t){if(!t[Qs]){t[Qs]=!0,Qh.forEach(function(n){n!=="selectionchange"&&(bk.has(n)||tu(n,!1,t),tu(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Qs]||(e[Qs]=!0,tu("selectionchange",!1,e))}}function gm(t,e,n,r){switch(jg(e)){case 1:var i=LS;break;case 4:i=IS;break;default:i=jc}n=i.bind(null,e,n,t),i=void 0,!Oc||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 nu(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}wg(function(){var c=o,d=Tc(n),f=[];e:{var p=dm.get(t);if(p!==void 0){var m=zc,b=t;switch(t){case"keypress":if(Vs(n)===0)break e;case"keydown":case"keyup":m=GS;break;case"focusin":b="focus",m=Vc;break;case"focusout":b="blur",m=Vc;break;case"beforeblur":case"afterblur":m=Vc;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":m=zg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=$S;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=XS;break;case am:case lm:case cm:m=BS;break;case um:m=ek;break;case"scroll":m=RS;break;case"wheel":m=nk;break;case"copy":case"cut":case"paste":m=US;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Hg}var v=(e&4)!==0,S=!v&&t==="scroll",y=v?p!==null?p+"Capture":null:p;v=[];for(var w=c,k;w!==null;){k=w;var C=k.stateNode;if(k.tag===5&&C!==null&&(k=C,y!==null&&(C=Yi(w,y),C!=null&&v.push(vo(w,C,k)))),S)break;w=w.return}0<v.length&&(p=new m(p,b,null,n,d),f.push({event:p,listeners:v}))}}if(!(e&7)){e:{if(p=t==="mouseover"||t==="pointerover",m=t==="mouseout"||t==="pointerout",p&&n!==Ec&&(b=n.relatedTarget||n.fromElement)&&(xr(b)||b[yn]))break e;if((m||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,m?(b=n.relatedTarget||n.toElement,m=c,b=b?xr(b):null,b!==null&&(S=kr(b),b!==S||b.tag!==5&&b.tag!==6)&&(b=null)):(m=null,b=c),m!==b)){if(v=zg,C="onMouseLeave",y="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(v=Hg,C="onPointerLeave",y="onPointerEnter",w="pointer"),S=m==null?p:hi(m),k=b==null?p:hi(b),p=new v(C,w+"leave",m,n,d),p.target=S,p.relatedTarget=k,C=null,xr(d)===c&&(v=new v(y,w+"enter",b,n,d),v.target=k,v.relatedTarget=S,C=v),S=C,m&&b)t:{for(v=m,y=b,w=0,k=v;k;k=fi(k))w++;for(k=0,C=y;C;C=fi(C))k++;for(;0<w-k;)v=fi(v),w--;for(;0<k-w;)y=fi(y),k--;for(;w--;){if(v===y||y!==null&&v===y.alternate)break t;v=fi(v),y=fi(y)}v=null}else v=null;m!==null&&mm(f,p,m,v,!1),b!==null&&S!==null&&mm(f,S,b,v,!0)}}e:{if(p=c?hi(c):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var E=ck;else if(Gg(p))if(Yg)E=pk;else{E=dk;var M=uk}else(m=p.nodeName)&&m.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(E=fk);if(E&&(E=E(t,c))){Qg(f,E,n,d);break e}M&&M(t,p,c),t==="focusout"&&(M=p._wrapperState)&&M.controlled&&p.type==="number"&&Sc(p,"number",p.value)}switch(M=c?hi(c):window,t){case"focusin":(Gg(M)||M.contentEditable==="true")&&(ui=M,Qc=c,ho=null);break;case"focusout":ho=Qc=ui=null;break;case"mousedown":Yc=!0;break;case"contextmenu":case"mouseup":case"dragend":Yc=!1,om(f,n,d);break;case"selectionchange":if(mk)break;case"keydown":case"keyup":om(f,n,d)}var O;if(Kc)e:{switch(t){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else ci?qg(t,n)&&(I="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(Vg&&n.locale!=="ko"&&(ci||I!=="onCompositionStart"?I==="onCompositionEnd"&&ci&&(O=Fg()):(Hn=d,Bc="value"in Hn?Hn.value:Hn.textContent,ci=!0)),M=Ys(c,I),0<M.length&&(I=new Ug(I,t,null,n,d),f.push({event:I,listeners:M}),O?I.data=O:(O=Jg(n),O!==null&&(I.data=O)))),(O=ik?ok(t,n):sk(t,n))&&(c=Ys(c,"onBeforeInput"),0<c.length&&(d=new Ug("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:c}),d.data=O))}hm(f,e)})}function vo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Ys(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 mm(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 wk=/\r\n?/g,Sk=/\u0000|\uFFFD/g;function vm(t){return(typeof t=="string"?t:""+t).replace(wk,`
|
|
372
|
+
`).replace(Sk,"")}function Xs(t,e,n){if(e=vm(e),vm(t)!==e&&n)throw Error(N(425))}function Zs(){}var ru=null,iu=null;function ou(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 su=typeof setTimeout=="function"?setTimeout:void 0,kk=typeof clearTimeout=="function"?clearTimeout:void 0,ym=typeof Promise=="function"?Promise:void 0,xk=typeof queueMicrotask=="function"?queueMicrotask:typeof ym<"u"?function(t){return ym.resolve(null).then(t).catch(_k)}:su;function _k(t){setTimeout(function(){throw t})}function au(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 bm(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 pi=Math.random().toString(36).slice(2),nn="__reactFiber$"+pi,yo="__reactProps$"+pi,yn="__reactContainer$"+pi,lu="__reactEvents$"+pi,Ck="__reactListeners$"+pi,Ek="__reactHandles$"+pi;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=bm(t);t!==null;){if(n=t[nn])return n;t=bm(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 hi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(N(33))}function ea(t){return t[yo]||null}var cu=[],gi=-1;function Kn(t){return{current:t}}function we(t){0>gi||(t.current=cu[gi],cu[gi]=null,gi--)}function me(t,e){gi++,cu[gi]=t.current,t.current=e}var qn={},We=Kn(qn),st=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 at(t){return t=t.childContextTypes,t!=null}function ta(){we(st),we(We)}function wm(t,e,n){if(We.current!==qn)throw Error(N(168));me(We,e),me(st,n)}function Sm(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,uS(t)||"Unknown",i));return _e({},n,r)}function na(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||qn,_r=We.current,me(We,t),me(st,st.current),!0}function km(t,e,n){var r=t.stateNode;if(!r)throw Error(N(169));n?(t=Sm(t,e,_r),r.__reactInternalMemoizedMergedChildContext=t,we(st),we(We),me(We,t)):we(st),me(st,n)}var bn=null,ra=!1,uu=!1;function xm(t){bn===null?bn=[t]:bn.push(t)}function Tk(t){ra=!0,xm(t)}function Jn(){if(!uu&&bn!==null){uu=!0;var t=0,e=ae;try{var n=bn;for(ae=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}bn=null,ra=!1}catch(i){throw bn!==null&&(bn=bn.slice(t+1)),Cg(Dc,Jn),i}finally{ae=e,uu=!1}}return null}var vi=[],yi=0,ia=null,oa=0,At=[],Ot=0,Cr=null,wn=1,Sn="";function Er(t,e){vi[yi++]=oa,vi[yi++]=ia,ia=t,oa=e}function _m(t,e,n){At[Ot++]=wn,At[Ot++]=Sn,At[Ot++]=Cr,Cr=t;var r=wn;t=Sn;var i=32-Ht(r)-1;r&=~(1<<i),n+=1;var o=32-Ht(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,wn=1<<32-Ht(e)+i|n<<i|r,Sn=o+t}else wn=1<<o|n<<i|r,Sn=t}function du(t){t.return!==null&&(Er(t,1),_m(t,1,0))}function fu(t){for(;t===ia;)ia=vi[--yi],vi[yi]=null,oa=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,Se=!1,Wt=null;function Cm(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 Em(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 pu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function hu(t){if(Se){var e=St;if(e){var n=e;if(!Em(t,e)){if(pu(t))throw Error(N(418));e=Wn(n.nextSibling);var r=wt;e&&Em(t,e)?Cm(r,n):(t.flags=t.flags&-4097|2,Se=!1,wt=t)}}else{if(pu(t))throw Error(N(418));t.flags=t.flags&-4097|2,Se=!1,wt=t}}}function Tm(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;wt=t}function sa(t){if(t!==wt)return!1;if(!Se)return Tm(t),Se=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!ou(t.type,t.memoizedProps)),e&&(e=St)){if(pu(t))throw Mm(),Error(N(418));for(;e;)Cm(t,e),e=Wn(e.nextSibling)}if(Tm(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 Mm(){for(var t=St;t;)t=Wn(t.nextSibling)}function bi(){St=wt=null,Se=!1}function gu(t){Wt===null?Wt=[t]:Wt.push(t)}var Mk=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 aa(t,e){throw t=Object.prototype.toString.call(e),Error(N(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Am(t){var e=t._init;return e(t._payload)}function Om(t){function e(y,w){if(t){var k=y.deletions;k===null?(y.deletions=[w],y.flags|=16):k.push(w)}}function n(y,w){if(!t)return null;for(;w!==null;)e(y,w),w=w.sibling;return null}function r(y,w){for(y=new Map;w!==null;)w.key!==null?y.set(w.key,w):y.set(w.index,w),w=w.sibling;return y}function i(y,w){return y=nr(y,w),y.index=0,y.sibling=null,y}function o(y,w,k){return y.index=k,t?(k=y.alternate,k!==null?(k=k.index,k<w?(y.flags|=2,w):k):(y.flags|=2,w)):(y.flags|=1048576,w)}function s(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,w,k,C){return w===null||w.tag!==6?(w=sd(k,y.mode,C),w.return=y,w):(w=i(w,k),w.return=y,w)}function l(y,w,k,C){var E=k.type;return E===ri?d(y,w,k.props.children,C,k.key):w!==null&&(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===$n&&Am(E)===w.type)?(C=i(w,k.props),C.ref=wo(y,w,k),C.return=y,C):(C=Pa(k.type,k.key,k.props,null,y.mode,C),C.ref=wo(y,w,k),C.return=y,C)}function c(y,w,k,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==k.containerInfo||w.stateNode.implementation!==k.implementation?(w=ad(k,y.mode,C),w.return=y,w):(w=i(w,k.children||[]),w.return=y,w)}function d(y,w,k,C,E){return w===null||w.tag!==7?(w=Ir(k,y.mode,C,E),w.return=y,w):(w=i(w,k),w.return=y,w)}function f(y,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=sd(""+w,y.mode,k),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ms:return k=Pa(w.type,w.key,w.props,null,y.mode,k),k.ref=wo(y,null,w),k.return=y,k;case ni:return w=ad(w,y.mode,k),w.return=y,w;case $n:var C=w._init;return f(y,C(w._payload),k)}if(Ji(w)||Ki(w))return w=Ir(w,y.mode,k,null),w.return=y,w;aa(y,w)}return null}function p(y,w,k,C){var E=w!==null?w.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return E!==null?null:a(y,w,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Ms:return k.key===E?l(y,w,k,C):null;case ni:return k.key===E?c(y,w,k,C):null;case $n:return E=k._init,p(y,w,E(k._payload),C)}if(Ji(k)||Ki(k))return E!==null?null:d(y,w,k,C,null);aa(y,k)}return null}function m(y,w,k,C,E){if(typeof C=="string"&&C!==""||typeof C=="number")return y=y.get(k)||null,a(w,y,""+C,E);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Ms:return y=y.get(C.key===null?k:C.key)||null,l(w,y,C,E);case ni:return y=y.get(C.key===null?k:C.key)||null,c(w,y,C,E);case $n:var M=C._init;return m(y,w,k,M(C._payload),E)}if(Ji(C)||Ki(C))return y=y.get(k)||null,d(w,y,C,E,null);aa(w,C)}return null}function b(y,w,k,C){for(var E=null,M=null,O=w,I=w=0,H=null;O!==null&&I<k.length;I++){O.index>I?(H=O,O=null):H=O.sibling;var z=p(y,O,k[I],C);if(z===null){O===null&&(O=H);break}t&&O&&z.alternate===null&&e(y,O),w=o(z,w,I),M===null?E=z:M.sibling=z,M=z,O=H}if(I===k.length)return n(y,O),Se&&Er(y,I),E;if(O===null){for(;I<k.length;I++)O=f(y,k[I],C),O!==null&&(w=o(O,w,I),M===null?E=O:M.sibling=O,M=O);return Se&&Er(y,I),E}for(O=r(y,O);I<k.length;I++)H=m(O,y,I,k[I],C),H!==null&&(t&&H.alternate!==null&&O.delete(H.key===null?I:H.key),w=o(H,w,I),M===null?E=H:M.sibling=H,M=H);return t&&O.forEach(function(te){return e(y,te)}),Se&&Er(y,I),E}function v(y,w,k,C){var E=Ki(k);if(typeof E!="function")throw Error(N(150));if(k=E.call(k),k==null)throw Error(N(151));for(var M=E=null,O=w,I=w=0,H=null,z=k.next();O!==null&&!z.done;I++,z=k.next()){O.index>I?(H=O,O=null):H=O.sibling;var te=p(y,O,z.value,C);if(te===null){O===null&&(O=H);break}t&&O&&te.alternate===null&&e(y,O),w=o(te,w,I),M===null?E=te:M.sibling=te,M=te,O=H}if(z.done)return n(y,O),Se&&Er(y,I),E;if(O===null){for(;!z.done;I++,z=k.next())z=f(y,z.value,C),z!==null&&(w=o(z,w,I),M===null?E=z:M.sibling=z,M=z);return Se&&Er(y,I),E}for(O=r(y,O);!z.done;I++,z=k.next())z=m(O,y,I,z.value,C),z!==null&&(t&&z.alternate!==null&&O.delete(z.key===null?I:z.key),w=o(z,w,I),M===null?E=z:M.sibling=z,M=z);return t&&O.forEach(function(he){return e(y,he)}),Se&&Er(y,I),E}function S(y,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 Ms:e:{for(var E=k.key,M=w;M!==null;){if(M.key===E){if(E=k.type,E===ri){if(M.tag===7){n(y,M.sibling),w=i(M,k.props.children),w.return=y,y=w;break e}}else if(M.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===$n&&Am(E)===M.type){n(y,M.sibling),w=i(M,k.props),w.ref=wo(y,M,k),w.return=y,y=w;break e}n(y,M);break}else e(y,M);M=M.sibling}k.type===ri?(w=Ir(k.props.children,y.mode,C,k.key),w.return=y,y=w):(C=Pa(k.type,k.key,k.props,null,y.mode,C),C.ref=wo(y,w,k),C.return=y,y=C)}return s(y);case ni:e:{for(M=k.key;w!==null;){if(w.key===M)if(w.tag===4&&w.stateNode.containerInfo===k.containerInfo&&w.stateNode.implementation===k.implementation){n(y,w.sibling),w=i(w,k.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else e(y,w);w=w.sibling}w=ad(k,y.mode,C),w.return=y,y=w}return s(y);case $n:return M=k._init,S(y,w,M(k._payload),C)}if(Ji(k))return b(y,w,k,C);if(Ki(k))return v(y,w,k,C);aa(y,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,w!==null&&w.tag===6?(n(y,w.sibling),w=i(w,k),w.return=y,y=w):(n(y,w),w=sd(k,y.mode,C),w.return=y,y=w),s(y)):n(y,w)}return S}var wi=Om(!0),Pm=Om(!1),la=Kn(null),ca=null,Si=null,mu=null;function vu(){mu=Si=ca=null}function yu(t){var e=la.current;we(la),t._currentValue=e}function bu(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){ca=t,mu=Si=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(lt=!0),t.firstContext=null)}function Pt(t){var e=t._currentValue;if(mu!==t)if(t={context:t,memoizedValue:e,next:null},Si===null){if(ca===null)throw Error(N(308));Si=t,ca.dependencies={lanes:0,firstContext:t}}else Si=Si.next=t;return e}var Tr=null;function wu(t){Tr===null?Tr=[t]:Tr.push(t)}function Dm(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,wu(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 Su(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Lm(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,ie&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,wu(r)):(e.next=i.next,i.next=e),r.interleaved=e,kn(t,n)}function ua(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,Rc(t,n)}}function Im(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 da(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 p=a.lane,m=a.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var b=t,v=a;switch(p=e,m=n,v.tag){case 1:if(b=v.payload,typeof b=="function"){f=b.call(m,f,p);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=v.payload,p=typeof b=="function"?b.call(m,f,p):b,p==null)break e;f=_e({},f,p);break e;case 2:Gn=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else m={eventTime:m,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=m,l=f):d=d.next=m,s|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,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 Rm(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 ku(t,e){switch(me(xo,e),me(ko,t),me(rn,So),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:xc(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=xc(e,t)}we(rn),me(rn,e)}function xi(){we(rn),we(ko),we(xo)}function Nm(t){Mr(xo.current);var e=Mr(rn.current),n=xc(e,t.type);e!==n&&(me(ko,t),me(rn,n))}function xu(t){ko.current===t&&(we(rn),we(ko))}var Ce=Kn(0);function fa(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 _u=[];function Cu(){for(var t=0;t<_u.length;t++)_u[t]._workInProgressVersionPrimary=null;_u.length=0}var pa=vn.ReactCurrentDispatcher,Eu=vn.ReactCurrentBatchConfig,Ar=0,Ee=null,De=null,Re=null,ha=!1,_o=!1,Co=0,Ak=0;function Ke(){throw Error(N(321))}function Tu(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Vt(t[n],e[n]))return!1;return!0}function Mu(t,e,n,r,i,o){if(Ar=o,Ee=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,pa.current=t===null||t.memoizedState===null?Lk:Ik,t=n(r,i),_o){o=0;do{if(_o=!1,Co=0,25<=o)throw Error(N(301));o+=1,Re=De=null,e.updateQueue=null,pa.current=Rk,t=n(r,i)}while(_o)}if(pa.current=va,e=De!==null&&De.next!==null,Ar=0,Re=De=Ee=null,ha=!1,e)throw Error(N(300));return t}function Au(){var t=Co!==0;return Co=0,t}function on(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Re===null?Ee.memoizedState=Re=t:Re=Re.next=t,Re}function Dt(){if(De===null){var t=Ee.alternate;t=t!==null?t.memoizedState:null}else t=De.next;var e=Re===null?Ee.memoizedState:Re.next;if(e!==null)Re=e,De=t;else{if(t===null)throw Error(N(310));De=t,t={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},Re===null?Ee.memoizedState=Re=t:Re=Re.next=t}return Re}function Eo(t,e){return typeof e=="function"?e(t):e}function Ou(t){var e=Dt(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=De,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,Ee.lanes|=d,Or|=d}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,Vt(r,e.memoizedState)||(lt=!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,Ee.lanes|=o,Or|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Pu(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);Vt(o,e.memoizedState)||(lt=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function $m(){}function jm(t,e){var n=Ee,r=Dt(),i=e(),o=!Vt(r.memoizedState,i);if(o&&(r.memoizedState=i,lt=!0),r=r.queue,Du(zm.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||Re!==null&&Re.memoizedState.tag&1){if(n.flags|=2048,To(9,Bm.bind(null,n,r,i,e),void 0,null),Ne===null)throw Error(N(349));Ar&30||Fm(n,e,i)}return i}function Fm(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ee.updateQueue,e===null?(e={lastEffect:null,stores:null},Ee.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Bm(t,e,n,r){e.value=n,e.getSnapshot=r,Um(e)&&Hm(t)}function zm(t,e,n){return n(function(){Um(e)&&Hm(t)})}function Um(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Vt(t,n)}catch{return!0}}function Hm(t){var e=kn(t,1);e!==null&&Gt(e,t,1,-1)}function Vm(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=Dk.bind(null,Ee,t),[e.memoizedState,t]}function To(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Ee.updateQueue,e===null?(e={lastEffect:null,stores:null},Ee.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 Wm(){return Dt().memoizedState}function ga(t,e,n,r){var i=on();Ee.flags|=t,i.memoizedState=To(1|e,n,void 0,r===void 0?null:r)}function ma(t,e,n,r){var i=Dt();r=r===void 0?null:r;var o=void 0;if(De!==null){var s=De.memoizedState;if(o=s.destroy,r!==null&&Tu(r,s.deps)){i.memoizedState=To(e,n,o,r);return}}Ee.flags|=t,i.memoizedState=To(1|e,n,o,r)}function Km(t,e){return ga(8390656,8,t,e)}function Du(t,e){return ma(2048,8,t,e)}function qm(t,e){return ma(4,2,t,e)}function Jm(t,e){return ma(4,4,t,e)}function Gm(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 Qm(t,e,n){return n=n!=null?n.concat([t]):null,ma(4,4,Gm.bind(null,e,t),n)}function Lu(){}function Ym(t,e){var n=Dt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Tu(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Xm(t,e){var n=Dt();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Tu(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function Zm(t,e,n){return Ar&21?(Vt(n,e)||(n=Ag(),Ee.lanes|=n,Or|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,lt=!0),t.memoizedState=n)}function Ok(t,e){var n=ae;ae=n!==0&&4>n?n:4,t(!0);var r=Eu.transition;Eu.transition={};try{t(!1),e()}finally{ae=n,Eu.transition=r}}function ev(){return Dt().memoizedState}function Pk(t,e,n){var r=er(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},tv(t))nv(e,n);else if(n=Dm(t,e,n,r),n!==null){var i=it();Gt(n,t,r,i),rv(n,e,r)}}function Dk(t,e,n){var r=er(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(tv(t))nv(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,Vt(a,s)){var l=e.interleaved;l===null?(i.next=i,wu(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Dm(t,e,i,r),n!==null&&(i=it(),Gt(n,t,r,i),rv(n,e,r))}}function tv(t){var e=t.alternate;return t===Ee||e!==null&&e===Ee}function nv(t,e){_o=ha=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function rv(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Rc(t,n)}}var va={readContext:Pt,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useInsertionEffect:Ke,useLayoutEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useMutableSource:Ke,useSyncExternalStore:Ke,useId:Ke,unstable_isNewReconciler:!1},Lk={readContext:Pt,useCallback:function(t,e){return on().memoizedState=[t,e===void 0?null:e],t},useContext:Pt,useEffect:Km,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,ga(4194308,4,Gm.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ga(4194308,4,t,e)},useInsertionEffect:function(t,e){return ga(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=Pk.bind(null,Ee,t),[r.memoizedState,t]},useRef:function(t){var e=on();return t={current:t},e.memoizedState=t},useState:Vm,useDebugValue:Lu,useDeferredValue:function(t){return on().memoizedState=t},useTransition:function(){var t=Vm(!1),e=t[0];return t=Ok.bind(null,t[1]),on().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ee,i=on();if(Se){if(n===void 0)throw Error(N(407));n=n()}else{if(n=e(),Ne===null)throw Error(N(349));Ar&30||Fm(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Km(zm.bind(null,r,o,t),[t]),r.flags|=2048,To(9,Bm.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=on(),e=Ne.identifierPrefix;if(Se){var n=Sn,r=wn;n=(r&~(1<<32-Ht(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Co++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Ak++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Ik={readContext:Pt,useCallback:Ym,useContext:Pt,useEffect:Du,useImperativeHandle:Qm,useInsertionEffect:qm,useLayoutEffect:Jm,useMemo:Xm,useReducer:Ou,useRef:Wm,useState:function(){return Ou(Eo)},useDebugValue:Lu,useDeferredValue:function(t){var e=Dt();return Zm(e,De.memoizedState,t)},useTransition:function(){var t=Ou(Eo)[0],e=Dt().memoizedState;return[t,e]},useMutableSource:$m,useSyncExternalStore:jm,useId:ev,unstable_isNewReconciler:!1},Rk={readContext:Pt,useCallback:Ym,useContext:Pt,useEffect:Du,useImperativeHandle:Qm,useInsertionEffect:qm,useLayoutEffect:Jm,useMemo:Xm,useReducer:Pu,useRef:Wm,useState:function(){return Pu(Eo)},useDebugValue:Lu,useDeferredValue:function(t){var e=Dt();return De===null?e.memoizedState=t:Zm(e,De.memoizedState,t)},useTransition:function(){var t=Pu(Eo)[0],e=Dt().memoizedState;return[t,e]},useMutableSource:$m,useSyncExternalStore:jm,useId:ev,unstable_isNewReconciler:!1};function Kt(t,e){if(t&&t.defaultProps){e=_e({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Iu(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:_e({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var ya={isMounted:function(t){return(t=t._reactInternals)?kr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=it(),i=er(t),o=xn(r,i);o.payload=e,n!=null&&(o.callback=n),e=Qn(t,o,i),e!==null&&(Gt(e,t,i,r),ua(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=it(),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&&(Gt(e,t,i,r),ua(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=it(),r=er(t),i=xn(n,r);i.tag=2,e!=null&&(i.callback=e),e=Qn(t,i,r),e!==null&&(Gt(e,t,r,n),ua(e,t,r))}};function iv(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?!po(n,r)||!po(i,o):!0}function ov(t,e,n){var r=!1,i=qn,o=e.contextType;return typeof o=="object"&&o!==null?o=Pt(o):(i=at(e)?_r:We.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=ya,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function sv(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&&ya.enqueueReplaceState(e,e.state,null)}function Ru(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Su(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Pt(o):(o=at(e)?_r:We.current,i.context=mi(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(Iu(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&&ya.enqueueReplaceState(i,i.state,null),da(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+=cS(r),r=r.return;while(r);var i=n}catch(o){i=`
|
|
373
|
+
Error generating stack: `+o.message+`
|
|
374
|
+
`+o.stack}return{value:t,source:e,stack:i,digest:null}}function Nu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function $u(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Nk=typeof WeakMap=="function"?WeakMap:Map;function av(t,e,n){n=xn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ca||(Ca=!0,Xu=r),$u(t,e)},n}function lv(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(){$u(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){$u(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 cv(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Nk;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=Qk.bind(null,t,e,n),e.then(t,t))}function uv(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 dv(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 $k=vn.ReactCurrentOwner,lt=!1;function rt(t,e,n,r){e.child=t===null?Pm(e,null,n,r):wi(e,t.child,n,r)}function fv(t,e,n,r,i){n=n.render;var o=e.ref;return ki(e,i),r=Mu(t,e,n,r,o,i),n=Au(),t!==null&&!lt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,_n(t,e,i)):(Se&&n&&du(e),e.flags|=1,rt(t,e,r,i),e.child)}function pv(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!od(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,hv(t,e,o,r,i)):(t=Pa(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:po,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 hv(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(po(o,r)&&t.ref===e.ref)if(lt=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(lt=!0);else return e.lanes=t.lanes,_n(t,e,i)}return ju(t,e,n,r,i)}function gv(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},me(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,me(Ei,kt),kt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,me(Ei,kt),kt|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,me(Ei,kt),kt|=r;return rt(t,e,i,n),e.child}function mv(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function ju(t,e,n,r,i){var o=at(n)?_r:We.current;return o=mi(e,o),ki(e,i),n=Mu(t,e,n,r,o,i),r=Au(),t!==null&&!lt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,_n(t,e,i)):(Se&&r&&du(e),e.flags|=1,rt(t,e,n,i),e.child)}function vv(t,e,n,r,i){if(at(n)){var o=!0;na(e)}else o=!1;if(ki(e,i),e.stateNode===null)wa(t,e),ov(e,n,r),Ru(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=at(n)?_r:We.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)&&sv(e,s,r,c),Gn=!1;var p=e.memoizedState;s.state=p,da(e,r,s,i),l=e.memoizedState,a!==r||p!==l||st.current||Gn?(typeof d=="function"&&(Iu(e,n,d,r),l=e.memoizedState),(a=Gn||iv(e,n,a,r,p,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,Lm(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Kt(e.type,a),s.props=c,f=e.pendingProps,p=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Pt(l):(l=at(n)?_r:We.current,l=mi(e,l));var m=n.getDerivedStateFromProps;(d=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||p!==l)&&sv(e,s,r,l),Gn=!1,p=e.memoizedState,s.state=p,da(e,r,s,i);var b=e.memoizedState;a!==f||p!==b||st.current||Gn?(typeof m=="function"&&(Iu(e,n,m,r),b=e.memoizedState),(c=Gn||iv(e,n,c,r,p,b,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,b,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,b,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=b),s.props=r,s.state=b,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),r=!1)}return Fu(t,e,n,r,o,i)}function Fu(t,e,n,r,i,o){mv(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&km(e,n,!1),_n(t,e,o);r=e.stateNode,$k.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)):rt(t,e,a,o),e.memoizedState=r.state,i&&km(e,n,!0),e.child}function yv(t){var e=t.stateNode;e.pendingContext?wm(t,e.pendingContext,e.pendingContext!==e.context):e.context&&wm(t,e.context,!1),ku(t,e.containerInfo)}function bv(t,e,n,r,i){return bi(),gu(i),e.flags|=256,rt(t,e,n,r),e.child}var Bu={dehydrated:null,treeContext:null,retryLane:0};function zu(t){return{baseLanes:t,cachePool:null,transitions:null}}function wv(t,e,n){var r=e.pendingProps,i=Ce.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),me(Ce,i&1),t===null)return hu(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=Da(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=zu(n),e.memoizedState=Bu,t):Uu(e,s));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return jk(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?zu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=Bu,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 Uu(t,e){return e=Da({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ba(t,e,n,r){return r!==null&&gu(r),wi(e,t.child,null,n),t=Uu(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function jk(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=Nu(Error(N(422))),ba(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Da({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=zu(s),e.memoizedState=Bu,o);if(!(e.mode&1))return ba(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=Nu(o,r,void 0),ba(t,e,s,r)}if(a=(s&t.childLanes)!==0,lt||a){if(r=Ne,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),Gt(r,t,i,-1))}return id(),r=Nu(Error(N(421))),ba(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=Yk.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,St=Wn(i.nextSibling),wt=e,Se=!0,Wt=null,t!==null&&(At[Ot++]=wn,At[Ot++]=Sn,At[Ot++]=Cr,wn=t.id,Sn=t.overflow,Cr=e),e=Uu(e,r.children),e.flags|=4096,e)}function Sv(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),bu(t.return,e,n)}function Hu(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 kv(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(rt(t,e,r.children,n),r=Ce.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&&Sv(t,n,e);else if(t.tag===19)Sv(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(me(Ce,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&&fa(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Hu(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&&fa(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Hu(e,!0,n,null,o);break;case"together":Hu(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function wa(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 Fk(t,e,n){switch(e.tag){case 3:yv(e),bi();break;case 5:Nm(e);break;case 1:at(e.type)&&na(e);break;case 4:ku(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;me(la,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(me(Ce,Ce.current&1),e.flags|=128,null):n&e.child.childLanes?wv(t,e,n):(me(Ce,Ce.current&1),t=_n(t,e,n),t!==null?t.sibling:null);me(Ce,Ce.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return kv(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),me(Ce,Ce.current),r)break;return null;case 22:case 23:return e.lanes=0,gv(t,e,n)}return _n(t,e,n)}var xv,Vu,_v,Cv;xv=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}},Vu=function(){},_v=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=bc(t,i),r=bc(t,r),o=[];break;case"select":i=_e({},i,{value:void 0}),r=_e({},r,{value:void 0}),o=[];break;case"textarea":i=kc(t,i),r=kc(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Zs)}_c(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"&&be("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)}},Cv=function(t,e,n,r){n!==r&&(e.flags|=4)};function Mo(t,e){if(!Se)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 qe(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 Bk(t,e,n){var r=e.pendingProps;switch(fu(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qe(e),null;case 1:return at(e.type)&&ta(),qe(e),null;case 3:return r=e.stateNode,xi(),we(st),we(We),Cu(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(sa(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Wt!==null&&(td(Wt),Wt=null))),Vu(t,e),qe(e),null;case 5:xu(e);var i=Mr(xo.current);if(n=e.type,t!==null&&e.stateNode!=null)_v(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 qe(e),null}if(t=Mr(rn.current),sa(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":be("cancel",r),be("close",r);break;case"iframe":case"object":case"embed":be("load",r);break;case"video":case"audio":for(i=0;i<go.length;i++)be(go[i],r);break;case"source":be("error",r);break;case"img":case"image":case"link":be("error",r),be("load",r);break;case"details":be("toggle",r);break;case"input":og(r,o),be("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},be("invalid",r);break;case"textarea":lg(r,o),be("invalid",r)}_c(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&&Xs(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&Xs(r.textContent,a,t),i=["children",""+a]):Wi.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&be("scroll",r)}switch(n){case"input":As(r),ag(r,o,!0);break;case"textarea":As(r),ug(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=Zs)}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=dg(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,xv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Cc(n,r),n){case"dialog":be("cancel",t),be("close",t),i=r;break;case"iframe":case"object":case"embed":be("load",t),i=r;break;case"video":case"audio":for(i=0;i<go.length;i++)be(go[i],t);i=r;break;case"source":be("error",t),i=r;break;case"img":case"image":case"link":be("error",t),be("load",t),i=r;break;case"details":be("toggle",t),i=r;break;case"input":og(t,r),i=bc(t,r),be("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=_e({},r,{value:void 0}),be("invalid",t);break;case"textarea":lg(t,r),i=kc(t,r),be("invalid",t);break;default:i=r}_c(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?hg(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&fg(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"&&be("scroll",t):l!=null&&lc(t,o,l,s))}switch(n){case"input":As(t),ag(t,r,!1);break;case"textarea":As(t),ug(t);break;case"option":r.value!=null&&t.setAttribute("value",""+jn(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=Zs)}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 qe(e),null;case 6:if(t&&e.stateNode!=null)Cv(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),sa(e)){if(r=e.stateNode,n=e.memoizedProps,r[nn]=e,(o=r.nodeValue!==n)&&(t=wt,t!==null))switch(t.tag){case 3:Xs(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Xs(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 qe(e),null;case 13:if(we(Ce),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Se&&St!==null&&e.mode&1&&!(e.flags&128))Mm(),bi(),e.flags|=98560,o=!1;else if(o=sa(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;qe(e),o=!1}else Wt!==null&&(td(Wt),Wt=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||Ce.current&1?Le===0&&(Le=3):id())),e.updateQueue!==null&&(e.flags|=4),qe(e),null);case 4:return xi(),Vu(t,e),t===null&&mo(e.stateNode.containerInfo),qe(e),null;case 10:return yu(e.type._context),qe(e),null;case 17:return at(e.type)&&ta(),qe(e),null;case 19:if(we(Ce),o=e.memoizedState,o===null)return qe(e),null;if(r=(e.flags&128)!==0,s=o.rendering,s===null)if(r)Mo(o,!1);else{if(Le!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=fa(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 me(Ce,Ce.current&1|2),e.child}t=t.sibling}o.tail!==null&&Oe()>Ti&&(e.flags|=128,r=!0,Mo(o,!1),e.lanes=4194304)}else{if(!r)if(t=fa(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&&!Se)return qe(e),null}else 2*Oe()-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=Oe(),e.sibling=null,n=Ce.current,me(Ce,r?n&1|2:n&1),e):(qe(e),null);case 22:case 23:return rd(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?kt&1073741824&&(qe(e),e.subtreeFlags&6&&(e.flags|=8192)):qe(e),null;case 24:return null;case 25:return null}throw Error(N(156,e.tag))}function zk(t,e){switch(fu(e),e.tag){case 1:return at(e.type)&&ta(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xi(),we(st),we(We),Cu(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return xu(e),null;case 13:if(we(Ce),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 we(Ce),null;case 4:return xi(),null;case 10:return yu(e.type._context),null;case 22:case 23:return rd(),null;case 24:return null;default:return null}}var Sa=!1,Je=!1,Uk=typeof WeakSet=="function"?WeakSet:Set,F=null;function Ci(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Te(t,e,r)}else n.current=null}function Wu(t,e,n){try{n()}catch(r){Te(t,e,r)}}var Ev=!1;function Hk(t,e){if(ru=zs,t=im(),Gc(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,p=null;t:for(;;){for(var m;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),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===t)break t;if(p===n&&++c===i&&(a=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(iu={focusedElem:t,selectionRange:n},zs=!1,F=e;F!==null;)if(e=F,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,F=t;else for(;F!==null;){e=F;try{var b=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var v=b.memoizedProps,S=b.memoizedState,y=e.stateNode,w=y.getSnapshotBeforeUpdate(e.elementType===e.type?v:Kt(e.type,v),S);y.__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){Te(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,F=t;break}F=e.return}return b=Ev,Ev=!1,b}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&&Wu(e,n,o)}i=i.next}while(i!==r)}}function ka(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 Ku(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 Tv(t){var e=t.alternate;e!==null&&(t.alternate=null,Tv(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[lu],delete e[Ck],delete e[Ek])),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 Mv(t){return t.tag===5||t.tag===3||t.tag===4}function Av(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Mv(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=Zs));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 Ju(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(Ju(t,e,n),t=t.sibling;t!==null;)Ju(t,e,n),t=t.sibling}var ze=null,qt=!1;function Yn(t,e,n){for(n=n.child;n!==null;)Ov(t,e,n),n=n.sibling}function Ov(t,e,n){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Rs,n)}catch{}switch(n.tag){case 5:Je||Ci(n,e);case 6:var r=ze,i=qt;ze=null,Yn(t,e,n),ze=r,qt=i,ze!==null&&(qt?(t=ze,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):ze.removeChild(n.stateNode));break;case 18:ze!==null&&(qt?(t=ze,n=n.stateNode,t.nodeType===8?au(t.parentNode,n):t.nodeType===1&&au(t,n),so(t)):au(ze,n.stateNode));break;case 4:r=ze,i=qt,ze=n.stateNode.containerInfo,qt=!0,Yn(t,e,n),ze=r,qt=i;break;case 0:case 11:case 14:case 15:if(!Je&&(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)&&Wu(n,e,s),i=i.next}while(i!==r)}Yn(t,e,n);break;case 1:if(!Je&&(Ci(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Te(n,e,a)}Yn(t,e,n);break;case 21:Yn(t,e,n);break;case 22:n.mode&1?(Je=(r=Je)||n.memoizedState!==null,Yn(t,e,n),Je=r):Yn(t,e,n);break;default:Yn(t,e,n)}}function Pv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Uk),e.forEach(function(r){var i=Xk.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Jt(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:ze=a.stateNode,qt=!1;break e;case 3:ze=a.stateNode.containerInfo,qt=!0;break e;case 4:ze=a.stateNode.containerInfo,qt=!0;break e}a=a.return}if(ze===null)throw Error(N(160));Ov(o,s,i),ze=null,qt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Te(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Dv(e,t),e=e.sibling}function Dv(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Jt(e,t),sn(t),r&4){try{Ao(3,t,t.return),ka(3,t)}catch(v){Te(t,t.return,v)}try{Ao(5,t,t.return)}catch(v){Te(t,t.return,v)}}break;case 1:Jt(e,t),sn(t),r&512&&n!==null&&Ci(n,n.return);break;case 5:if(Jt(e,t),sn(t),r&512&&n!==null&&Ci(n,n.return),t.flags&32){var i=t.stateNode;try{Gi(i,"")}catch(v){Te(t,t.return,v)}}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&&sg(i,o),Cc(a,s);var c=Cc(a,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d==="style"?hg(i,f):d==="dangerouslySetInnerHTML"?fg(i,f):d==="children"?Gi(i,f):lc(i,d,f,c)}switch(a){case"input":wc(i,o);break;case"textarea":cg(i,o);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m!=null?ii(i,!!o.multiple,m,!1):p!==!!o.multiple&&(o.defaultValue!=null?ii(i,!!o.multiple,o.defaultValue,!0):ii(i,!!o.multiple,o.multiple?[]:"",!1))}i[yo]=o}catch(v){Te(t,t.return,v)}}break;case 6:if(Jt(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(v){Te(t,t.return,v)}}break;case 3:if(Jt(e,t),sn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{so(e.containerInfo)}catch(v){Te(t,t.return,v)}break;case 4:Jt(e,t),sn(t);break;case 13:Jt(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||(Yu=Oe())),r&4&&Pv(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Je=(c=Je)||d,Jt(e,t),Je=c):Jt(e,t),sn(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(F=t,d=t.child;d!==null;){for(f=F=d;F!==null;){switch(p=F,m=p.child,p.tag){case 0:case 11:case 14:case 15:Ao(4,p,p.return);break;case 1:Ci(p,p.return);var b=p.stateNode;if(typeof b.componentWillUnmount=="function"){r=p,n=p.return;try{e=r,b.props=e.memoizedProps,b.state=e.memoizedState,b.componentWillUnmount()}catch(v){Te(r,n,v)}}break;case 5:Ci(p,p.return);break;case 22:if(p.memoizedState!==null){Rv(f);continue}}m!==null?(m.return=p,F=m):Rv(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=pg("display",s))}catch(v){Te(t,t.return,v)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(v){Te(t,t.return,v)}}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:Jt(e,t),sn(t),r&4&&Pv(t);break;case 21:break;default:Jt(e,t),sn(t)}}function sn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Mv(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=Av(t);Ju(t,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=Av(t);qu(t,a,s);break;default:throw Error(N(161))}}catch(l){Te(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Vk(t,e,n){F=t,Lv(t)}function Lv(t,e,n){for(var r=(t.mode&1)!==0;F!==null;){var i=F,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||Sa;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Je;a=Sa;var c=Je;if(Sa=s,(Je=l)&&!c)for(F=i;F!==null;)s=F,l=s.child,s.tag===22&&s.memoizedState!==null?Nv(i):l!==null?(l.return=s,F=l):Nv(i);for(;o!==null;)F=o,Lv(o),o=o.sibling;F=i,Sa=a,Je=c}Iv(t)}else i.subtreeFlags&8772&&o!==null?(o.return=i,F=o):Iv(t)}}function Iv(t){for(;F!==null;){var e=F;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Je||ka(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Je)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&&Rm(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}Rm(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))}Je||e.flags&512&&Ku(e)}catch(p){Te(e,e.return,p)}}if(e===t){F=null;break}if(n=e.sibling,n!==null){n.return=e.return,F=n;break}F=e.return}}function Rv(t){for(;F!==null;){var e=F;if(e===t){F=null;break}var n=e.sibling;if(n!==null){n.return=e.return,F=n;break}F=e.return}}function Nv(t){for(;F!==null;){var e=F;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{ka(4,e)}catch(l){Te(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Te(e,i,l)}}var o=e.return;try{Ku(e)}catch(l){Te(e,o,l)}break;case 5:var s=e.return;try{Ku(e)}catch(l){Te(e,s,l)}}}catch(l){Te(e,e.return,l)}if(e===t){F=null;break}var a=e.sibling;if(a!==null){a.return=e.return,F=a;break}F=e.return}}var Wk=Math.ceil,xa=vn.ReactCurrentDispatcher,Gu=vn.ReactCurrentOwner,Lt=vn.ReactCurrentBatchConfig,ie=0,Ne=null,Pe=null,Ue=0,kt=0,Ei=Kn(0),Le=0,Oo=null,Or=0,_a=0,Qu=0,Po=null,ct=null,Yu=0,Ti=1/0,Cn=null,Ca=!1,Xu=null,Xn=null,Ea=!1,Zn=null,Ta=0,Do=0,Zu=null,Ma=-1,Aa=0;function it(){return ie&6?Oe():Ma!==-1?Ma:Ma=Oe()}function er(t){return t.mode&1?ie&2&&Ue!==0?Ue&-Ue:Mk.transition!==null?(Aa===0&&(Aa=Ag()),Aa):(t=ae,t!==0||(t=window.event,t=t===void 0?16:jg(t.type)),t):1}function Gt(t,e,n,r){if(50<Do)throw Do=0,Zu=null,Error(N(185));to(t,n,r),(!(ie&2)||t!==Ne)&&(t===Ne&&(!(ie&2)&&(_a|=n),Le===4&&tr(t,Ue)),ut(t,r),n===1&&ie===0&&!(e.mode&1)&&(Ti=Oe()+500,ra&&Jn()))}function ut(t,e){var n=t.callbackNode;MS(t,e);var r=js(t,t===Ne?Ue:0);if(r===0)n!==null&&Eg(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Eg(n),e===1)t.tag===0?Tk(jv.bind(null,t)):xm(jv.bind(null,t)),xk(function(){!(ie&6)&&Jn()}),n=null;else{switch(Og(r)){case 1:n=Dc;break;case 4:n=Tg;break;case 16:n=Is;break;case 536870912:n=Mg;break;default:n=Is}n=Kv(n,$v.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function $v(t,e){if(Ma=-1,Aa=0,ie&6)throw Error(N(327));var n=t.callbackNode;if(Mi()&&t.callbackNode!==n)return null;var r=js(t,t===Ne?Ue:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Oa(t,r);else{e=r;var i=ie;ie|=2;var o=Bv();(Ne!==t||Ue!==e)&&(Cn=null,Ti=Oe()+500,Dr(t,e));do try{Jk();break}catch(a){Fv(t,a)}while(!0);vu(),xa.current=o,ie=i,Pe!==null?e=0:(Ne=null,Ue=0,e=Le)}if(e!==0){if(e===2&&(i=Lc(t),i!==0&&(r=i,e=ed(t,i))),e===1)throw n=Oo,Dr(t,0),tr(t,r),ut(t,Oe()),n;if(e===6)tr(t,r);else{if(i=t.current.alternate,!(r&30)&&!Kk(i)&&(e=Oa(t,r),e===2&&(o=Lc(t),o!==0&&(r=o,e=ed(t,o))),e===1))throw n=Oo,Dr(t,0),tr(t,r),ut(t,Oe()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(N(345));case 2:Lr(t,ct,Cn);break;case 3:if(tr(t,r),(r&130023424)===r&&(e=Yu+500-Oe(),10<e)){if(js(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){it(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=su(Lr.bind(null,t,ct,Cn),e);break}Lr(t,ct,Cn);break;case 4:if(tr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var s=31-Ht(r);o=1<<s,s=e[s],s>i&&(i=s),r&=~o}if(r=i,r=Oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wk(r/1960))-r,10<r){t.timeoutHandle=su(Lr.bind(null,t,ct,Cn),r);break}Lr(t,ct,Cn);break;case 5:Lr(t,ct,Cn);break;default:throw Error(N(329))}}}return ut(t,Oe()),t.callbackNode===n?$v.bind(null,t):null}function ed(t,e){var n=Po;return t.current.memoizedState.isDehydrated&&(Dr(t,e).flags|=256),t=Oa(t,e),t!==2&&(e=ct,ct=n,e!==null&&td(e)),t}function td(t){ct===null?ct=t:ct.push.apply(ct,t)}function Kk(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(!Vt(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&=~Qu,e&=~_a,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Ht(e),r=1<<n;t[n]=-1,e&=~r}}function jv(t){if(ie&6)throw Error(N(327));Mi();var e=js(t,0);if(!(e&1))return ut(t,Oe()),null;var n=Oa(t,e);if(t.tag!==0&&n===2){var r=Lc(t);r!==0&&(e=r,n=ed(t,r))}if(n===1)throw n=Oo,Dr(t,0),tr(t,e),ut(t,Oe()),n;if(n===6)throw Error(N(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Lr(t,ct,Cn),ut(t,Oe()),null}function nd(t,e){var n=ie;ie|=1;try{return t(e)}finally{ie=n,ie===0&&(Ti=Oe()+500,ra&&Jn())}}function Pr(t){Zn!==null&&Zn.tag===0&&!(ie&6)&&Mi();var e=ie;ie|=1;var n=Lt.transition,r=ae;try{if(Lt.transition=null,ae=1,t)return t()}finally{ae=r,Lt.transition=n,ie=e,!(ie&6)&&Jn()}}function rd(){kt=Ei.current,we(Ei)}function Dr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,kk(n)),Pe!==null)for(n=Pe.return;n!==null;){var r=n;switch(fu(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ta();break;case 3:xi(),we(st),we(We),Cu();break;case 5:xu(r);break;case 4:xi();break;case 13:we(Ce);break;case 19:we(Ce);break;case 10:yu(r.type._context);break;case 22:case 23:rd()}n=n.return}if(Ne=t,Pe=t=nr(t.current,null),Ue=kt=e,Le=0,Oo=null,Qu=_a=Or=0,ct=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 Fv(t,e){do{var n=Pe;try{if(vu(),pa.current=va,ha){for(var r=Ee.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ha=!1}if(Ar=0,Re=De=Ee=null,_o=!1,Co=0,Gu.current=null,n===null||n.return===null){Le=1,Oo=e,Pe=null;break}e:{var o=t,s=n.return,a=n,l=e;if(e=Ue,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 p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=uv(s);if(m!==null){m.flags&=-257,dv(m,s,a,o,e),m.mode&1&&cv(o,c,e),e=m,l=c;var b=e.updateQueue;if(b===null){var v=new Set;v.add(l),e.updateQueue=v}else b.add(l);break e}else{if(!(e&1)){cv(o,c,e),id();break e}l=Error(N(426))}}else if(Se&&a.mode&1){var S=uv(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),dv(S,s,a,o,e),gu(_i(l,a));break e}}o=l=_i(l,a),Le!==4&&(Le=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 y=av(o,l,e);Im(o,y);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=lv(o,a,e);Im(o,C);break e}}o=o.return}while(o!==null)}Uv(n)}catch(E){e=E,Pe===n&&n!==null&&(Pe=n=n.return);continue}break}while(!0)}function Bv(){var t=xa.current;return xa.current=va,t===null?va:t}function id(){(Le===0||Le===3||Le===2)&&(Le=4),Ne===null||!(Or&268435455)&&!(_a&268435455)||tr(Ne,Ue)}function Oa(t,e){var n=ie;ie|=2;var r=Bv();(Ne!==t||Ue!==e)&&(Cn=null,Dr(t,e));do try{qk();break}catch(i){Fv(t,i)}while(!0);if(vu(),ie=n,xa.current=r,Pe!==null)throw Error(N(261));return Ne=null,Ue=0,Le}function qk(){for(;Pe!==null;)zv(Pe)}function Jk(){for(;Pe!==null&&!bS();)zv(Pe)}function zv(t){var e=Wv(t.alternate,t,kt);t.memoizedProps=t.pendingProps,e===null?Uv(t):Pe=e,Gu.current=null}function Uv(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=zk(n,e),n!==null){n.flags&=32767,Pe=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Le=6,Pe=null;return}}else if(n=Bk(n,e,kt),n!==null){Pe=n;return}if(e=e.sibling,e!==null){Pe=e;return}Pe=e=t}while(e!==null);Le===0&&(Le=5)}function Lr(t,e,n){var r=ae,i=Lt.transition;try{Lt.transition=null,ae=1,Gk(t,e,n,r)}finally{Lt.transition=i,ae=r}return null}function Gk(t,e,n,r){do Mi();while(Zn!==null);if(ie&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(AS(t,o),t===Ne&&(Pe=Ne=null,Ue=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ea||(Ea=!0,Kv(Is,function(){return Mi(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Lt.transition,Lt.transition=null;var s=ae;ae=1;var a=ie;ie|=4,Gu.current=null,Hk(t,n),Dv(n,t),gk(iu),zs=!!ru,iu=ru=null,t.current=n,Vk(n),wS(),ie=a,ae=s,Lt.transition=o}else t.current=n;if(Ea&&(Ea=!1,Zn=t,Ta=i),o=t.pendingLanes,o===0&&(Xn=null),xS(n.stateNode),ut(t,Oe()),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(Ca)throw Ca=!1,t=Xu,Xu=null,t;return Ta&1&&t.tag!==0&&Mi(),o=t.pendingLanes,o&1?t===Zu?Do++:(Do=0,Zu=t):Do=0,Jn(),null}function Mi(){if(Zn!==null){var t=Og(Ta),e=Lt.transition,n=ae;try{if(Lt.transition=null,ae=16>t?16:t,Zn===null)var r=!1;else{if(t=Zn,Zn=null,Ta=0,ie&6)throw Error(N(331));var i=ie;for(ie|=4,F=t.current;F!==null;){var o=F,s=o.child;if(F.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(F=c;F!==null;){var d=F;switch(d.tag){case 0:case 11:case 15:Ao(8,d,o)}var f=d.child;if(f!==null)f.return=d,F=f;else for(;F!==null;){d=F;var p=d.sibling,m=d.return;if(Tv(d),d===c){F=null;break}if(p!==null){p.return=m,F=p;break}F=m}}}var b=o.alternate;if(b!==null){var v=b.child;if(v!==null){b.child=null;do{var S=v.sibling;v.sibling=null,v=S}while(v!==null)}}F=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,F=s;else e:for(;F!==null;){if(o=F,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Ao(9,o,o.return)}var y=o.sibling;if(y!==null){y.return=o.return,F=y;break e}F=o.return}}var w=t.current;for(F=w;F!==null;){s=F;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,F=k;else e:for(s=w;F!==null;){if(a=F,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:ka(9,a)}}catch(E){Te(a,a.return,E)}if(a===s){F=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,F=C;break e}F=a.return}}if(ie=i,Jn(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Rs,t)}catch{}r=!0}return r}finally{ae=n,Lt.transition=e}}return!1}function Hv(t,e,n){e=_i(n,e),e=av(t,e,1),t=Qn(t,e,1),e=it(),t!==null&&(to(t,1,e),ut(t,e))}function Te(t,e,n){if(t.tag===3)Hv(t,t,n);else for(;e!==null;){if(e.tag===3){Hv(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=lv(e,t,1),e=Qn(e,t,1),t=it(),e!==null&&(to(e,1,t),ut(e,t));break}}e=e.return}}function Qk(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=it(),t.pingedLanes|=t.suspendedLanes&n,Ne===t&&(Ue&n)===n&&(Le===4||Le===3&&(Ue&130023424)===Ue&&500>Oe()-Yu?Dr(t,0):Qu|=n),ut(t,e)}function Vv(t,e){e===0&&(t.mode&1?(e=$s,$s<<=1,!($s&130023424)&&($s=4194304)):e=1);var n=it();t=kn(t,e),t!==null&&(to(t,e,n),ut(t,n))}function Yk(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Vv(t,n)}function Xk(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),Vv(t,n)}var Wv;Wv=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||st.current)lt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return lt=!1,Fk(t,e,n);lt=!!(t.flags&131072)}else lt=!1,Se&&e.flags&1048576&&_m(e,oa,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;wa(t,e),t=e.pendingProps;var i=mi(e,We.current);ki(e,n),i=Mu(null,e,r,t,i,n);var o=Au();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,at(r)?(o=!0,na(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Su(e),i.updater=ya,e.stateNode=i,i._reactInternals=e,Ru(e,r,t,n),e=Fu(null,e,r,!0,o,n)):(e.tag=0,Se&&o&&du(e),rt(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(wa(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=ex(r),t=Kt(r,t),i){case 0:e=ju(null,e,r,t,n);break e;case 1:e=vv(null,e,r,t,n);break e;case 11:e=fv(null,e,r,t,n);break e;case 14:e=pv(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),ju(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Kt(r,i),vv(t,e,r,i,n);case 3:e:{if(yv(e),t===null)throw Error(N(387));r=e.pendingProps,o=e.memoizedState,i=o.element,Lm(t,e),da(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=bv(t,e,r,n,i);break e}else if(r!==i){i=_i(Error(N(424)),e),e=bv(t,e,r,n,i);break e}else for(St=Wn(e.stateNode.containerInfo.firstChild),wt=e,Se=!0,Wt=null,n=Pm(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}rt(t,e,r,n)}e=e.child}return e;case 5:return Nm(e),t===null&&hu(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,ou(r,i)?s=null:o!==null&&ou(r,o)&&(e.flags|=32),mv(t,e),rt(t,e,s,n),e.child;case 6:return t===null&&hu(e),null;case 13:return wv(t,e,n);case 4:return ku(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=wi(e,null,r,n):rt(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Kt(r,i),fv(t,e,r,i,n);case 7:return rt(t,e,e.pendingProps,n),e.child;case 8:return rt(t,e,e.pendingProps.children,n),e.child;case 12:return rt(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,me(la,r._currentValue),r._currentValue=s,o!==null)if(Vt(o.value,s)){if(o.children===i.children&&!st.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),bu(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),bu(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}rt(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,rt(t,e,r,n),e.child;case 14:return r=e.type,i=Kt(r,e.pendingProps),i=Kt(r.type,i),pv(t,e,r,i,n);case 15:return hv(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Kt(r,i),wa(t,e),e.tag=1,at(r)?(t=!0,na(e)):t=!1,ki(e,n),ov(e,r,i),Ru(e,r,i,n),Fu(null,e,r,!0,t,n);case 19:return kv(t,e,n);case 22:return gv(t,e,n)}throw Error(N(156,e.tag))};function Kv(t,e){return Cg(t,e)}function Zk(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 Zk(t,e,n,r)}function od(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ex(t){if(typeof t=="function")return od(t)?1:0;if(t!=null){if(t=t.$$typeof,t===dc)return 11;if(t===hc)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 Pa(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")od(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ri:return Ir(n.children,i,o,e);case cc:s=8,i|=8;break;case uc:return t=It(12,n,e,i|2),t.elementType=uc,t.lanes=o,t;case fc:return t=It(13,n,e,i),t.elementType=fc,t.lanes=o,t;case pc:return t=It(19,n,e,i),t.elementType=pc,t.lanes=o,t;case tg:return Da(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Zh:s=10;break e;case eg:s=9;break e;case dc:s=11;break e;case hc: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 Da(t,e,n,r){return t=It(22,t,r,e),t.elementType=tg,t.lanes=n,t.stateNode={isHidden:!1},t}function sd(t,e,n){return t=It(6,t,null,e),t.lanes=n,t}function ad(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 tx(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=Ic(0),this.expirationTimes=Ic(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ic(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ld(t,e,n,r,i,o,s,a,l){return t=new tx(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},Su(o),t}function nx(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 qv(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(at(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(at(n))return Sm(t,n,e)}return e}function Jv(t,e,n,r,i,o,s,a,l){return t=ld(n,r,!0,t,i,o,s,a,l),t.context=qv(null),n=t.current,r=it(),i=er(n),o=xn(r,i),o.callback=e??null,Qn(n,o,i),t.current.lanes=i,to(t,i,r),ut(t,r),t}function La(t,e,n,r){var i=e.current,o=it(),s=er(i);return n=qv(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&&(Gt(t,i,s,o),ua(t,i,s)),s}function Ia(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 Gv(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function cd(t,e){Gv(t,e),(t=t.alternate)&&Gv(t,e)}function rx(){return null}var Qv=typeof reportError=="function"?reportError:function(t){console.error(t)};function ud(t){this._internalRoot=t}Ra.prototype.render=ud.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(N(409));La(t,e,null,null)},Ra.prototype.unmount=ud.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Pr(function(){La(null,t,null,null)}),e[yn]=null}};function Ra(t){this._internalRoot=t}Ra.prototype.unstable_scheduleHydration=function(t){if(t){var e=Lg();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Un.length&&e!==0&&e<Un[n].priority;n++);Un.splice(n,0,t),n===0&&Ng(t)}};function dd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Na(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Yv(){}function ix(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=Ia(s);o.call(c)}}var s=Jv(e,r,t,0,null,!1,!1,"",Yv);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=Ia(l);a.call(c)}}var l=ld(t,0,!1,null,null,!1,!1,"",Yv);return t._reactRootContainer=l,t[yn]=l.current,mo(t.nodeType===8?t.parentNode:t),Pr(function(){La(e,l,n,r)}),l}function $a(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=Ia(s);a.call(l)}}La(e,s,t,i)}else s=ix(n,e,t,i,r);return Ia(s)}Pg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=eo(e.pendingLanes);n!==0&&(Rc(e,n|1),ut(e,Oe()),!(ie&6)&&(Ti=Oe()+500,Jn()))}break;case 13:Pr(function(){var r=kn(t,1);if(r!==null){var i=it();Gt(r,t,1,i)}}),cd(t,1)}},Nc=function(t){if(t.tag===13){var e=kn(t,134217728);if(e!==null){var n=it();Gt(e,t,134217728,n)}cd(t,134217728)}},Dg=function(t){if(t.tag===13){var e=er(t),n=kn(t,e);if(n!==null){var r=it();Gt(n,t,e,r)}cd(t,e)}},Lg=function(){return ae},Ig=function(t,e){var n=ae;try{return ae=t,e()}finally{ae=n}},Mc=function(t,e,n){switch(e){case"input":if(wc(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=ea(r);if(!i)throw Error(N(90));ig(r),wc(r,i)}}}break;case"textarea":cg(t,n);break;case"select":e=n.value,e!=null&&ii(t,!!n.multiple,e,!1)}},yg=nd,bg=Pr;var ox={usingClientEntryPoint:!1,Events:[bo,hi,ea,mg,vg,nd]},Lo={findFiberByHostInstance:xr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},sx={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=xg(t),t===null?null:t.stateNode},findFiberByHostInstance:Lo.findFiberByHostInstance||rx,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{Rs=ja.inject(sx),tn=ja}catch{}}vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ox,vt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!dd(e))throw Error(N(200));return nx(t,e,null,n)},vt.createRoot=function(t,e){if(!dd(t))throw Error(N(299));var n=!1,r="",i=Qv;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=ld(t,1,!1,null,null,n,!1,r,i),t[yn]=e.current,mo(t.nodeType===8?t.parentNode:t),new ud(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=xg(e),t=t===null?null:t.stateNode,t},vt.flushSync=function(t){return Pr(t)},vt.hydrate=function(t,e,n){if(!Na(e))throw Error(N(200));return $a(null,t,e,!0,n)},vt.hydrateRoot=function(t,e,n){if(!dd(t))throw Error(N(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=Qv;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=Jv(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 Ra(e)},vt.render=function(t,e,n){if(!Na(e))throw Error(N(200));return $a(null,t,e,!1,n)},vt.unmountComponentAtNode=function(t){if(!Na(t))throw Error(N(40));return t._reactRootContainer?(Pr(function(){$a(null,null,t,!1,function(){t._reactRootContainer=null,t[yn]=null})}),!0):!1},vt.unstable_batchedUpdates=nd,vt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Na(n))throw Error(N(200));if(t==null||t._reactInternals===void 0)throw Error(N(38));return $a(t,e,n,!1,r)},vt.version="18.3.1-next-f1338f8080-20240426";function Xv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Xv)}catch(t){console.error(t)}}Xv(),qh.exports=vt;var ax=qh.exports,Zv=ax;ic.createRoot=Zv.createRoot,ic.hydrateRoot=Zv.hydrateRoot;var ey={exports:{}},Fa={};/**
|
|
375
|
+
* @license React
|
|
376
|
+
* react-jsx-runtime.production.min.js
|
|
377
|
+
*
|
|
378
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
379
|
+
*
|
|
380
|
+
* This source code is licensed under the MIT license found in the
|
|
381
|
+
* LICENSE file in the root directory of this source tree.
|
|
382
|
+
*/var lx=ye,cx=Symbol.for("react.element"),ux=Symbol.for("react.fragment"),dx=Object.prototype.hasOwnProperty,fx=lx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,px={key:!0,ref:!0,__self:!0,__source:!0};function ty(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)dx.call(e,r)&&!px.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:cx,type:t,key:o,ref:s,props:i,_owner:fx.current}}Fa.Fragment=ux,Fa.jsx=ty,Fa.jsxs=ty,ey.exports=Fa;var T=ey.exports;const hx=({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]=ye.useState(Array(a).fill(.15)),d=ye.useRef(),f=ye.useRef(Array(a).fill(.15));ye.useEffect(()=>{if(s&&s.length>0&&t){const b=Array(a).fill(0).map((v,S)=>{let y=0;if(S===0)y=s.reduce((k,C)=>k+C,0)/s.length,y=Math.pow(y,.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,M=0;for(let O=k;O<C;O++)E+=s[O],M++;y=M>0?E/M:0,y=y*(1-S*.08)}return Math.max(.15,Math.min(1,.15+y*.85))});f.current=b}else t||(f.current=Array(a).fill(.15))},[s,t,a]),ye.useEffect(()=>{const b=()=>{c(v=>v.map((S,y)=>{const w=f.current[y]||.15,k=t?.35:.15;return S+(w-S)*k})),d.current=requestAnimationFrame(b)};return d.current=requestAnimationFrame(b),()=>{d.current&&cancelAnimationFrame(d.current)}},[t,a]);const p=Kh.useMemo(()=>{const b=[];for(let v=a-1;v>0;v--)b.push(l[v]);b.push(l[0]);for(let v=1;v<a;v++)b.push(l[v]);return b},[l,a]),m=p.length*i+(p.length-1)*o;return T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:`${n}px`,width:`${m}px`,gap:`${o}px`},children:p.map((b,v)=>{const S=v===Math.floor(p.length/2),y=Math.max(4,n*b*(S?1.1:1));return T.jsx("div",{style:{width:`${i}px`,height:`${y}px`,background:e,borderRadius:`${i/2}px`,transition:"none",opacity:t?1:.4,boxShadow:t&&b>.3?`0 0 ${6*b}px ${e}50`:"none"}},v)})})},gx=({isActive:t,state:e,size:n=64})=>{const i=(()=>{switch(e){case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#a78bfa";case"paused":return"#9ca3af";case"connecting":return"#f59e0b";case"minimized":return"#6b7280";default:return"#6b7280"}})();return T.jsxs("div",{style:{position:"relative",width:`${n}px`,height:`${n}px`,display:"flex",alignItems:"center",justifyContent:"center"},children:[t&&T.jsxs(T.Fragment,{children:[T.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",border:`2px solid ${i}`,animation:"circularPulse 2s ease-out infinite",opacity:.4}}),T.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",border:`2px solid ${i}`,animation:"circularPulse 2s ease-out infinite 0.5s",opacity:.3}})]}),T.jsx("div",{style:{width:`${n*.6}px`,height:`${n*.6}px`,borderRadius:"50%",background:`radial-gradient(circle, ${i}40 0%, ${i}10 70%, transparent 100%)`,animation:t?"innerGlow 1.5s ease-in-out infinite":"none"}}),T.jsx("div",{style:{position:"absolute",width:`${n*.35}px`,height:`${n*.35}px`,borderRadius:"50%",background:i,boxShadow:`0 0 ${n*.3}px ${i}60`,transition:"all 0.3s ease"}}),T.jsx("style",{children:`
|
|
383
|
+
@keyframes circularPulse {
|
|
384
|
+
0% { transform: scale(1); opacity: 0.4; }
|
|
385
|
+
100% { transform: scale(1.6); opacity: 0; }
|
|
386
|
+
}
|
|
387
|
+
@keyframes innerGlow {
|
|
388
|
+
0%, 100% { opacity: 0.6; transform: scale(1); }
|
|
389
|
+
50% { opacity: 1; transform: scale(1.1); }
|
|
390
|
+
}
|
|
391
|
+
`})]})},mx=({connected:t,voiceEnabled:e,agentState:n,screenShareEnabled:r=!1,isSpeaking:i=!1,audioLevels:o=[],onToggleConnection:s,onToggleMute:a,onToggleScreenShare:l,onToggleSidebar:c,sidebarOpen:d=!1,onResume:f,pausedSessionId:p,onStop:m,connectionProgress:b,isMinimized:v=!1,onExpand:S,onMinimize:y,isReturningUser:w=!1,showNewConversationOption:k=!1,onNewConversation:C})=>{const[E,M]=ye.useState(!w),[O,I]=ye.useState(!1),[H,z]=ye.useState(!1),te=ye.useRef(null);ye.useEffect(()=>{t&&!v&&M(!0)},[t,v]),ye.useEffect(()=>{w&&!t&&M(!1)},[w,t]);const he=ye.useCallback(j=>{j.key==="Enter"||j.key===" "?(j.preventDefault(),E||(M(!0),S==null||S())):j.key==="Escape"&&E&&t&&(M(!1),y==null||y())},[E,t,S,y]),Y=()=>{if(n==="connecting")return"#fbbf24";if(!e&&t&&n!=="speaking")return"#ef4444";switch(n){case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#a78bfa";case"paused":return"#f59e0b";case"minimized":return"#6b7280";default:return"#6b7280"}},Ge=()=>{if(n==="connecting")return(b==null?void 0:b.message)||"Connecting...";if(!e&&t&&n!=="speaking")return"Muted";switch(n){case"listening":return"Listening";case"thinking":return"Thinking";case"speaking":return"Speaking";case"guiding":return"Guiding";case"paused":return"Paused";case"minimized":return"Ready";default:return t?"Ready":w?"Click to start":"Offline"}},Me=()=>{E||(M(!0),S==null||S(),w&&!t&&s&&s())},Rt=()=>{M(!1),y==null||y()};if(!E)return T.jsxs("div",{ref:te,role:"button",tabIndex:0,"aria-label":w?"Start AI Assistant":"Expand AI Assistant",onClick:Me,onKeyDown:he,onMouseEnter:()=>{I(!0),z(!0)},onMouseLeave:()=>{I(!1),z(!1)},onFocus:()=>z(!0),onBlur:()=>z(!1),style:{position:"fixed",bottom:"24px",right:"24px",width:w&&!t?"64px":"56px",height:w&&!t?"64px":"56px",borderRadius:"50%",background:w&&!t?"linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%)":"linear-gradient(135deg, rgba(30, 30, 30, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%)",backdropFilter:"blur(20px)",border:w&&!t?"2px solid rgba(139, 92, 246, 0.5)":"1px solid rgba(255, 255, 255, 0.1)",boxShadow:w&&!t?"0 0 0 1px rgba(139, 92, 246, 0.3), 0 8px 32px rgba(139, 92, 246, 0.3), 0 0 60px rgba(139, 92, 246, 0.15)":"0 0 0 1px rgba(0, 0, 0, 0.3), 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:2147483645,pointerEvents:"all",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",transform:O?"scale(1.08)":"scale(1)",outline:"none"},children:[t&&n!=="idle"||w&&!t?T.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",border:`2px solid ${w&&!t?"#a78bfa":Y()}`,animation:"pulseRing 2s ease-out infinite",opacity:.6}}):null,w&&!t?T.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),T.jsx("path",{d:"M2 17l10 5 10-5"}),T.jsx("path",{d:"M2 12l10 5 10-5"})]}):T.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",background:Y(),boxShadow:`0 0 20px ${Y()}60`,transition:"all 0.3s ease"}}),H&&w&&!t&&T.jsxs("div",{style:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"12px",padding:"10px 16px",background:"rgba(0, 0, 0, 0.95)",borderRadius:"10px",fontSize:"13px",fontWeight:"500",color:"white",whiteSpace:"nowrap",pointerEvents:"none",animation:"tooltipFade 0.2s ease",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif'},children:["👋 Welcome back! Click to start",T.jsx("div",{style:{position:"absolute",bottom:"-6px",left:"50%",width:"12px",height:"12px",background:"rgba(0, 0, 0, 0.95)",transform:"translateX(-50%) rotate(45deg)"}})]}),T.jsx("style",{children:`
|
|
392
|
+
@keyframes pulseRing {
|
|
393
|
+
0% { transform: scale(1); opacity: 0.6; }
|
|
394
|
+
100% { transform: scale(1.4); opacity: 0; }
|
|
395
|
+
}
|
|
396
|
+
@keyframes tooltipFade {
|
|
397
|
+
from { opacity: 0; transform: translateX(-50%) translateY(4px); }
|
|
398
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
399
|
+
}
|
|
400
|
+
`})]});const dt=()=>n!=="connecting"||!b?null:T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"0 12px"},children:[T.jsx("div",{style:{width:"20px",height:"20px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),T.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px",minWidth:"140px"},children:[T.jsx("span",{style:{fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.9)"},children:b.message}),T.jsx("div",{style:{width:"100%",height:"3px",background:"rgba(255, 255, 255, 0.1)",borderRadius:"2px",overflow:"hidden"},children:T.jsx("div",{style:{width:`${b.progress}%`,height:"100%",background:"linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%)",borderRadius:"2px",transition:"width 0.3s ease"}})})]}),T.jsx("style",{children:`
|
|
401
|
+
@keyframes spin {
|
|
402
|
+
from { transform: rotate(0deg); }
|
|
403
|
+
to { transform: rotate(360deg); }
|
|
404
|
+
}
|
|
405
|
+
`})]});return T.jsxs("div",{ref:te,role:"toolbar","aria-label":"AI Assistant Controls",onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),style:{position:"fixed",bottom:"24px",right:"24px",background:"linear-gradient(135deg, rgba(30, 30, 30, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%)",backdropFilter:"blur(20px)",borderRadius:"16px",padding:"12px",border:"1px solid rgba(255, 255, 255, 0.08)",boxShadow:`
|
|
406
|
+
0 0 0 1px rgba(0, 0, 0, 0.3),
|
|
407
|
+
0 8px 32px rgba(0, 0, 0, 0.4),
|
|
408
|
+
0 24px 48px rgba(0, 0, 0, 0.2),
|
|
409
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.05)
|
|
410
|
+
`,display:"flex",alignItems:"center",gap:"8px",zIndex:2147483645,pointerEvents:"all",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",flexWrap:"wrap",maxWidth:"calc(100vw - 48px)"},children:[n==="connecting"?dt():T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"0 8px",minWidth:"120px"},children:[T.jsxs("div",{style:{position:"relative"},children:[T.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:Y(),boxShadow:`0 0 12px ${Y()}80`,transition:"all 0.3s ease"}}),t&&n!=="idle"&&T.jsx("div",{style:{position:"absolute",top:"-3px",left:"-3px",width:"16px",height:"16px",borderRadius:"50%",border:`1.5px solid ${Y()}`,animation:"statusPulse 2s ease-out infinite"}})]}),t&&e&&(n==="speaking"||n==="listening")?T.jsx(hx,{isActive:i,color:Y(),height:24,barCount:5,audioLevels:o}):T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[!e&&t&&n!=="speaking"&&T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),T.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),T.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"})]}),T.jsx("span",{style:{fontSize:"12px",fontWeight:"600",color:!e&&t&&n!=="speaking"?"#ef4444":"rgba(255, 255, 255, 0.7)",letterSpacing:"0.02em",textTransform:!e&&t&&n!=="speaking"?"uppercase":"none"},children:Ge()})]})]}),T.jsx("div",{style:{width:"1px",height:"28px",background:"rgba(255, 255, 255, 0.1)"}}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[n==="paused"&&f&&T.jsx(rr,{onClick:f,active:!0,activeColor:"#34d399",tooltip:"Resume Session",ariaLabel:"Resume session",children:T.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),n==="paused"&&m&&T.jsx(rr,{onClick:m,active:!1,activeColor:"#ef4444",tooltip:"End Session",ariaLabel:"End session",children:T.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),n!=="paused"&&n!=="connecting"&&T.jsx(rr,{onClick:s,active:t,activeColor:"#34d399",tooltip:t?"End Session":"Connect",ariaLabel:t?"End session":"Connect",children:t?T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),T.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}):T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M5 12.55a11 11 0 0 1 14.08 0"}),T.jsx("path",{d:"M1.42 9a16 16 0 0 1 21.16 0"}),T.jsx("path",{d:"M8.53 16.11a6 6 0 0 1 6.95 0"}),T.jsx("circle",{cx:"12",cy:"20",r:"1"})]})}),n==="connecting"&&T.jsx(rr,{onClick:s,active:!1,activeColor:"#ef4444",tooltip:"Cancel",ariaLabel:"Cancel connection",children:T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),T.jsxs("div",{style:{position:"relative"},children:[T.jsx(rr,{onClick:a,disabled:!t,active:e,activeColor:e?"#60a5fa":"#ef4444",tooltip:e?"Mute":"Unmute",ariaLabel:e?"Mute microphone":"Unmute microphone",isMuted:!e&&t,children:e?T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),T.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),T.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),T.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}):T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),T.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),T.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"}),T.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),T.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}),!e&&t&&n!=="speaking"&&T.jsx("div",{style:{position:"absolute",top:"-4px",right:"-4px",width:"12px",height:"12px",borderRadius:"50%",background:"#ef4444",border:"2px solid rgba(30, 30, 30, 0.95)",boxShadow:"0 0 8px #ef444480"}})]}),T.jsx(rr,{onClick:l,disabled:!t,active:r,activeColor:"#a78bfa",tooltip:r?"Stop Share":"Share Screen",ariaLabel:r?"Stop screen share":"Share screen",children:r?T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),T.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),T.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),T.jsx("path",{d:"M12 11V7l3 2-3 2z",fill:"currentColor"})]}):T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),T.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),T.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),T.jsx("div",{style:{width:"1px",height:"28px",background:"rgba(255, 255, 255, 0.1)",margin:"0 4px"}}),T.jsx(rr,{onClick:c,active:d,activeColor:"#fbbf24",tooltip:d?"Hide Transcript":"Show Transcript",ariaLabel:d?"Hide transcript":"Show transcript",children:T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.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"}),T.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"9"}),T.jsx("line",{x1:"9",y1:"13",x2:"13",y2:"13"})]})}),T.jsx(rr,{onClick:Rt,tooltip:"Minimize",ariaLabel:"Minimize control panel",children:T.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})]}),T.jsx("style",{children:`
|
|
411
|
+
@keyframes statusPulse {
|
|
412
|
+
0% { transform: scale(1); opacity: 0.6; }
|
|
413
|
+
100% { transform: scale(1.8); opacity: 0; }
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* Responsive styles */
|
|
417
|
+
@media (max-width: 480px) {
|
|
418
|
+
/* On mobile, the control hub should be more compact */
|
|
419
|
+
}
|
|
420
|
+
`})]})},rr=({onClick:t,disabled:e=!1,active:n=!1,activeColor:r="#60a5fa",tooltip:i,ariaLabel:o,isMuted:s=!1,children:a})=>{const[l,c]=ye.useState(!1),[d,f]=ye.useState(!1),p=()=>s?"rgba(239, 68, 68, 0.2)":n?`${r}20`:(l||d)&&!e?"rgba(255, 255, 255, 0.08)":"transparent",m=()=>s?"#ef4444":n?r:e?"rgba(255, 255, 255, 0.3)":"rgba(255, 255, 255, 0.7)";return T.jsxs("div",{style:{position:"relative"},children:[T.jsx("button",{onClick:t,disabled:e,"aria-label":o,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>f(!0),onBlur:()=>f(!1),style:{width:"36px",height:"36px",borderRadius:"10px",border:s?"1px solid rgba(239, 68, 68, 0.3)":d?"2px solid rgba(255, 255, 255, 0.3)":"none",background:p(),color:m(),cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:e?.5:1,boxShadow:s?"0 0 12px rgba(239, 68, 68, 0.2)":"none"},children:a}),i&&(l||d)&&!e&&T.jsx("div",{style:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px",padding:"6px 10px",background:"rgba(0, 0, 0, 0.9)",borderRadius:"6px",fontSize:"11px",fontWeight:"500",color:"rgba(255, 255, 255, 0.9)",whiteSpace:"nowrap",pointerEvents:"none",animation:"tooltipFade 0.15s ease"},children:i}),T.jsx("style",{children:`
|
|
421
|
+
@keyframes tooltipFade {
|
|
422
|
+
from { opacity: 0; transform: translateX(-50%) translateY(4px); }
|
|
423
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
424
|
+
}
|
|
425
|
+
`})]})},vx=({isOpen:t,agentState:e,connected:n,messages:r,currentTranscript:i="",currentRole:o,onClose:s,onResume:a})=>{const l=ye.useRef(null),[c,d]=ye.useState(!1);ye.useEffect(()=>{var m;(m=l.current)==null||m.scrollIntoView({behavior:"smooth"})},[r,i]),ye.useEffect(()=>{t&&d(!0)},[t]);const f=()=>{switch(e){case"listening":return"Listening...";case"thinking":return"Thinking...";case"speaking":return"Speaking...";case"guiding":return"Guiding you...";case"paused":return"Session Paused";default:return n?"Ready to help":"Offline"}},p=()=>{switch(e){case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#a78bfa";case"paused":return"#f59e0b";default:return"#6b7280"}};return!t&&!c?null:T.jsx(T.Fragment,{children:T.jsxs("div",{onTransitionEnd:()=>!t&&d(!1),style:{position:"fixed",bottom:"88px",right:"16px",width:"340px",maxHeight:"min(50vh, 600px)",minHeight:"200px",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:`
|
|
426
|
+
0 0 0 1px rgba(0, 0, 0, 0.3),
|
|
427
|
+
0 24px 48px rgba(0, 0, 0, 0.5),
|
|
428
|
+
0 12px 24px rgba(0, 0, 0, 0.3),
|
|
429
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.05)
|
|
430
|
+
`,display:"flex",flexDirection:"column",zIndex:2147483644,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:[T.jsxs("div",{style:{padding:"20px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[T.jsx(gx,{isActive:n&&e!=="idle",state:e,size:40}),T.jsxs("div",{children:[T.jsx("div",{style:{fontSize:"14px",fontWeight:"600",color:"rgba(255, 255, 255, 0.95)",marginBottom:"2px"},children:"AI Assistant"}),T.jsxs("div",{style:{fontSize:"12px",color:p(),fontWeight:"500",display:"flex",alignItems:"center",gap:"6px"},children:[T.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:p(),boxShadow:`0 0 8px ${p()}`}}),f()]})]})]}),T.jsx("button",{onClick:s,style:{width:"32px",height:"32px",borderRadius:"8px",border:"none",background:"rgba(255, 255, 255, 0.06)",color:"rgba(255, 255, 255, 0.6)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.background="rgba(255, 255, 255, 0.1)",m.currentTarget.style.color="rgba(255, 255, 255, 0.9)"},onMouseLeave:m=>{m.currentTarget.style.background="rgba(255, 255, 255, 0.06)",m.currentTarget.style.color="rgba(255, 255, 255, 0.6)"},children:T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e==="paused"&&T.jsxs("div",{style:{padding:"16px 20px",background:"rgba(245, 158, 11, 0.1)",borderBottom:"1px solid rgba(245, 158, 11, 0.2)",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[T.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#f59e0b",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("circle",{cx:"12",cy:"12",r:"10"}),T.jsx("line",{x1:"10",y1:"15",x2:"10",y2:"9"}),T.jsx("line",{x1:"14",y1:"15",x2:"14",y2:"9"})]}),T.jsx("span",{style:{color:"#f59e0b",fontSize:"14px",fontWeight:"600"},children:"Session Paused"})]}),T.jsx("div",{style:{color:"rgba(255, 255, 255, 0.6)",fontSize:"12px",textAlign:"center",lineHeight:"1.5"},children:"You were inactive. Click Resume to continue where you left off."}),a&&T.jsxs("button",{onClick:a,style:{padding:"10px 24px",background:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",border:"none",borderRadius:"8px",color:"white",fontSize:"14px",fontWeight:"600",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",boxShadow:"0 4px 12px rgba(245, 158, 11, 0.3)",transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.transform="scale(1.02)",m.currentTarget.style.boxShadow="0 6px 16px rgba(245, 158, 11, 0.4)"},onMouseLeave:m=>{m.currentTarget.style.transform="scale(1)",m.currentTarget.style.boxShadow="0 4px 12px rgba(245, 158, 11, 0.3)"},children:[T.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:T.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Resume Session"]})]}),T.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px",display:"flex",flexDirection:"column",gap:"16px"},children:[r.length===0&&!i?T.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"40px 20px",color:"rgba(255, 255, 255, 0.4)"},children:[T.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{marginBottom:"16px",opacity:.5},children:T.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"})}),T.jsx("div",{style:{fontSize:"14px",fontWeight:"500",marginBottom:"8px"},children:"No messages yet"}),T.jsx("div",{style:{fontSize:"12px",lineHeight:"1.5"},children:"Start speaking or connect to begin your conversation"})]}):T.jsxs(T.Fragment,{children:[r.map(m=>T.jsx(ny,{message:m},m.id)),i&&o&&T.jsx(ny,{message:{id:"current",role:o,content:i,timestamp:Date.now(),isPartial:!0}})]}),T.jsx("div",{ref:l})]}),T.jsx("div",{style:{padding:"16px 20px",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},children:T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px 16px",background:"rgba(255, 255, 255, 0.04)",borderRadius:"12px",border:"1px solid rgba(255, 255, 255, 0.06)"},children:[T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255, 255, 255, 0.4)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),T.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),T.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),T.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),T.jsx("span",{style:{fontSize:"13px",color:"rgba(255, 255, 255, 0.4)",flex:1},children:"Voice input active..."}),n&&T.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#34d399",boxShadow:"0 0 8px #34d39980",animation:"pulse 2s ease-in-out infinite"}})]})}),T.jsx("style",{children:`
|
|
431
|
+
@keyframes pulse {
|
|
432
|
+
0%, 100% { opacity: 1; }
|
|
433
|
+
50% { opacity: 0.5; }
|
|
434
|
+
}
|
|
435
|
+
`})]})})},ny=({message:t})=>{const e=t.role==="user";return T.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:e?"flex-end":"flex-start",animation:"messageSlide 0.3s ease-out"},children:[T.jsx("div",{style:{fontSize:"10px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",color:"rgba(255, 255, 255, 0.4)",marginBottom:"6px",paddingLeft:e?"0":"12px",paddingRight:e?"12px":"0"},children:e?"You":"Assistant"}),T.jsxs("div",{style:{maxWidth:"90%",padding:"12px 16px",borderRadius:e?"16px 16px 4px 16px":"16px 16px 16px 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&&T.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&&T.jsx("div",{style:{fontSize:"10px",color:"rgba(255, 255, 255, 0.3)",marginTop:"4px",paddingLeft:e?"0":"12px",paddingRight:e?"12px":"0"},children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),T.jsx("style",{children:`
|
|
436
|
+
@keyframes messageSlide {
|
|
437
|
+
from {
|
|
438
|
+
opacity: 0;
|
|
439
|
+
transform: translateY(8px);
|
|
440
|
+
}
|
|
441
|
+
to {
|
|
442
|
+
opacity: 1;
|
|
443
|
+
transform: translateY(0);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
@keyframes blink {
|
|
447
|
+
0%, 100% { opacity: 1; }
|
|
448
|
+
50% { opacity: 0; }
|
|
449
|
+
}
|
|
450
|
+
`})]})},yx=({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:p=[],onResume:m,pausedSessionId:b,onStop:v,connectionProgress:S,isReturningUser:y=!1,onMinimize:w,onExpand:k})=>{const[C,E]=ye.useState(!y);ye.useEffect(()=>{console.log("[AgentUI] Rendering with state:",{connected:t,agentState:n,voiceEnabled:e,screenShareEnabled:o,sidebarOpen:C,historyCount:p.length,botTranscript:r==null?void 0:r.substring(0,30),userTranscript:i==null?void 0:i.substring(0,30)})},[t,n,e,o,C,p.length,r,i]);const{currentTranscript:M,currentRole:O}=ye.useMemo(()=>n==="speaking"&&r?{currentTranscript:r,currentRole:"assistant"}:n==="listening"&&i?{currentTranscript:i,currentRole:"user"}:{currentTranscript:"",currentRole:void 0},[n,r,i]),I=ye.useCallback(()=>{E(H=>!H)},[]);return T.jsxs(T.Fragment,{children:[T.jsx(mx,{connected:t,voiceEnabled:e,agentState:n,screenShareEnabled:o,isSpeaking:s||a,audioLevels:l,onToggleConnection:c,onToggleMute:d,onToggleScreenShare:f,onToggleSidebar:I,sidebarOpen:C,onResume:m,pausedSessionId:b,onStop:v,connectionProgress:S,isReturningUser:y,onMinimize:w,onExpand:k}),T.jsx(vx,{isOpen:C,agentState:n,connected:t,messages:p,currentTranscript:M,currentRole:O,onClose:()=>E(!1),onResume:m}),T.jsx("style",{children:`
|
|
451
|
+
/* Smooth scrollbar for sidebar */
|
|
452
|
+
#onboarding-sdk-react-ui *::-webkit-scrollbar {
|
|
453
|
+
width: 6px;
|
|
454
|
+
}
|
|
455
|
+
#onboarding-sdk-react-ui *::-webkit-scrollbar-track {
|
|
456
|
+
background: transparent;
|
|
457
|
+
}
|
|
458
|
+
#onboarding-sdk-react-ui *::-webkit-scrollbar-thumb {
|
|
459
|
+
background: rgba(255, 255, 255, 0.1);
|
|
460
|
+
border-radius: 3px;
|
|
461
|
+
}
|
|
462
|
+
#onboarding-sdk-react-ui *::-webkit-scrollbar-thumb:hover {
|
|
463
|
+
background: rgba(255, 255, 255, 0.2);
|
|
464
|
+
}
|
|
465
|
+
`})]})},xt=class xt{constructor(){L(this,"refCounters",{});L(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(xt.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 xt.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,p)=>a(p)-a(f));for(const f of d){if(n.has(f))continue;let p=!1;for(const m of r)if(f.contains(m)&&f!==m){const b=l(f),v=l(m);if(b==="card"||b==="listitem"||b==="option"){if(!c(f)){p=!0;break}}else if(b===v){p=!0;break}}if(!p){for(const m of r)if(m.contains(f)&&m!==f){const b=c(f),v=c(m);if(!b||b===v){p=!0;break}}}p||(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,p,m,b,v,S;const n=e.getAttribute("aria-labelledby");if(n){const y=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(y.length)return y.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 y=this.getInputLabel(e);if(y)return y;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=(p=e.getAttribute("title"))==null?void 0:p.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 y=(b=(m=a.querySelector("title"))==null?void 0:m.textContent)==null?void 0:b.trim();if(y)return y.slice(0,100);const w=(S=(v=a.querySelector("desc"))==null?void 0:v.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(`
|
|
466
|
+
`);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 xt.INPUT_TYPE_ROLES[i]||"textbox"}return r==="a"?e.hasAttribute("href")?"link":"":xt.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,p,m,b,v;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 y=o.querySelector(':scope > [class*="title"], :scope > [class*="Title"], :scope > [class*="header"] > *');if(y)return((p=y.textContent)==null?void 0:p.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=(m=s.textContent)==null?void 0:m.trim();if(S&&S.length<50)return S}const a=(b=e.parentElement)==null?void 0:b.previousElementSibling;if(a&&a.matches('p, label, [class*="label"], [class*="Label"]')){const S=(v=a.textContent)==null?void 0:v.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=xt.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=xt.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))}};L(xt,"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"}),L(xt,"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"}),L(xt,"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"}),L(xt,"INTERACTIVE_SELECTOR",`
|
|
467
|
+
button,
|
|
468
|
+
a[href],
|
|
469
|
+
input:not([type="hidden"]),
|
|
470
|
+
select,
|
|
471
|
+
textarea,
|
|
472
|
+
[role="button"],
|
|
473
|
+
[role="link"],
|
|
474
|
+
[role="tab"],
|
|
475
|
+
[role="menuitem"],
|
|
476
|
+
[role="option"],
|
|
477
|
+
[role="checkbox"],
|
|
478
|
+
[role="radio"],
|
|
479
|
+
[role="switch"],
|
|
480
|
+
[role="combobox"],
|
|
481
|
+
[role="listbox"],
|
|
482
|
+
[role="slider"],
|
|
483
|
+
[role="spinbutton"],
|
|
484
|
+
[role="searchbox"],
|
|
485
|
+
[role="textbox"],
|
|
486
|
+
[tabindex]:not([tabindex="-1"]),
|
|
487
|
+
[contenteditable="true"],
|
|
488
|
+
summary
|
|
489
|
+
`.replace(/\s+/g," ").trim()),L(xt,"SKIP_SELECTORS",["#onboarding-overlay","#onboarding-sdk-react-ui","#hse-highlight-element","script","style","noscript","template"]);let fd=xt;const bx=["#onboarding-overlay","#floe-cursor","#onboarding-sdk-react-ui","#hse-highlight-element","#floe-cursor-styles","#onboarding-animations"],Ai="data-floe-widget";function an(t){if(!t)return!1;if(t.hasAttribute(Ai))return!0;for(const e of bx)if(t.closest(e))return!0;return!1}function Rr(){return window.location.origin+window.location.pathname}class ry{constructor(){L(this,"audioContext",null);L(this,"analyzerNode",null);L(this,"sourceNode",null);L(this,"dataArray",new Uint8Array(0));L(this,"isRunning",!1);L(this,"onLevelsCallback",null);L(this,"animationId",null);L(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 wx{constructor(){L(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){return this.events[e]?(this.events[e].forEach(r=>r(...n)),!0):!1}}class Sx{constructor(){L(this,"lastSnapshot",null);L(this,"lastSnapshotHash","");L(this,"snapshotInterval",null);L(this,"sendCallback",null);L(this,"correlationCounter",0);L(this,"INTERACTIVE_TAGS",new Set(["button","a","input","select","textarea","label","summary","details","option","menuitem"]));L(this,"INTERACTIVE_ROLES",new Set(["button","link","menuitem","option","tab","checkbox","radio","switch","textbox","combobox","listbox","slider"]));L(this,"mutationObserver",null);L(this,"mutationDebounceTimer",null)}startCapturing(e=1500,n){console.log(`[DOMIntrospector] Starting DOM capture every ${e}ms`),this.sendCallback=n,this.captureAndSend(),this.snapshotInterval=window.setInterval(()=>{this.captureAndSend()},e),this.setupMutationObserver()}stopCapturing(){this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=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.captureAndSend()},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){return e.elements.slice(0,50).map(r=>{var i;return`${r.tag}:${(i=r.text)==null?void 0:i.slice(0,20)}:${Math.round(r.rect.x)}:${Math.round(r.rect.y)}`}).join("|")}captureSnapshot(){const e=[],n={width:window.innerWidth,height:window.innerHeight},r=document.body.querySelectorAll("*");let i=0,o=0;return r.forEach(s=>{var p;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:((p=a.parentElement)==null?void 0:p.tagName.toLowerCase())||null,depth:this.getElementDepth(a)};e.push(f)}),{timestamp:Date.now(),url:Rr(),viewport:n,elements:e,totalElements:e.length,interactiveCount:o}}shouldSkipElement(e){if(an(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 v;const c=l;if(this.shouldSkipElement(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x)<=10,p=Math.abs(d.y-e.y)<=10,m=Math.abs(d.width-e.width)<=10*2,b=Math.abs(d.height-e.height)<=10*2;if(f&&p&&m&&b){let S=100,y=!1;if(n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r){const w=((v=c.innerText)==null?void 0:v.trim().toLowerCase())||"",k=r.toLowerCase();w===k?(S+=50,y=!0):(w.includes(k)||k.includes(w))&&(S+=25,y=!0)}else y=!0;o.push({element:c,score:S,textMatch:y})}}),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 p of r){const m=this.executeStrategyMulti(p,e);for(const b of m)an(b)||b.isConnected&&(i.has(b)?i.get(b).strategies.push(p):i.set(b,{element:b,strategies:[p],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[p,m]of i){if(!p.isConnected){console.warn("[HybridTargetResolver] ⚠️ Candidate element was removed from DOM, skipping");continue}m.validationScore=this.computeValidationScore(p,e),m.interactable=this.checkInteractability(p).ok,m.confidence=this.computeConfidence(m,r.length,e),o.push(m),console.log(`[HybridTargetResolver] <${p.tagName.toLowerCase()}> "${(f=p.textContent)==null?void 0:f.slice(0,25)}..."`),console.log(`[HybridTargetResolver] Strategies: ${m.strategies.join(", ")} (${m.strategies.length}/${r.length})`),console.log(`[HybridTargetResolver] Confidence: ${m.confidence.toFixed(1)}%`)}if(o.length===0)return{element:null,confidence:0,strategies:[],candidateCount:i.size,ambiguous:!1,duration:performance.now()-n};o.sort((p,m)=>m.confidence-p.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 p=o.find(m=>m.interactable);if(p&&p.confidence>30)return console.log(`[HybridTargetResolver] ✅ Using interactable candidate (${p.confidence.toFixed(1)}%)`),{element:this.getClickableContainer(p.element),confidence:p.confidence,strategies:p.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(s=>!!s&&this.isValidCSSSelector(s));for(const s of o)try{document.querySelectorAll(s).forEach(a=>i.add(a))}catch{console.warn(`[HybridTargetResolver] querySelectorAll failed for: "${s.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){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(text())=${a}]`;try{const d=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let f=0;f<d.snapshotLength;f++){const p=d.snapshotItem(f);p&&!this.isDropdownDisplayValue(p)&&!i.has(p)&&(r.push(p),i.add(p))}}catch{}const c=`//${s}[contains(normalize-space(text()), ${a})]`;try{const d=document.evaluate(c,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let f=0;f<d.snapshotLength;f++){const p=d.snapshotItem(f);p&&!this.isDropdownDisplayValue(p)&&!i.has(p)&&(r.push(p),i.add(p))}}catch{}return r}static computeValidationScore(e,n){var c,d,f;let r=0,i=0,o=!1,s=!1;if(n.role){i+=25;const p=e.getAttribute("role");if(p===n.role)r+=25;else if(p)o=!0;else{const m=e.tagName.toLowerCase(),b=typeof e.className=="string"?e.className:"";m==="div"||m==="span"||e.classList.contains("container")||b.includes("control")||b.includes("wrapper")?r+=10:s=!0}}if(n.role==="combobox"&&e.querySelector('[role="combobox"]')&&(r+=10,i+=10),n.tag){i+=15;const p=e.tagName.toLowerCase(),m=n.tag.toLowerCase();p===m?r+=15:n.role==="combobox"&&(p==="input"||p==="div")&&(r+=10)}if(n.text&&!n.optionText){i+=20;const p=(e.textContent||"").toLowerCase().trim(),m=n.text.toLowerCase().trim();if(n.role==="combobox"&&e.tagName.toLowerCase()==="input"){const b=(c=e.closest('.css-6lmz24, [class*="value-container"], [class*="placeholder"]'))==null?void 0:c.parentElement,v=b==null?void 0:b.querySelector('[class*="placeholder"], [id*="placeholder"]'),S=((d=v==null?void 0:v.textContent)==null?void 0:d.toLowerCase().trim())||"";(S===m||S.includes(m))&&(r+=20)}else if(p===m)r+=20;else if(p.includes(m)){const b=m.length/p.length;b>.8?r+=15:b>.5?r+=8:(new RegExp(`\\b${ir.escapeRegex(m)}\\b`,"i").test(p)?r+=2:r+=0,console.log(`[HybridTargetResolver] Text length mismatch: "${m}" (${m.length}) in "${p.slice(0,30)}..." (${p.length}), ratio=${b.toFixed(2)}, points=${r}`))}else if(m.includes(p)){const b=p.length/m.length;r+=Math.round(15*b)}}if(n.ariaLabel){i+=15;const p=e.getAttribute("aria-label")||"";p.toLowerCase()===n.ariaLabel.toLowerCase()?r+=15:p.toLowerCase().includes(n.ariaLabel.toLowerCase())&&(r+=10)}if(n.placeholder){i+=15;const p=e.placeholder||"",m=n.placeholder.toLowerCase();if(p.toLowerCase().includes(m))r+=15;else if(n.role==="combobox"){const b=e.closest('[class*="container"]')||e.parentElement,v=b==null?void 0:b.querySelector('[class*="placeholder"], [id*="placeholder"]');(((f=v==null?void 0:v.textContent)==null?void 0:f.toLowerCase().trim())||"").includes(m)&&(r+=15)}}if(n.labelText){i+=20;const p=this.getAssociatedLabelText(e);if(p){const m=p.toLowerCase().trim().replace(/\*$/,"").trim(),b=n.labelText.toLowerCase().trim().replace(/\*$/,"").trim();m===b?r+=20:(m.includes(b)||b.includes(m))&&(r+=15)}}if(n.optionText){i+=15;const m=(e.textContent||"").trim().toLowerCase(),b=n.optionText.toLowerCase().trim();m===b?r+=15:m.includes(b)&&(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 p=this.extractSelectorContext(n.selector);if(p.parentTag||p.parentSelector){const m=this.matchesSelectorContext(e,p);m>.5?a=Math.min(100,Math.round(a*1.15)):m<.5&&n.text&&(a=Math.round(a*.7))}}if(n.text){const p=e.tagName.toLowerCase(),m=e.getAttribute("role"),b=["button","a","input","select","textarea"].includes(p),v=["button","link","menuitem","option","tab","checkbox","radio"].includes(m||""),S=e.onclick!==null||e.hasAttribute("onclick"),y=e.closest('button, a, [role="button"], [role="link"]');b||v?(a=Math.min(100,Math.round(a*1.25)),console.log(`[HybridTargetResolver] Interactive element bonus (25%): <${p}> is natively interactive`)):y?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 v;const c=l;if(an(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x),p=Math.abs(d.y-e.y),m=Math.abs(d.width-e.width),b=Math.abs(d.height-e.height);if(f<=i&&p<=i&&m<=i*2&&b<=i*2){let S=100-f-p;n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r&&(((v=c.innerText)==null?void 0:v.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 p=document.getElementById(f);if(p)return((a=p.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 m=(l=f.textContent)==null?void 0:l.trim().replace(/\*$/,"").trim();if(m&&m.length>0&&m.length<50)return m}else if(this.isLabelForElement(f,e,i)){const m=(c=f.textContent)==null?void 0:c.trim().replace(/\*$/,"").trim();if(m&&m.length>0&&m.length<50)return m}}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),p=Math.abs(o.left-i.right);if(f<p&&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,p=f.getAttribute("placeholder")||"",m=f.getAttribute("aria-label")||"",b=f.id||"";console.log(`[HybridTargetResolver] ${d}: id="${b}" placeholder="${p}" aria-label="${m}"`)}))}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"]'],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 m=d.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]):not([class*="placeholder"])');for(const b of m){const v=b,S=v.className||"";if(i.some(k=>S.toLowerCase().includes(k.toLowerCase()))){console.log(`[HybridTargetResolver] → Skipping display value: "${(o=v.textContent)==null?void 0:o.trim().substring(0,30)}..."`);continue}if(!v.closest('[role="listbox"], [role="menu"], [class*="-menu"]'))continue;const w=((s=v.textContent)==null?void 0:s.trim().toLowerCase())||"";if(w===n||w.includes(n))return console.log(`[HybridTargetResolver] → Found ACTUAL option in open menu: "${(a=v.textContent)==null?void 0:a.trim()}"`),v}}}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 p of f){const m=l.querySelector(p);if(m&&this.isVisible(m))return console.log(`[HybridTargetResolver] → Found remove button: <${m.tagName.toLowerCase()}> with selector "${p}"`),m}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 m,b,v;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),p=S=>{const y=S,w=y.getBoundingClientRect();if(w.width===0||w.height===0)return!1;if(!y.offsetParent)try{const C=window.getComputedStyle(y).position;if(C!=="fixed"&&C!=="sticky")return!1}catch{return!1}return!0};for(const S of l){if(!p(S))continue;const y=S.getAttribute("id");if(y)try{const O=document.querySelector(`label[for="${CSS.escape(y)}"]`);if(O&&f(O.textContent||""))return console.log("[HybridTargetResolver] → Found via label[for] attribute"),S}catch{}const w=S.getAttribute("aria-labelledby");if(w){const O=w.split(/\s+/).filter(I=>I.length>0);for(const I of O){const H=document.getElementById(I);if(H&&f(H.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,M=0;for(;E&&M<6;){const O=E.querySelectorAll('input, select, textarea, [role="combobox"], [role="listbox"]'),I=Array.from(O),H=I.includes(S),z=E.classList.contains("MuiFormControl-root")||E.tagName==="FIELDSET"||/form(-|_)?(field|group|control|item|row)/i.test(E.className)||E.childElementCount>=2&&E.childElementCount<=5,te=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 he of te){if(S.contains(he)||he.contains(S)||he.querySelector('input, select, textarea, [role="combobox"]'))continue;const Y=((m=he.textContent)==null?void 0:m.trim())||"";if(!(Y.length>50)&&f(Y)){if(O.length===1&&H)return console.log(`[HybridTargetResolver] → Found via label in container: "${Y}"`),S;if(H&&this.isTextNearElement(he,S,I))return console.log(`[HybridTargetResolver] → Found via label position: "${Y}"`),S}}if(z||M>=3){const he=E.querySelectorAll(":scope > div, :scope > span, :scope > p, :scope > div > div, :scope > div > span, :scope > div > p");for(const Y of he){if(Y.querySelector('input, select, textarea, [role="combobox"]')||Y.contains(S)||S.contains(Y))continue;const Ge=S.value||"";if(Ge&&((b=Y.textContent)==null?void 0:b.trim())===Ge)continue;const Me=((v=Y.textContent)==null?void 0:v.trim())||"";if(Me.length>0&&Me.length<=30&&f(Me)){if(O.length===1&&H)return console.log(`[HybridTargetResolver] → Found via nearby text: "${Me}"`),S;if(H&&this.isTextNearElement(Y,S,I))return console.log(`[HybridTargetResolver] → Found via nearby text (position): "${Me}"`),S}}}E=E.parentElement,M++}}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 S,y,w,k,C;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 E=this.findElementByLabelText(i,r);if(E)return console.log(`[HybridTargetResolver] → Found element matching selector "${r}" associated with label "${i}"`),E}const l=`//${s}[normalize-space(text())=${a}]`;console.log(`[HybridTargetResolver] → XPath exact query: ${l}`);let c;try{c=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(E){console.warn("[HybridTargetResolver] → XPath query failed:",E),c={snapshotLength:0,snapshotItem:()=>null}}if(c.snapshotLength>0){console.log(`[HybridTargetResolver] → Found ${c.snapshotLength} exact match(es), checking visibility...`);let E=null,M=null;for(let O=0;O<c.snapshotLength;O++){const I=c.snapshotItem(O);if(M||(M=I),this.isDropdownDisplayValue(I)){console.log(`[HybridTargetResolver] → Skipping display value (not an option): "${(S=I.textContent)==null?void 0:S.trim().substring(0,30)}..."`);continue}const H=I.getBoundingClientRect();if(H.width>0&&H.height>0){E=I,console.log(`[HybridTargetResolver] → Returning visible match ${O}: "${(y=I.textContent)==null?void 0:y.trim().substring(0,30)}..."`);break}}if(E)return E;if(M&&!this.isDropdownDisplayValue(M))return console.log("[HybridTargetResolver] → No visible matches, returning first (possibly hidden) element"),M}console.log("[HybridTargetResolver] → No exact match, trying partial match...");const d=`//${s}[contains(normalize-space(text()), ${a})]`;console.log(`[HybridTargetResolver] → XPath partial query: ${d}`);let f;try{f=document.evaluate(d,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(E){console.warn("[HybridTargetResolver] → XPath partial query failed:",E),f={snapshotLength:0,snapshotItem:()=>null}}if(f.snapshotLength>0){let E=null,M=-1;const O=r?this.extractSelectorContext(r):{},I=!!(O.parentTag||O.parentSelector);console.log(`[HybridTargetResolver] → Selector context: parentTag="${O.parentTag||"none"}", expectedTag="${O.expectedTag||"none"}"`);for(let H=0;H<f.snapshotLength;H++){const z=f.snapshotItem(H),te=(z.textContent||"").trim();if(te.length===0)continue;const he=te.toLowerCase(),Y=o.length/he.length,Ge=z.getBoundingClientRect();if(Ge.width===0||Ge.height===0||this.isDropdownDisplayValue(z))continue;let Me=Y;if(new RegExp(`\\b${ir.escapeRegex(o)}\\b`,"i").test(he))Me+=.5;else if(Y<.5)if(I){if(this.matchesSelectorContext(z,O)<.5){console.log(`[HybridTargetResolver] → Skipping low ratio match that doesn't match selector context: "${te.slice(0,30)}..."`);continue}}else{console.log(`[HybridTargetResolver] → Skipping low ratio match (${Y.toFixed(2)}): "${te.slice(0,30)}..."`);continue}if(I){const j=this.matchesSelectorContext(z,O);Me+=j*.3}Me>M&&(M=Me,E=z)}if(E)return console.log(`[HybridTargetResolver] → XPath partial match found (score=${M.toFixed(2)})!`),E}console.log("[HybridTargetResolver] → XPath found nothing, trying fallback...");const p=document.querySelectorAll(n||"*");console.log(`[HybridTargetResolver] → Fallback: checking ${p.length} <${n||"*"}> elements for text "${i}"`);const m=E=>{const M=E;return an(M)?!0:M.id==="root"||M.id==="app"||M.id==="__next"||M.tagName==="BODY"||M.tagName==="HTML"};for(const E of p){if(m(E)||(((w=E.textContent)==null?void 0:w.trim().toLowerCase())||"")!==o)continue;const O=E.getBoundingClientRect();if(O.width>0&&O.height>0&&(((k=E.innerText)==null?void 0:k.trim().toLowerCase())||"")===o)return console.log("[HybridTargetResolver] → Found via exact text match"),E}let b=null,v=-1/0;for(const E of p){if(m(E))continue;const M=((C=E.textContent)==null?void 0:C.trim().toLowerCase())||"";if(M.length!==0&&M.includes(o)){const O=o.length/M.length,I=E.getBoundingClientRect(),H=I.width*I.height;if(H>0&&H<5e5){const z=Math.max(0,50-H/1e4),te=O*50,he=z+te;he>v&&(v=he,b=E)}}}if(b){const E=b.getBoundingClientRect();return console.log(`[HybridTargetResolver] → Found via textContent (${E.width.toFixed(0)}x${E.height.toFixed(0)}px, score=${v.toFixed(0)})`),b}return 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 p=f;if(p.id==="root"||p.id==="app"||p.tagName==="BODY"||p.tagName==="HTML"||!ir.isVisible(p)||(((i=p.innerText)==null?void 0:i.length)||0)>200)continue;const b=((o=p.innerText)==null?void 0:o.trim())||"",v=b.toLowerCase();if(v===a){console.log(`[HybridTargetResolver] → Found exact match: "${b.substring(0,50)}..."`),l=p;break}if(v.includes(a)){const S=a.length/v.length;S>.7&&S>d&&(c=p,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(p=>setTimeout(p,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}};L(ir,"domIntrospector",null);let pe=ir;class kx{constructor(e){L(this,"piiPatterns");this.piiPatterns={email:/[\w.-]+@[\w.-]+\.\w+/g,phone:/[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}/g,ssn:/\d{3}-\d{2}-\d{4}/g,creditCard:/\d{4}[\s.-]?\d{4}[\s.-]?\d{4}[\s.-]?\d{4}/g,...e}}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.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,p=0;for(let b=-o;b<=o;b++)for(let v=-o;v<=o;v++){const S=a+v,y=s+b;if(S>=0&&S<n.width&&y>=0&&y<n.height){const w=(y*n.width+S)*4;l+=i[w],c+=i[w+1],d+=i[w+2],f+=i[w+3],p++}}const m=(s*n.width+a)*4;i[m]=l/p,i[m+1]=c/p,i[m+2]=d/p,i[m+3]=f/p}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:p,rect:m}of f){const b=this.containsPII(p.textContent||"");b.contains&&s.push({x:m.left,y:m.top,width:m.width,height:m.height,type:b.type||"unknown"})}}const a=document.createElement("canvas"),l=a.getContext("2d"),c=window.innerWidth*r,d=window.innerHeight*r;return a.width=c,a.height=d,new Promise(f=>{const p=document.createElement("iframe");p.style.position="fixed",p.style.top="0",p.style.left="0",p.style.width="100%",p.style.height="100%",p.style.border="none",p.style.zIndex="-999999",document.body.appendChild(p);const m=p.contentDocument;if(m.open(),m.write(document.documentElement.outerHTML),m.close(),n&&s.length>0){const b=m.createElement("style");if(b.textContent=`
|
|
490
|
+
.pii-redacted {
|
|
491
|
+
filter: blur(5px);
|
|
492
|
+
background: #000;
|
|
493
|
+
color: transparent !important;
|
|
494
|
+
}
|
|
495
|
+
`,m.head.appendChild(b),!m.body)return console.warn("[ScreenCapture] Cloned document has no body"),a.toDataURL(`image/${o}`,i);const v=m.createTreeWalker(m.body,NodeFilter.SHOW_TEXT);let S;for(;S=v.nextNode();)this.containsPII(S.textContent||"").contains&&S.parentElement&&S.parentElement.classList.add("pii-redacted")}setTimeout(()=>{l.save(),l.scale(r,r),n&&s.length>0&&s.forEach(b=>{this.applyBlur(l,{x:b.x*r,y:b.y*r,width:b.width*r,height:b.height*r})}),document.body.removeChild(p),f(a.toDataURL(`image/${o}`,i))},100)})}async captureSimple(e={}){return this.captureWithRedaction({...e,redact:!1})}}class xx{constructor(){L(this,"container",null);L(this,"highlightEl",null);L(this,"tooltipElement",null);L(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=`
|
|
496
|
+
position: fixed;
|
|
497
|
+
top: 0;
|
|
498
|
+
left: 0;
|
|
499
|
+
width: 100%;
|
|
500
|
+
height: 100%;
|
|
501
|
+
pointer-events: none;
|
|
502
|
+
z-index: 2147483647;
|
|
503
|
+
`,document.body.appendChild(this.container),this.injectFloeCursor(),console.log("[OverlaySystem] Injected"))}injectFloeCursor(){if(this.floeCursor)return;this.floeCursor=document.createElement("div"),this.floeCursor.id="floe-cursor",this.floeCursor.setAttribute(Ai,"cursor"),this.floeCursor.innerHTML=`
|
|
504
|
+
<div class="floe-cursor-pointer">
|
|
505
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
506
|
+
<defs>
|
|
507
|
+
<linearGradient id="cursorGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
508
|
+
<stop offset="0%" style="stop-color:#8b5cf6"/>
|
|
509
|
+
<stop offset="100%" style="stop-color:#6366f1"/>
|
|
510
|
+
</linearGradient>
|
|
511
|
+
</defs>
|
|
512
|
+
<path d="M5.5 3L19.5 12L12 13.5L9 21L5.5 3Z" fill="url(#cursorGradient)" stroke="white" stroke-width="1.5" stroke-linejoin="round"/>
|
|
513
|
+
</svg>
|
|
514
|
+
</div>
|
|
515
|
+
<div class="floe-cursor-label">
|
|
516
|
+
<span class="floe-cursor-name">Floe</span>
|
|
517
|
+
</div>
|
|
518
|
+
`,this.floeCursor.style.cssText=`
|
|
519
|
+
position: fixed;
|
|
520
|
+
top: -100px;
|
|
521
|
+
left: -100px;
|
|
522
|
+
pointer-events: none;
|
|
523
|
+
z-index: 2147483646;
|
|
524
|
+
display: flex;
|
|
525
|
+
align-items: flex-start;
|
|
526
|
+
gap: 4px;
|
|
527
|
+
opacity: 0;
|
|
528
|
+
transform: scale(0.8);
|
|
529
|
+
transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
|
530
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
|
|
531
|
+
`;const e=document.createElement("style");e.id="floe-cursor-styles",e.textContent=`
|
|
532
|
+
.floe-cursor-pointer {
|
|
533
|
+
position: relative;
|
|
534
|
+
}
|
|
535
|
+
#floe-cursor svg {
|
|
536
|
+
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
|
|
537
|
+
}
|
|
538
|
+
.floe-cursor-label {
|
|
539
|
+
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
|
540
|
+
color: white;
|
|
541
|
+
font-size: 11px;
|
|
542
|
+
font-weight: 600;
|
|
543
|
+
padding: 4px 10px;
|
|
544
|
+
border-radius: 6px;
|
|
545
|
+
margin-top: 4px;
|
|
546
|
+
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
547
|
+
white-space: nowrap;
|
|
548
|
+
letter-spacing: 0.02em;
|
|
549
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
|
|
550
|
+
}
|
|
551
|
+
.floe-cursor-name {
|
|
552
|
+
display: flex;
|
|
553
|
+
align-items: center;
|
|
554
|
+
gap: 4px;
|
|
555
|
+
}
|
|
556
|
+
@keyframes floeCursorPulse {
|
|
557
|
+
0% { transform: scale(1); }
|
|
558
|
+
50% { transform: scale(1.05); }
|
|
559
|
+
100% { transform: scale(1); }
|
|
560
|
+
}
|
|
561
|
+
@keyframes floeCursorClick {
|
|
562
|
+
0% { transform: scale(1); }
|
|
563
|
+
30% { transform: scale(0.85); }
|
|
564
|
+
100% { transform: scale(1); }
|
|
565
|
+
}
|
|
566
|
+
`,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 p=f-a,m=Math.min(p/r,1),b=1-Math.pow(1-m,3),v=l+(e-l)*b,S=c+(n-c)*b;this.floeCursor&&(this.floeCursor.style.left=`${v}px`,this.floeCursor.style.top=`${S}px`),m<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=`
|
|
567
|
+
position: fixed;
|
|
568
|
+
top: 0;
|
|
569
|
+
left: 0;
|
|
570
|
+
width: 100%;
|
|
571
|
+
height: 100%;
|
|
572
|
+
background: rgba(0, 0, 0, 0.8);
|
|
573
|
+
backdrop-filter: blur(12px);
|
|
574
|
+
display: flex;
|
|
575
|
+
align-items: center;
|
|
576
|
+
justify-content: center;
|
|
577
|
+
z-index: 2147483647;
|
|
578
|
+
pointer-events: auto;
|
|
579
|
+
animation: modalFadeIn 0.2s ease-out;
|
|
580
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
|
|
581
|
+
`;const r=document.createElement("div");r.style.cssText=`
|
|
582
|
+
background: linear-gradient(180deg, rgba(32, 32, 36, 0.98) 0%, rgba(24, 24, 28, 0.99) 100%);
|
|
583
|
+
border-radius: 20px;
|
|
584
|
+
padding: 32px;
|
|
585
|
+
max-width: 420px;
|
|
586
|
+
width: 90%;
|
|
587
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
588
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 24px 48px rgba(0, 0, 0, 0.5), 0 12px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
|
589
|
+
animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
590
|
+
`,r.innerHTML=`
|
|
591
|
+
<style>
|
|
592
|
+
@keyframes modalFadeIn {
|
|
593
|
+
from { opacity: 0; }
|
|
594
|
+
to { opacity: 1; }
|
|
595
|
+
}
|
|
596
|
+
@keyframes modalSlideUp {
|
|
597
|
+
from { transform: translateY(20px) scale(0.98); opacity: 0; }
|
|
598
|
+
to { transform: translateY(0) scale(1); opacity: 1; }
|
|
599
|
+
}
|
|
600
|
+
@keyframes modalFadeOut {
|
|
601
|
+
from { opacity: 1; }
|
|
602
|
+
to { opacity: 0; }
|
|
603
|
+
}
|
|
604
|
+
</style>
|
|
605
|
+
|
|
606
|
+
<!-- Icon -->
|
|
607
|
+
<div style="display: flex; justify-content: center; margin-bottom: 24px;">
|
|
608
|
+
<div style="
|
|
609
|
+
width: 64px;
|
|
610
|
+
height: 64px;
|
|
611
|
+
border-radius: 16px;
|
|
612
|
+
background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
|
|
613
|
+
border: 1px solid rgba(139, 92, 246, 0.3);
|
|
614
|
+
display: flex;
|
|
615
|
+
align-items: center;
|
|
616
|
+
justify-content: center;
|
|
617
|
+
box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
|
|
618
|
+
">
|
|
619
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="#a78bfa" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
620
|
+
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
|
|
621
|
+
<line x1="8" y1="21" x2="16" y2="21"/>
|
|
622
|
+
<line x1="12" y1="17" x2="12" y2="21"/>
|
|
623
|
+
<circle cx="12" cy="10" r="2" fill="#a78bfa" stroke="none"/>
|
|
624
|
+
</svg>
|
|
625
|
+
</div>
|
|
626
|
+
</div>
|
|
627
|
+
|
|
628
|
+
<!-- Title -->
|
|
629
|
+
<h2 style="margin: 0 0 12px 0; font-size: 20px; font-weight: 600; color: rgba(255, 255, 255, 0.95); text-align: center; letter-spacing: -0.02em;">
|
|
630
|
+
Enable Smart Guidance
|
|
631
|
+
</h2>
|
|
632
|
+
|
|
633
|
+
<!-- Description -->
|
|
634
|
+
<p style="margin: 0 0 24px 0; color: rgba(255, 255, 255, 0.5); font-size: 14px; line-height: 1.6; text-align: center;">
|
|
635
|
+
Share your screen so the AI can see what you're working on and provide contextual help.
|
|
636
|
+
</p>
|
|
637
|
+
|
|
638
|
+
<!-- Features -->
|
|
639
|
+
<div style="background: rgba(255, 255, 255, 0.03); border-radius: 12px; padding: 16px; margin-bottom: 24px; border: 1px solid rgba(255, 255, 255, 0.05);">
|
|
640
|
+
<!-- Feature 1 -->
|
|
641
|
+
<div style="display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05);">
|
|
642
|
+
<div style="width: 32px; height: 32px; border-radius: 8px; background: rgba(96, 165, 250, 0.15); border: 1px solid rgba(96, 165, 250, 0.3); display: flex; align-items: center; justify-content: center;">
|
|
643
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#60a5fa" stroke-width="2">
|
|
644
|
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
|
|
645
|
+
<circle cx="12" cy="12" r="3"/>
|
|
646
|
+
</svg>
|
|
647
|
+
</div>
|
|
648
|
+
<div style="flex: 1;">
|
|
649
|
+
<div style="font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.9); margin-bottom: 2px;">Visual Context</div>
|
|
650
|
+
<div style="font-size: 12px; color: rgba(255, 255, 255, 0.4);">AI sees exactly what you see</div>
|
|
651
|
+
</div>
|
|
652
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#60a5fa" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>
|
|
653
|
+
</div>
|
|
654
|
+
|
|
655
|
+
<!-- Feature 2 -->
|
|
656
|
+
<div style="display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05);">
|
|
657
|
+
<div style="width: 32px; height: 32px; border-radius: 8px; background: rgba(52, 211, 153, 0.15); border: 1px solid rgba(52, 211, 153, 0.3); display: flex; align-items: center; justify-content: center;">
|
|
658
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#34d399" stroke-width="2">
|
|
659
|
+
<circle cx="12" cy="12" r="10"/>
|
|
660
|
+
<polyline points="12 6 12 12 16 14"/>
|
|
661
|
+
</svg>
|
|
662
|
+
</div>
|
|
663
|
+
<div style="flex: 1;">
|
|
664
|
+
<div style="font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.9); margin-bottom: 2px;">Faster Help</div>
|
|
665
|
+
<div style="font-size: 12px; color: rgba(255, 255, 255, 0.4);">No need to explain what's on screen</div>
|
|
666
|
+
</div>
|
|
667
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#34d399" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>
|
|
668
|
+
</div>
|
|
669
|
+
|
|
670
|
+
<!-- Feature 3 -->
|
|
671
|
+
<div style="display: flex; align-items: center; gap: 12px;">
|
|
672
|
+
<div style="width: 32px; height: 32px; border-radius: 8px; background: rgba(167, 139, 250, 0.15); border: 1px solid rgba(167, 139, 250, 0.3); display: flex; align-items: center; justify-content: center;">
|
|
673
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#a78bfa" stroke-width="2">
|
|
674
|
+
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
|
675
|
+
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
|
|
676
|
+
</svg>
|
|
677
|
+
</div>
|
|
678
|
+
<div style="flex: 1;">
|
|
679
|
+
<div style="font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.9); margin-bottom: 2px;">Privacy First</div>
|
|
680
|
+
<div style="font-size: 12px; color: rgba(255, 255, 255, 0.4);">Only this tab, stop anytime</div>
|
|
681
|
+
</div>
|
|
682
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#a78bfa" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>
|
|
683
|
+
</div>
|
|
684
|
+
</div>
|
|
685
|
+
|
|
686
|
+
<!-- Primary Button -->
|
|
687
|
+
<button id="screen-share-allow" style="
|
|
688
|
+
width: 100%;
|
|
689
|
+
padding: 14px 20px;
|
|
690
|
+
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
|
691
|
+
color: white;
|
|
692
|
+
border: none;
|
|
693
|
+
border-radius: 12px;
|
|
694
|
+
font-size: 14px;
|
|
695
|
+
font-weight: 600;
|
|
696
|
+
cursor: pointer;
|
|
697
|
+
transition: all 0.2s ease;
|
|
698
|
+
display: flex;
|
|
699
|
+
align-items: center;
|
|
700
|
+
justify-content: center;
|
|
701
|
+
gap: 8px;
|
|
702
|
+
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
|
|
703
|
+
">
|
|
704
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
705
|
+
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
|
|
706
|
+
<line x1="8" y1="21" x2="16" y2="21"/>
|
|
707
|
+
<line x1="12" y1="17" x2="12" y2="21"/>
|
|
708
|
+
</svg>
|
|
709
|
+
Enable Screen Share
|
|
710
|
+
</button>
|
|
711
|
+
|
|
712
|
+
<!-- Secondary Button -->
|
|
713
|
+
<button id="screen-share-deny" style="
|
|
714
|
+
width: 100%;
|
|
715
|
+
margin-top: 12px;
|
|
716
|
+
padding: 12px 20px;
|
|
717
|
+
background: transparent;
|
|
718
|
+
color: rgba(255, 255, 255, 0.4);
|
|
719
|
+
border: none;
|
|
720
|
+
border-radius: 12px;
|
|
721
|
+
font-size: 14px;
|
|
722
|
+
font-weight: 500;
|
|
723
|
+
cursor: pointer;
|
|
724
|
+
transition: all 0.2s ease;
|
|
725
|
+
">
|
|
726
|
+
Maybe Later
|
|
727
|
+
</button>
|
|
728
|
+
|
|
729
|
+
<!-- Footer -->
|
|
730
|
+
<p style="margin: 16px 0 0 0; font-size: 11px; color: rgba(255, 255, 255, 0.3); text-align: center;">
|
|
731
|
+
You can enable this anytime from the control panel
|
|
732
|
+
</p>
|
|
733
|
+
`,n.appendChild(r),document.body.appendChild(n);const i=r.querySelector("#screen-share-allow"),o=r.querySelector("#screen-share-deny");i.onmouseenter=()=>{i.style.transform="translateY(-1px)",i.style.background="linear-gradient(135deg, #818cf8 0%, #a78bfa 100%)",i.style.boxShadow="0 8px 24px rgba(99, 102, 241, 0.4)"},i.onmouseleave=()=>{i.style.transform="translateY(0)",i.style.background="linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)",i.style.boxShadow="0 4px 12px rgba(99, 102, 241, 0.25)"},o.onmouseenter=()=>{o.style.color="rgba(255, 255, 255, 0.8)"},o.onmouseleave=()=>{o.style.color="rgba(255, 255, 255, 0.4)"},i.onclick=()=>{n.style.animation="modalFadeOut 0.2s ease",setTimeout(()=>{n.remove(),e(!0)},200)},o.onclick=()=>{n.style.animation="modalFadeOut 0.2s ease",setTimeout(()=>{n.remove(),e(!1)},200)}})}highlight(e,n={}){const r=document.querySelector(e);if(!r){console.warn("[OverlaySystem] Element not found:",e);return}this.highlightElement(r,n)}highlightTarget(e,n={}){console.log("╔══════════════════════════════════════════════════════════════╗"),console.log("║ [OverlaySystem] 💡 HIGHLIGHT TARGET CALLED ║"),console.log("╚══════════════════════════════════════════════════════════════╝"),console.log("[OverlaySystem] Target:",JSON.stringify(e,null,2)),console.log("[OverlaySystem] Options:",n);const r=pe.resolveTarget(e);return r?(console.log("[OverlaySystem] ✅ Element found, applying highlight..."),console.log("[OverlaySystem] Element details:"),console.log(" • tagName:",r.tagName),console.log(" • id:",r.id||"(none)"),console.log(" • classes:",r.className||"(none)"),console.log(" • innerText:",(r.innerText||"").substring(0,50)+"..."),this.highlightElement(r,n),console.log("[OverlaySystem] 🎨 Highlight applied successfully!"),!0):(console.warn("[OverlaySystem] ❌ Element not found for target"),!1)}highlightResolvedElement(e,n={}){return this.highlightElement(e,n)}highlightElement(e,n={}){var o;const{color:r="rgba(139, 92, 246, 1)",padding:i=4}=n;if(console.log("[OverlaySystem] highlightElement() called"),console.log("[OverlaySystem] Highlight color:",r),console.log("[OverlaySystem] Highlight padding:",i),this.highlightEl||(console.log("[OverlaySystem] Creating new highlight element"),this.highlightEl=document.createElement("div"),this.highlightEl.id="hse-highlight-element",this.highlightEl.setAttribute(Ai,"highlight"),(o=this.container)==null||o.appendChild(this.highlightEl)),console.log("[OverlaySystem] Scrolling element into view..."),pe.scrollIntoView(e),console.log("[OverlaySystem] Waiting 300ms for scroll to complete..."),setTimeout(()=>{const s=e.getBoundingClientRect();console.log("[OverlaySystem] Element position after scroll:"),console.log(" • top:",s.top),console.log(" • left:",s.left),console.log(" • width:",s.width),console.log(" • height:",s.height),this.highlightEl&&(this.highlightEl.style.cssText=`
|
|
734
|
+
position: fixed;
|
|
735
|
+
top: ${s.top-i}px;
|
|
736
|
+
left: ${s.left-i}px;
|
|
737
|
+
width: ${s.width+i*2}px;
|
|
738
|
+
height: ${s.height+i*2}px;
|
|
739
|
+
pointer-events: none;
|
|
740
|
+
z-index: 2147483645;
|
|
741
|
+
border: 2px solid #8b5cf6;
|
|
742
|
+
border-radius: 8px;
|
|
743
|
+
background: transparent;
|
|
744
|
+
box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 0 20px rgba(139, 92, 246, 0.3);
|
|
745
|
+
animation: highlightFadeIn 0.2s ease-out, highlightPulse 2s ease-in-out infinite;
|
|
746
|
+
`,console.log("[OverlaySystem] ✨ HIGHLIGHT VISIBLE! Position:",{top:s.top-i,left:s.left-i,width:s.width+i*2,height:s.height+i*2}))},300),!document.querySelector("#onboarding-animations")){const s=document.createElement("style");s.id="onboarding-animations",s.textContent=`
|
|
747
|
+
@keyframes highlightFadeIn {
|
|
748
|
+
from { opacity: 0; transform: scale(0.98); }
|
|
749
|
+
to { opacity: 1; transform: scale(1); }
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
@keyframes highlightPulse {
|
|
753
|
+
0%, 100% {
|
|
754
|
+
border-color: #8b5cf6;
|
|
755
|
+
box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 0 20px rgba(139, 92, 246, 0.3);
|
|
756
|
+
}
|
|
757
|
+
50% {
|
|
758
|
+
border-color: #a78bfa;
|
|
759
|
+
box-shadow: 0 0 0 6px rgba(167, 139, 250, 0.2), 0 0 30px rgba(139, 92, 246, 0.4);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
@keyframes strongPulse {
|
|
764
|
+
0%, 100% {
|
|
765
|
+
border-color: #8b5cf6;
|
|
766
|
+
box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2), 0 0 25px rgba(139, 92, 246, 0.4);
|
|
767
|
+
}
|
|
768
|
+
50% {
|
|
769
|
+
border-color: #a78bfa;
|
|
770
|
+
box-shadow: 0 0 0 8px rgba(167, 139, 250, 0.25), 0 0 40px rgba(139, 92, 246, 0.5);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
#hse-highlight-element.strong-pulse {
|
|
775
|
+
border-width: 3px;
|
|
776
|
+
animation: highlightFadeIn 0.2s ease-out, strongPulse 1s ease-in-out infinite !important;
|
|
777
|
+
}
|
|
778
|
+
`,document.head.appendChild(s)}}pulse(e,n={}){this.highlight(e,{...n,color:n.color||"rgba(167, 139, 250, 0.8)"}),this.highlightEl&&this.highlightEl.classList.add("strong-pulse")}pulseTarget(e,n={}){const r=this.highlightTarget(e,{...n,color:n.color||"rgba(167, 139, 250, 0.8)"});return r&&this.highlightEl&&this.highlightEl.classList.add("strong-pulse"),r}clearHighlight(){this.highlightEl&&(this.highlightEl.remove(),this.highlightEl=null)}showTooltip(e,n={}){var o;this.tooltipElement||(this.tooltipElement=document.createElement("div"),(o=this.container)==null||o.appendChild(this.tooltipElement));let r=n.x||window.innerWidth/2,i=n.y||window.innerHeight-100;if(n.anchor){const s=document.querySelector(n.anchor);if(s){const a=s.getBoundingClientRect();r=a.left+a.width/2,i=a.bottom+10}}this.tooltipElement.style.cssText=`
|
|
779
|
+
position: fixed;
|
|
780
|
+
left: ${r}px;
|
|
781
|
+
top: ${i}px;
|
|
782
|
+
transform: translateX(-50%);
|
|
783
|
+
background: rgba(0, 0, 0, 0.9);
|
|
784
|
+
color: white;
|
|
785
|
+
padding: 12px 20px;
|
|
786
|
+
border-radius: 8px;
|
|
787
|
+
font-size: 14px;
|
|
788
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
789
|
+
pointer-events: none;
|
|
790
|
+
max-width: 300px;
|
|
791
|
+
text-align: center;
|
|
792
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
793
|
+
`,this.tooltipElement.textContent=e}hideTooltip(){this.tooltipElement&&(this.tooltipElement.remove(),this.tooltipElement=null)}remove(){var e;(e=this.container)==null||e.remove(),this.container=null,this.highlightEl=null,this.tooltipElement=null}}class _x{constructor(){L(this,"confirmationSound");this.confirmationSound=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=")}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){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=pe.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=document.querySelector(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=pe.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=pe.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:(pe.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=pe.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),!1}}async executeOnElement(e,n,r,i){switch(pe.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 f=this.parseOptionTextFromSelector(n);if(f){console.log("[ActionExecutor] 🎯 Detected dropdown option selector, searching for:",f);const m=this.findDropdownOption(f);if(m){console.log("[ActionExecutor] Found option by text, clicking it"),this.performClick(m);return}console.log("[ActionExecutor] Option not found by text, trying direct click")}const p=this.parseLabelFromSelector(n);if(p){console.log("[ActionExecutor] 🎯 Detected labeled combobox selector:",p);const m=this.findComboboxByLabel(p);if(m){console.log("[ActionExecutor] Found combobox by label, opening it"),this.handleComboboxClick(m);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 f=this.triggerReactOnClick(e);console.log(`[ActionExecutor] React onClick triggered: ${f}`),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 DOM events (no React onClick or fallback)");const c={bubbles:!0,cancelable:!0,view:window,clientX:s,clientY:a,screenX:s,screenY:a,button:0,buttons:1},d={bubbles:!0,cancelable:!0,view:window,clientX:s,clientY:a,screenX:s,screenY:a,button:0,buttons:1,pointerType:"mouse",isPrimary:!0};i.dispatchEvent(new PointerEvent("pointerdown",d)),i.dispatchEvent(new PointerEvent("pointerup",d)),i.dispatchEvent(new MouseEvent("mousedown",c)),i.dispatchEvent(new MouseEvent("mouseup",c)),i.dispatchEvent(new MouseEvent("click",c)),console.log("[ActionExecutor] Simulated click at",s,a,"on",i.tagName),i!==e&&console.log("[ActionExecutor] Note: Clicked parent",i.tagName,"instead of",e.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 p=n.querySelector('input[role="combobox"]');if(p)return console.log("[ActionExecutor] Found combobox input via control element"),p;const m=n.parentElement;if(m){const v=m.querySelector('input[role="combobox"]');if(v)return console.log("[ActionExecutor] Found combobox input in parent container"),v}const b=n.querySelector('button[aria-haspopup="listbox"]');if(b)return console.log("[ActionExecutor] Found listbox trigger button"),b}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");const n=e.closest('[class*="control"]')||e.closest('[class*="trigger"]')||e.closest("[aria-haspopup]")||e.parentElement;e.focus&&e.focus();const r=(n||e).getBoundingClientRect(),i=r.left+r.width/2,o=r.top+r.height/2,s={bubbles:!0,cancelable:!0,view:window,clientX:i,clientY:o},a=n||e;a.dispatchEvent(new MouseEvent("mousedown",s)),a.dispatchEvent(new MouseEvent("mouseup",s)),a.dispatchEvent(new MouseEvent("click",s)),a!==e&&(e.dispatchEvent(new MouseEvent("mousedown",s)),e.dispatchEvent(new MouseEvent("mouseup",s))),e.dispatchEvent(new FocusEvent("focus",{bubbles:!0})),e instanceof HTMLInputElement&&e.dispatchEvent(new Event("input",{bubbles:!0})),console.log("[ActionExecutor] ✅ Combobox/dropdown should now be open")}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"];for(const i of n){const o=document.querySelectorAll(i);for(const s of o){if(!pe.isVisible(s))continue;const a=['[role="option"]','[class*="option"]','[class*="item"]',"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){const n=e.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2;e.focus&&e.focus();const o={bubbles:!0,cancelable:!0,view:window,clientX:r,clientY:i,screenX:r,screenY:i,button:0,buttons:1},s={bubbles:!0,cancelable:!0,view:window,clientX:r,clientY:i,screenX:r,screenY:i,button:0,buttons:1,pointerType:"mouse",isPrimary:!0};e.dispatchEvent(new PointerEvent("pointerdown",s)),e.dispatchEvent(new PointerEvent("pointerup",s)),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.dispatchEvent(new MouseEvent("click",o)),e.click&&e.click(),console.log("[ActionExecutor] ✅ performClick completed on",e.tagName)}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"),p=(a=i.classList)==null?void 0:a.contains("cursor-pointer"),m=i.hasAttribute("onclick")||i.hasAttribute("data-onclick")||i.getAttribute("role")==="button"||i.getAttribute("role")==="menuitem",b=i.tagName==="BUTTON"||i.tagName==="A";if(console.log(`[ActionExecutor] Checking parent #${s}:`,i.tagName,"cursor:",l.cursor,"hasCursorClass:",f||p,"classes:",d.substring(0,60)),(c||f||p||m||b)&&(o=i,console.log("[ActionExecutor] ✅ Found clickable parent:",i.tagName,d.substring(0,80)),b||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 p=f.trim().split(/\s+/).slice(0,3).join(".");p&&(d+="."+p)}}i.unshift(d),o=o.parentElement}const s=d=>{var m;const f=d.querySelector("span, label, p");if((m=f==null?void 0:f.textContent)!=null&&m.trim())return f.textContent.trim().substring(0,50);let p="";for(const b of Array.from(d.childNodes))b.nodeType===Node.TEXT_NODE&&(p+=(b.textContent||"").trim()+" ");return p=p.trim(),!p&&d.textContent&&(p=d.textContent.trim().substring(0,50)),p},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}"?
|
|
794
|
+
${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 Cx{constructor(e){L(this,"sdk");L(this,"domIntrospector",null);L(this,"lastUrl","");L(this,"clickHandler",null);L(this,"focusHandler",null);L(this,"blurHandler",null);L(this,"inputHandler",null);L(this,"keydownHandler",null);L(this,"inputDebounceTimers",new Map);L(this,"isTracking",!1);L(this,"scrollHandler",null);L(this,"scrollDebounceTimer",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||an(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)||an(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)||an(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||an(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)||an(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.inputDebounceTimers.forEach(e=>clearTimeout(e)),this.inputDebounceTimers.clear(),console.log("[PageTracker] Stopped tracking"))}setupUrlTracking(){setInterval(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},1e3),window.addEventListener("popstate",()=>{setTimeout(()=>this.sendPageMetadata(),100)})}sendPageMetadata(){const e=Rr();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 p=d.tagName.toLowerCase();const m=d.getAttribute("role"),b=d.getAttribute("data-testid");if(b){c.unshift(`[data-testid="${b}"]`);break}if(m)p+=`[role="${m}"]`;else if(d.className&&typeof d.className=="string"){const v=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);v.length>0&&(p+=`.${v.join(".")}`)}c.unshift(p),d=d.parentElement,f++}return c.join(" > ")}getElementMetadata(e){var p,m,b,v;const n=e,r=this.getSelector(e),i=((p=n.innerText)==null?void 0:p.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=(m=S.textContent)==null?void 0:m.trim())}const f=e.getAttribute("id");if(!c&&f)try{const S=document.querySelector(`label[for="${CSS.escape(f)}"]`);S&&(c=(b=S.textContent)==null?void 0:b.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 y=S.querySelector(":scope > label, :scope > .MuiFormLabel-root, :scope > div > label");if(y){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=(v=y.textContent)==null?void 0:v.trim().replace(/\*$/,"").trim())}}}return{selector:r,text:i,tagName:o,role:s,ariaLabel:a,placeholder:l,labelText:c}}}class iy{constructor(){L(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 Ex{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 Tx{constructor(){L(this,"lastUrl","");L(this,"urlChangeCallback",null);L(this,"loadingDetector");L(this,"domStabilityChecker");L(this,"originalPushState",null);L(this,"originalReplaceState",null);L(this,"popstateHandler",null);L(this,"isStarted",!1);L(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(Rr())}});this.lastUrl=window.location.href,this.loadingDetector=new iy,this.domStabilityChecker=new Ex}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 Mx{constructor(e,n){L(this,"overlay");L(this,"loadingDetector");L(this,"domIntrospector",null);L(this,"isExecuting",!1);this.overlay=e,this.loadingDetector=new iy}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 p=0;p<=o;p++)if(p>0&&(console.log(`[BatchedActionExecutor] Retry ${p}/${o} in ${s[p-1]}ms...`),await new Promise(m=>setTimeout(m,s[p-1]))),i=pe.resolveTarget(e.target),i){const m=((d=i.textContent)==null?void 0:d.trim().toLowerCase())||"",b=i.tagName.toLowerCase();if(n&&!m.includes(n)){console.warn(`[BatchedActionExecutor] ⚠️ Found element text "${m.slice(0,50)}" doesn't match expected "${n}"`),i=null;continue}r&&b!==r&&console.log(`[BatchedActionExecutor] Note: Found ${b} 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 p=Array.from(document.querySelectorAll("*")).filter(m=>{var b;return(b=m.textContent)==null?void 0:b.toLowerCase().includes(n)}).slice(0,5).map(m=>{var b;return`${m.tagName.toLowerCase()}: "${(b=m.textContent)==null?void 0:b.trim().slice(0,50)}"`});p.length>0&&console.log("[BatchedActionExecutor] Similar elements found:",p)}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(p=>setTimeout(p,150)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(p=>setTimeout(p,100)),this.simulateClick(i),await new Promise(p=>setTimeout(p,100)),this.overlay.clearHighlight(),this.domIntrospector&&(await new Promise(p=>setTimeout(p,100)),this.domIntrospector.captureAndSendImmediate("post-batch-step-click")),!0}simulateClick(e){const n=e.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2,o={bubbles:!0,cancelable:!0,view:window,clientX:r,clientY:i,screenX:r+window.screenX,screenY:i+window.screenY,button:0,buttons:1};typeof e.focus=="function"&&e.focus(),e.dispatchEvent(new MouseEvent("mouseenter",{...o,bubbles:!1})),e.dispatchEvent(new MouseEvent("mouseover",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.dispatchEvent(new MouseEvent("click",o)),e.tagName==="A"&&e.href&&console.log("[BatchedActionExecutor] Clicked link:",e.href)}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=pe.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(pe.resolveTarget(e))return!0;await new Promise(o=>setTimeout(o,100))}return!1}}class oy extends wx{constructor(n){super();L(this,"config");L(this,"sessionId");L(this,"overlay");L(this,"capture");L(this,"actionExecutor");L(this,"pipecatClient",null);L(this,"transport",null);L(this,"isInitialized",!1);L(this,"reactRoot",null);L(this,"reactContainer",null);L(this,"agentState","idle");L(this,"pausedSessionId",null);L(this,"pendingResumeSessionId",null);L(this,"botTranscript","");L(this,"userTranscript","");L(this,"transcriptHistory",[]);L(this,"lastUserTranscript","");L(this,"isConnected",!1);L(this,"connectInFlight",!1);L(this,"micEnabled",!0);L(this,"userIsSpeaking",!1);L(this,"botIsSpeaking",!1);L(this,"audioLevels",[]);L(this,"_discoveryPopupShown",!1);L(this,"_pendingDiscoveryStart",!1);L(this,"botAudioAnalyzer",null);L(this,"userAudioAnalyzer",null);L(this,"userMicStream",null);L(this,"audioElements",[]);L(this,"pageTracker");L(this,"screenShareEnabled",!1);L(this,"domIntrospector");L(this,"accessibleSnapshot");L(this,"fastExecutionMode",!1);L(this,"batchedActionExecutor",null);L(this,"navigationCompleteDetector",null);L(this,"_botActionDepth",0);L(this,"endUserStatus",null);L(this,"connectionProgress",null);L(this,"isReturningUser",!1);L(this,"_isMinimized",!1);if(!n.clientKey)throw new Error("Client key is required");const r="http://localhost:3001";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 xx,this.capture=new kx(this.config.redactionPatterns),this.actionExecutor=new _x,this.pageTracker=new Cx(this),this.domIntrospector=new Sx,pe.setDOMIntrospector(this.domIntrospector),this.accessibleSnapshot=new fd,this.batchedActionExecutor=new Mx(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 startScreenShare(){try{this.pipecatClient&&(await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,console.log("[OnboardingSDK] Screen share enabled"),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{if(this.overlay.inject(),this.initReactUI(),this.config.userInfo&&(this.config.userInfo.externalId||this.config.userInfo.email)&&await this.checkEndUserStatus(),this.shouldSkipOnboardingModal())console.log("[OnboardingSDK] 🔄 Skipping onboarding modal for returning user"),this._discoveryPopupShown=!0,this.isReturningUser=!0;else if(this.config.enableDiscoveryPopup!==!1){console.log("[OnboardingSDK] 🎉 Showing welcome popup before connect");const o=await this.showWelcomePopupAsync();this._discoveryPopupShown=!0,this.markUserVisited(),o?(this._pendingDiscoveryStart=!0,console.log("[OnboardingSDK] User chose guided discovery - will start after connect")):console.log("[OnboardingSDK] User skipped discovery - normal flow")}this.transport=new gn,this.pipecatClient=new $t({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 r=`${this.config.apiUrl}/sites/start-session`;console.log("[OnboardingSDK] Starting session via floe-api proxy:",r);const i={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};if(this.config.userInfo&&(i.sessionData.userInfo=this.config.userInfo),await this.pipecatClient.startBotAndConnect({endpoint:r,requestData:i}),this.config.enableScreenCapture)if(await this.overlay.showScreenShareModal())try{await this.startScreenShare()}catch(s){console.error("[OnboardingSDK] Screen share failed:",s)}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 ry),this.userAudioAnalyzer||(this.userAudioAnalyzer=new ry),this.setupUserMicAnalysis(),this.navigationCompleteDetector||(this.navigationCompleteDetector=new Tx),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=[])}))}async setupUserMicAnalysis(){try{this.userMicStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),console.log("[OnboardingSDK] 🎤 User mic stream captured for visualization"),this.userAudioAnalyzer&&this.userMicStream&&this.userAudioAnalyzer.start(this.userMicStream,n=>{this.userIsSpeaking&&(this.audioLevels=n,this.renderReactUI())})}catch(n){console.warn("[OnboardingSDK] Could not capture mic for visualization:",n)}}initReactUI(){this.reactContainer=document.createElement("div"),this.reactContainer.id="onboarding-sdk-react-ui",this.reactContainer.setAttribute(Ai,"react-ui"),this.reactContainer.style.cssText=`
|
|
795
|
+
position: fixed;
|
|
796
|
+
top: 0;
|
|
797
|
+
left: 0;
|
|
798
|
+
width: 100%;
|
|
799
|
+
height: 100%;
|
|
800
|
+
pointer-events: none;
|
|
801
|
+
z-index: 2147483646;
|
|
802
|
+
`,document.body.appendChild(this.reactContainer),this.reactRoot=ic.createRoot(this.reactContainer),this.renderReactUI()}renderReactUI(){this.reactRoot&&this.reactRoot.render(Kh.createElement(yx,{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,onMinimize:()=>this.handleMinimize(),onExpand:()=>this.handleExpand()}))}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.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.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 $t({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.renderReactUI(),this.emit("disconnected"),this.pageTracker.stop()},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),n.type==="session_paused"&&(console.log("[OnboardingSDK] Session paused:",n),this.agentState="paused",this.pausedSessionId=n.session_id||null,this.renderReactUI(),this.emit("sessionPaused",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):(console.log("[OnboardingSDK] Starting screen share"),await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!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==="session_paused"?(console.log("[OnboardingSDK] Session paused:",r),this.agentState="paused",this.pausedSessionId=r.session_id||null,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=Rr();if(n.target.optionText){console.log("[OnboardingSDK] 🎯 Dropdown option selection detected:",n.target.optionText),await this.handleDropdownOptionClick(n);break}let o=pe.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}pe.scrollIntoView(o),setTimeout(async()=>{var p,m;const a=this.findCollapsedSidebar(o);if(a){console.log("[OnboardingSDK] 🔍 Element is in collapsed sidebar, expanding first...");const b=a.getBoundingClientRect();await this.overlay.animateFloeCursorTo(b.left+b.width/2,b.top+b.height/3,400),a.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),a.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0})),await new Promise(v=>setTimeout(v,450)),console.log("[OnboardingSDK] 📂 Sidebar expanded")}if(!await pe.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=pe.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"),this.overlay.highlightResolvedElement(o,{color:"rgba(124, 58, 237, 0.5)",padding:8}),await this.overlay.moveToElementAndClick(o),await new Promise(b=>setTimeout(b,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:(p=n.target.strategy)==null?void 0:p.filter(b=>b!=="boundingBox"&&b!=="domIndex")}};let f=!1;try{f=await this.actionExecutor.executeHybridAction(d,!1)}finally{this._botActionDepth--}if(f){console.log("[OnboardingSDK] ✅ Click executed successfully");const b=(n.target.text||"").toLowerCase().trim(),v=((m=o==null?void 0:o.textContent)==null?void 0:m.toLowerCase().trim())||"",S=(o==null?void 0:o.tagName.toLowerCase())||"unknown";let y=!1,w="";b&&v&&!v.includes(b)&&!b.includes(v)&&(y=!0,w=`Expected "${n.target.text}", but clicked "${v.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:!y,target:n.target.text||n.target.selector||"unknown",actualClicked:y?v.slice(0,100):void 0,clickedTag:S,mismatch:y,mismatchDetails:w||void 0,previousUrl:i,currentUrl:Rr(),timestamp:Date.now()}),y?console.warn("[OnboardingSDK] ⚠️ Click mismatch reported to server"):console.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance")}else console.warn("[OnboardingSDK] ⚠️ Click action failed"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",timestamp:Date.now()});await new Promise(b=>setTimeout(b,100)),setTimeout(()=>{this.overlay.clearHighlight(),this.overlay.hideFloeCursor()},800)},350);break;case"type":console.log("[OnboardingSDK] ⌨️ Executing TYPE action, value:",n.value);const s=pe.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(p=>setTimeout(p,100));const f=document.activeElement instanceof HTMLElement?document.activeElement:document.body;f&&f.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(p=>setTimeout(p,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&&pe.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}pe.scrollIntoView(i),await new Promise(l=>setTimeout(l,200)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.5)",padding:8}),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 p=d.getBoundingClientRect(),m=p.left+p.width/2,b=p.top+p.height/2,v={bubbles:!0,cancelable:!0,view:window,clientX:m,clientY:b};d.dispatchEvent(new MouseEvent("mousedown",v)),d.dispatchEvent(new MouseEvent("mouseup",v)),d.dispatchEvent(new MouseEvent("click",v)),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}pe.scrollIntoView(o),await new Promise(c=>setTimeout(c,200)),this.overlay.highlightResolvedElement(o,{color:"rgba(124, 58, 237, 0.5)",padding:8}),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 p;return(p=f.textContent)==null?void 0:p.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"]'];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(!pe.isVisible(f)||f.getBoundingClientRect().height<20)continue;const m=d.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]):not([class*="placeholder"])');for(const b of m){const v=b,S=v.className||"";if(S.toLowerCase().includes("singlevalue")||S.toLowerCase().includes("placeholder"))continue;const y=((a=v.textContent)==null?void 0:a.trim().toLowerCase())||"";if(y===r){console.log(`[OnboardingSDK] Found EXACT match for option: "${n}"`),o=v;break}if(!s&&y.includes(r)){const w=r.length/y.length;w>.7&&(console.log(`[OnboardingSDK] Found partial match (${(w*100).toFixed(0)}%): "${y.slice(0,50)}"`),s=v)}}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(!pe.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(p=>setTimeout(p,100));const f=a.querySelectorAll('[role="option"], [class*="option"]');for(const p of f){const m=p,b=((o=m.textContent)==null?void 0:o.trim().toLowerCase())||"";if(b===r||b.includes(r))return console.log(`[OnboardingSDK] ✅ Found option after scrolling: "${n}"`),m.scrollIntoView({block:"center"}),await new Promise(v=>setTimeout(v,100)),m}}}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(an(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=document.querySelector(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 p=this.getClickableDropdownContainer(d);if(this.isValidDropdownElement(p,!0))return console.log("[OnboardingSDK] ✅ Found trigger via display value match"),p;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 m=document.getElementById(d.htmlFor);if(m)return this.getClickableDropdownContainer(m)}const f=d.id;if(f){const m=document.querySelector(`[aria-labelledby="${f}"]`);if(m)return this.getClickableDropdownContainer(m)}const p=d.closest('[class*="field"], [class*="form-group"], [class*="FormControl"]')||d.parentElement;if(p){const m=p.querySelector('input[role="combobox"], select, [aria-haspopup="listbox"], [class*="control"]');if(m)return this.getClickableDropdownContainer(m)}}}}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;this.overlay.highlightResolvedElement(n,{color:"rgba(124, 58, 237, 0.5)",padding:4}),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"),p=d.includes("w-12")||d.includes("w-14")||d.includes("w-16");if(l&&c&&(a||f)||p)return console.log("[OnboardingSDK] Detected collapsed sidebar:",{width:o,height:s,hasTransition:a,hasTailwindCollapsed:p,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=pe.resolveTarget(n.target);if(!r&&(await new Promise(o=>setTimeout(o,150)),r=pe.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 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:Rr(),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:Rr(),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=`
|
|
803
|
+
position: fixed;
|
|
804
|
+
top: 0;
|
|
805
|
+
left: 0;
|
|
806
|
+
width: 100%;
|
|
807
|
+
height: 100%;
|
|
808
|
+
background: rgba(0, 0, 0, 0.8);
|
|
809
|
+
backdrop-filter: blur(12px);
|
|
810
|
+
display: flex;
|
|
811
|
+
align-items: center;
|
|
812
|
+
justify-content: center;
|
|
813
|
+
z-index: 2147483647;
|
|
814
|
+
pointer-events: auto;
|
|
815
|
+
animation: welcomeFadeIn 0.2s ease-out;
|
|
816
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
|
|
817
|
+
`;const i=document.createElement("div");i.style.cssText=`
|
|
818
|
+
background: linear-gradient(180deg, rgba(32, 32, 36, 0.98) 0%, rgba(24, 24, 28, 0.99) 100%);
|
|
819
|
+
border-radius: 20px;
|
|
820
|
+
padding: 32px;
|
|
821
|
+
max-width: 420px;
|
|
822
|
+
width: 90%;
|
|
823
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
824
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 24px 48px rgba(0, 0, 0, 0.5), 0 12px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
|
825
|
+
animation: welcomeSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
826
|
+
`,i.innerHTML=`
|
|
827
|
+
<style>
|
|
828
|
+
@keyframes welcomeFadeIn {
|
|
829
|
+
from { opacity: 0; }
|
|
830
|
+
to { opacity: 1; }
|
|
831
|
+
}
|
|
832
|
+
@keyframes welcomeSlideUp {
|
|
833
|
+
from { transform: translateY(20px) scale(0.98); opacity: 0; }
|
|
834
|
+
to { transform: translateY(0) scale(1); opacity: 1; }
|
|
835
|
+
}
|
|
836
|
+
@keyframes welcomeFadeOut {
|
|
837
|
+
from { opacity: 1; }
|
|
838
|
+
to { opacity: 0; }
|
|
839
|
+
}
|
|
840
|
+
</style>
|
|
841
|
+
|
|
842
|
+
<!-- Icon -->
|
|
843
|
+
<div style="display: flex; justify-content: center; margin-bottom: 24px;">
|
|
844
|
+
<div style="
|
|
845
|
+
width: 64px;
|
|
846
|
+
height: 64px;
|
|
847
|
+
border-radius: 16px;
|
|
848
|
+
background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
|
|
849
|
+
border: 1px solid rgba(139, 92, 246, 0.3);
|
|
850
|
+
display: flex;
|
|
851
|
+
align-items: center;
|
|
852
|
+
justify-content: center;
|
|
853
|
+
box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
|
|
854
|
+
">
|
|
855
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="#a78bfa" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
856
|
+
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
|
|
857
|
+
<path d="M2 17l10 5 10-5"/>
|
|
858
|
+
<path d="M2 12l10 5 10-5"/>
|
|
859
|
+
</svg>
|
|
860
|
+
</div>
|
|
861
|
+
</div>
|
|
862
|
+
|
|
863
|
+
<!-- Title -->
|
|
864
|
+
<h2 style="margin: 0 0 12px 0; font-size: 20px; font-weight: 600; color: rgba(255, 255, 255, 0.95); text-align: center; letter-spacing: -0.02em;">
|
|
865
|
+
Let's personalize your setup
|
|
866
|
+
</h2>
|
|
867
|
+
|
|
868
|
+
<!-- Description -->
|
|
869
|
+
<p style="margin: 0 0 20px 0; color: rgba(255, 255, 255, 0.6); font-size: 14px; line-height: 1.6; text-align: center;">
|
|
870
|
+
I'll ask a few quick questions to understand your needs, then guide you through the perfect setup for your use case.
|
|
871
|
+
</p>
|
|
872
|
+
|
|
873
|
+
<!-- Benefits -->
|
|
874
|
+
<div style="background: rgba(255, 255, 255, 0.03); border-radius: 10px; padding: 14px; margin-bottom: 24px; border: 1px solid rgba(255, 255, 255, 0.05);">
|
|
875
|
+
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;">
|
|
876
|
+
<span style="font-size: 14px;">⚡</span>
|
|
877
|
+
<span style="font-size: 13px; color: rgba(255, 255, 255, 0.7);">Takes less than a minute</span>
|
|
878
|
+
</div>
|
|
879
|
+
<div style="display: flex; align-items: center; gap: 10px;">
|
|
880
|
+
<span style="font-size: 14px;">🎯</span>
|
|
881
|
+
<span style="font-size: 13px; color: rgba(255, 255, 255, 0.7);">Get a customized walkthrough</span>
|
|
882
|
+
</div>
|
|
883
|
+
</div>
|
|
884
|
+
|
|
885
|
+
<!-- Buttons -->
|
|
886
|
+
<div style="display: flex; flex-direction: column; gap: 12px;">
|
|
887
|
+
<button id="floe-start-guided" style="
|
|
888
|
+
width: 100%;
|
|
889
|
+
padding: 14px 20px;
|
|
890
|
+
border-radius: 12px;
|
|
891
|
+
font-size: 14px;
|
|
892
|
+
font-weight: 600;
|
|
893
|
+
cursor: pointer;
|
|
894
|
+
border: none;
|
|
895
|
+
background: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
|
|
896
|
+
color: white;
|
|
897
|
+
transition: all 0.2s ease;
|
|
898
|
+
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
|
|
899
|
+
">
|
|
900
|
+
🚀 Let's Get Started
|
|
901
|
+
</button>
|
|
902
|
+
<button id="floe-skip-guided" style="
|
|
903
|
+
width: 100%;
|
|
904
|
+
padding: 14px 20px;
|
|
905
|
+
border-radius: 12px;
|
|
906
|
+
font-size: 14px;
|
|
907
|
+
font-weight: 500;
|
|
908
|
+
cursor: pointer;
|
|
909
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
910
|
+
background: rgba(255, 255, 255, 0.05);
|
|
911
|
+
color: rgba(255, 255, 255, 0.7);
|
|
912
|
+
transition: all 0.2s ease;
|
|
913
|
+
">
|
|
914
|
+
Skip — I'll explore on my own
|
|
915
|
+
</button>
|
|
916
|
+
</div>
|
|
917
|
+
`,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.transform="translateY(-2px)",o.style.boxShadow="0 8px 20px rgba(99, 102, 241, 0.4)"},o.onmouseleave=()=>{o.style.transform="translateY(0)",o.style.boxShadow="0 4px 12px rgba(99, 102, 241, 0.3)"},o.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!0)},200)}),s&&(s.onmouseenter=()=>{s.style.background="rgba(255, 255, 255, 0.1)",s.style.color="rgba(255, 255, 255, 0.9)"},s.onmouseleave=()=>{s.style.background="rgba(255, 255, 255, 0.05)",s.style.color="rgba(255, 255, 255, 0.7)"},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 l=`${this.config.apiUrl||"http://localhost:3001"}/end-users/check-status`,c={clientKey:this.config.clientKey,origin:window.location.origin};(n=this.config.userInfo)!=null&&n.externalId&&(c.externalId=this.config.userInfo.externalId),(r=this.config.userInfo)!=null&&r.email&&(c.email=this.config.userInfo.email),this.config.debug&&console.log("[OnboardingSDK] Checking EndUser status...",{externalId:c.externalId?"***":void 0,email:c.email?"***":void 0});const d=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok){console.warn(`[OnboardingSDK] EndUser status check failed: ${d.status}`);return}this.endUserStatus=await d.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&&o.found&&!this.endUserStatus.isNewUser)return console.log("[OnboardingSDK] Skipping modal: existing EndUser (isNewUser=false)"),!0;const n=localStorage.getItem("floe_has_visited")==="true",r=!!((s=this.config.userInfo)!=null&&s.externalId),i=n||r;return console.log(`[OnboardingSDK] Auto-detect skip modal: ${i} (hasVisited: ${n}, hasUserIdentity: ${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.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.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=oy);function Ax(t){return{clientKey:t.clientKey,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}}function sy(t){if(!t.clientKey)throw new Error("[Floe] clientKey is required");const e=Ax(t),n=new oy(e);return n.ready=n.init().catch(r=>{throw console.error("[Floe] Initialization failed:",r),r}),n}typeof window<"u"&&(window.Floe=sy),_t.Floe=sy,Object.defineProperty(_t,Symbol.toStringTag,{value:"Module"})});
|
|
918
|
+
//# sourceMappingURL=floe-sdk.umd.js.map
|