@voxket-ai/voxket-live 1.0.52 → 1.0.53
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/README.md +1 -3
- package/dist/index.cjs +94 -586
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +16441 -39376
- package/package.json +1 -1
- package/dist/styles/inject-styles.d.ts +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,701 +1,209 @@
|
|
|
1
|
-
"use strict";var Hw=Object.defineProperty;var zw=(t,e,n)=>e in t?Hw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ye=(t,e,n)=>zw(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("react"),m=require("react/jsx-runtime"),Ww=require("react-dom"),qw=require("react-dom/client");function Gg(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const g=Gg(M),js=Gg(Ww);function Gw(t,e){return e.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(t)}var Kw=Object.defineProperty,Zw=(t,e,n)=>e in t?Kw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Lh=(t,e,n)=>Zw(t,typeof e!="symbol"?e+"":e,n);let yt=class{constructor(){Lh(this,"_locking"),Lh(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const n=new Promise(r=>e=()=>{this._locks-=1,r()}),i=this._locking.then(()=>e);return this._locking=this._locking.then(()=>n),i}};function He(t,e){if(!t)throw new Error(e)}const Yw=34028234663852886e22,Jw=-34028234663852886e22,Xw=4294967295,Qw=2147483647,eS=-2147483648;function So(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>Qw||t<eS)throw new Error("invalid int 32: "+t)}function vl(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>Xw||t<0)throw new Error("invalid uint 32: "+t)}function Kg(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>Yw||t<Jw))throw new Error("invalid float 32: "+t)}const Zg=Symbol("@bufbuild/protobuf/enum-type");function tS(t){const e=t[Zg];return He(e,"missing enum type on enum object"),e}function Yg(t,e,n,i){t[Zg]=Jg(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function Jg(t,e,n){const i=Object.create(null),r=Object.create(null),s=[];for(const o of e){const a=Xg(o);s.push(a),i[o.name]=a,r[o.no]=a}return{typeName:t,values:s,findName(o){return i[o]},findNumber(o){return r[o]}}}function nS(t,e,n){const i={};for(const r of e){const s=Xg(r);i[s.localName]=s.no,i[s.no]=s.localName}return Yg(i,t,e),i}function Xg(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Kd{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const i=this.getType(),r=i.runtime.bin,s=r.makeReadOptions(n);return r.readMessage(this,s.readerFactory(e),e.byteLength,s),this}fromJson(e,n){const i=this.getType(),r=i.runtime.json,s=r.makeReadOptions(n);return r.readMessage(i,e,s,this),this}fromJsonString(e,n){let i;try{i=JSON.parse(e)}catch(r){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(r instanceof Error?r.message:String(r)))}return this.fromJson(i,n)}toBinary(e){const n=this.getType(),i=n.runtime.bin,r=i.makeWriteOptions(e),s=r.writerFactory();return i.writeMessage(this,s,r),s.finish()}toJson(e){const n=this.getType(),i=n.runtime.json,r=i.makeWriteOptions(e);return i.writeMessage(this,r)}toJsonString(e){var n;const i=this.toJson(e);return JSON.stringify(i,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function iS(t,e,n,i){var r;const s=(r=i==null?void 0:i.localName)!==null&&r!==void 0?r:e.substring(e.lastIndexOf(".")+1),o={[s]:function(a){t.util.initFields(this),t.util.initPartial(a,this)}}[s];return Object.setPrototypeOf(o.prototype,new Kd),Object.assign(o,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(a,c){return new o().fromBinary(a,c)},fromJson(a,c){return new o().fromJson(a,c)},fromJsonString(a,c){return new o().fromJsonString(a,c)},equals(a,c){return t.util.equals(o,a,c)}}),o}function rS(){let t=0,e=0;for(let i=0;i<28;i+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<i,(r&128)==0)return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,(n&128)==0)return this.assertBounds(),[t,e];for(let i=3;i<=31;i+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<i,(r&128)==0)return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function ac(t,e,n){for(let s=0;s<28;s=s+7){const o=t>>>s,a=!(!(o>>>7)&&e==0),c=(a?o|128:o)&255;if(n.push(c),!a)return}const i=t>>>28&15|(e&7)<<4,r=e>>3!=0;if(n.push((r?i|128:i)&255),!!r){for(let s=3;s<31;s=s+7){const o=e>>>s,a=!!(o>>>7),c=(a?o|128:o)&255;if(n.push(c),!a)return}n.push(e>>>31&1)}}const ko=4294967296;function Vh(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let i=0,r=0;function s(o,a){const c=Number(t.slice(o,a));r*=n,i=i*n+c,i>=ko&&(r=r+(i/ko|0),i=i%ko)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?e0(i,r):Zd(i,r)}function sS(t,e){let n=Zd(t,e);const i=n.hi&2147483648;i&&(n=e0(n.lo,n.hi));const r=Qg(n.lo,n.hi);return i?"-"+r:r}function Qg(t,e){if({lo:t,hi:e}=oS(t,e),e<=2097151)return String(ko*e+t);const n=t&16777215,i=(t>>>24|e<<8)&16777215,r=e>>16&65535;let s=n+i*6777216+r*6710656,o=i+r*8147497,a=r*2;const c=1e7;return s>=c&&(o+=Math.floor(s/c),s%=c),o>=c&&(a+=Math.floor(o/c),o%=c),a.toString()+Fh(o)+Fh(s)}function oS(t,e){return{lo:t>>>0,hi:e>>>0}}function Zd(t,e){return{lo:t|0,hi:e|0}}function e0(t,e){return e=~e,t?t=~t+1:e+=1,Zd(t,e)}const Fh=t=>{const e=String(t);return"0000000".slice(e.length)+e};function Uh(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function aS(){let t=this.buf[this.pos++],e=t&127;if((t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,(t&128)==0)return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;(t&128)!==0&&n<10;n++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function cS(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){const r=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(c){const l=typeof c=="bigint"?c:BigInt(c);if(l>s||l<r)throw new Error("int64 invalid: ".concat(c));return l},uParse(c){const l=typeof c=="bigint"?c:BigInt(c);if(l>a||l<o)throw new Error("uint64 invalid: ".concat(c));return l},enc(c){return t.setBigInt64(0,this.parse(c),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(c){return t.setBigInt64(0,this.uParse(c),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(c,l){return t.setInt32(0,c,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)},uDec(c,l){return t.setInt32(0,c,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0)}}}const n=r=>He(/^-?[0-9]+$/.test(r),"int64 invalid: ".concat(r)),i=r=>He(/^[0-9]+$/.test(r),"uint64 invalid: ".concat(r));return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),n(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),i(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),n(r),Vh(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),i(r),Vh(r)},dec(r,s){return sS(r,s)},uDec(r,s){return Qg(r,s)}}}const De=cS();var K;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(K||(K={}));var Xn;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(Xn||(Xn={}));function Bn(t,e,n){if(e===n)return!0;if(t==K.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}switch(t){case K.UINT64:case K.FIXED64:case K.INT64:case K.SFIXED64:case K.SINT64:return e==n}return!1}function Tr(t,e){switch(t){case K.BOOL:return!1;case K.UINT64:case K.FIXED64:case K.INT64:case K.SFIXED64:case K.SINT64:return e==0?De.zero:"0";case K.DOUBLE:case K.FLOAT:return 0;case K.BYTES:return new Uint8Array(0);case K.STRING:return"";default:return 0}}function t0(t,e){switch(t){case K.BOOL:return e===!1;case K.STRING:return e==="";case K.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var Ke;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(Ke||(Ke={}));class lS{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),i=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],i),i+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(vl(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return So(e),Uh(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){Kg(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){vl(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){So(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return So(e),e=(e<<1^e>>31)>>>0,Uh(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),i=new DataView(n.buffer),r=De.enc(e);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),i=new DataView(n.buffer),r=De.uEnc(e);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=De.enc(e);return ac(n.lo,n.hi,this.buf),this}sint64(e){let n=De.enc(e),i=n.hi>>31,r=n.lo<<1^i,s=(n.hi<<1|n.lo>>>31)^i;return ac(r,s,this.buf),this}uint64(e){let n=De.uEnc(e);return ac(n.lo,n.hi,this.buf),this}}class dS{constructor(e,n){this.varint64=rS,this.uint32=aS,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,i=e&7;if(n<=0||i<0||i>5)throw new Error("illegal tag: field no "+n+" wire type "+i);return[n,i]}skip(e,n){let i=this.pos;switch(e){case Ke.Varint:for(;this.buf[this.pos++]&128;);break;case Ke.Bit64:this.pos+=4;case Ke.Bit32:this.pos+=4;break;case Ke.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Ke.StartGroup:for(;;){const[s,o]=this.tag();if(o===Ke.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(o,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return De.dec(...this.varint64())}uint64(){return De.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),i=-(e&1);return e=(e>>>1|(n&1)<<31)^i,n=n>>>1^i,De.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return De.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return De.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function uS(t,e,n,i){let r;return{typeName:e,extendee:n,get field(){if(!r){const s=typeof i=="function"?i():i;s.name=e.split(".").pop(),s.jsonName="[".concat(e,"]"),r=t.util.newFieldList([s]).list()[0]}return r},runtime:t}}function n0(t){const e=t.field.localName,n=Object.create(null);return n[e]=hS(t),[n,()=>n[e]]}function hS(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return Tr(e.T,e.L);case"message":const n=e.T,i=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}function fS(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let n=t.length-1;n>=0;--n)if(t[n].no==e.no)return[t[n]];return[]}return t.filter(n=>n.no===e.no)}let En="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),wa=[];for(let t=0;t<En.length;t++)wa[En[t].charCodeAt(0)]=t;wa[45]=En.indexOf("+");wa[95]=En.indexOf("/");const i0={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),i=0,r=0,s,o=0;for(let a=0;a<t.length;a++){if(s=wa[t.charCodeAt(a)],s===void 0)switch(t[a]){case"=":r=0;case`
|
|
2
|
-
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:o=s,r=1;break;case 1:n[i++]=o<<2|(s&48)>>4,o=s,r=2;break;case 2:n[i++]=(o&15)<<4|(s&60)>>2,o=s,r=3;break;case 3:n[i++]=(o&3)<<6|s,r=0;break}}if(r==1)throw Error("invalid base64 string.");return n.subarray(0,i)},enc(t){let e="",n=0,i,r=0;for(let s=0;s<t.length;s++)switch(i=t[s],n){case 0:e+=En[i>>2],r=(i&3)<<4,n=1;break;case 1:e+=En[r|i>>4],r=(i&15)<<2,n=2;break;case 2:e+=En[r|i>>6],e+=En[i&63],n=0;break}return n&&(e+=En[r],e+="=",n==1&&(e+="=")),e}};function mS(t,e,n){s0(e,t);const i=e.runtime.bin.makeReadOptions(n),r=fS(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,o]=n0(e);for(const a of r)e.runtime.bin.readField(s,i.readerFactory(a.data),e.field,a.wireType,i);return o()}function pS(t,e,n,i){s0(e,t);const r=e.runtime.bin.makeReadOptions(i),s=e.runtime.bin.makeWriteOptions(i);if(r0(t,e)){const l=t.getType().runtime.bin.listUnknownFields(t).filter(d=>d.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const d of l)t.getType().runtime.bin.onUnknownField(t,d.no,d.wireType,d.data)}const o=s.writerFactory();let a=e.field;!a.opt&&!a.repeated&&(a.kind=="enum"||a.kind=="scalar")&&(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,o,s);const c=r.readerFactory(o.finish());for(;c.pos<c.len;){const[l,d]=c.tag(),u=c.skip(d,l);t.getType().runtime.bin.onUnknownField(t,l,d,u)}}function r0(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(i=>i.no==e.field.no)}function s0(t,e){He(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function o0(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!t0(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function Bh(t,e){const n=t.localName,i=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=i?t.T.values[0].no:void 0;break;case"scalar":e[n]=i?Tr(t.T,t.L):void 0;break;case"message":e[n]=void 0;break}}function Pn(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Kd.prototype).every(i=>i in t&&typeof t[i]=="function"))return!1;const n=t.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:e===void 0?!0:n.typeName==e.typeName}function a0(t,e){return Pn(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}K.DOUBLE,K.FLOAT,K.INT64,K.UINT64,K.INT32,K.UINT32,K.BOOL,K.STRING,K.BYTES;const $h={ignoreUnknownFields:!1},Hh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function gS(t){return t?Object.assign(Object.assign({},$h),t):$h}function vS(t){return t?Object.assign(Object.assign({},Hh),t):Hh}const Yo=Symbol(),Co=Symbol();function yS(){return{makeReadOptions:gS,makeWriteOptions:vS,readMessage(t,e,n,i){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(rn(e)));i=i??new t;const r=new Map,s=n.typeRegistry;for(const[o,a]of Object.entries(e)){const c=t.fields.findJsonName(o);if(c){if(c.oneof){if(a===null&&c.kind=="scalar")continue;const l=r.get(c.oneof);if(l!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(c.oneof.name,'" present: "').concat(l,'", "').concat(o,'"'));r.set(c.oneof,o)}zh(i,a,c,n,t)}else{let l=!1;if(s!=null&&s.findExtension&&o.startsWith("[")&&o.endsWith("]")){const d=s.findExtension(o.substring(1,o.length-1));if(d&&d.extendee.typeName==t.typeName){l=!0;const[u,h]=n0(d);zh(u,a,d.field,n,d),pS(i,d,h(),n)}}if(!l&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(o,'" is unknown'))}}return i},writeMessage(t,e){const n=t.getType(),i={};let r;try{for(r of n.fields.byNumber()){if(!o0(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!xS(r))continue}const o=r.oneof?t[r.oneof.localName].value:t[r.localName],a=Wh(r,o,e);a!==void 0&&(i[e.useProtoFieldName?r.name:r.jsonName]=a)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const o of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,o.no);if(a&&r0(t,a)){const c=mS(t,a,e),l=Wh(a.field,c,e);l!==void 0&&(i[a.field.jsonName]=l)}}}catch(s){const o=r?"cannot encode field ".concat(n.typeName,".").concat(r.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),a=s instanceof Error?s.message:String(s);throw new Error(o+(a.length>0?": ".concat(a):""))}return i},readScalar(t,e,n){return ds(t,e,n??Xn.BIGINT,!0)},writeScalar(t,e,n){if(e!==void 0&&(n||t0(t,e)))return To(t,e)},debug:rn}}function rn(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function zh(t,e,n,i,r){let s=n.localName;if(n.repeated){if(He(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(e)));const o=t[s];for(const a of e){if(a===null)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(a)));switch(n.kind){case"message":o.push(n.T.fromJson(a,i));break;case"enum":const c=cc(n.T,a,i.ignoreUnknownFields,!0);c!==Co&&o.push(c);break;case"scalar":try{o.push(ds(n.T,a,n.L,!0))}catch(l){let d="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(a));throw l instanceof Error&&l.message.length>0&&(d+=": ".concat(l.message)),new Error(d)}break}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(e)));const o=t[s];for(const[a,c]of Object.entries(e)){if(c===null)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: map value null"));let l;try{l=bS(n.K,a)}catch(d){let u="cannot decode map key for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(e));throw d instanceof Error&&d.message.length>0&&(u+=": ".concat(d.message)),new Error(u)}switch(n.V.kind){case"message":o[l]=n.V.T.fromJson(c,i);break;case"enum":const d=cc(n.V.T,c,i.ignoreUnknownFields,!0);d!==Co&&(o[l]=d);break;case"scalar":try{o[l]=ds(n.V.T,c,Xn.BIGINT,!0)}catch(u){let h="cannot decode map value for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(e));throw u instanceof Error&&u.message.length>0&&(h+=": ".concat(u.message)),new Error(h)}break}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const o=n.T;if(e===null&&o.typeName!="google.protobuf.Value")return;let a=t[s];Pn(a)?a.fromJson(e,i):(t[s]=a=o.fromJson(e,i),o.fieldWrapper&&!n.oneof&&(t[s]=o.fieldWrapper.unwrapField(a)));break;case"enum":const c=cc(n.T,e,i.ignoreUnknownFields,!1);switch(c){case Yo:Bh(n,t);break;case Co:break;default:t[s]=c;break}break;case"scalar":try{const l=ds(n.T,e,n.L,!1);switch(l){case Yo:Bh(n,t);break;default:t[s]=l;break}}catch(l){let d="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(rn(e));throw l instanceof Error&&l.message.length>0&&(d+=": ".concat(l.message)),new Error(d)}break}}function bS(t,e){if(t===K.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return ds(t,e,Xn.BIGINT,!0).toString()}function ds(t,e,n,i){if(e===null)return i?Tr(t,n):Yo;switch(t){case K.DOUBLE:case K.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==K.FLOAT&&Kg(r),r;case K.INT32:case K.FIXED32:case K.SFIXED32:case K.SINT32:case K.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==K.UINT32||t==K.FIXED32?vl(s):So(s),s;case K.INT64:case K.SFIXED64:case K.SINT64:if(typeof e!="number"&&typeof e!="string")break;const o=De.parse(e);return n?o.toString():o;case K.FIXED64:case K.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=De.uParse(e);return n?a.toString():a;case K.BOOL:if(typeof e!="boolean")break;return e;case K.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case K.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return i0.dec(e)}throw new Error}function cc(t,e,n,i){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:i?t.values[0].no:Yo;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return Co;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(rn(e)))}function xS(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function Wh(t,e,n){if(t.kind=="map"){He(typeof e=="object"&&e!=null);const i={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[o,a]of r)i[o.toString()]=To(t.V.T,a);break;case"message":for(const[o,a]of r)i[o.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[o,a]of r)i[o.toString()]=lc(s,a,n.enumAsInteger);break}return n.emitDefaultValues||r.length>0?i:void 0}if(t.repeated){He(Array.isArray(e));const i=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)i.push(To(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)i.push(lc(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)i.push(e[r].toJson(n));break}return n.emitDefaultValues||i.length>0?i:void 0}switch(t.kind){case"scalar":return To(t.T,e);case"enum":return lc(t.T,e,n.enumAsInteger);case"message":return a0(t.T,e).toJson(n)}}function lc(t,e,n){var i;if(He(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(i=r==null?void 0:r.name)!==null&&i!==void 0?i:e}function To(t,e){switch(t){case K.INT32:case K.SFIXED32:case K.SINT32:case K.FIXED32:case K.UINT32:return He(typeof e=="number"),e;case K.FLOAT:case K.DOUBLE:return He(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case K.STRING:return He(typeof e=="string"),e;case K.BOOL:return He(typeof e=="boolean"),e;case K.UINT64:case K.FIXED64:case K.INT64:case K.SFIXED64:case K.SINT64:return He(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case K.BYTES:return He(e instanceof Uint8Array),i0.enc(e)}}const zi=Symbol("@bufbuild/protobuf/unknown-fields"),qh={readUnknownFields:!0,readerFactory:t=>new dS(t)},Gh={writeUnknownFields:!0,writerFactory:()=>new lS};function wS(t){return t?Object.assign(Object.assign({},qh),t):qh}function SS(t){return t?Object.assign(Object.assign({},Gh),t):Gh}function kS(){return{makeReadOptions:wS,makeWriteOptions:SS,listUnknownFields(t){var e;return(e=t[zi])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[zi]},writeUnknownFields(t,e){const i=t[zi];if(i)for(const r of i)e.tag(r.no,r.wireType).raw(r.data)},onUnknownField(t,e,n,i){const r=t;Array.isArray(r[zi])||(r[zi]=[]),r[zi].push({no:e,wireType:n,data:i})},readMessage(t,e,n,i,r){const s=t.getType(),o=r?e.len:e.pos+n;let a,c;for(;e.pos<o&&([a,c]=e.tag(),!(r===!0&&c==Ke.EndGroup));){const l=s.fields.find(a);if(!l){const d=e.skip(c,a);i.readUnknownFields&&this.onUnknownField(t,a,c,d);continue}Kh(t,e,l,c,i)}if(r&&(c!=Ke.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:Kh,writeMessage(t,e,n){const i=t.getType();for(const r of i.fields.byNumber()){if(!o0(r,t)){if(r.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(r.name," to binary: required field not set"));continue}const s=r.oneof?t[r.oneof.localName].value:t[r.localName];Zh(r,s,e,n)}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,i){e!==void 0&&Zh(t,e,n,i)}}}function Kh(t,e,n,i,r){let{repeated:s,localName:o}=n;switch(n.oneof&&(t=t[n.oneof.localName],t.case!=o&&delete t.value,t.case=o,o="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?K.INT32:n.T;let c=Jo;if(n.kind=="scalar"&&n.L>0&&(c=TS),s){let h=t[o];if(i==Ke.LengthDelimited&&a!=K.STRING&&a!=K.BYTES){let v=e.uint32()+e.pos;for(;e.pos<v;)h.push(c(e,a))}else h.push(c(e,a))}else t[o]=c(e,a);break;case"message":const l=n.T;s?t[o].push(Eo(e,new l,r,n)):Pn(t[o])?Eo(e,t[o],r,n):(t[o]=Eo(e,new l,r,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(t[o]=l.fieldWrapper.unwrapField(t[o])));break;case"map":let[d,u]=CS(n,e,r);t[o][d]=u;break}}function Eo(t,e,n,i){const r=e.getType().runtime.bin,s=i==null?void 0:i.delimited;return r.readMessage(e,t,s?i.no:t.uint32(),n,s),e}function CS(t,e,n){const i=e.uint32(),r=e.pos+i;let s,o;for(;e.pos<r;){const[a]=e.tag();switch(a){case 1:s=Jo(e,t.K);break;case 2:switch(t.V.kind){case"scalar":o=Jo(e,t.V.T);break;case"enum":o=e.int32();break;case"message":o=Eo(e,new t.V.T,n,void 0);break}break}}if(s===void 0&&(s=Tr(t.K,Xn.BIGINT)),typeof s!="string"&&typeof s!="number"&&(s=s.toString()),o===void 0)switch(t.V.kind){case"scalar":o=Tr(t.V.T,Xn.BIGINT);break;case"enum":o=t.V.T.values[0].no;break;case"message":o=new t.V.T;break}return[s,o]}function TS(t,e){const n=Jo(t,e);return typeof n=="bigint"?n.toString():n}function Jo(t,e){switch(e){case K.STRING:return t.string();case K.BOOL:return t.bool();case K.DOUBLE:return t.double();case K.FLOAT:return t.float();case K.INT32:return t.int32();case K.INT64:return t.int64();case K.UINT64:return t.uint64();case K.FIXED64:return t.fixed64();case K.BYTES:return t.bytes();case K.FIXED32:return t.fixed32();case K.SFIXED32:return t.sfixed32();case K.SFIXED64:return t.sfixed64();case K.SINT64:return t.sint64();case K.UINT32:return t.uint32();case K.SINT32:return t.sint32()}}function Zh(t,e,n,i){He(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?K.INT32:t.T;if(r)if(He(Array.isArray(e)),t.packed)PS(n,s,t.no,e);else for(const o of e)us(n,s,t.no,o);else us(n,s,t.no,e);break;case"message":if(r){He(Array.isArray(e));for(const o of e)Yh(n,i,t,o)}else Yh(n,i,t,e);break;case"map":He(typeof e=="object"&&e!=null);for(const[o,a]of Object.entries(e))ES(n,i,t,o,a);break}}function ES(t,e,n,i,r){t.tag(n.no,Ke.LengthDelimited),t.fork();let s=i;switch(n.K){case K.INT32:case K.FIXED32:case K.UINT32:case K.SFIXED32:case K.SINT32:s=Number.parseInt(i);break;case K.BOOL:He(i=="true"||i=="false"),s=i=="true";break}switch(us(t,n.K,1,s),n.V.kind){case"scalar":us(t,n.V.T,2,r);break;case"enum":us(t,K.INT32,2,r);break;case"message":He(r!==void 0),t.tag(2,Ke.LengthDelimited).bytes(r.toBinary(e));break}t.join()}function Yh(t,e,n,i){const r=a0(n.T,i);n.delimited?t.tag(n.no,Ke.StartGroup).raw(r.toBinary(e)).tag(n.no,Ke.EndGroup):t.tag(n.no,Ke.LengthDelimited).bytes(r.toBinary(e))}function us(t,e,n,i){He(i!==void 0);let[r,s]=c0(e);t.tag(n,r)[s](i)}function PS(t,e,n,i){if(!i.length)return;t.tag(n,Ke.LengthDelimited).fork();let[,r]=c0(e);for(let s=0;s<i.length;s++)t[r](i[s]);t.join()}function c0(t){let e=Ke.Varint;switch(t){case K.BYTES:case K.STRING:e=Ke.LengthDelimited;break;case K.DOUBLE:case K.FIXED64:case K.SFIXED64:e=Ke.Bit64;break;case K.FIXED32:case K.SFIXED32:case K.FLOAT:e=Ke.Bit32;break}const n=K[t].toLowerCase();return[e,n]}function RS(){return{setEnumType:Yg,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const i of n.fields.byMember()){const r=i.localName,s=e,o=t;if(o[r]!=null)switch(i.kind){case"oneof":const a=o[r].case;if(a===void 0)continue;const c=i.findField(a);let l=o[r].value;c&&c.kind=="message"&&!Pn(l,c.T)?l=new c.T(l):c&&c.kind==="scalar"&&c.T===K.BYTES&&(l=Kr(l)),s[r]={case:a,value:l};break;case"scalar":case"enum":let d=o[r];i.T===K.BYTES&&(d=i.repeated?d.map(Kr):Kr(d)),s[r]=d;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===K.BYTES)for(const[p,v]of Object.entries(o[r]))s[r][p]=Kr(v);else Object.assign(s[r],o[r]);break;case"message":const h=i.V.T;for(const p of Object.keys(o[r])){let v=o[r][p];h.fieldWrapper||(v=new h(v)),s[r][p]=v}break}break;case"message":const u=i.T;if(i.repeated)s[r]=o[r].map(h=>Pn(h,u)?h:new u(h));else{const h=o[r];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?s[r]=Kr(h):s[r]=h:s[r]=Pn(h,u)?h:new u(h)}break}}},equals(t,e,n){return e===n?!0:!e||!n?!1:t.fields.byMember().every(i=>{const r=e[i.localName],s=n[i.localName];if(i.repeated){if(r.length!==s.length)return!1;switch(i.kind){case"message":return r.every((o,a)=>i.T.equals(o,s[a]));case"scalar":return r.every((o,a)=>Bn(i.T,o,s[a]));case"enum":return r.every((o,a)=>Bn(K.INT32,o,s[a]))}throw new Error("repeated cannot contain ".concat(i.kind))}switch(i.kind){case"message":let o=r,a=s;return i.T.fieldWrapper&&(o!==void 0&&!Pn(o)&&(o=i.T.fieldWrapper.wrapField(o)),a!==void 0&&!Pn(a)&&(a=i.T.fieldWrapper.wrapField(a))),i.T.equals(o,a);case"enum":return Bn(K.INT32,r,s);case"scalar":return Bn(i.T,r,s);case"oneof":if(r.case!==s.case)return!1;const c=i.findField(r.case);if(c===void 0)return!0;switch(c.kind){case"message":return c.T.equals(r.value,s.value);case"enum":return Bn(K.INT32,r.value,s.value);case"scalar":return Bn(c.T,r.value,s.value)}throw new Error("oneof cannot contain ".concat(c.kind));case"map":const l=Object.keys(r).concat(Object.keys(s));switch(i.V.kind){case"message":const d=i.V.T;return l.every(h=>d.equals(r[h],s[h]));case"enum":return l.every(h=>Bn(K.INT32,r[h],s[h]));case"scalar":const u=i.V.T;return l.every(h=>Bn(u,r[h],s[h]))}break}})},clone(t){const e=t.getType(),n=new e,i=n;for(const r of e.fields.byMember()){const s=t[r.localName];let o;if(r.repeated)o=s.map(Js);else if(r.kind=="map"){o=i[r.localName];for(const[a,c]of Object.entries(s))o[a]=Js(c)}else r.kind=="oneof"?o=r.findField(s.case)?{case:s.case,value:Js(s.value)}:{case:void 0}:o=Js(s);i[r.localName]=o}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(i,r.no,r.wireType,r.data);return n}}}function Js(t){if(t===void 0)return t;if(Pn(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Kr(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function AS(t,e,n){return{syntax:t,json:yS(),bin:kS(),util:Object.assign(Object.assign({},RS()),{newFieldList:e,initFields:n}),makeMessageType(i,r,s){return iS(this,i,r,s)},makeEnum:nS,makeEnumType:Jg,getEnumType:tS,makeExtension(i,r,s){return uS(this,i,r,s)}}}class IS{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const i of this.list())n[i.jsonName]=n[i.name]=i;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const i of this.list())n[i.no]=i;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const i of this.list())i.oneof?i.oneof!==n&&(n=i.oneof,e.push(n)):e.push(i)}return this.members}}function l0(t,e){const n=d0(t);return e?n:jS(DS(n))}function MS(t){return l0(t,!1)}const NS=d0;function d0(t){let e=!1;const n=[];for(let i=0;i<t.length;i++){let r=t.charAt(i);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r);break}}return n.join("")}const _S=new Set(["constructor","toString","toJSON","valueOf"]),OS=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),u0=t=>"".concat(t,"$"),DS=t=>OS.has(t)?u0(t):t,jS=t=>_S.has(t)?u0(t):t;class LS{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=MS(e)}addField(e){He(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}function VS(t,e){var n,i,r,s,o,a;const c=[];let l;for(const d of typeof t=="function"?t():t){const u=d;if(u.localName=l0(d.name,d.oneof!==void 0),u.jsonName=(n=d.jsonName)!==null&&n!==void 0?n:NS(d.name),u.repeated=(i=d.repeated)!==null&&i!==void 0?i:!1,d.kind=="scalar"&&(u.L=(r=d.L)!==null&&r!==void 0?r:Xn.BIGINT),u.delimited=(s=d.delimited)!==null&&s!==void 0?s:!1,u.req=(o=d.req)!==null&&o!==void 0?o:!1,u.opt=(a=d.opt)!==null&&a!==void 0?a:!1,d.packed===void 0&&(u.packed=d.kind=="enum"||d.kind=="scalar"&&d.T!=K.BYTES&&d.T!=K.STRING),d.oneof!==void 0){const h=typeof d.oneof=="string"?d.oneof:d.oneof.name;(!l||l.name!=h)&&(l=new LS(h)),u.oneof=l,l.addField(u)}c.push(u)}return c}const U=AS("proto3",t=>new IS(t,e=>VS(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,i=t;if(e.repeated){i[n]=[];continue}switch(e.kind){case"oneof":i[n]={case:void 0};break;case"enum":i[n]=0;break;case"map":i[n]={};break;case"scalar":i[n]=Tr(e.T,e.L);break}}});class vt extends Kd{constructor(e){super(),this.seconds=De.zero,this.nanos=0,U.util.initPartial(e,this)}fromJson(e,n){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(U.json.debug(e)));const i=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const r=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(r))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=De.parse(r/1e3),this.nanos=0,i[7]&&(this.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),this}toJson(e){const n=Number(this.seconds)*1e3;if(n<Date.parse("0001-01-01T00:00:00Z")||n>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let i="Z";if(this.nanos>0){const r=(this.nanos+1e9).toString().substring(1);r.substring(3)==="000000"?i="."+r.substring(0,3)+"Z":r.substring(6)==="000"?i="."+r.substring(0,6)+"Z":i="."+r+"Z"}return new Date(n).toISOString().replace(".000Z",i)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return vt.fromDate(new Date)}static fromDate(e){const n=e.getTime();return new vt({seconds:De.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(e,n){return new vt().fromBinary(e,n)}static fromJson(e,n){return new vt().fromJson(e,n)}static fromJsonString(e,n){return new vt().fromJsonString(e,n)}static equals(e,n){return U.util.equals(vt,e,n)}}vt.runtime=U;vt.typeName="google.protobuf.Timestamp";vt.fields=U.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const FS=U.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:vt},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:US,repeated:!0},{no:5,name:"events",kind:"message",T:$S,repeated:!0}]),US=U.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:BS,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),BS=U.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:vt},{no:3,name:"value",kind:"scalar",T:2}]),$S=U.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:vt},{no:7,name:"normalized_end_timestamp",kind:"message",T:vt,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),h0=U.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Wt=U.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Xe=U.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),Yd=U.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),rs=U.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),ys=U.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Gt=U.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"}]),Wi=U.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),HS=U.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),st=U.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),Sa=U.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:Xo,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:T0}]),Xo=U.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),zS=U.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:U.getEnumType(Xe),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),_i=U.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:U.getEnumType(hr)},{no:4,name:"tracks",kind:"message",T:ir,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:zS},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:U.getEnumType(Oi)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:U.getEnumType(Gt)},{no:18,name:"kind_details",kind:"enum",T:U.getEnumType(WS),repeated:!0}]),hr=U.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Oi=U.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),WS=U.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),Ct=U.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),qS=U.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Pi,repeated:!0}]),ir=U.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:U.getEnumType(Wt)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:U.getEnumType(Xe)},{no:10,name:"layers",kind:"message",T:Pi,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:qS,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:U.getEnumType(Ct)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:T0},{no:19,name:"audio_features",kind:"enum",T:U.getEnumType(st),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:U.getEnumType(h0)}]),Pi=U.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:U.getEnumType(Yd)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}]),gt=U.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:U.getEnumType(me)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:m0,oneof:"value"},{no:3,name:"speaker",kind:"message",T:GS,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:p0,oneof:"value"},{no:7,name:"transcription",kind:"message",T:KS,oneof:"value"},{no:8,name:"metrics",kind:"message",T:FS,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:yl,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:g0,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:v0,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:y0,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:xl,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:wl,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Sl,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),me=U.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),GS=U.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:f0,repeated:!0}]),f0=U.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),m0=U.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),p0=U.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),KS=U.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:ZS,repeated:!0}]),ZS=U.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),yl=U.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),g0=U.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),v0=U.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),y0=U.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:b0,oneof:"value"}]),b0=U.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),x0=U.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),w0=U.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:U.getEnumType(S0)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),S0=U.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),YS=U.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:U.getEnumType(k0)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),k0=U.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"}]),C0=U.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:Jh},{no:2,name:"screen",kind:"message",T:Jh},{no:3,name:"resume_connection",kind:"enum",T:U.getEnumType(ys)},{no:4,name:"disabled_codecs",kind:"message",T:JS},{no:5,name:"force_relay",kind:"enum",T:U.getEnumType(ys)}]),Jh=U.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:U.getEnumType(ys)}]),JS=U.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:Xo,repeated:!0},{no:2,name:"publish",kind:"message",T:Xo,repeated:!0}]),T0=U.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),bl=U.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),E0=U.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:U.getEnumType(bl)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),P0=U.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),xl=U.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:U.getEnumType(Ct)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:E0,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:P0,oneof:"content_header"}],{localName:"DataStream_Header"}),wl=U.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),Sl=U.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),qt=U.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),kl=U.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),XS=U.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),QS=U.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:Di,oneof:"message"},{no:2,name:"answer",kind:"message",T:Di,oneof:"message"},{no:3,name:"trickle",kind:"message",T:Jd,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Tl,oneof:"message"},{no:5,name:"mute",kind:"message",T:Xd,oneof:"message"},{no:6,name:"subscription",kind:"message",T:ka,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:R0,oneof:"message"},{no:8,name:"leave",kind:"message",T:Ca,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:I0,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:O0,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:D0,oneof:"message"},{no:13,name:"simulate",kind:"message",T:nn,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:M0,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:V0,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:A0,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:rk,oneof:"message"}]),Xh=U.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:ek,oneof:"message"},{no:2,name:"answer",kind:"message",T:Di,oneof:"message"},{no:3,name:"offer",kind:"message",T:Di,oneof:"message"},{no:4,name:"trickle",kind:"message",T:Jd,oneof:"message"},{no:5,name:"update",kind:"message",T:ik,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Qd,oneof:"message"},{no:8,name:"leave",kind:"message",T:Ca,oneof:"message"},{no:9,name:"mute",kind:"message",T:Xd,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:sk,oneof:"message"},{no:11,name:"room_update",kind:"message",T:ok,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:ck,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:dk,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:hk,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:fk,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:nk,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:tk,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:pk,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:yk,oneof:"message"},{no:22,name:"request_response",kind:"message",T:bk,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:xk,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:mk,oneof:"message"}]),Cl=U.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),Tl=U.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:U.getEnumType(Wt)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:U.getEnumType(Xe)},{no:9,name:"layers",kind:"message",T:Pi,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Cl,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:U.getEnumType(Ct)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:U.getEnumType(h0)},{no:17,name:"audio_features",kind:"enum",T:U.getEnumType(st),repeated:!0}]),Jd=U.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:U.getEnumType(qt)},{no:3,name:"final",kind:"scalar",T:8}]),Xd=U.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),ek=U.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:Sa},{no:2,name:"participant",kind:"message",T:_i},{no:3,name:"other_participants",kind:"message",T:_i,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:N0,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:C0},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:w0},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:Xo,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),tk=U.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:N0,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:C0},{no:3,name:"server_info",kind:"message",T:w0},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),Qd=U.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:ir}]),nk=U.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Di=U.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13}]),ik=U.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:_i,repeated:!0}]),ka=U.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:x0,repeated:!0}]),R0=U.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:U.getEnumType(Yd)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),A0=U.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:U.getEnumType(st),repeated:!0}]),rk=U.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),Ca=U.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:U.getEnumType(Gt)},{no:3,name:"action",kind:"enum",T:U.getEnumType(fr)},{no:4,name:"regions",kind:"message",T:gk}]),fr=U.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),I0=U.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Pi,repeated:!0}]),M0=U.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),N0=U.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),sk=U.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:f0,repeated:!0}]),ok=U.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:Sa}]),ak=U.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:U.getEnumType(rs)},{no:3,name:"score",kind:"scalar",T:2}]),ck=U.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:ak,repeated:!0}]),lk=U.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:U.getEnumType(kl)}]),dk=U.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:lk,repeated:!0}]),eu=U.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:U.getEnumType(Yd)},{no:2,name:"enabled",kind:"scalar",T:8}]),uk=U.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:eu,repeated:!0}]),hk=U.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:eu,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:uk,repeated:!0}]),_0=U.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),O0=U.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:_0,repeated:!0}]),fk=U.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),mk=U.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:Sa},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:_i},{no:4,name:"other_participants",kind:"message",T:_i,repeated:!0}]),D0=U.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:Di},{no:2,name:"subscription",kind:"message",T:ka},{no:3,name:"publish_tracks",kind:"message",T:Qd,repeated:!0},{no:4,name:"data_channels",kind:"message",T:L0,repeated:!0},{no:5,name:"offer",kind:"message",T:Di},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:j0,repeated:!0}]),j0=U.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),L0=U.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:U.getEnumType(qt)}]),nn=U.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:U.getEnumType(XS),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),V0=U.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),pk=U.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),gk=U.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:vk,repeated:!0}]),vk=U.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),yk=U.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:U.getEnumType(HS)}]),bk=U.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:U.getEnumType(tu)},{no:3,name:"message",kind:"scalar",T:9}]),tu=U.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),xk=U.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function wk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Po={exports:{}},Sk=Po.exports,Qh;function kk(){return Qh||(Qh=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(Sk,function(){var e=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(f,y){var b=f[y];if(typeof b.bind=="function")return b.bind(f);try{return Function.prototype.bind.call(b,f)}catch{return function(){return Function.prototype.apply.apply(b,[f,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(f){return f==="debug"&&(f="log"),typeof console===n?!1:f==="trace"&&i?c:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):e}function d(){for(var f=this.getLevel(),y=0;y<r.length;y++){var b=r[y];this[b]=y<f?e:this.methodFactory(b,f,this.name)}if(this.log=this.debug,typeof console===n&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==n&&(d.call(this),this[f].apply(this,arguments))}}function h(f,y,b){return l(f)||u.apply(this,arguments)}function p(f,y){var b=this,S,k,w,x="loglevel";typeof f=="string"?x+=":"+f:typeof f=="symbol"&&(x=void 0);function T(A){var N=(r[A]||"silent").toUpperCase();if(!(typeof window===n||!x)){try{window.localStorage[x]=N;return}catch{}try{window.document.cookie=encodeURIComponent(x)+"="+N+";"}catch{}}}function E(){var A;if(!(typeof window===n||!x)){try{A=window.localStorage[x]}catch{}if(typeof A===n)try{var N=window.document.cookie,Z=encodeURIComponent(x),Q=N.indexOf(Z+"=");Q!==-1&&(A=/^([^;]+)/.exec(N.slice(Q+Z.length+1))[1])}catch{}return b.levels[A]===void 0&&(A=void 0),A}}function P(){if(!(typeof window===n||!x)){try{window.localStorage.removeItem(x)}catch{}try{window.document.cookie=encodeURIComponent(x)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function I(A){var N=A;if(typeof N=="string"&&b.levels[N.toUpperCase()]!==void 0&&(N=b.levels[N.toUpperCase()]),typeof N=="number"&&N>=0&&N<=b.levels.SILENT)return N;throw new TypeError("log.setLevel() called with invalid level: "+A)}b.name=f,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=y||h,b.getLevel=function(){return w??k??S},b.setLevel=function(A,N){return w=I(A),N!==!1&&T(w),d.call(b)},b.setDefaultLevel=function(A){k=I(A),E()||b.setLevel(A,!1)},b.resetLevel=function(){w=null,P(),d.call(b)},b.enableAll=function(A){b.setLevel(b.levels.TRACE,A)},b.disableAll=function(A){b.setLevel(b.levels.SILENT,A)},b.rebuild=function(){if(o!==b&&(S=I(o.getLevel())),d.call(b),o===b)for(var A in s)s[A].rebuild()},S=I(o?o.getLevel():"WARN");var C=E();C!=null&&(w=I(C)),d.call(b)}o=new p,o.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var b=s[y];return b||(b=s[y]=new p(y,o.methodFactory)),b};var v=typeof window!==n?window.log:void 0;return o.noConflict=function(){return typeof window!==n&&window.log===o&&(window.log=v),o},o.getLoggers=function(){return s},o.default=o,o})}(Po)),Po.exports}var Ta=kk(),El;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(El||(El={}));var Zt;(function(t){t.Default="livekit",t.Room="livekit-room",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee"})(Zt||(Zt={}));let ye=Ta.getLogger("livekit");const Ck=Object.values(Zt).map(t=>Ta.getLogger(t));ye.setDefaultLevel(El.info);function Nn(t){const e=Ta.getLogger(t);return e.setDefaultLevel(ye.getLevel()),e}function Tk(t,e){for(const n of Ck)n.setLevel(t)}const Ek=Ta.getLogger("lk-e2ee"),Zr=7e3,Pk=[0,300,4*300,9*300,16*300,Zr,Zr,Zr,Zr,Zr];class Rk{constructor(e){this._retryDelays=e!==void 0?[...e]:Pk}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const n=this._retryDelays[e.retryCount];return e.retryCount<=1?n:n+Math.random()*1e3}}function Ak(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function R(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{l(i.next(d))}catch(u){o(u)}}function c(d){try{l(i.throw(d))}catch(u){o(u)}}function l(d){d.done?s(d.value):r(d.value).then(a,c)}l((i=i.apply(t,e||[])).next())})}function ef(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rn(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof ef=="function"?ef(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(s){n[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),r(a,c,o.done,o.value)})}}function r(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var Xs={exports:{}},tf;function Ik(){if(tf)return Xs.exports;tf=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(x,T,E){return Function.prototype.apply.call(x,T,E)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:n=function(x){return Object.getOwnPropertyNames(x)};function i(w){console&&console.warn&&console.warn(w)}var r=Number.isNaN||function(x){return x!==x};function s(){s.init.call(this)}Xs.exports=s,Xs.exports.once=b,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(w){if(typeof w!="number"||w<0||r(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");o=w}}),s.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},s.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||r(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function c(w){return w._maxListeners===void 0?s.defaultMaxListeners:w._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(x){for(var T=[],E=1;E<arguments.length;E++)T.push(arguments[E]);var P=x==="error",I=this._events;if(I!==void 0)P=P&&I.error===void 0;else if(!P)return!1;if(P){var C;if(T.length>0&&(C=T[0]),C instanceof Error)throw C;var A=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw A.context=C,A}var N=I[x];if(N===void 0)return!1;if(typeof N=="function")e(N,this,T);else for(var Z=N.length,Q=v(N,Z),E=0;E<Z;++E)e(Q[E],this,T);return!0};function l(w,x,T,E){var P,I,C;if(a(T),I=w._events,I===void 0?(I=w._events=Object.create(null),w._eventsCount=0):(I.newListener!==void 0&&(w.emit("newListener",x,T.listener?T.listener:T),I=w._events),C=I[x]),C===void 0)C=I[x]=T,++w._eventsCount;else if(typeof C=="function"?C=I[x]=E?[T,C]:[C,T]:E?C.unshift(T):C.push(T),P=c(w),P>0&&C.length>P&&!C.warned){C.warned=!0;var A=new Error("Possible EventEmitter memory leak detected. "+C.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");A.name="MaxListenersExceededWarning",A.emitter=w,A.type=x,A.count=C.length,i(A)}return w}s.prototype.addListener=function(x,T){return l(this,x,T,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(x,T){return l(this,x,T,!0)};function d(){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 u(w,x,T){var E={fired:!1,wrapFn:void 0,target:w,type:x,listener:T},P=d.bind(E);return P.listener=T,E.wrapFn=P,P}s.prototype.once=function(x,T){return a(T),this.on(x,u(this,x,T)),this},s.prototype.prependOnceListener=function(x,T){return a(T),this.prependListener(x,u(this,x,T)),this},s.prototype.removeListener=function(x,T){var E,P,I,C,A;if(a(T),P=this._events,P===void 0)return this;if(E=P[x],E===void 0)return this;if(E===T||E.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete P[x],P.removeListener&&this.emit("removeListener",x,E.listener||T));else if(typeof E!="function"){for(I=-1,C=E.length-1;C>=0;C--)if(E[C]===T||E[C].listener===T){A=E[C].listener,I=C;break}if(I<0)return this;I===0?E.shift():f(E,I),E.length===1&&(P[x]=E[0]),P.removeListener!==void 0&&this.emit("removeListener",x,A||T)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(x){var T,E,P;if(E=this._events,E===void 0)return this;if(E.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):E[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete E[x]),this;if(arguments.length===0){var I=Object.keys(E),C;for(P=0;P<I.length;++P)C=I[P],C!=="removeListener"&&this.removeAllListeners(C);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=E[x],typeof T=="function")this.removeListener(x,T);else if(T!==void 0)for(P=T.length-1;P>=0;P--)this.removeListener(x,T[P]);return this};function h(w,x,T){var E=w._events;if(E===void 0)return[];var P=E[x];return P===void 0?[]:typeof P=="function"?T?[P.listener||P]:[P]:T?y(P):v(P,P.length)}s.prototype.listeners=function(x){return h(this,x,!0)},s.prototype.rawListeners=function(x){return h(this,x,!1)},s.listenerCount=function(w,x){return typeof w.listenerCount=="function"?w.listenerCount(x):p.call(w,x)},s.prototype.listenerCount=p;function p(w){var x=this._events;if(x!==void 0){var T=x[w];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function v(w,x){for(var T=new Array(x),E=0;E<x;++E)T[E]=w[E];return T}function f(w,x){for(;x+1<w.length;x++)w[x]=w[x+1];w.pop()}function y(w){for(var x=new Array(w.length),T=0;T<x.length;++T)x[T]=w[T].listener||w[T];return x}function b(w,x){return new Promise(function(T,E){function P(C){w.removeListener(x,I),E(C)}function I(){typeof w.removeListener=="function"&&w.removeListener("error",P),T([].slice.call(arguments))}k(w,x,I,{once:!0}),x!=="error"&&S(w,P,{once:!0})})}function S(w,x,T){typeof w.on=="function"&&k(w,"error",x,T)}function k(w,x,T,E){if(typeof w.on=="function")E.once?w.once(x,T):w.on(x,T);else if(typeof w.addEventListener=="function")w.addEventListener(x,function P(I){E.once&&w.removeEventListener(x,P),T(I)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return Xs.exports}var vn=Ik();let F0=!0,U0=!0;function ss(t,e,n){const i=t.match(e);return i&&i.length>=n&&parseFloat(i[n],10)}function $i(t,e,n){if(!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(o,a){if(o!==e)return r.apply(this,arguments);const c=l=>{const d=n(l);d&&(a.handleEvent?a.handleEvent(d):a(d))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),r.apply(this,[o,c])};const s=i.removeEventListener;i.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);const c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Mk(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(F0=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Nk(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(U0=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function B0(){if(typeof window=="object"){if(F0)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function nu(t,e){U0&&console.warn(t+" is deprecated, please use "+e+" instead.")}function _k(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.userAgentData&&n.userAgentData.brands){const i=n.userAgentData.brands.find(r=>r.brand==="Chromium");if(i)return{browser:"chrome",version:parseInt(i.version,10)}}if(n.mozGetUserMedia)e.browser="firefox",e.version=parseInt(ss(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(ss(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(ss(n.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=ss(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function nf(t){return Object.prototype.toString.call(t)==="[object Object]"}function $0(t){return nf(t)?Object.keys(t).reduce(function(e,n){const i=nf(t[n]),r=i?$0(t[n]):t[n],s=i&&!Object.keys(r).length;return r===void 0||s?e:Object.assign(e,{[n]:r})},{}):t}function Pl(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Pl(t,t.get(e[i]),n):i.endsWith("Ids")&&e[i].forEach(r=>{Pl(t,t.get(r),n)})}))}function rf(t,e,n){const i=n?"outbound-rtp":"inbound-rtp",r=new Map;if(e===null)return r;const s=[];return t.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(o=>{t.forEach(a=>{a.type===i&&a.trackId===o.id&&Pl(t,a,r)})}),r}const sf=B0;function H0(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const i=function(a){if(typeof a!="object"||a.mandatory||a.optional)return a;const c={};return Object.keys(a).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const d=typeof a[l]=="object"?a[l]:{ideal:a[l]};d.exact!==void 0&&typeof d.exact=="number"&&(d.min=d.max=d.exact);const u=function(h,p){return h?h+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(d.ideal!==void 0){c.optional=c.optional||[];let h={};typeof d.ideal=="number"?(h[u("min",l)]=d.ideal,c.optional.push(h),h={},h[u("max",l)]=d.ideal,c.optional.push(h)):(h[u("",l)]=d.ideal,c.optional.push(h))}d.exact!==void 0&&typeof d.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[u("",l)]=d.exact):["min","max"].forEach(h=>{d[h]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[u(h,l)]=d[h])})}),a.advanced&&(c.optional=(c.optional||[]).concat(a.advanced)),c},r=function(a,c){if(e.version>=61)return c(a);if(a=JSON.parse(JSON.stringify(a)),a&&typeof a.audio=="object"){const l=function(d,u,h){u in d&&!(h in d)&&(d[h]=d[u],delete d[u])};a=JSON.parse(JSON.stringify(a)),l(a.audio,"autoGainControl","googAutoGainControl"),l(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=i(a.audio)}if(a&&typeof a.video=="object"){let l=a.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const d=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!d)){delete a.video.facingMode;let u;if(l.exact==="environment"||l.ideal==="environment"?u=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(u=["front"]),u)return n.mediaDevices.enumerateDevices().then(h=>{h=h.filter(v=>v.kind==="videoinput");let p=h.find(v=>u.some(f=>v.label.toLowerCase().includes(f)));return!p&&h.length&&u.includes("back")&&(p=h[h.length-1]),p&&(a.video.deviceId=l.exact?{exact:p.deviceId}:{ideal:p.deviceId}),a.video=i(a.video),sf("chrome: "+JSON.stringify(a)),c(a)})}a.video=i(a.video)}return sf("chrome: "+JSON.stringify(a)),c(a)},s=function(a){return e.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(a,c,l){r(a,d=>{n.webkitGetUserMedia(d,c,u=>{l&&l(s(u))})})};if(n.getUserMedia=o.bind(n),n.mediaDevices.getUserMedia){const a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(c){return r(c,l=>a(l).then(d=>{if(l.audio&&!d.getAudioTracks().length||l.video&&!d.getVideoTracks().length)throw d.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return d},d=>Promise.reject(s(d))))}}}function z0(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function W0(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(n){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=n)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=i=>{i.stream.addEventListener("addtrack",r=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===r.track.id):s={track:r.track};const o=new Event("track");o.track=r.track,o.receiver=s,o.transceiver={receiver:s},o.streams=[i.stream],this.dispatchEvent(o)}),i.stream.getTracks().forEach(r=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===r.id):s={track:r};const o=new Event("track");o.track=r,o.receiver=s,o.transceiver={receiver:s},o.streams=[i.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else $i(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function q0(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,c){let l=r.apply(this,arguments);return l||(l=e(this,a),this._senders.push(l)),l};const s=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){s.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],n.apply(this,[s]),s.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(o=>{const a=this._senders.find(c=>c.track===o);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function G0(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const n=t.RTCPeerConnection.prototype.getSenders;n&&(t.RTCPeerConnection.prototype.getSenders=function(){const s=n.apply(this,[]);return s.forEach(o=>o._pc=this),s});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function(){const s=i.apply(this,arguments);return s._pc=this,s}),t.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(o=>rf(o,s.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const n=t.RTCPeerConnection.prototype.getReceivers;n&&(t.RTCPeerConnection.prototype.getReceivers=function(){const r=n.apply(this,[]);return r.forEach(s=>s._pc=this),r}),$i(t,"track",i=>(i.receiver._pc=i.srcElement,i)),t.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>rf(s,r.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const i=arguments[0];let r,s,o;return this.getSenders().forEach(a=>{a.track===i&&(r?o=!0:r=a)}),this.getReceivers().forEach(a=>(a.track===i&&(s?o=!0:s=a),a.track===i)),o||r&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function K0(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(o,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(l=>{if(this.getSenders().find(u=>u.track===l))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();n.apply(this,arguments);const c=this.getSenders().filter(l=>a.indexOf(l)===-1);this._shimmedLocalStreams[o.id]=[o].concat(c)};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],i.apply(this,arguments)};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(o);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),r.apply(this,arguments)}}function Z0(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return K0(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const d=n.apply(this);return this._reverseStreams=this._reverseStreams||{},d.map(u=>this._reverseStreams[u.id])};const i=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(d){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},d.getTracks().forEach(u=>{if(this.getSenders().find(p=>p.track===u))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[d.id]){const u=new t.MediaStream(d.getTracks());this._streams[d.id]=u,this._reverseStreams[u.id]=d,d=u}i.apply(this,[d])};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(d){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[d.id]||d]),delete this._reverseStreams[this._streams[d.id]?this._streams[d.id].id:d.id],delete this._streams[d.id]},t.RTCPeerConnection.prototype.addTrack=function(d,u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const h=[].slice.call(arguments,1);if(h.length!==1||!h[0].getTracks().find(f=>f===d))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(f=>f.track===d))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const v=this._streams[u.id];if(v)v.addTrack(d),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const f=new t.MediaStream([d]);this._streams[u.id]=f,this._reverseStreams[f.id]=u,this.addStream(f)}return this.getSenders().find(f=>f.track===d)};function s(l,d){let u=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(h=>{const p=l._reverseStreams[h],v=l._streams[p.id];u=u.replace(new RegExp(v.id,"g"),p.id)}),new RTCSessionDescription({type:d.type,sdp:u})}function o(l,d){let u=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(h=>{const p=l._reverseStreams[h],v=l._streams[p.id];u=u.replace(new RegExp(p.id,"g"),v.id)}),new RTCSessionDescription({type:d.type,sdp:u})}["createOffer","createAnswer"].forEach(function(l){const d=t.RTCPeerConnection.prototype[l],u={[l](){const h=arguments;return arguments.length&&typeof arguments[0]=="function"?d.apply(this,[v=>{const f=s(this,v);h[0].apply(null,[f])},v=>{h[1]&&h[1].apply(null,v)},arguments[2]]):d.apply(this,arguments).then(v=>s(this,v))}};t.RTCPeerConnection.prototype[l]=u[l]});const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?a.apply(this,arguments):(arguments[0]=o(this,arguments[0]),a.apply(this,arguments))};const c=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const l=c.get.apply(this);return l.type===""?l:s(this,l)}}),t.RTCPeerConnection.prototype.removeTrack=function(d){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!d._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(d._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let h;Object.keys(this._streams).forEach(p=>{this._streams[p].getTracks().find(f=>d.track===f)&&(h=this._streams[p])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(d.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Rl(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const i=t.RTCPeerConnection.prototype[n],r={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=r[n]})}function Y0(t,e){$i(t,"negotiationneeded",n=>{const i=n.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return n})}var of=Object.freeze({__proto__:null,fixNegotiationNeeded:Y0,shimAddTrackRemoveTrack:Z0,shimAddTrackRemoveTrackWithNative:K0,shimGetSendersWithDtmf:q0,shimGetUserMedia:H0,shimMediaStream:z0,shimOnTrack:W0,shimPeerConnection:Rl,shimSenderReceiverGetStats:G0});function J0(t,e){const n=t&&t.navigator,i=t&&t.MediaStreamTrack;if(n.getUserMedia=function(r,s,o){nu("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(r).then(s,o)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const r=function(o,a,c){a in o&&!(c in o)&&(o[c]=o[a],delete o[a])},s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(o){return typeof o=="object"&&typeof o.audio=="object"&&(o=JSON.parse(JSON.stringify(o)),r(o.audio,"autoGainControl","mozAutoGainControl"),r(o.audio,"noiseSuppression","mozNoiseSuppression")),s(o)},i&&i.prototype.getSettings){const o=i.prototype.getSettings;i.prototype.getSettings=function(){const a=o.apply(this,arguments);return r(a,"mozAutoGainControl","autoGainControl"),r(a,"mozNoiseSuppression","noiseSuppression"),a}}if(i&&i.prototype.applyConstraints){const o=i.prototype.applyConstraints;i.prototype.applyConstraints=function(a){return this.kind==="audio"&&typeof a=="object"&&(a=JSON.parse(JSON.stringify(a)),r(a,"autoGainControl","mozAutoGainControl"),r(a,"noiseSuppression","mozNoiseSuppression")),o.apply(this,[a])}}}}function Ok(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(i){if(!(i&&i.video)){const r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return i.video===!0?i.video={mediaSource:e}:i.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(i)})}function X0(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Al(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){const s=t.RTCPeerConnection.prototype[r],o={[r](){return arguments[0]=new(r==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),s.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=o[r]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[s,o,a]=arguments;return i.apply(this,[s||null]).then(c=>{if(e.version<53&&!o)try{c.forEach(l=>{l.type=n[l.type]||l.type})}catch(l){if(l.name!=="TypeError")throw l;c.forEach((d,u)=>{c.set(u,Object.assign({},d,{type:n[d.type]||d.type}))})}return c}).then(o,a)}}function Q0(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(s=>s._pc=this),r});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const r=n.apply(this,arguments);return r._pc=this,r}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ev(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i}),$i(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function tv(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){nu("removeStream","removeTrack"),this.getSenders().forEach(i=>{i.track&&n.getTracks().includes(i.track)&&this.removeTrack(i)})})}function nv(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function iv(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let i=arguments[1]&&arguments[1].sendEncodings;i===void 0&&(i=[]),i=[...i];const r=i.length>0;r&&i.forEach(o=>{if("rid"in o&&!/^[a-z0-9]{0,16}$/i.test(o.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in o&&!(parseFloat(o.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in o&&!(parseFloat(o.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const s=e.apply(this,arguments);if(r){const{sender:o}=s,a=o.getParameters();(!("encodings"in a)||a.encodings.length===1&&Object.keys(a.encodings[0]).length===0)&&(a.encodings=i,o.sendEncodings=i,this.setParametersPromises.push(o.setParameters(a).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return s})}function rv(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const i=e.apply(this,arguments);return"encodings"in i||(i.encodings=[].concat(this.sendEncodings||[{}])),i})}function sv(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function ov(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var af=Object.freeze({__proto__:null,shimAddTransceiver:iv,shimCreateAnswer:ov,shimCreateOffer:sv,shimGetDisplayMedia:Ok,shimGetParameters:rv,shimGetUserMedia:J0,shimOnTrack:X0,shimPeerConnection:Al,shimRTCDataChannel:nv,shimReceiverGetStats:ev,shimRemoveStream:tv,shimSenderGetStats:Q0});function av(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(i){this._localStreams||(this._localStreams=[]),this._localStreams.includes(i)||this._localStreams.push(i),i.getAudioTracks().forEach(r=>e.call(this,r,i)),i.getVideoTracks().forEach(r=>e.call(this,r,i))},t.RTCPeerConnection.prototype.addTrack=function(i){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s&&s.forEach(a=>{this._localStreams?this._localStreams.includes(a)||this._localStreams.push(a):this._localStreams=[a]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){this._localStreams||(this._localStreams=[]);const i=this._localStreams.indexOf(n);if(i===-1)return;this._localStreams.splice(i,1);const r=n.getTracks();this.getSenders().forEach(s=>{r.includes(s.track)&&this.removeTrack(s)})})}}function cv(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(n){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=n),this.addEventListener("track",this._onaddstreampoly=i=>{i.streams.forEach(r=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(r))return;this._remoteStreams.push(r);const s=new Event("addstream");s.stream=r,this.dispatchEvent(s)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const i=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(s=>{if(i._remoteStreams||(i._remoteStreams=[]),i._remoteStreams.indexOf(s)>=0)return;i._remoteStreams.push(s);const o=new Event("addstream");o.stream=s,i.dispatchEvent(o)})}),e.apply(i,arguments)}}}function lv(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,i=e.createAnswer,r=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,d){const u=arguments.length>=2?arguments[2]:arguments[0],h=n.apply(this,[u]);return d?(h.then(l,d),Promise.resolve()):h},e.createAnswer=function(l,d){const u=arguments.length>=2?arguments[2]:arguments[0],h=i.apply(this,[u]);return d?(h.then(l,d),Promise.resolve()):h};let a=function(c,l,d){const u=r.apply(this,[c]);return d?(u.then(l,d),Promise.resolve()):u};e.setLocalDescription=a,a=function(c,l,d){const u=s.apply(this,[c]);return d?(u.then(l,d),Promise.resolve()):u},e.setRemoteDescription=a,a=function(c,l,d){const u=o.apply(this,[c]);return d?(u.then(l,d),Promise.resolve()):u},e.addIceCandidate=a}function dv(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const n=e.mediaDevices,i=n.getUserMedia.bind(n);e.mediaDevices.getUserMedia=r=>i(uv(r))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(i,r,s){e.mediaDevices.getUserMedia(i).then(r,s)}).bind(e))}function uv(t){return t&&t.video!==void 0?Object.assign({},t,{video:$0(t.video)}):t}function hv(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(i,r){if(i&&i.iceServers){const s=[];for(let o=0;o<i.iceServers.length;o++){let a=i.iceServers[o];a.urls===void 0&&a.url?(nu("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,s.push(a)):s.push(i.iceServers[o])}i.iceServers=s}return new e(i,r)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function fv(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function mv(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(i){if(i){typeof i.offerToReceiveAudio<"u"&&(i.offerToReceiveAudio=!!i.offerToReceiveAudio);const r=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");i.offerToReceiveAudio===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):i.offerToReceiveAudio===!0&&!r&&this.addTransceiver("audio",{direction:"recvonly"}),typeof i.offerToReceiveVideo<"u"&&(i.offerToReceiveVideo=!!i.offerToReceiveVideo);const s=this.getTransceivers().find(o=>o.receiver.track.kind==="video");i.offerToReceiveVideo===!1&&s?s.direction==="sendrecv"?s.setDirection?s.setDirection("sendonly"):s.direction="sendonly":s.direction==="recvonly"&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive"):i.offerToReceiveVideo===!0&&!s&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function pv(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var cf=Object.freeze({__proto__:null,shimAudioContext:pv,shimCallbacksAPI:lv,shimConstraints:uv,shimCreateOfferLegacy:mv,shimGetUserMedia:dv,shimLocalStreamsAPI:av,shimRTCIceServerUrls:hv,shimRemoteStreamsAPI:cv,shimTrackEventTransceiver:fv}),dc={exports:{}},lf;function Dk(){return lf||(lf=1,function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(n){return n.trim().split(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`]:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
o=`+(r||"thisisadapterortc")+" "+s+" "+o+` IN IP4 127.0.0.1\r
|
|
31
|
-
s=-\r
|
|
32
|
-
t=0 0\r
|
|
33
|
-
`},e.getDirection=function(n,i){const r=e.splitLines(n);for(let s=0;s<r.length;s++)switch(r[s]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[s].substring(2)}return i?e.getDirection(i):"sendrecv"},e.getKind=function(n){return e.splitLines(n)[0].split(" ")[0].substring(2)},e.isRejected=function(n){return n.split(" ",2)[1]==="0"},e.parseMLine=function(n){const r=e.splitLines(n)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},e.parseOLine=function(n){const r=e.matchPrefix(n,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},e.isValidSDP=function(n){if(typeof n!="string"||n.length===0)return!1;const i=e.splitLines(n);for(let r=0;r<i.length;r++)if(i[r].length<2||i[r].charAt(1)!=="=")return!1;return!0},t.exports=e}(dc)),dc.exports}var gv=Dk(),mr=wk(gv),jk=Gw({__proto__:null,default:mr},[gv]);function Ro(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(i){if(typeof i=="object"&&i.candidate&&i.candidate.indexOf("a=")===0&&(i=JSON.parse(JSON.stringify(i)),i.candidate=i.candidate.substring(2)),i.candidate&&i.candidate.length){const r=new e(i),s=mr.parseCandidate(i.candidate);for(const o in s)o in r||Object.defineProperty(r,o,{value:s[o]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new e(i)},t.RTCIceCandidate.prototype=e.prototype,$i(t,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new t.RTCIceCandidate(n.candidate),writable:"false"}),n))}function Il(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||$i(t,"icecandidate",e=>{if(e.candidate){const n=mr.parseCandidate(e.candidate.candidate);n.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return e})}function Ao(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const n=function(a){if(!a||!a.sdp)return!1;const c=mr.splitSections(a.sdp);return c.shift(),c.some(l=>{const d=mr.parseMLine(l);return d&&d.kind==="application"&&d.protocol.indexOf("SCTP")!==-1})},i=function(a){const c=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(c===null||c.length<2)return-1;const l=parseInt(c[1],10);return l!==l?-1:l},r=function(a){let c=65536;return e.browser==="firefox"&&(e.version<57?a===-1?c=16384:c=2147483637:e.version<60?c=e.version===57?65535:65536:c=2147483637),c},s=function(a,c){let l=65536;e.browser==="firefox"&&e.version===57&&(l=65535);const d=mr.matchPrefix(a.sdp,"a=max-message-size:");return d.length>0?l=parseInt(d[0].substring(19),10):e.browser==="firefox"&&c!==-1&&(l=2147483637),l},o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:c}=this.getConfiguration();c==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const c=i(arguments[0]),l=r(c),d=s(arguments[0],c);let u;l===0&&d===0?u=Number.POSITIVE_INFINITY:l===0||d===0?u=Math.max(l,d):u=Math.min(l,d);const h={};Object.defineProperty(h,"maxMessageSize",{get(){return u}}),this._sctp=h}return o.apply(this,arguments)}}function Io(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(i,r){const s=i.send;i.send=function(){const a=arguments[0],c=a.length||a.size||a.byteLength;if(i.readyState==="open"&&r.sctp&&c>r.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+r.sctp.maxMessageSize+" bytes)");return s.apply(i,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const r=n.apply(this,arguments);return e(r,this),r},$i(t,"datachannel",i=>(e(i.channel,i.target),i))}function Ml(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(n){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),n&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=n)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(n=>{const i=e[n];e[n]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=r=>{const s=r.target;if(s._lastConnectionState!==s.connectionState){s._lastConnectionState=s.connectionState;const o=new Event("connectionstatechange",r);s.dispatchEvent(o)}return r},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})}function Nl(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e._safariVersion>=13.1)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(r){if(r&&r.sdp&&r.sdp.indexOf(`
|
|
34
|
-
a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
|
|
35
|
-
`).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
|
|
36
|
-
`);t.RTCSessionDescription&&r instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:r.type,sdp:s}):r.sdp=s}return n.apply(this,arguments)}}function Mo(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function No(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let r=arguments[0]||{};if(typeof r!="object"||r.type&&r.sdp)return n.apply(this,arguments);if(r={type:r.type,sdp:r.sdp},!r.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer";break}return r.sdp||r.type!=="offer"&&r.type!=="answer"?n.apply(this,[r]):(r.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(o=>n.apply(this,[o]))})}var Lk=Object.freeze({__proto__:null,removeExtmapAllowMixed:Nl,shimAddIceCandidateNullOrEmpty:Mo,shimConnectionState:Ml,shimMaxMessageSize:Ao,shimParameterlessSetLocalDescription:No,shimRTCIceCandidate:Ro,shimRTCIceCandidateRelayProtocol:Il,shimSendThrowTypeError:Io});function Vk(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=B0,i=_k(t),r={browserDetails:i,commonShim:Lk,extractVersion:ss,disableLog:Mk,disableWarnings:Nk,sdp:jk};switch(i.browser){case"chrome":if(!of||!Rl||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),r;if(i.version===null)return n("Chrome shim can not determine version, not shimming."),r;n("adapter.js shimming chrome."),r.browserShim=of,Mo(t,i),No(t),H0(t,i),z0(t),Rl(t,i),W0(t),Z0(t,i),q0(t),G0(t),Y0(t,i),Ro(t),Il(t),Ml(t),Ao(t,i),Io(t),Nl(t,i);break;case"firefox":if(!af||!Al||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),r;n("adapter.js shimming firefox."),r.browserShim=af,Mo(t,i),No(t),J0(t,i),Al(t,i),X0(t),tv(t),Q0(t),ev(t),nv(t),iv(t),rv(t),sv(t),ov(t),Ro(t),Ml(t),Ao(t,i),Io(t);break;case"safari":if(!cf||!e.shimSafari)return n("Safari shim is not included in this adapter release."),r;n("adapter.js shimming safari."),r.browserShim=cf,Mo(t,i),No(t),hv(t),mv(t),lv(t),av(t),cv(t),fv(t),dv(t),pv(t),Ro(t),Il(t),Ao(t,i),Io(t),Nl(t,i);break;default:n("Unsupported browser!");break}return r}Vk({window:typeof window>"u"?void 0:window});const Fk=10,Yr="lk_e2ee",Uk="LKFrameEncryptionKey",Bk={sharedKey:!1,ratchetSalt:Uk,ratchetWindowSize:8,failureTolerance:Fk,keyringSize:16};var Yn;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(Yn||(Yn={}));var df;(function(t){t.KeyRatcheted="keyRatcheted"})(df||(df={}));var Zn;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(Zn||(Zn={}));var uf;(function(t){t.Error="cryptorError"})(uf||(uf={}));function $k(){return Hk()||_l()}function _l(){return typeof window.RTCRtpScriptTransform<"u"}function Hk(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class Vj extends vn.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(n,i,r)=>{ye.debug("key ratcheted event received",{ratchetResult:n,participantId:i,keyIndex:r})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Bk),e),this.on(Yn.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,n,i){const r={key:e,participantIdentity:n,keyIndex:i};if(!this.options.sharedKey&&!n)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(n??"shared","-").concat(i??0),r),this.emit(Yn.SetKey,r)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,n){this.emit(Yn.RatchetRequest,e,n)}}class li extends Error{constructor(e,n){super(n||"an error has occured"),this.name="LiveKitError",this.code=e}}var be;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest",t[t.Timeout=5]="Timeout"})(be||(be={}));class Ne extends li{constructor(e,n,i,r){super(1,e),this.name="ConnectionError",this.status=i,this.reason=n,this.context=r,this.reasonName=be[n]}}class iu extends li{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class An extends li{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class zk extends li{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class nt extends li{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Ol extends li{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class hf extends li{constructor(e,n){super(15,e),this.name="PublishTrackError",this.status=n}}class ff extends li{constructor(e,n){super(15,e),this.reason=n,this.reasonName=typeof n=="string"?n:tu[n]}}var Qo;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(Qo||(Qo={}));(function(t){function e(n){if(n&&"name"in n)return n.name==="NotFoundError"||n.name==="DevicesNotFoundError"?t.NotFound:n.name==="NotAllowedError"||n.name==="PermissionDeniedError"?t.PermissionDenied:n.name==="NotReadableError"||n.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e})(Qo||(Qo={}));var mf;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(mf||(mf={}));var V;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(V||(V={}));var q;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(q||(q={}));var re;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved"})(re||(re={}));var ne;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate",t.PreConnectBufferFlushed="preConnectBufferFlushed"})(ne||(ne={}));function Wk(t){return typeof t>"u"?t:typeof structuredClone=="function"?typeof t=="object"&&t!==null?structuredClone(Object.assign({},t)):structuredClone(t):JSON.parse(JSON.stringify(t))}const qk=/version\/(\d+(\.?_?\d+)+)/i;let uc;function Pt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(uc===void 0||e){const i=Gk.find(r=>{let{test:s}=r;return s.test(n)});uc=i==null?void 0:i.describe(n)}return uc}const Gk=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:_o(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:hc(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:_o(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:hc(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:_o(qk,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:hc(t)}}}];function _o(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const i=e.match(t);return i&&i.length>=n&&i[n]||""}function hc(t){return t.includes("mac os")?_o(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var Kk="2.13.8";const Zk=Kk,Yk=16;class lt{}lt.setTimeout=function(){return setTimeout(...arguments)};lt.setInterval=function(){return setInterval(...arguments)};lt.clearTimeout=function(){return clearTimeout(...arguments)};lt.clearInterval=function(){return clearInterval(...arguments)};const Jk=5e3,Jr=[];var Dt;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Dt||(Dt={}));class D extends vn.EventEmitter{constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=D.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=ye,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),Jk):this.handleAppVisibilityChanged()},this.log=Nn((r=i.loggerName)!==null&&r!==void 0?r:Zt.Track),this.loggerContextCb=i.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=D.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ve(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let n="audio";this.kind===D.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===D.Kind.Video&&this.addAppVisibilityListener(),e||(n==="audio"&&(Jr.forEach(s=>{s.parentElement===null&&!e&&(e=s)}),e&&Jr.splice(Jr.indexOf(e),1)),e||(e=document.createElement(n))),this.attachedElements.includes(e)||this.attachedElements.push(e),rr(this.mediaStreamTrack,e);const i=e.srcObject.getTracks(),r=i.some(s=>s.kind==="audio");return e.play().then(()=>{this.emit(r?ne.AudioPlaybackStarted:ne.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(r?ne.AudioPlaybackFailed:ne.VideoPlaybackFailed,s):s.name==="AbortError"?ye.debug("".concat(r?"audio":"video"," playback aborted, likely due to new play request")):ye.warn("could not playback ".concat(r?"audio":"video"),s),r&&e&&i.some(o=>o.kind==="video")&&s.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(ne.ElementAttached,e),e}detach(e){try{if(e){pr(this.mediaStreamTrack,e);const i=this.attachedElements.indexOf(e);return i>=0&&(this.attachedElements.splice(i,1),this.recycleElement(e),this.emit(ne.ElementDetached,e)),e}const n=[];return this.attachedElements.forEach(i=>{pr(this.mediaStreamTrack,i),n.push(i),this.recycleElement(i),this.emit(ne.ElementDetached,i)}),this.attachedElements=[],n}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=Nn(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let n=!0;e.pause(),Jr.forEach(i=>{i.parentElement||(n=!1)}),n&&Jr.push(e)}}handleAppVisibilityChanged(){return R(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===D.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){bt()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){bt()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function rr(t,e){let n;e.srcObject instanceof MediaStream?n=e.srcObject:n=new MediaStream;let i;t.kind==="audio"?i=n.getAudioTracks():i=n.getVideoTracks(),i.includes(t)||(i.forEach(r=>{n.removeTrack(r)}),n.addTrack(t)),(!ji()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=n.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==n&&(e.srcObject=n,(ji()||Er())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=n,e.play().catch(()=>{})},0))}function pr(t,e){if(e.srcObject instanceof MediaStream){const n=e.srcObject;n.removeTrack(t),n.getTracks().length>0?e.srcObject=n:e.srcObject=null}}(function(t){let e;(function(l){l.Audio="audio",l.Video="video",l.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let n;(function(l){l.Camera="camera",l.Microphone="microphone",l.ScreenShare="screen_share",l.ScreenShareAudio="screen_share_audio",l.Unknown="unknown"})(n=t.Source||(t.Source={}));let i;(function(l){l.Active="active",l.Paused="paused",l.Unknown="unknown"})(i=t.StreamState||(t.StreamState={}));function r(l){switch(l){case e.Audio:return Wt.AUDIO;case e.Video:return Wt.VIDEO;default:return Wt.DATA}}t.kindToProto=r;function s(l){switch(l){case Wt.AUDIO:return e.Audio;case Wt.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=s;function o(l){switch(l){case n.Camera:return Xe.CAMERA;case n.Microphone:return Xe.MICROPHONE;case n.ScreenShare:return Xe.SCREEN_SHARE;case n.ScreenShareAudio:return Xe.SCREEN_SHARE_AUDIO;default:return Xe.UNKNOWN}}t.sourceToProto=o;function a(l){switch(l){case Xe.CAMERA:return n.Camera;case Xe.MICROPHONE:return n.Microphone;case Xe.SCREEN_SHARE:return n.ScreenShare;case Xe.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}t.sourceFromProto=a;function c(l){switch(l){case kl.ACTIVE:return i.Active;case kl.PAUSED:return i.Paused;default:return i.Unknown}}t.streamStateFromProto=c})(D||(D={}));class Ae{constructor(e,n,i,r,s){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(n!==void 0&&i!==void 0)this.width=e,this.height=n,this.aspectRatio=e/n,this.encoding={maxBitrate:i,maxFramerate:r,priority:s};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const Xk=["vp8","h264"],Qk=["vp8","h264","vp9","av1"];function eC(t){return!!Xk.find(e=>e===t)}var pf;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(pf||(pf={}));var Dl;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(Dl||(Dl={}));const bs={h90:new Ae(160,90,9e4,20),h180:new Ae(320,180,16e4,20),h216:new Ae(384,216,18e4,20),h360:new Ae(640,360,45e4,20),h540:new Ae(960,540,8e5,25),h720:new Ae(1280,720,17e5,30),h1080:new Ae(1920,1080,3e6,30),h1440:new Ae(2560,1440,5e6,30),h2160:new Ae(3840,2160,8e6,30)},jl={h120:new Ae(160,120,7e4,20),h180:new Ae(240,180,125e3,20),h240:new Ae(320,240,14e4,20),h360:new Ae(480,360,33e4,20),h480:new Ae(640,480,5e5,20),h540:new Ae(720,540,6e5,25),h720:new Ae(960,720,13e5,30),h1080:new Ae(1440,1080,23e5,30),h1440:new Ae(1920,1440,38e5,30)},ru={h360fps3:new Ae(640,360,2e5,3,"medium"),h360fps15:new Ae(640,360,4e5,15,"medium"),h720fps5:new Ae(1280,720,8e5,5,"medium"),h720fps15:new Ae(1280,720,15e5,15,"medium"),h720fps30:new Ae(1280,720,2e6,30,"medium"),h1080fps15:new Ae(1920,1080,25e5,15,"medium"),h1080fps30:new Ae(1920,1080,5e6,30,"medium"),original:new Ae(0,0,7e6,30,"medium")},tC="|",gf="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function nC(t){const e=t.split(tC);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function wt(t){return R(this,void 0,void 0,function*(){return new Promise(e=>lt.setTimeout(e,t))})}function Ll(){return"addTransceiver"in RTCPeerConnection.prototype}function Vl(){return"addTrack"in RTCPeerConnection.prototype}function iC(){if(!("getCapabilities"in RTCRtpSender)||ji())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/AV1"){e=!0;break}}return e}function rC(){if(!("getCapabilities"in RTCRtpSender)||Er())return!1;if(ji()){const n=Pt();if(n!=null&&n.version&&Qn(n.version,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType==="video/VP9"){e=!0;break}}return e}function Mn(t){return t==="av1"||t==="vp9"}function Fl(t){return document?(t||(t=document.createElement("audio")),"setSinkId"in t):!1}function sC(){return typeof RTCPeerConnection>"u"?!1:Ll()||Vl()}function Er(){var t;return((t=Pt())===null||t===void 0?void 0:t.name)==="Firefox"}function ji(){var t;return((t=Pt())===null||t===void 0?void 0:t.name)==="Safari"}function vf(){const t=Pt();return(t==null?void 0:t.name)==="Safari"||(t==null?void 0:t.os)==="iOS"}function oC(){const t=Pt();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")}function aC(t){return t||(t=Pt()),(t==null?void 0:t.name)==="Safari"&&Qn(t.version,"18.3")>0}function vv(){var t,e;return bt()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function cC(){const t=Pt(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&Qn(e,t.osVersion)>=0?!0:t.name==="Safari"&&Qn(e,t.version)>=0}function bt(){return typeof document<"u"}function mn(){return navigator.product=="ReactNative"}function Ul(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function yv(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function bv(){if(!mn())return;let t=yv();if(t)return t.platform}function yf(){if(bt())return window.devicePixelRatio;if(mn()){let t=yv();if(t)return t.devicePixelRatio}return 1}function Qn(t,e){const n=t.split("."),i=e.split("."),r=Math.min(n.length,i.length);for(let s=0;s<r;++s){const o=parseInt(n[s],10),a=parseInt(i[s],10);if(o>a)return 1;if(o<a)return-1;if(s===r-1&&o===a)return 0}return t===""&&e!==""?-1:e===""?1:n.length==i.length?0:n.length<i.length?-1:1}function lC(t){for(const e of t)e.target.handleResize(e)}function dC(t){for(const e of t)e.target.handleVisibilityChanged(e)}let fc=null;const bf=()=>(fc||(fc=new ResizeObserver(lC)),fc);let mc=null;const xf=()=>(mc||(mc=new IntersectionObserver(dC,{root:null,rootMargin:"0px"})),mc);function uC(){var t;const e=new YS({sdk:k0.JS,protocol:Yk,version:Zk});return mn()&&(e.os=(t=bv())!==null&&t!==void 0?t:""),e}function wf(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const r=document.createElement("canvas");r.width=t,r.height=e;const s=r.getContext("2d");s==null||s.fillRect(0,0,r.width,r.height),i&&s&&(s.beginPath(),s.arc(t/2,e/2,50,0,Math.PI*2,!0),s.closePath(),s.fillStyle="grey",s.fill());const o=r.captureStream(),[a]=o.getTracks();if(!a)throw Error("Could not get empty media stream video track");return a.enabled=n,a}let Xr;function pc(){if(!Xr){const t=new AudioContext,e=t.createOscillator(),n=t.createGain();n.gain.setValueAtTime(0,0);const i=t.createMediaStreamDestination();if(e.connect(n),n.connect(i),e.start(),[Xr]=i.stream.getAudioTracks(),!Xr)throw Error("Could not get empty media stream audio track");Xr.enabled=!1}return Xr.clone()}class sr{constructor(e,n){this.onFinally=n,this.promise=new Promise((i,r)=>R(this,void 0,void 0,function*(){this.resolve=i,this.reject=r,e&&(yield e(i,r))})).finally(()=>{var i;return(i=this.onFinally)===null||i===void 0?void 0:i.call(this)})}}function hC(t,e){const n=Object.assign({cloneTrack:!1,fftSize:2048,smoothingTimeConstant:.8,minDecibels:-100,maxDecibels:-80},e),i=ou();if(!i)throw new Error("Audio Context not supported on this browser");const r=n.cloneTrack?t.mediaStreamTrack.clone():t.mediaStreamTrack,s=i.createMediaStreamSource(new MediaStream([r])),o=i.createAnalyser();o.minDecibels=n.minDecibels,o.maxDecibels=n.maxDecibels,o.fftSize=n.fftSize,o.smoothingTimeConstant=n.smoothingTimeConstant,s.connect(o);const a=new Uint8Array(o.frequencyBinCount);return{calculateVolume:()=>{o.getByteFrequencyData(a);let d=0;for(const h of a)d+=Math.pow(h/255,2);return Math.sqrt(d/a.length)},analyser:o,cleanup:()=>R(this,void 0,void 0,function*(){yield i.close(),n.cloneTrack&&r.stop()})}}function fC(t){return Qk.includes(t)}function Jn(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function mC(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function Bl(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function pC(t,e){return t.segments.map(n=>{let{id:i,text:r,language:s,startTime:o,endTime:a,final:c}=n;var l;const d=(l=e.get(i))!==null&&l!==void 0?l:Date.now(),u=Date.now();return c?e.delete(i):e.set(i,d),{id:i,text:r,startTime:Number.parseInt(o.toString()),endTime:Number.parseInt(a.toString()),final:c,language:s,firstReceivedTime:d,lastReceivedTime:u}})}function gC(t){const{id:e,timestamp:n,message:i,editTimestamp:r}=t;return{id:e,timestamp:Number.parseInt(n.toString()),editTimestamp:r?Number.parseInt(r.toString()):void 0,message:i}}function Sf(t){switch(t.reason){case be.LeaveRequest:return t.context;case be.Cancelled:return Gt.CLIENT_INITIATED;case be.NotAllowed:return Gt.USER_REJECTED;case be.ServerUnreachable:return Gt.JOIN_FAILURE;default:return Gt.UNKNOWN_REASON}}function Oo(t){return t!==void 0?Number(t):void 0}function wi(t){return t!==void 0?BigInt(t):void 0}function gr(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function ln(t){return!!t&&t.kind==D.Kind.Audio}function jr(t){return!!t&&t.kind==D.Kind.Video}function $n(t){return gr(t)&&jr(t)}function Cn(t){return gr(t)&&ln(t)}function $l(t){return!!t&&!t.isLocal}function vC(t){return!!t&&!t.isLocal}function gc(t){return $l(t)&&jr(t)}function yC(t){return t.isLocal}function bC(t,e){const n=[];let i=new TextEncoder().encode(t);for(;i.length>e;){let r=e;for(;r>0;){const s=i[r];if(s!==void 0&&(s&192)!==128)break;r--}n.push(i.slice(0,r)),i=i.slice(r)}return i.length>0&&n.push(i),n}function xv(t,e,n){var i,r,s,o;const{optionsWithoutProcessor:a,audioProcessor:c,videoProcessor:l}=Sv(t??{}),d=e==null?void 0:e.processor,u=n==null?void 0:n.processor,h=a??{};return h.audio===!0&&(h.audio={}),h.video===!0&&(h.video={}),h.audio&&(Hl(h.audio,e),(i=(s=h.audio).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(c||d)&&(h.audio.processor=c??d)),h.video&&(Hl(h.video,n),(r=(o=h.video).deviceId)!==null&&r!==void 0||(o.deviceId={ideal:"default"}),(l||u)&&(h.video.processor=l??u)),h}function Hl(t,e){return Object.keys(e).forEach(n=>{t[n]===void 0&&(t[n]=e[n])}),t}function su(t){var e,n,i,r;const s={};if(t.video)if(typeof t.video=="object"){const o={},a=o,c=t.video;Object.keys(c).forEach(l=>{switch(l){case"resolution":Hl(a,c.resolution);break;default:a[l]=c[l]}}),s.video=o,(e=(i=s.video).deviceId)!==null&&e!==void 0||(i.deviceId={ideal:"default"})}else s.video=t.video?{deviceId:{ideal:"default"}}:!1;else s.video=!1;return t.audio?typeof t.audio=="object"?(s.audio=t.audio,(n=(r=s.audio).deviceId)!==null&&n!==void 0||(r.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function wv(t){return R(this,arguments,void 0,function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const i=ou();if(i){const r=i.createAnalyser();r.fftSize=2048;const s=r.frequencyBinCount,o=new Uint8Array(s);i.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(r),yield wt(n),r.getByteTimeDomainData(o);const c=o.some(l=>l!==128&&l!==0);return i.close(),!c}return!1}()})}function ou(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const n=new e({latencyHint:"interactive"});if(n.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const i=()=>R(this,void 0,void 0,function*(){var r;try{n.state==="suspended"&&(yield n.resume())}catch(s){console.warn("Error trying to auto-resume audio context",s)}(r=window.document.body)===null||r===void 0||r.removeEventListener("click",i)});window.document.body.addEventListener("click",i)}return n}}function xC(t){return t==="audioinput"?D.Source.Microphone:t==="videoinput"?D.Source.Camera:D.Source.Unknown}function zl(t){return t===D.Source.Microphone?"audioinput":t===D.Source.Camera?"videoinput":void 0}function wC(t){var e,n;let i=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(i=typeof i=="boolean"?{}:i,ji()?i=Object.assign(Object.assign({},i),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):i=Object.assign(Object.assign({},i),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(n=t.audio)!==null&&n!==void 0?n:!1,video:i,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function Do(t){return t.split("/")[1].toLowerCase()}function SC(t){const e=[];return t.forEach(n=>{n.track!==void 0&&e.push(new Qd({cid:n.track.mediaStreamID,track:n.trackInfo}))}),e}function ve(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?ve(t.track):{})}}function kC(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function CC(t,e){var n;t===void 0&&(t={}),e===void 0&&(e={});const i=[...Object.keys(e),...Object.keys(t)],r={};for(const s of i)t[s]!==e[s]&&(r[s]=(n=e[s])!==null&&n!==void 0?n:"");return r}function Sv(t){const e=Object.assign({},t);let n,i;return typeof e.audio=="object"&&e.audio.processor&&(n=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(i=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:Wk(e)}}function TC(t){switch(t){case Xe.CAMERA:return D.Source.Camera;case Xe.MICROPHONE:return D.Source.Microphone;case Xe.SCREEN_SHARE:return D.Source.ScreenShare;case Xe.SCREEN_SHARE_AUDIO:return D.Source.ScreenShareAudio;default:return D.Source.Unknown}}class EC extends vn.EventEmitter{constructor(e){super(),this.onWorkerMessage=n=>{var i,r;const{kind:s,data:o}=n.data;switch(s){case"error":ye.error(o.error.message),this.emit(Zn.EncryptionError,o.error);break;case"initAck":o.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)});break;case"enable":if(o.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)}),this.encryptionEnabled!==o.enabled&&o.participantIdentity===((i=this.room)===null||i===void 0?void 0:i.localParticipant.identity))this.emit(Zn.ParticipantEncryptionStatusChanged,o.enabled,this.room.localParticipant),this.encryptionEnabled=o.enabled;else if(o.participantIdentity){const a=(r=this.room)===null||r===void 0?void 0:r.getParticipantByIdentity(o.participantIdentity);if(!a)throw TypeError("couldn't set encryption status, participant not found".concat(o.participantIdentity));this.emit(Zn.ParticipantEncryptionStatusChanged,o.enabled,a)}break;case"ratchetKey":this.keyProvider.emit(Yn.KeyRatcheted,o.ratchetResult,o.participantIdentity,o.keyIndex);break}},this.onWorkerError=n=>{ye.error("e2ee worker encountered an error:",{error:n.error}),this.emit(Zn.EncryptionError,n.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!$k())throw new iu("tried to setup end-to-end encryption on an unsupported browser");if(ye.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const n={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Ek.getLevel()}};this.worker&&(ye.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(e,n){ye.debug("set e2ee to ".concat(e," for participant ").concat(n)),this.postEnable(e,n)}setSifTrailer(e){!e||e.length===0?ye.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(re.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(e,n){e.on(V.TrackPublished,(i,r)=>this.setParticipantCryptorEnabled(i.trackInfo.encryption!==Ct.NONE,r.identity)),e.on(V.ConnectionStateChanged,i=>{i===he.Connected&&e.remoteParticipants.forEach(r=>{r.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==Ct.NONE,r.identity)})})}).on(V.TrackUnsubscribed,(i,r,s)=>{var o;const a={kind:"removeTransform",data:{participantIdentity:s.identity,trackId:i.mediaStreamID}};(o=this.worker)===null||o===void 0||o.postMessage(a)}).on(V.TrackSubscribed,(i,r,s)=>{this.setupE2EEReceiver(i,s.identity,r.trackInfo)}).on(V.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");n.getKeys().forEach(i=>{this.postKey(i)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(q.LocalTrackPublished,i=>R(this,void 0,void 0,function*(){this.setupE2EESender(i.track,i.track.sender)})),n.on(Yn.SetKey,i=>this.postKey(i)).on(Yn.RatchetRequest,(i,r)=>this.postRatchetRequest(i,r))}postRatchetRequest(e,n){if(!this.worker)throw Error("could not ratchet key, worker is missing");const i={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:n}};this.worker.postMessage(i)}postKey(e){let{key:n,participantIdentity:i,keyIndex:r}=e;var s;if(!this.worker)throw Error("could not set key, worker is missing");const o={kind:"setKey",data:{participantIdentity:i,isPublisher:i===((s=this.room)===null||s===void 0?void 0:s.localParticipant.identity),key:n,keyIndex:r}};this.worker.postMessage(o)}postEnable(e,n){if(this.worker){const i={kind:"enable",data:{enabled:e,participantIdentity:n}};this.worker.postMessage(i)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var n;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((n=this.room)===null||n===void 0)&&n.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const i={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(i)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const n={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(n)}setupE2EEReceiver(e,n,i){if(e.receiver){if(!(i!=null&&i.mimeType)||i.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,n,e.kind==="video"?Do(i.mimeType):void 0)}}setupE2EESender(e,n){if(!gr(e)||!n){n||ye.warn("early return because sender is not ready");return}this.handleSender(n,e.mediaStreamID,void 0)}handleReceiver(e,n,i,r){return R(this,void 0,void 0,function*(){if(this.worker){if(_l()){const s={kind:"decode",participantIdentity:i,trackId:n,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{if(Yr in e&&r){const c={kind:"updateCodec",data:{trackId:n,codec:r,participantIdentity:i}};this.worker.postMessage(c);return}let s=e.writableStream,o=e.readableStream;if(!s||!o){const c=e.createEncodedStreams();e.writableStream=c.writable,s=c.writable,e.readableStream=c.readable,o=c.readable}const a={kind:"decode",data:{readableStream:o,writableStream:s,trackId:n,codec:r,participantIdentity:i,isReuse:Yr in e}};this.worker.postMessage(a,[o,s])}e[Yr]=!0}})}handleSender(e,n,i){var r;if(!(Yr in e||!this.worker)){if(!(!((r=this.room)===null||r===void 0)&&r.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(_l()){ye.info("initialize script transform");const s={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:n,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{ye.info("initialize encoded streams");const s=e.createEncodedStreams(),o={kind:"encode",data:{readableStream:s.readable,writableStream:s.writable,codec:i,trackId:n,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(o,[s.readable,s.writable])}e[Yr]=!0}}}const vc="default";class ot{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new ot),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return R(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;if(((s=ot.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){ye.debug("awaiting getUserMedia promise");try{n?yield ot.userMediaPromiseMap.get(n):yield Promise.all(ot.userMediaPromiseMap.values())}catch{ye.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(r&&!(ji()&&i.hasDeviceInUse(n))&&(o.filter(c=>c.kind===n).length===0||o.some(c=>{const l=c.label==="",d=n?c.kind===n:!0;return l&&d}))){const c={video:n!=="audioinput"&&n!=="audiooutput",audio:n!=="videoinput"&&{deviceId:{ideal:"default"}}},l=yield navigator.mediaDevices.getUserMedia(c);o=yield navigator.mediaDevices.enumerateDevices(),l.getTracks().forEach(d=>{d.stop()})}return i._previousDevices=o,n&&(o=o.filter(a=>a.kind===n)),o}()})}normalizeDeviceId(e,n,i){return R(this,void 0,void 0,function*(){if(n!==vc)return n;const r=yield this.getDevices(e),s=r.find(a=>a.deviceId===vc);if(!s){ye.warn("could not reliably determine default device");return}const o=r.find(a=>a.deviceId!==vc&&a.groupId===(i??s.groupId));if(!o){ye.warn("could not reliably determine default device");return}return o==null?void 0:o.deviceId})}hasDeviceInUse(e){return e?ot.userMediaPromiseMap.has(e):ot.userMediaPromiseMap.size>0}}ot.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];ot.userMediaPromiseMap=new Map;var hs;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(hs||(hs={}));class PC{constructor(){this.pendingTasks=new Map,this.taskMutex=new yt,this.nextTaskIndex=0}run(e){return R(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:hs.WAITING};this.pendingTasks.set(n.id,n);const i=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=hs.RUNNING,yield e()}finally{n.status=hs.COMPLETED,this.pendingTasks.delete(n.id),i()}})}flush(){return R(this,void 0,void 0,function*(){return this.run(()=>R(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function RC(t,e){const n=new URL(mC(t));return e.forEach((i,r)=>{n.searchParams.set(r,i)}),kv(n,"rtc")}function AC(t){const e=new URL(Bl(t));return kv(e,"validate")}function IC(t){return t.endsWith("/")?t:"".concat(t,"/")}function kv(t,e){return t.pathname="".concat(IC(t.pathname)).concat(e),t.toString()}const MC=["syncState","trickle","offer","answer","simulate","leave"];function NC(t){const e=MC.indexOf(t.case)>=0;return ye.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var _e;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(_e||(_e={}));class au{get currentState(){return this.state}get isDisconnected(){return this.state===_e.DISCONNECTING||this.state===_e.DISCONNECTED}get isEstablishingConnection(){return this.state===_e.CONNECTING||this.state===_e.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;this.rtt=0,this.state=_e.DISCONNECTED,this.log=ye,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=Nn((i=n.loggerName)!==null&&i!==void 0?i:Zt.Signal),this.loggerContextCb=n.loggerContextCb,this.useJSON=e,this.requestQueue=new PC,this.queuedRequests=[],this.closingLock=new yt,this.connectionLock=new yt,this.state=_e.DISCONNECTED}get logContext(){var e,n;return(n=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:{}}join(e,n,i,r){return R(this,void 0,void 0,function*(){return this.state=_e.CONNECTING,this.options=i,yield this.connect(e,n,i,r)})}reconnect(e,n,i,r){return R(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=_e.RECONNECTING,this.clearPingInterval(),yield this.connect(e,n,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:i,reconnectReason:r}))})}connect(e,n,i,r){this.connectOptions=i;const s=uC(),o=_C(n,s,i),a=RC(e,o),c=AC(a);return new Promise((l,d)=>R(this,void 0,void 0,function*(){const u=yield this.connectionLock.lock();try{const h=()=>R(this,void 0,void 0,function*(){this.close(),clearTimeout(p),d(new Ne("room connection has been cancelled (signal)",be.Cancelled))}),p=setTimeout(()=>{this.close(),d(new Ne("room connection has timed out (signal)",be.ServerUnreachable))},i.websocketTimeout);r!=null&&r.aborted&&h(),r==null||r.addEventListener("abort",h);const v=new URL(a);v.searchParams.has("access_token")&&v.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(v),Object.assign({reconnect:i.reconnect,reconnectReason:i.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(a),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(p)},this.ws.onerror=f=>R(this,void 0,void 0,function*(){if(this.state!==_e.CONNECTED){this.state=_e.DISCONNECTED,clearTimeout(p);try{const y=yield fetch(c);if(y.status.toFixed(0).startsWith("4")){const b=yield y.text();d(new Ne(b,be.NotAllowed,y.status))}else d(new Ne("Encountered unknown websocket error during connection: ".concat(f.toString()),be.InternalError,y.status))}catch(y){d(new Ne(y instanceof Error?y.message:"server was not reachable",be.ServerUnreachable))}return}this.handleWSError(f)}),this.ws.onmessage=f=>R(this,void 0,void 0,function*(){var y,b,S;let k;if(typeof f.data=="string"){const w=JSON.parse(f.data);k=Xh.fromJson(w,{ignoreUnknownFields:!0})}else if(f.data instanceof ArrayBuffer)k=Xh.fromBinary(new Uint8Array(f.data));else{this.log.error("could not decode websocket message: ".concat(typeof f.data),this.logContext);return}if(this.state!==_e.CONNECTED){let w=!1;if(((y=k.message)===null||y===void 0?void 0:y.case)==="join"?(this.state=_e.CONNECTED,r==null||r.removeEventListener("abort",h),this.pingTimeoutDuration=k.message.value.pingTimeout,this.pingIntervalDuration=k.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),l(k.message.value)):this.state===_e.RECONNECTING&&k.message.case!=="leave"?(this.state=_e.CONNECTED,r==null||r.removeEventListener("abort",h),this.startPingInterval(),((b=k.message)===null||b===void 0?void 0:b.case)==="reconnect"?l(k.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),l(void 0),w=!0)):this.isEstablishingConnection&&k.message.case==="leave"?d(new Ne("Received leave request while trying to (re)connect",be.LeaveRequest,void 0,k.message.value.reason)):i.reconnect||d(new Ne("did not receive join response, got ".concat((S=k.message)===null||S===void 0?void 0:S.case," instead"),be.InternalError)),!w)return}this.signalLatency&&(yield wt(this.signalLatency)),this.handleSignalResponse(k)}),this.ws.onclose=f=>{this.isEstablishingConnection&&d(new Ne("Websocket got closed during a (re)connection attempt",be.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:f.reason,code:f.code,wasClean:f.wasClean,state:this.state})),this.handleOnClose(f.reason)}}finally{u()}}))}close(){return R(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const i=yield e.closingLock.lock();try{if(e.clearPingInterval(),n&&(e.state=_e.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const r=new Promise(s=>{e.ws?e.ws.onclose=()=>{s()}:s()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([r,wt(250)])),e.ws=void 0}}finally{n&&(e.state=_e.DISCONNECTED),i()}}()})}sendOffer(e,n){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:ea(e,n)})}sendAnswer(e,n){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:ea(e,n)})}sendIceCandidate(e,n){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new Jd({candidateInit:JSON.stringify(e),target:n})})}sendMuteTrack(e,n){return this.sendRequest({case:"mute",value:new Xd({sid:e,muted:n})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,n){return R(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const a=s.getNextRequestId();return yield s.sendRequest({case:"updateMetadata",value:new M0({requestId:a,metadata:i,name:r,attributes:o})}),a}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,n){return this.sendRequest({case:"updateLayers",value:new I0({trackSid:e,layers:n})})}sendUpdateSubscriptionPermissions(e,n){return this.sendRequest({case:"subscriptionPermission",value:new O0({allParticipants:e,trackPermissions:n})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:De.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new V0({timestamp:De.parse(Date.now()),rtt:De.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,n){return this.sendRequest({case:"updateAudioTrack",value:new A0({trackSid:e,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new Ca({reason:Gt.CLIENT_INITIATED,action:fr.DISCONNECT})})}sendRequest(e){return R(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!r&&!NC(n)&&i.state===_e.RECONNECTING){i.queuedRequests.push(()=>R(i,void 0,void 0,function*(){yield this.sendRequest(n,!0)}));return}if(r||(yield i.requestQueue.flush()),i.signalLatency&&(yield wt(i.signalLatency)),!i.ws||i.ws.readyState!==i.ws.OPEN){i.log.error("cannot send signal request before connected, type: ".concat(n==null?void 0:n.case),i.logContext);return}const o=new QS({message:n});try{i.useJSON?i.ws.send(o.toJsonString()):i.ws.send(o.toBinary())}catch(a){i.log.error("error sending signal message",Object.assign(Object.assign({},i.logContext),{error:a}))}}()})}handleSignalResponse(e){var n,i;const r=e.message;if(r==null){this.log.debug("received unsupported message",this.logContext);return}let s=!1;if(r.case==="answer"){const o=kf(r.value);this.onAnswer&&this.onAnswer(o,r.value.id)}else if(r.case==="offer"){const o=kf(r.value);this.onOffer&&this.onOffer(o,r.value.id)}else if(r.case==="trickle"){const o=JSON.parse(r.value.candidateInit);this.onTrickle&&this.onTrickle(o,r.value.target)}else r.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((n=r.value.participants)!==null&&n!==void 0?n:[]):r.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(r.value):r.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((i=r.value.speakers)!==null&&i!==void 0?i:[]):r.case==="leave"?this.onLeave&&this.onLeave(r.value):r.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(r.value.sid,r.value.muted):r.case==="roomUpdate"?this.onRoomUpdate&&r.value.room&&this.onRoomUpdate(r.value.room):r.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(r.value):r.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(r.value):r.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(r.value):r.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(r.value):r.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(r.value):r.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(r.value):r.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(r.value):r.case==="pong"||(r.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(r.value.lastPingTimestamp.toString()),this.resetPingTimeout(),s=!0):r.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(r.value):r.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(r.value.trackSid):r.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(r.value.token),this.onRoomMoved&&this.onRoomMoved(r.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:r.case})));s||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return R(this,void 0,void 0,function*(){if(this.state===_e.DISCONNECTED)return;const n=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),n&&n(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=lt.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&<.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=lt.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&<.clearInterval(this.pingInterval)}}function kf(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function ea(t,e){return new Di({sdp:t.sdp,type:t.type,id:e})}function _C(t,e,n){var i;const r=new URLSearchParams;return r.set("access_token",t),n.reconnect&&(r.set("reconnect","1"),n.sid&&r.set("sid",n.sid)),r.set("auto_subscribe",n.autoSubscribe?"1":"0"),r.set("sdk",mn()?"reactnative":"js"),r.set("version",e.version),r.set("protocol",e.protocol.toString()),e.deviceModel&&r.set("device_model",e.deviceModel),e.os&&r.set("os",e.os),e.osVersion&&r.set("os_version",e.osVersion),e.browser&&r.set("browser",e.browser),e.browserVersion&&r.set("browser_version",e.browserVersion),n.adaptiveStream&&r.set("adaptive_stream","1"),n.reconnectReason&&r.set("reconnect_reason",n.reconnectReason.toString()),!((i=navigator.connection)===null||i===void 0)&&i.type&&r.set("network",navigator.connection.type),r}class Cf{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const n=this.buffer[0];if(this._totalSize-n.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class OC{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,n){const i=Date.now();i-this._lastCleanup>this.ttl/2&&this.cleanup();const r=i+this.ttl;return this._map.set(e,{value:n,expiresAt:r}),this}get(e){const n=this._map.get(e);if(n){if(n.expiresAt<Date.now()){this._map.delete(e);return}return n.value}}has(e){const n=this._map.get(e);return n?n.expiresAt<Date.now()?(this._map.delete(e),!1):!0:!1}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[n,i]of this._map.entries())i.expiresAt<e&&this._map.delete(n);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[n,i]of this._map.entries())i.expiresAt>=Date.now()&&e(i.value,n,this.asValueMap())}map(e){this.cleanup();const n=[],i=this.asValueMap();for(const[r,s]of i.entries())n.push(e(s,r,i));return n}asValueMap(){const e=new Map;for(const[n,i]of this._map.entries())i.expiresAt>=Date.now()&&e.set(n,i.value);return e}}var Ut={},yc={},bc={exports:{}},Tf;function cu(){if(Tf)return bc.exports;Tf=1;var t=bc.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var n="candidate:%s %d %s %d %s %d typ %s";return n+=e.raddr!=null?" raddr %s rport %d":"%v%v",n+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(n+=" generation %d"),n+=e["network-id"]!=null?" network-id %d":"%v",n+=e["network-cost"]!=null?" network-cost %d":"%v",n}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var n="ssrc:%d";return e.attribute!=null&&(n+=" %s",e.value!=null&&(n+=":%s")),n}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var n="mediaclk:";return n+=e.id!=null?"id=%s %s":"%v%s",n+=e.mediaClockValue!=null?"=%s":"",n+=e.rateNumerator!=null?" rate=%s":"",n+=e.rateDenominator!=null?"/%s":"",n}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var n=t[e];n.forEach(function(i){i.reg||(i.reg=/(.*)/),i.format||(i.format="%s")})}),bc.exports}var Ef;function DC(){return Ef||(Ef=1,function(t){var e=function(a){return String(Number(a))===a?Number(a):a},n=function(a,c,l,d){if(d&&!l)c[d]=e(a[1]);else for(var u=0;u<l.length;u+=1)a[u+1]!=null&&(c[l[u]]=e(a[u+1]))},i=function(a,c,l){var d=a.name&&a.names;a.push&&!c[a.push]?c[a.push]=[]:d&&!c[a.name]&&(c[a.name]={});var u=a.push?{}:d?c[a.name]:c;n(l.match(a.reg),u,a.names,a.name),a.push&&c[a.push].push(u)},r=cu(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(a){var c={},l=[],d=c;return a.split(/(\r\n|\r|\n)/).filter(s).forEach(function(u){var h=u[0],p=u.slice(2);h==="m"&&(l.push({rtp:[],fmtp:[]}),d=l[l.length-1]);for(var v=0;v<(r[h]||[]).length;v+=1){var f=r[h][v];if(f.reg.test(p))return i(f,d,p)}}),c.media=l,c};var o=function(a,c){var l=c.split(/=(.+)/,2);return l.length===2?a[l[0]]=e(l[1]):l.length===1&&c.length>1&&(a[l[0]]=void 0),a};t.parseParams=function(a){return a.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(a){return a.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(a){for(var c=[],l=a.split(" ").map(e),d=0;d<l.length;d+=3)c.push({component:l[d],ip:l[d+1],port:l[d+2]});return c},t.parseImageAttributes=function(a){return a.split(" ").map(function(c){return c.substring(1,c.length-1).split(",").reduce(o,{})})},t.parseSimulcastStreamList=function(a){return a.split(";").map(function(c){return c.split(",").map(function(l){var d,u=!1;return l[0]!=="~"?d=e(l):(d=e(l.substring(1,l.length)),u=!0),{scid:d,paused:u}})})}}(yc)),yc}var xc,Pf;function jC(){if(Pf)return xc;Pf=1;var t=cu(),e=/%[sdv%]/g,n=function(o){var a=1,c=arguments,l=c.length;return o.replace(e,function(d){if(a>=l)return d;var u=c[a];switch(a+=1,d){case"%%":return"%";case"%s":return String(u);case"%d":return Number(u);case"%v":return""}})},i=function(o,a,c){var l=a.format instanceof Function?a.format(a.push?c:c[a.name]):a.format,d=[o+"="+l];if(a.names)for(var u=0;u<a.names.length;u+=1){var h=a.names[u];a.name?d.push(c[a.name][h]):d.push(c[a.names[u]])}else d.push(c[a.name]);return n.apply(null,d)},r=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return xc=function(o,a){a=a||{},o.version==null&&(o.version=0),o.name==null&&(o.name=" "),o.media.forEach(function(u){u.payloads==null&&(u.payloads="")});var c=a.outerOrder||r,l=a.innerOrder||s,d=[];return c.forEach(function(u){t[u].forEach(function(h){h.name in o&&o[h.name]!=null?d.push(i(u,h,o)):h.push in o&&o[h.push]!=null&&o[h.push].forEach(function(p){d.push(i(u,h,p))})})}),o.media.forEach(function(u){d.push(i("m",t.m[0],u)),l.forEach(function(h){t[h].forEach(function(p){p.name in u&&u[p.name]!=null?d.push(i(h,p,u)):p.push in u&&u[p.push]!=null&&u[p.push].forEach(function(v){d.push(i(h,p,v))})})})}),d.join(`\r
|
|
37
|
-
`)+`\r
|
|
38
|
-
`},xc}var Rf;function LC(){if(Rf)return Ut;Rf=1;var t=DC(),e=jC(),n=cu();return Ut.grammar=n,Ut.write=e,Ut.parse=t.parse,Ut.parseParams=t.parseParams,Ut.parseFmtpConfig=t.parseFmtpConfig,Ut.parsePayloads=t.parsePayloads,Ut.parseRemoteCandidates=t.parseRemoteCandidates,Ut.parseImageAttributes=t.parseImageAttributes,Ut.parseSimulcastStreamList=t.parseSimulcastStreamList,Ut}var zn=LC();function lu(t,e,n){var i,r,s;e===void 0&&(e=50),n===void 0&&(n={});var o=(i=n.isImmediate)!=null&&i,a=(r=n.callback)!=null&&r,c=n.maxWait,l=Date.now(),d=[];function u(){if(c!==void 0){var p=Date.now()-l;if(p+e>=c)return c-p}return e}var h=function(){var p=[].slice.call(arguments),v=this;return new Promise(function(f,y){var b=o&&s===void 0;if(s!==void 0&&clearTimeout(s),s=setTimeout(function(){if(s=void 0,l=Date.now(),!o){var k=t.apply(v,p);a&&a(k),d.forEach(function(w){return(0,w.resolve)(k)}),d=[]}},u()),b){var S=t.apply(v,p);return a&&a(S),f(S)}d.push({resolve:f,reject:y})})};return h.cancel=function(p){s!==void 0&&clearTimeout(s),d.forEach(function(v){return(0,v.reject)(p)}),d=[]},h}const VC=.7,FC=20,vr={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class Af extends vn.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;super(),this.log=ye,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=lu(r=>R(this,void 0,void 0,function*(){this.emit(vr.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(r)r(s);else throw s}}),FC),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=Nn((i=n.loggerName)!==null&&i!==void 0?i:Zt.PCTransport),this.loggerOptions=n,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=n=>{var i;n.candidate&&((i=this.onIceCandidate)===null||i===void 0||i.call(this,n.candidate))},e.onicecandidateerror=n=>{var i;(i=this.onIceCandidateError)===null||i===void 0||i.call(this,n)},e.oniceconnectionstatechange=()=>{var n;(n=this.onIceConnectionStateChange)===null||n===void 0||n.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var n;(n=this.onSignalingStatechange)===null||n===void 0||n.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var n;(n=this.onConnectionStateChange)===null||n===void 0||n.call(this,e.connectionState)},e.ondatachannel=n=>{var i;(i=this.onDataChannel)===null||i===void 0||i.call(this,n)},e.ontrack=n=>{var i;(i=this.onTrack)===null||i===void 0||i.call(this,n)},e}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return R(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,n){return R(this,void 0,void 0,function*(){var i;if(e.type==="answer"&&this.latestOfferId>0&&n>0&&n!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:n,latestOfferId:this.latestOfferId})),!1;let r;if(e.type==="offer"){let{stereoMids:s,nackMids:o}=UC(e);this.remoteStereoMids=s,this.remoteNackMids=o}else if(e.type==="answer"){const s=zn.parse((i=e.sdp)!==null&&i!==void 0?i:"");s.media.forEach(o=>{o.type==="audio"&&this.trackBitrates.some(a=>{if(!a.transceiver||o.mid!=a.transceiver.mid)return!1;let c=0;if(o.rtp.some(d=>d.codec.toUpperCase()===a.codec.toUpperCase()?(c=d.payload,!0):!1),c===0)return!0;let l=!1;for(const d of o.fmtp)if(d.payload===c){d.config=d.config.split(";").filter(u=>!u.includes("maxaveragebitrate")).join(";"),a.maxbr>0&&(d.config+=";maxaveragebitrate=".concat(a.maxbr*1e3)),l=!0;break}return l||a.maxbr>0&&o.fmtp.push({payload:c,config:"maxaveragebitrate=".concat(a.maxbr*1e3)}),!0})}),r=zn.write(s)}return yield this.setMungedSDP(e,r,!0),this.pendingCandidates.forEach(s=>{this.pc.addIceCandidate(s)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(vr.NegotiationComplete),e.sdp&&zn.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(vr.RTPVideoPayloadTypes,o.rtp)})),!0})}createAndSendOffer(e){return R(this,void 0,void 0,function*(){var n;const i=this.latestOfferId+1;if(this.latestOfferId=i,this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const o=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&o)yield this._pc.setRemoteDescription(o);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const r=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:r.sdp},this.logContext));const s=zn.parse((n=r.sdp)!==null&&n!==void 0?n:"");if(s.media.forEach(o=>{Mf(o),o.type==="audio"?If(o,[],[]):o.type==="video"&&this.trackBitrates.some(a=>{if(!o.msid||!a.cid||!o.msid.includes(a.cid))return!1;let c=0;if(o.rtp.some(d=>d.codec.toUpperCase()===a.codec.toUpperCase()?(c=d.payload,!0):!1),c===0||(Mn(a.codec)&&this.ensureVideoDDExtensionForSVC(o,s),a.codec!=="av1"))return!0;const l=Math.round(a.maxbr*VC);for(const d of o.fmtp)if(d.payload===c){d.config.includes("x-google-start-bitrate")||(d.config+=";x-google-start-bitrate=".concat(l));break}return!0})}),this.latestOfferId>i){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:i}));return}yield this.setMungedSDP(r,zn.write(s)),this.onOffer(r,this.latestOfferId)})}createAndSetAnswer(){return R(this,void 0,void 0,function*(){var e;const n=yield this.pc.createAnswer(),i=zn.parse((e=n.sdp)!==null&&e!==void 0?e:"");return i.media.forEach(r=>{Mf(r),r.type==="audio"&&If(r,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,zn.write(i)),n})}createDataChannel(e,n){return this.pc.createDataChannel(e,n)}addTransceiver(e,n){return this.pc.addTransceiver(e,n)}addTrack(e){if(!this._pc)throw new nt("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var n;if(!this._pc)throw new nt("PC closed, cannot configure");return(n=this._pc)===null||n===void 0?void 0:n.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var n;return(n=this._pc)===null||n===void 0?void 0:n.removeTrack(e)}getConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&n!==void 0?n:"closed"}getICEConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&n!==void 0?n:"closed"}getSignallingState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&n!==void 0?n:"closed"}getTransceivers(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&n!==void 0?n:[]}getSenders(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&n!==void 0?n:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return R(this,void 0,void 0,function*(){var e;if(!this._pc)return;let n="";const i=new Map,r=new Map;if((yield this._pc.getStats()).forEach(a=>{switch(a.type){case"transport":n=a.selectedCandidatePairId;break;case"candidate-pair":n===""&&a.selected&&(n=a.id),i.set(a.id,a);break;case"remote-candidate":r.set(a.id,"".concat(a.address,":").concat(a.port));break}}),n==="")return;const o=(e=i.get(n))===null||e===void 0?void 0:e.remoteCandidateId;if(o!==void 0)return r.get(o)})}setMungedSDP(e,n,i){return R(this,void 0,void 0,function*(){if(n){const r=e.sdp;e.sdp=n;try{this.log.debug("setting munged ".concat(i?"remote":"local"," description"),this.logContext),i?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(s){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:s,sdp:n})),e.sdp=r}}try{i?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(r){let s="unknown error";r instanceof Error?s=r.message:typeof r=="string"&&(s=r);const o={error:s,sdp:e.sdp};throw!i&&this.pc.remoteDescription&&(o.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:o})),new Ol(s)}})}ensureVideoDDExtensionForSVC(e,n){var i,r;if(!((i=e.ext)===null||i===void 0?void 0:i.some(o=>o.uri===gf))){if(this.ddExtID===0){let o=0;n.media.forEach(a=>{var c;a.type==="video"&&((c=a.ext)===null||c===void 0||c.forEach(l=>{l.value>o&&(o=l.value)}))}),this.ddExtID=o+1}(r=e.ext)===null||r===void 0||r.push({value:this.ddExtID,uri:gf})}}}function If(t,e,n){let i=0;t.rtp.some(r=>r.codec==="opus"?(i=r.payload,!0):!1),i>0&&(t.rtcpFb||(t.rtcpFb=[]),n.includes(t.mid)&&!t.rtcpFb.some(r=>r.payload===i&&r.type==="nack")&&t.rtcpFb.push({payload:i,type:"nack"}),e.includes(t.mid)&&t.fmtp.some(r=>r.payload===i?(r.config.includes("stereo=1")||(r.config+=";stereo=1"),!0):!1))}function UC(t){var e;const n=[],i=[],r=zn.parse((e=t.sdp)!==null&&e!==void 0?e:"");let s=0;return r.media.forEach(o=>{var a;o.type==="audio"&&(o.rtp.some(c=>c.codec==="opus"?(s=c.payload,!0):!1),!((a=o.rtcpFb)===null||a===void 0)&&a.some(c=>c.payload===s&&c.type==="nack")&&i.push(o.mid),o.fmtp.some(c=>c.payload===s?(c.config.includes("sprop-stereo=1")&&n.push(o.mid),!0):!1))}),{stereoMids:n,nackMids:i}}function Mf(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}const Wl="vp8",BC={audioPreset:Dl.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:ru.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Wl,backupCodec:!0,preConnectBuffer:!1},Cv={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Tv={deviceId:{ideal:"default"},resolution:bs.h720.resolution},$C={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new Rk,disconnectOnPageLeave:!0,webAudioMix:!1},du={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var $e;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})($e||($e={}));class HC{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,n,i){var r;this.peerConnectionTimeout=du.peerConnectionTimeout,this.log=ye,this.updateState=()=>{var s;const o=this.state,a=this.requiredTransports.map(c=>c.getConnectionState());a.every(c=>c==="connected")?this.state=$e.CONNECTED:a.some(c=>c==="failed")?this.state=$e.FAILED:a.some(c=>c==="connecting")?this.state=$e.CONNECTING:a.every(c=>c==="closed")?this.state=$e.CLOSED:a.some(c=>c==="closed")?this.state=$e.CLOSING:a.every(c=>c==="new")&&(this.state=$e.NEW),o!==this.state&&(this.log.debug("pc state change: from ".concat($e[o]," to ").concat($e[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=Nn((r=i.loggerName)!==null&&r!==void 0?r:Zt.PCManager),this.loggerOptions=i,this.isPublisherConnectionRequired=!n,this.isSubscriberConnectionRequired=n,this.publisher=new Af(e,i),this.subscriber=new Af(e,i),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=s=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,s,qt.PUBLISHER)},this.subscriber.onIceCandidate=s=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,s,qt.SUBSCRIBER)},this.subscriber.onDataChannel=s=>{var o;(o=this.onDataChannel)===null||o===void 0||o.call(this,s)},this.subscriber.onTrack=s=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,s)},this.publisher.onOffer=(s,o)=>{var a;(a=this.onPublisherOffer)===null||a===void 0||a.call(this,s,o)},this.state=$e.NEW,this.connectionLock=new yt,this.remoteOfferLock=new yt}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,n){return this.publisher.setRemoteDescription(e,n)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return R(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const n of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(n)}catch(i){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:i}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return R(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,n){return R(this,void 0,void 0,function*(){n===qt.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,n){return R(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const i=yield this.remoteOfferLock.lock();try{return(yield this.subscriber.setRemoteDescription(e,n))?yield this.subscriber.createAndSetAnswer():void 0}finally{i()}})}updateConfiguration(e,n){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),n&&this.triggerIceRestart()}ensurePCTransportConnection(e,n){return R(this,void 0,void 0,function*(){var i;const r=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((i=this.requiredTransports)===null||i===void 0?void 0:i.map(s=>this.ensureTransportConnected(s,e,n)))}finally{r()}})}negotiate(e){return R(this,void 0,void 0,function*(){return new Promise((n,i)=>R(this,void 0,void 0,function*(){const r=setTimeout(()=>{i("negotiation timed out")},this.peerConnectionTimeout),s=()=>{clearTimeout(r),i("negotiation aborted")};e.signal.addEventListener("abort",s),this.publisher.once(vr.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(vr.NegotiationComplete,()=>{clearTimeout(r),n()})}),yield this.publisher.negotiate(o=>{clearTimeout(r),i(o)})}))})}addPublisherTransceiver(e,n){return this.publisher.addTransceiver(e,n)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,n){return this.publisher.createDataChannel(e,n)}getConnectedAddress(e){return e===qt.PUBLISHER?this.publisher.getConnectedAddress():e===qt.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,n){return R(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(i.getConnectionState()!=="connected")return new Promise((c,l)=>R(s,void 0,void 0,function*(){const d=()=>{this.log.warn("abort transport connection",this.logContext),lt.clearTimeout(u),l(new Ne("room connection has been cancelled",be.Cancelled))};r!=null&&r.signal.aborted&&d(),r==null||r.signal.addEventListener("abort",d);const u=lt.setTimeout(()=>{r==null||r.signal.removeEventListener("abort",d),l(new Ne("could not establish pc connection",be.InternalError))},o);for(;this.state!==$e.CONNECTED;)if(yield wt(50),r!=null&&r.signal.aborted){l(new Ne("room connection has been cancelled",be.Cancelled));return}lt.clearTimeout(u),r==null||r.signal.removeEventListener("abort",d),c()}))}()})}}class ze extends Error{constructor(e,n,i){super(n),this.code=e,this.message=Nf(n,ze.MAX_MESSAGE_BYTES),this.data=i?Nf(i,ze.MAX_DATA_BYTES):void 0}static fromProto(e){return new ze(e.code,e.message,e.data)}toProto(){return new b0({code:this.code,message:this.message,data:this.data})}static builtIn(e,n){return new ze(ze.ErrorCode[e],ze.ErrorMessage[e],n)}}ze.MAX_MESSAGE_BYTES=256;ze.MAX_DATA_BYTES=15360;ze.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404};ze.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const Ev=15360;function uu(t){return new TextEncoder().encode(t).length}function Nf(t,e){if(uu(t)<=e)return t;let n=0,i=t.length;const r=new TextEncoder;for(;n<i;){const s=Math.floor((n+i+1)/2);r.encode(t.slice(0,s)).length<=e?n=s:i=s-1}return t.slice(0,n)}const hu=2e3;function Ea(t,e){if(!e)return 0;let n,i;return"bytesReceived"in t?(n=t.bytesReceived,i=e.bytesReceived):"bytesSent"in t&&(n=t.bytesSent,i=e.bytesSent),n===void 0||i===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(n-i)*8*1e3/(t.timestamp-e.timestamp)}const fu=typeof MediaRecorder<"u";class zC{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const WC=fu?MediaRecorder:zC;class qC extends WC{constructor(e,n){if(!fu)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([e.mediaStreamTrack]),n);let i,r;const s=()=>r===void 0,o=()=>{this.removeEventListener("dataavailable",i),this.removeEventListener("stop",o),this.removeEventListener("error",a),r==null||r.close(),r=void 0},a=c=>{r==null||r.error(c),this.removeEventListener("dataavailable",i),this.removeEventListener("stop",o),this.removeEventListener("error",a),r=void 0};this.byteStream=new ReadableStream({start:c=>{r=c,i=l=>R(this,void 0,void 0,function*(){const d=yield l.data.arrayBuffer();s()||c.enqueue(new Uint8Array(d))}),this.addEventListener("dataavailable",i)},cancel:()=>{o()}}),this.addEventListener("stop",o),this.addEventListener("error",a)}}function GC(){return fu}const KC=1e3,ZC=1e4;class Pv extends D{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,n,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;super(e,n,s),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=lu(()=>R(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>R(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(ne.Ended,this)},this.reacquireTrack=!1,this.providedByUser=r,this.muteLock=new yt,this.pauseUpstreamLock=new yt,this.processorLock=new yt,this.restartLock=new yt,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),i&&(this._constraints=i)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==D.Kind.Video)return;const{width:e,height:n}=this._mediaStreamTrack.getSettings();if(e&&n)return{width:e,height:n}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,n;return(n=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&n!==void 0?n:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,n){return R(this,void 0,void 0,function*(){var i;if(e===this._mediaStreamTrack&&!n)return;this._mediaStreamTrack&&(this.attachedElements.forEach(s=>{pr(this._mediaStreamTrack,s)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let r;if(this.processor&&e){const s=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(rr(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),r=this.processor.processedTrack}finally{s()}}this.sender&&((i=this.sender.transport)===null||i===void 0?void 0:i.state)!=="closed"&&(yield this.sender.replaceTrack(r??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(s=>{rr(r??e,s)}))})}waitForDimensions(){return R(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:KC;return function*(){var i;if(e.kind===D.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((i=Pt())===null||i===void 0?void 0:i.os)==="iOS"&&(yield wt(10));const r=Date.now();for(;Date.now()-r<n;){const s=e.dimensions;if(s)return s;yield wt(50)}throw new An("unable to get track dimensions after timeout")}()})}setDeviceId(e){return R(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Jn(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Jn(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return R(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===D.Source.ScreenShare)return;const{deviceId:i,groupId:r}=e._mediaStreamTrack.getSettings(),s=e.kind===D.Kind.Audio?"audioinput":"videoinput";return n?ot.getInstance().normalizeDeviceId(s,i,r):i}()})}mute(){return R(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return R(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,n){return R(this,void 0,void 0,function*(){if(!this.sender)throw new An("unable to replace an unpublished track");let i,r;return typeof n=="boolean"?i=n:n!==void 0&&(i=n.userProvidedTrack,r=n.stopProcessor),this.providedByUser=i??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),r&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return R(this,void 0,void 0,function*(){this.manuallyStopped=!1;const n=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:i,facingMode:r}=e,s=Ak(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const o={audio:!1,video:!1};this.kind===D.Kind.Video?o.video=i||r?{deviceId:i,facingMode:r}:!0:o.audio=i?{deviceId:i}:!0,this.attachedElements.forEach(l=>{pr(this.mediaStreamTrack,l)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const c=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return yield c.applyConstraints(s),c.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(c),this._constraints=e,this.emit(ne.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{n()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?ne.Muted:ne.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return R(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),vv()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return R(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(ne.UpstreamPaused,this);const i=Pt();if((i==null?void 0:i.name)==="Safari"&&Qn(i.version,"12.0")<0)throw new iu("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{n()}})}resumeUpstream(){return R(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(ne.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{n()}})}getRTCStatsReport(){return R(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return R(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;const o=yield i.processorLock.lock();try{i.log.debug("setting up processor",i.logContext);const a=document.createElement(i.kind),c={kind:i.kind,track:i._mediaStreamTrack,element:a,audioContext:i.audioContext};if(yield n.init(c),i.log.debug("processor initialized",i.logContext),i.processor&&(yield i.stopProcessor()),i.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(rr(i._mediaStreamTrack,a),a.muted=!0,a.play().catch(l=>i.log.error("failed to play processor element",Object.assign(Object.assign({},i.logContext),{error:l}))),i.processor=n,i.processorElement=a,i.processor.processedTrack){for(const l of i.attachedElements)l!==i.processorElement&&r&&(pr(i._mediaStreamTrack,l),rr(i.processor.processedTrack,l));yield(s=i.sender)===null||s===void 0?void 0:s.replaceTrack(i.processor.processedTrack)}i.emit(ne.TrackProcessorUpdate,i.processor)}finally{o()}}()})}getProcessor(){return this.processor}stopProcessor(){return R(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var i,r;e.processor&&(e.log.debug("stopping processor",e.logContext),(i=e.processor.processedTrack)===null||i===void 0||i.stop(),yield e.processor.destroy(),e.processor=void 0,n||((r=e.processorElement)===null||r===void 0||r.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(ne.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!GC()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(!this.localTrackRecorder)this.localTrackRecorder=new qC(this,{mimeType:"audio/webm;codecs=opus"});else{this.log.warn("preconnect buffer already started");return}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},ZC)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.byteStream}}class ta extends Pv{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;super(e,D.Kind.Audio,n,i,s),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>R(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let o;try{o=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}o&&this.prevStats&&(this._currentBitrate=Ea(o,this.prevStats)),this.prevStats=o}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(ne.AudioTrackFeatureUpdate,this,st.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(ne.AudioTrackFeatureUpdate,this,st.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=r,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return R(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===D.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return R(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const i=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Jn(this._constraints.deviceId);return this.source===D.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||i)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{n()}})}restartTrack(e){return R(this,void 0,void 0,function*(){let n;if(e){const i=su({audio:e});typeof i.audio!="boolean"&&(n=i.audio)}yield this.restart(n)})}restart(e){const n=Object.create(null,{restart:{get:()=>super.restart}});return R(this,void 0,void 0,function*(){const i=yield n.restart.call(this,e);return this.checkForSilence(),i})}startMonitor(){bt()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},hu)))}setProcessor(e){return R(this,void 0,void 0,function*(){var n;const i=yield this.processorLock.lock();try{if(!mn()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const r={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(r),this.processor=e,this.processor.processedTrack&&(yield(n=this.sender)===null||n===void 0?void 0:n.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(ne.TrackProcessorUpdate,this.processor)}finally{i()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return R(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const n=yield this.sender.getStats();let i;return n.forEach(r=>{r.type==="outbound-rtp"&&(i={type:"audio",streamId:r.id,packetsSent:r.packetsSent,packetsLost:r.packetsLost,bytesSent:r.bytesSent,timestamp:r.timestamp,roundTripTime:r.roundTripTime,jitter:r.jitter})}),i})}checkForSilence(){return R(this,void 0,void 0,function*(){const e=yield wv(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(ne.AudioSilenceDetected)),e})}}function YC(t,e,n){switch(t.kind){case"audio":return new ta(t,e,!1,void 0,n);case"video":return new na(t,e,!1,n);default:throw new An("unsupported track type: ".concat(t.kind))}}const JC=Object.values(bs),XC=Object.values(jl),QC=Object.values(ru),eT=[bs.h180,bs.h360],tT=[jl.h180,jl.h360],nT=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(n=>{var i,r;return new Ae(Math.floor(t.width/n.scaleResolutionDownBy),Math.floor(t.height/n.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(n.scaleResolutionDownBy,2)*(((i=t.encoding.maxFramerate)!==null&&i!==void 0?i:30)/((r=n.fps)!==null&&r!==void 0?r:30))))),n.fps,t.encoding.priority)}),ql=["q","h","f"];function Gl(t,e,n,i){var r,s;let o=i==null?void 0:i.videoEncoding;t&&(o=i==null?void 0:i.screenShareEncoding);const a=i==null?void 0:i.simulcast,c=i==null?void 0:i.scalabilityMode,l=i==null?void 0:i.videoCodec;if(!o&&!a&&!c||!e||!n)return[{}];o||(o=rT(t,e,n,l),ye.debug("using video encoding",o));const d=o.maxFramerate,u=new Ae(e,n,o.maxBitrate,o.maxFramerate,o.priority);if(c&&Mn(l)){const v=new Rv(c),f=[];if(v.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(c));const y=Pt();if(ji()||mn()||(y==null?void 0:y.name)==="Chrome"&&Qn(y==null?void 0:y.version,"113")<0){const b=v.suffix=="h"?2:3,S=aC(y);for(let k=0;k<v.spatial;k+=1)f.push({rid:ql[2-k],maxBitrate:o.maxBitrate/Math.pow(b,k),maxFramerate:u.encoding.maxFramerate,scaleResolutionDownBy:S?Math.pow(2,k):void 0});f[0].scalabilityMode=c}else f.push({maxBitrate:o.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:c});return u.encoding.priority&&(f[0].priority=u.encoding.priority,f[0].networkPriority=u.encoding.priority),ye.debug("using svc encoding",{encodings:f}),f}if(!a)return[o];let h=[];t?h=(r=Of(i==null?void 0:i.screenShareSimulcastLayers))!==null&&r!==void 0?r:_f(t,u):h=(s=Of(i==null?void 0:i.videoSimulcastLayers))!==null&&s!==void 0?s:_f(t,u);let p;if(h.length>0){const v=h[0];h.length>1&&([,p]=h);const f=Math.max(e,n);if(f>=960&&p)return wc(e,n,[v,p,u],d);if(f>=480)return wc(e,n,[v,u],d)}return wc(e,n,[u])}function iT(t,e,n){var i,r,s,o;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;e!==n.backupCodec.codec&&ye.warn("requested a different codec than specified as backup",{serverRequested:e,backup:n.backupCodec.codec}),n.videoCodec=e,n.videoEncoding=n.backupCodec.encoding;const a=t.mediaStreamTrack.getSettings(),c=(i=a.width)!==null&&i!==void 0?i:(r=t.dimensions)===null||r===void 0?void 0:r.width,l=(s=a.height)!==null&&s!==void 0?s:(o=t.dimensions)===null||o===void 0?void 0:o.height;return t.source===D.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),Gl(t.source===D.Source.ScreenShare,c,l,n)}function rT(t,e,n,i){const r=sT(t,e,n);let{encoding:s}=r[0];const o=Math.max(e,n);for(let a=0;a<r.length;a+=1){const c=r[a];if(s=c.encoding,c.width>=o)break}if(i)switch(i){case"av1":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.7;break;case"vp9":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.85;break}return s}function sT(t,e,n){if(t)return QC;const i=e>n?e/n:n/e;return Math.abs(i-16/9)<Math.abs(i-4/3)?JC:XC}function _f(t,e){if(t)return nT(e);const{width:n,height:i}=e,r=n>i?n/i:i/n;return Math.abs(r-16/9)<Math.abs(r-4/3)?eT:tT}function wc(t,e,n,i){const r=[];if(n.forEach((s,o)=>{if(o>=ql.length)return;const a=Math.min(t,e),l={rid:ql[o],scaleResolutionDownBy:Math.max(1,a/Math.min(s.width,s.height)),maxBitrate:s.encoding.maxBitrate},d=i&&s.encoding.maxFramerate?Math.min(i,s.encoding.maxFramerate):s.encoding.maxFramerate;d&&(l.maxFramerate=d);const u=Er()||o===0;s.encoding.priority&&u&&(l.priority=s.encoding.priority,l.networkPriority=s.encoding.priority),r.push(l)}),mn()&&bv()==="ios"){let s;r.forEach(a=>{s?a.maxFramerate&&a.maxFramerate>s&&(s=a.maxFramerate):s=a.maxFramerate});let o=!0;r.forEach(a=>{var c;a.maxFramerate!=s&&(o&&(o=!1,ye.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),ye.info('Setting framerate of encoding "'.concat((c=a.rid)!==null&&c!==void 0?c:"",'" to ').concat(s)),a.maxFramerate=s)})}return r}function Of(t){if(t)return t.sort((e,n)=>{const{encoding:i}=e,{encoding:r}=n;return i.maxBitrate>r.maxBitrate?1:i.maxBitrate<r.maxBitrate?-1:i.maxBitrate===r.maxBitrate&&i.maxFramerate&&r.maxFramerate?i.maxFramerate>r.maxFramerate?1:-1:0})}class Rv{constructor(e){const n=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!n)throw new Error("invalid scalability mode");if(this.spatial=parseInt(n[1]),this.temporal=parseInt(n[2]),n.length>3)switch(n[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=n[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function oT(t){return t.source===D.Source.ScreenShare||t.constraints.height&&Jn(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const aT=5e3;class na extends Pv{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0;super(e,D.Kind.Video,n,i,r),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>R(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}const o=new Map(s.map(a=>[a.rid,a]));if(this.prevStats){let a=0;o.forEach((c,l)=>{var d;const u=(d=this.prevStats)===null||d===void 0?void 0:d.get(l);a+=Ea(c,u)}),this._currentBitrate=a}this.prevStats=o}),this.senderLock=new yt}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var n;if(this.signalClient=e,!bt())return;const i=(n=this.sender)===null||n===void 0?void 0:n.getParameters();i&&(this.encodings=i.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},hu))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return R(this,void 0,void 0,function*(){var n,i,r,s,o;yield e.pauseUpstream.call(this);try{for(var a=!0,c=Rn(this.simulcastCodecs.values()),l;l=yield c.next(),n=l.done,!n;a=!0)s=l.value,a=!1,yield(o=s.sender)===null||o===void 0?void 0:o.replaceTrack(null)}catch(d){i={error:d}}finally{try{!a&&!n&&(r=c.return)&&(yield r.call(c))}finally{if(i)throw i.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return R(this,void 0,void 0,function*(){var n,i,r,s,o;yield e.resumeUpstream.call(this);try{for(var a=!0,c=Rn(this.simulcastCodecs.values()),l;l=yield c.next(),n=l.done,!n;a=!0){s=l.value,a=!1;const d=s;yield(o=d.sender)===null||o===void 0?void 0:o.replaceTrack(d.mediaStreamTrack)}}catch(d){i={error:d}}finally{try{!a&&!n&&(r=c.return)&&(yield r.call(c))}finally{if(i)throw i.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return R(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===D.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return R(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===D.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}setTrackMuted(e){super.setTrackMuted(e);for(const n of this.simulcastCodecs.values())n.mediaStreamTrack.enabled=!e}getSenderStats(){return R(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const n=[],i=yield this.sender.getStats();return i.forEach(r=>{var s;if(r.type==="outbound-rtp"){const o={type:"video",streamId:r.id,frameHeight:r.frameHeight,frameWidth:r.frameWidth,framesPerSecond:r.framesPerSecond,framesSent:r.framesSent,firCount:r.firCount,pliCount:r.pliCount,nackCount:r.nackCount,packetsSent:r.packetsSent,bytesSent:r.bytesSent,qualityLimitationReason:r.qualityLimitationReason,qualityLimitationDurations:r.qualityLimitationDurations,qualityLimitationResolutionChanges:r.qualityLimitationResolutionChanges,rid:(s=r.rid)!==null&&s!==void 0?s:r.id,retransmittedPacketsSent:r.retransmittedPacketsSent,targetBitrate:r.targetBitrate,timestamp:r.timestamp},a=i.get(r.remoteId);a&&(o.jitter=a.jitter,o.packetsLost=a.packetsLost,o.roundTripTime=a.roundTripTime),n.push(o)}}),n.sort((r,s)=>{var o,a;return((o=s.frameWidth)!==null&&o!==void 0?o:0)-((a=r.frameWidth)!==null&&a!==void 0?a:0)}),n})}setPublishingQuality(e){const n=[];for(let i=Dt.LOW;i<=Dt.HIGH;i+=1)n.push(new eu({quality:i,enabled:i<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(Mn(this.codec),n)}restartTrack(e){return R(this,void 0,void 0,function*(){var n,i,r,s,o;let a;if(e){const u=su({video:e});typeof u.video!="boolean"&&(a=u.video)}yield this.restart(a);try{for(var c=!0,l=Rn(this.simulcastCodecs.values()),d;d=yield l.next(),n=d.done,!n;c=!0){s=d.value,c=!1;const u=s;u.sender&&((o=u.sender.transport)===null||o===void 0?void 0:o.state)!=="closed"&&(u.mediaStreamTrack=this.mediaStreamTrack.clone(),yield u.sender.replaceTrack(u.mediaStreamTrack))}}catch(u){i={error:u}}finally{try{!c&&!n&&(r=l.return)&&(yield r.call(l))}finally{if(i)throw i.error}}})}setProcessor(e){const n=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return R(this,arguments,void 0,function(i){var r=this;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var o,a,c,l,d,u;if(yield n.setProcessor.call(r,i,s),!((d=r.processor)===null||d===void 0)&&d.processedTrack)try{for(var h=!0,p=Rn(r.simulcastCodecs.values()),v;v=yield p.next(),o=v.done,!o;h=!0)l=v.value,h=!1,yield(u=l.sender)===null||u===void 0?void 0:u.replaceTrack(r.processor.processedTrack)}catch(f){a={error:f}}finally{try{!h&&!o&&(c=p.return)&&(yield c.call(p))}finally{if(a)throw a.error}}}()})}setDegradationPreference(e){return R(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const n=this.sender.getParameters();n.degradationPreference=e,this.sender.setParameters(n)}catch(n){this.log.warn("failed to set degradationPreference",Object.assign({error:n},this.logContext))}})}addSimulcastTrack(e,n){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const i={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:n};return this.simulcastCodecs.set(e,i),i}setSimulcastTrackSender(e,n){const i=this.simulcastCodecs.get(e);i&&(i.sender=n,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},aT))}setPublishingCodecs(e){return R(this,void 0,void 0,function*(){var n,i,r,s,o,a,c;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(Mn(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const l=[];try{for(n=!0,i=Rn(e);r=yield i.next(),s=r.done,!s;n=!0){c=r.value,n=!1;const d=c;if(!this.codec||this.codec===d.codec)yield this.setPublishingLayers(Mn(d.codec),d.qualities);else{const u=this.simulcastCodecs.get(d.codec);if(this.log.debug("try setPublishingCodec for ".concat(d.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:u})),!u||!u.sender){for(const h of d.qualities)if(h.enabled){l.push(d.codec);break}}else u.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(d.codec),this.logContext),yield Df(u.sender,u.encodings,d.qualities,this.senderLock,Mn(d.codec),this.log,this.logContext))}}}catch(d){o={error:d}}finally{try{!n&&!s&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return l})}setPublishingLayers(e,n){return R(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:n})),!(!this.sender||!this.encodings)&&(yield Df(this.sender,this.encodings,n,this.senderLock,e,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return R(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),vv()&&this.isInBackground&&this.source===D.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function Df(t,e,n,i,r,s,o){return R(this,void 0,void 0,function*(){const a=yield i.lock();s.debug("setPublishingLayersForSender",Object.assign(Object.assign({},o),{sender:t,qualities:n,senderEncodings:e}));try{const c=t.getParameters(),{encodings:l}=c;if(!l)return;if(l.length!==e.length){s.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},o),{encodings:l,senderEncodings:e}));return}let d=!1;!1&&l[0].scalabilityMode||(r&&n.some(p=>p.enabled)&&n.forEach(p=>p.enabled=!0),l.forEach((h,p)=>{var v;let f=(v=h.rid)!==null&&v!==void 0?v:"";f===""&&(f="q");const y=Av(f),b=n.find(S=>S.quality===y);b&&h.active!==b.enabled&&(d=!0,h.active=b.enabled,s.debug("setting layer ".concat(b.quality," to ").concat(h.active?"enabled":"disabled"),o),Er()&&(b.enabled?(h.scaleResolutionDownBy=e[p].scaleResolutionDownBy,h.maxBitrate=e[p].maxBitrate,h.maxFrameRate=e[p].maxFrameRate):(h.scaleResolutionDownBy=4,h.maxBitrate=10,h.maxFrameRate=2)))})),d&&(c.encodings=l,s.debug("setting encodings",Object.assign(Object.assign({},o),{encodings:c.encodings})),yield t.setParameters(c))}finally{a()}})}function Av(t){switch(t){case"f":return Dt.HIGH;case"h":return Dt.MEDIUM;case"q":return Dt.LOW;default:return Dt.HIGH}}function jf(t,e,n,i){if(!n)return[new Pi({quality:Dt.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(i){const r=n[0].scalabilityMode,s=new Rv(r),o=[],a=s.suffix=="h"?1.5:2,c=s.suffix=="h"?2:3;for(let l=0;l<s.spatial;l+=1)o.push(new Pi({quality:Math.min(Dt.HIGH,s.spatial-1)-l,width:Math.ceil(t/Math.pow(a,l)),height:Math.ceil(e/Math.pow(a,l)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(c,l)):0,ssrc:0}));return o}return n.map(r=>{var s,o,a;const c=(s=r.scaleResolutionDownBy)!==null&&s!==void 0?s:1;let l=Av((o=r.rid)!==null&&o!==void 0?o:"");return new Pi({quality:l,width:Math.ceil(t/c),height:Math.ceil(e/c),bitrate:(a=r.maxBitrate)!==null&&a!==void 0?a:0,ssrc:0})})}const Lf="_lossy",Vf="_reliable",cT=2*1e3,Sc="leave-reconnect",lT=3e4;var Bt;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(Bt||(Bt={}));class dT extends vn.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var n;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=du.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=Bt.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=ye,this.reliableDataSequence=1,this.reliableMessageBuffer=new Cf,this.reliableReceivedState=new OC(lT),this.handleDataChannel=i=>R(this,[i],void 0,function(r){var s=this;let{channel:o}=r;return function*(){if(o){if(o.label===Vf)s.reliableDCSub=o;else if(o.label===Lf)s.lossyDCSub=o;else return;s.log.debug("on data channel ".concat(o.id,", ").concat(o.label),s.logContext),o.onmessage=s.handleDataMessage}}()}),this.handleDataMessage=i=>R(this,void 0,void 0,function*(){var r,s;const o=yield this.dataProcessLock.lock();try{let a;if(i.data instanceof ArrayBuffer)a=i.data;else if(i.data instanceof Blob)a=yield i.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:i.data}));return}const c=gt.fromBinary(new Uint8Array(a));if(c.sequence>0&&c.participantSid!==""){const l=this.reliableReceivedState.get(c.participantSid);if(l&&c.sequence<=l)return;this.reliableReceivedState.set(c.participantSid,c.sequence)}((r=c.value)===null||r===void 0?void 0:r.case)==="speaker"?this.emit(re.ActiveSpeakersUpdate,c.value.value.speakers):(((s=c.value)===null||s===void 0?void 0:s.case)==="user"&&hT(c,c.value.value),this.emit(re.DataPacketReceived,c))}finally{o()}}),this.handleDataError=i=>{const s=i.currentTarget.maxRetransmits===0?"lossy":"reliable";if(i instanceof ErrorEvent&&i.error){const{error:o}=i.error;this.log.error("DataChannel error on ".concat(s,": ").concat(i.message),Object.assign(Object.assign({},this.logContext),{error:o}))}else this.log.error("Unknown DataChannel error on ".concat(s),Object.assign(Object.assign({},this.logContext),{event:i}))},this.handleBufferedAmountLow=i=>{const s=i.currentTarget.maxRetransmits===0?me.LOSSY:me.RELIABLE;this.updateAndEmitDCBufferStatus(s)},this.handleDisconnect=(i,r)=>{if(this._isClosed)return;this.log.warn("".concat(i," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const s=c=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(c,"ms. giving up"),this.logContext),this.emit(re.Disconnected),this.close()},o=Date.now()-this.reconnectStart;let a=this.getNextRetryDelay({elapsedMs:o,retryCount:this.reconnectAttempts});if(a===null){s(o);return}i===Sc&&(a=0),this.log.debug("reconnecting in ".concat(a,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=lt.setTimeout(()=>this.attemptReconnect(r).finally(()=>this.reconnectTimeout=void 0),a)},this.waitForRestarted=()=>new Promise((i,r)=>{this.pcState===Bt.Connected&&i();const s=()=>{this.off(re.Disconnected,o),i()},o=()=>{this.off(re.Restarted,s),r()};this.once(re.Restarted,s),this.once(re.Disconnected,o)}),this.updateAndEmitDCBufferStatus=i=>{const r=this.isBufferStatusLow(i);typeof r<"u"&&r!==this.dcBufferStatus.get(i)&&(this.dcBufferStatus.set(i,r),this.emit(re.DCBufferStatusChanged,r,i))},this.isBufferStatusLow=i=>{const r=this.dataChannelForKind(i);if(r)return i===me.RELIABLE&&this.reliableMessageBuffer.alignBufferedAmount(r.bufferedAmount),r.bufferedAmount<=r.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===_e.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(Wi.RR_SIGNAL_DISCONNECTED))},this.log=Nn((n=e.loggerName)!==null&&n!==void 0?n:Zt.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new au(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new yt,this.dataProcessLock=new yt,this.dcBufferStatus=new Map([[me.LOSSY,!0],[me.RELIABLE,!0]]),this.client.onParticipantUpdate=i=>this.emit(re.ParticipantUpdate,i),this.client.onConnectionQuality=i=>this.emit(re.ConnectionQualityUpdate,i),this.client.onRoomUpdate=i=>this.emit(re.RoomUpdate,i),this.client.onSubscriptionError=i=>this.emit(re.SubscriptionError,i),this.client.onSubscriptionPermissionUpdate=i=>this.emit(re.SubscriptionPermissionUpdate,i),this.client.onSpeakersChanged=i=>this.emit(re.SpeakersChanged,i),this.client.onStreamStateUpdate=i=>this.emit(re.StreamStateChanged,i),this.client.onRequestResponse=i=>this.emit(re.SignalRequestResponse,i)}get logContext(){var e,n,i,r,s,o;return{room:(n=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||n===void 0?void 0:n.name,roomID:(r=(i=this.latestJoinResponse)===null||i===void 0?void 0:i.room)===null||r===void 0?void 0:r.sid,participant:(o=(s=this.latestJoinResponse)===null||s===void 0?void 0:s.participant)===null||o===void 0?void 0:o.identity,pID:this.participantSid}}join(e,n,i,r){return R(this,void 0,void 0,function*(){this.url=e,this.token=n,this.signalOpts=i,this.maxJoinAttempts=i.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const s=yield this.client.join(e,n,i,r);return this._isClosed=!1,this.latestJoinResponse=s,this.subscriberPrimary=s.subscriberPrimary,this.pcManager||(yield this.configure(s)),(!this.subscriberPrimary||s.fastPublish)&&this.negotiate(),this.clientConfiguration=s.clientConfiguration,this.emit(re.SignalConnected,s),s}catch(s){if(s instanceof Ne&&s.reason===be.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,n,i,r);throw s}})}close(){return R(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(re.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return R(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const n=i=>{i&&(i.close(),i.onbufferedamountlow=null,i.onclose=null,i.onclosing=null,i.onerror=null,i.onmessage=null,i.onopen=null)};n(this.lossyDC),n(this.lossyDCSub),n(this.reliableDC),n(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new Cf,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupClient(){return R(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new An("a track with the same ID has already been published");return new Promise((n,i)=>{const r=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],i(new Ne("publication of local track timed out, no response from server",be.Timeout))},1e4);this.pendingTrackResolvers[e.cid]={resolve:s=>{clearTimeout(r),n(s)},reject:()=>{clearTimeout(r),i(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:n}=this.pendingTrackResolvers[e.track.id];n&&n(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(n){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:n}))}return!1}updateMuteStatus(e,n){this.client.sendMuteTrack(e,n)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return R(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return R(this,void 0,void 0,function*(){var n,i;if(this.pcManager&&this.pcManager.currentState!==$e.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const r=this.makeRTCConfiguration(e);this.pcManager=new HC(r,e.subscriberPrimary,this.loggerOptions),this.emit(re.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(s,o)=>{this.client.sendIceCandidate(s,o)},this.pcManager.onPublisherOffer=(s,o)=>{this.client.sendOffer(s,o)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(s,o,a)=>R(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(s),this.logContext),["closed","disconnected","failed"].includes(o)&&(this.publisherConnectionPromise=void 0),s===$e.CONNECTED){const d=this.pcState===Bt.New;this.pcState=Bt.Connected,d&&this.emit(re.Connected,e)}else s===$e.FAILED&&this.pcState===Bt.Connected&&(this.pcState=Bt.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?Wi.RR_SUBSCRIBER_FAILED:Wi.RR_PUBLISHER_FAILED));const c=this.client.isDisconnected||this.client.currentState===_e.RECONNECTING,l=[$e.FAILED,$e.CLOSING,$e.CLOSED].includes(s);c&&l&&!this._isClosed&&this.emit(re.Offline)}),this.pcManager.onTrack=s=>{this.emit(re.MediaTrackAdded,s.track,s.streams[0],s.receiver)},uT((i=e.serverInfo)===null||i===void 0?void 0:i.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(e,n)=>R(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e,n))}),this.client.onTrickle=(e,n)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:n})),this.pcManager.addIceCandidate(e,n))},this.client.onOffer=(e,n)=>R(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=n,!this.pcManager)return;const i=yield this.pcManager.createSubscriberAnswerFromOffer(e,n);i&&this.client.sendAnswer(i,n)}),this.client.onLocalTrackPublished=e=>{var n;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(n=e.track)===null||n===void 0?void 0:n.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:i}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],i(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(re.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(re.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,n)=>{this.emit(re.RemoteMute,e,n)},this.client.onSubscribedQualityUpdate=e=>{this.emit(re.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var n;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(re.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",Wi.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case fr.DISCONNECT:this.emit(re.Disconnected,e==null?void 0:e.reason),this.close();break;case fr.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Sc);break;case fr.RESUME:this.handleDisconnect(Sc)}}}makeRTCConfiguration(e){var n;const i=Object.assign({},this.rtcConfig);if(!((n=this.signalOpts)===null||n===void 0)&&n.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),i.encodedInsertableStreams=!0),e.iceServers&&!i.iceServers){const r=[];e.iceServers.forEach(s=>{const o={urls:s.urls};s.username&&(o.username=s.username),s.credential&&(o.credential=s.credential),r.push(o)}),i.iceServers=r}return e.clientConfiguration&&e.clientConfiguration.forceRelay===ys.ENABLED&&(i.iceTransportPolicy="relay"),i.sdpSemantics="unified-plan",i.continualGatheringPolicy="gather_continually",i}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(Lf,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(Vf,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,n,i){return R(this,void 0,void 0,function*(){if(Ll())return yield this.createTransceiverRTCRtpSender(e,n,i);if(Vl())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new nt("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,n,i,r){return R(this,void 0,void 0,function*(){if(Ll())return this.createSimulcastTransceiverSender(e,n,i,r);if(Vl())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new nt("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,n,i){return R(this,void 0,void 0,function*(){if(!this.pcManager)throw new nt("publisher is closed");const r=[];e.mediaStream&&r.push(e.mediaStream),jr(e)&&(e.codec=n.videoCodec);const s={direction:"sendonly",streams:r};return i&&(s.sendEncodings=i),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,s)).sender})}createSimulcastTransceiverSender(e,n,i,r){return R(this,void 0,void 0,function*(){if(!this.pcManager)throw new nt("publisher is closed");const s={direction:"sendonly"};r&&(s.sendEncodings=r);const o=yield this.pcManager.addPublisherTransceiver(n.mediaStreamTrack,s);if(i.videoCodec)return e.setSimulcastTrackSender(i.videoCodec,o.sender),o.sender})}createRTCRtpSender(e){return R(this,void 0,void 0,function*(){if(!this.pcManager)throw new nt("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return R(this,void 0,void 0,function*(){var n,i,r;if(!this._isClosed){if(this.attemptingReconnect){ye.warn("already attempting reconnect, returning early",this.logContext);return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===ys.DISABLED||((r=(i=this.pcManager)===null||i===void 0?void 0:i.currentState)!==null&&r!==void 0?r:$e.NEW)===$e.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(s){this.reconnectAttempts+=1;let o=!0;s instanceof nt?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:s})),o=!1):s instanceof qi||(this.fullReconnectOnNext=!0),o?this.handleDisconnect("reconnect",Wi.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(re.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(n){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:n}))}return null}restartConnection(e){return R(this,void 0,void 0,function*(){var n,i,r;try{if(!this.url||!this.token)throw new nt("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(re.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let s;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new qi;s=yield this.join(e??this.url,this.token,this.signalOpts)}catch(o){throw o instanceof Ne&&o.reason===be.NotAllowed?new nt("could not reconnect, token might be expired"):new qi}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(re.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==_e.CONNECTED)throw new qi("Signal connection got severed during reconnect");(n=this.regionUrlProvider)===null||n===void 0||n.resetAttempts(),this.emit(re.Restarted)}catch(s){const o=yield(i=this.regionUrlProvider)===null||i===void 0?void 0:i.getNextBestRegionUrl();if(o){yield this.restartConnection(o);return}else throw(r=this.regionUrlProvider)===null||r===void 0||r.resetAttempts(),s}})}resumeConnection(e){return R(this,void 0,void 0,function*(){var n;if(!this.url||!this.token)throw new nt("could not reconnect, url or token not saved");if(!this.pcManager)throw new nt("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(re.Resuming);let i;try{this.setupSignalClientCallbacks(),i=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(r){let s="";throw r instanceof Error&&(s=r.message,this.log.error(r.message,Object.assign(Object.assign({},this.logContext),{error:r}))),r instanceof Ne&&r.reason===be.NotAllowed?new nt("could not reconnect, token might be expired"):r instanceof Ne&&r.reason===be.LeaveRequest?r:new qi(s)}if(this.emit(re.SignalResumed),i){const r=this.makeRTCConfiguration(i);this.pcManager.updateConfiguration(r),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=i.serverInfo)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==_e.CONNECTED)throw new qi("Signal connection got severed during reconnect");this.client.setReconnected(),((n=this.reliableDC)===null||n===void 0?void 0:n.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),i!=null&&i.lastMessageSeq&&this.resendReliableMessagesForResume(i.lastMessageSeq),this.emit(re.Resumed)})}waitForPCInitialConnection(e,n){return R(this,void 0,void 0,function*(){if(!this.pcManager)throw new nt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,e)})}waitForPCReconnected(){return R(this,void 0,void 0,function*(){this.pcState=Bt.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield wt(cT),!this.pcManager)throw new nt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Bt.Connected}catch(e){throw this.pcState=Bt.Disconnected,new Ne("could not establish PC connection, ".concat(e.message),be.InternalError)}})}publishRpcResponse(e,n,i,r){return R(this,void 0,void 0,function*(){const s=new gt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcResponse",value:new y0({requestId:n,value:r?{case:"error",value:r.toProto()}:{case:"payload",value:i??""}})}});yield this.sendDataPacket(s,me.RELIABLE)})}publishRpcAck(e,n){return R(this,void 0,void 0,function*(){const i=new gt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcAck",value:new v0({requestId:n})}});yield this.sendDataPacket(i,me.RELIABLE)})}sendDataPacket(e,n){return R(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(n),n===me.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const i=e.toBinary(),r=this.dataChannelForKind(n);if(r){if(n===me.RELIABLE&&this.reliableMessageBuffer.push({data:i,sequence:e.sequence}),this.attemptingReconnect)return;r.send(i)}this.updateAndEmitDCBufferStatus(n)})}resendReliableMessagesForResume(e){return R(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(me.RELIABLE);const n=this.dataChannelForKind(me.RELIABLE);n&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(i=>{n.send(i.data)})),this.updateAndEmitDCBufferStatus(me.RELIABLE)})}waitForBufferStatusLow(e){return new Promise((n,i)=>R(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))n();else{const r=()=>i("Engine closed");for(this.once(re.Closing,r);!this.dcBufferStatus.get(e);)yield wt(10);this.off(re.Closing,r),n()}}))}ensureDataTransportConnected(e){return R(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var s;if(!i.pcManager)throw new nt("PC manager is closed");const o=r?i.pcManager.subscriber:i.pcManager.publisher,a=r?"Subscriber":"Publisher";if(!o)throw new Ne("".concat(a," connection not set"),be.InternalError);let c=!1;!r&&!i.dataChannelForKind(n,r)&&(i.createDataChannels(),c=!0),!c&&!r&&!i.pcManager.publisher.isICEConnected&&i.pcManager.publisher.getICEConnectionState()!=="checking"&&(c=!0),c&&i.negotiate();const l=i.dataChannelForKind(n,r);if((l==null?void 0:l.readyState)==="open")return;const d=new Date().getTime()+i.peerConnectionTimeout;for(;new Date().getTime()<d;){if(o.isICEConnected&&((s=i.dataChannelForKind(n,r))===null||s===void 0?void 0:s.readyState)==="open")return;yield wt(50)}throw new Ne("could not establish ".concat(a," connection, state: ").concat(o.getICEConnectionState()),be.InternalError)}()})}ensurePublisherConnected(e){return R(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==$e.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return R(this,void 0,void 0,function*(){return new Promise((e,n)=>R(this,void 0,void 0,function*(){if(!this.pcManager){n(new Ol("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const i=new AbortController,r=()=>{i.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&n("cannot negotiate on closed engine"),this.on(re.Closing,r),this.pcManager.publisher.once(vr.RTPVideoPayloadTypes,s=>{const o=new Map;s.forEach(a=>{const c=a.codec.toLowerCase();fC(c)&&o.set(a.payload,c)}),this.emit(re.RTPVideoMapUpdate,o)});try{yield this.pcManager.negotiate(i),e()}catch(s){s instanceof Ol&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Wi.RR_UNKNOWN),n(s)}finally{this.off(re.Closing,r)}}))})}dataChannelForKind(e,n){if(n){if(e===me.LOSSY)return this.lossyDCSub;if(e===me.RELIABLE)return this.reliableDCSub}else{if(e===me.LOSSY)return this.lossyDC;if(e===me.RELIABLE)return this.reliableDC}}sendSyncState(e,n){var i,r;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const s=this.pcManager.subscriber.getLocalDescription(),o=this.pcManager.subscriber.getRemoteDescription(),a=(r=(i=this.signalOpts)===null||i===void 0?void 0:i.autoSubscribe)!==null&&r!==void 0?r:!0,c=new Array,l=new Array;e.forEach(d=>{d.isDesired!==a&&c.push(d.trackSid),d.isEnabled||l.push(d.trackSid)}),this.client.sendSyncState(new D0({answer:s?ea({sdp:s.sdp,type:s.type}):void 0,offer:o?ea({sdp:o.sdp,type:o.type}):void 0,subscription:new ka({trackSids:c,subscribe:!a,participantTracks:[]}),publishTracks:SC(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:l,datachannelReceiveStates:this.reliableReceivedState.map((d,u)=>new j0({publisherSid:u,lastSeq:d}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],n=(i,r)=>{(i==null?void 0:i.id)!==void 0&&i.id!==null&&e.push(new L0({label:i.label,id:i.id,target:r}))};return n(this.dataChannelForKind(me.LOSSY),qt.PUBLISHER),n(this.dataChannelForKind(me.RELIABLE),qt.PUBLISHER),n(this.dataChannelForKind(me.LOSSY,!0),qt.SUBSCRIBER),n(this.dataChannelForKind(me.RELIABLE,!0),qt.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&<.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){bt()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){bt()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class qi extends Error{}function uT(t){return t!==void 0&&t>13}function hT(t,e){const n=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=n,e.participantIdentity=n;const i=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=i,e.destinationIdentities=i}class Kl{constructor(e,n){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=n}updateToken(e){this.token=e}isCloud(){return Ul(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return R(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const n=this.regionSettings.regions.filter(i=>!this.attemptedRegions.find(r=>r.url===i.url));if(n.length>0){const i=n[0];return this.attemptedRegions.push(i),ye.debug("next region: ".concat(i.region)),i.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return R(this,void 0,void 0,function*(){const n=yield fetch("".concat(fT(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(n.ok){const i=yield n.json();return this.lastUpdateAt=Date.now(),i}else throw new Ne("Could not fetch region settings: ".concat(n.statusText),n.status===401?be.NotAllowed:be.InternalError,n.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function fT(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class Iv{get info(){return this._info}constructor(e,n,i){this.reader=n,this.totalByteSize=i,this._info=e,this.bytesReceived=0}}class mT extends Iv{handleChunkReceived(e){var n;this.bytesReceived+=e.content.byteLength;const i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,i)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>R(this,void 0,void 0,function*(){try{const{done:n,value:i}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:i.content})}catch{return{done:!0,value:void 0}}}),return(){return R(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return R(this,void 0,void 0,function*(){var e,n,i,r;let s=new Set;try{for(var o=!0,a=Rn(this),c;c=yield a.next(),e=c.done,!e;o=!0){r=c.value,o=!1;const l=r;s.add(l)}}catch(l){n={error:l}}finally{try{!o&&!e&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}return Array.from(s)})}}class pT extends Iv{constructor(e,n,i){super(e,n,i),this.receivedChunks=new Map}handleChunkReceived(e){var n;const i=Oo(e.chunkIndex),r=this.receivedChunks.get(i);if(r&&r.version>e.version)return;this.receivedChunks.set(i,e),this.bytesReceived+=e.content.byteLength;const s=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,s)}[Symbol.asyncIterator](){const e=this.reader.getReader(),n=new TextDecoder;return{next:()=>R(this,void 0,void 0,function*(){try{const{done:i,value:r}=yield e.read();return i?{done:!0,value:void 0}:(this.handleChunkReceived(r),{done:!1,value:n.decode(r.content)})}catch{return{done:!0,value:void 0}}}),return(){return R(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return R(this,void 0,void 0,function*(){var e,n,i,r;let s="";try{for(var o=!0,a=Rn(this),c;c=yield a.next(),e=c.done,!e;o=!0)r=c.value,o=!1,s+=r}catch(l){n={error:l}}finally{try{!o&&!e&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}return s})}}class Mv{constructor(e,n,i){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=i,this.info=n}write(e){return this.defaultWriter.write(e)}close(){return R(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class gT extends Mv{}class vT extends Mv{}class Nv extends D{constructor(e,n,i,r,s){super(e,i,s),this.sid=n,this.receiver=r}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?ne.Muted:ne.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const n=i=>{i.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",n),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(ne.Ended,this))};e.addEventListener("removetrack",n)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return R(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),hu)),kC()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var n;this.timeSyncHandle=requestAnimationFrame(()=>e());const i=(n=this.receiver)===null||n===void 0?void 0:n.getSynchronizationSources()[0];if(i){const{timestamp:r,rtpTimestamp:s}=i;s&&this.rtpTimestamp!==s&&(this.emit(ne.TimeSyncUpdate,{timestamp:r,rtpTimestamp:s}),this.rtpTimestamp=s)}};e()}}class _v extends Nv{constructor(e,n,i,r,s,o){super(e,n,D.Kind.Audio,i,o),this.monitorReceiver=()=>R(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const a=yield this.getReceiverStats();a&&this.prevStats&&this.receiver&&(this._currentBitrate=Ea(a,this.prevStats)),this.prevStats=a}),this.audioContext=r,this.webAudioPluginNodes=[],s&&(this.sinkId=s.deviceId)}setVolume(e){var n;for(const i of this.attachedElements)this.audioContext?(n=this.gainNode)===null||n===void 0||n.gain.setTargetAtTime(e,0,.1):i.volume=e;mn()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(mn())return 1;let e=0;return this.attachedElements.forEach(n=>{n.volume>e&&(e=n.volume)}),e}setSinkId(e){return R(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(n=>{if(Fl(n))return n.setSinkId(e)}))})}attach(e){const n=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&Fl(e)&&e.setSinkId(this.sinkId).catch(i=>{this.log.error("Failed to set sink id on remote audio track",i,this.logContext)}),this.audioContext&&n&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let n;return e?(n=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(n=super.detach(),this.disconnectWebAudio()),n}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,n){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(n.srcObject);let i=this.sourceNode;this.webAudioPluginNodes.forEach(r=>{i.connect(r),i=r}),this.gainNode=e.createGain(),i.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(ne.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(r=>{this.emit(ne.AudioPlaybackFailed,r)})}disconnectWebAudio(){var e,n;(e=this.gainNode)===null||e===void 0||e.disconnect(),(n=this.sourceNode)===null||n===void 0||n.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return R(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n;return e.forEach(i=>{i.type==="inbound-rtp"&&(n={type:"audio",streamId:i.id,timestamp:i.timestamp,jitter:i.jitter,bytesReceived:i.bytesReceived,concealedSamples:i.concealedSamples,concealmentEvents:i.concealmentEvents,silentConcealedSamples:i.silentConcealedSamples,silentConcealmentEvents:i.silentConcealmentEvents,totalAudioEnergy:i.totalAudioEnergy,totalSamplesDuration:i.totalSamplesDuration})}),n})}}const kc=100;class yT extends Nv{constructor(e,n,i,r,s){super(e,n,D.Kind.Video,i,s),this.elementInfos=[],this.monitorReceiver=()=>R(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=Ea(o,this.prevStats)),this.prevStats=o}),this.debouncedHandleResize=lu(()=>{this.updateDimensions()},kc),this.adaptiveStreamSettings=r}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(n=>{e?pr(this._mediaStreamTrack,n):rr(this._mediaStreamTrack,n)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(n=>n.element===e)===void 0){const n=new bT(e);this.observeElementInfo(n)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(n=>n===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const n=this.elementInfos.filter(i=>i===e);for(const i of n)i.stopObserving();this.elementInfos=this.elementInfos.filter(i=>i!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let n=[];if(e)return this.stopObservingElement(e),super.detach(e);n=super.detach();for(const i of n)this.stopObservingElement(i);return n}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return R(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n,i="",r=new Map;return e.forEach(s=>{s.type==="inbound-rtp"?(i=s.codecId,n={type:"video",streamId:s.id,framesDecoded:s.framesDecoded,framesDropped:s.framesDropped,framesReceived:s.framesReceived,packetsReceived:s.packetsReceived,packetsLost:s.packetsLost,frameWidth:s.frameWidth,frameHeight:s.frameHeight,pliCount:s.pliCount,firCount:s.firCount,nackCount:s.nackCount,jitter:s.jitter,timestamp:s.timestamp,bytesReceived:s.bytesReceived,decoderImplementation:s.decoderImplementation}):s.type==="codec"&&r.set(s.id,s)}),n&&i!==""&&r.get(i)&&(n.mimeType=r.get(i).mimeType),n})}stopObservingElement(e){const n=this.elementInfos.filter(i=>i.element===e);for(const i of n)this.stopObservingElementInfo(i)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return R(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,n;const i=this.elementInfos.reduce((a,c)=>Math.max(a,c.visibilityChangedAt||0),0),r=!((n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&n!==void 0)||n?this.isInBackground:!1,s=this.elementInfos.some(a=>a.pictureInPicture),o=this.elementInfos.some(a=>a.visible)&&!r||s;if(this.lastVisible!==o){if(!o&&Date.now()-i<kc){lt.setTimeout(()=>{this.updateVisibility()},kc);return}this.lastVisible=o,this.emit(ne.VisibilityChanged,o,this)}}updateDimensions(){var e,n;let i=0,r=0;const s=this.getPixelDensity();for(const o of this.elementInfos){const a=o.width()*s,c=o.height()*s;a+c>i+r&&(i=a,r=c)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===i&&((n=this.lastDimensions)===null||n===void 0?void 0:n.height)===r||(this.lastDimensions={width:i,height:r},this.emit(ne.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return n==="screen"?yf():n||(yf()>2?2:1)}}class bT{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,n){this.onVisibilityChanged=i=>{var r;const{target:s,isIntersecting:o}=i;s===this.element&&(this.isIntersecting=o,this.isPiP=Qr(this.element),this.visibilityChangedAt=Date.now(),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this))},this.onEnterPiP=()=>{var i,r,s;(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Qr(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)},this.onLeavePiP=()=>{var i;this.isPiP=Qr(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.element=e,this.isIntersecting=n??Zl(e),this.isPiP=bt()&&Qr(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,n,i;this.isIntersecting=Zl(this.element),this.isPiP=Qr(this.element),this.element.handleResize=()=>{var r;(r=this.handleResize)===null||r===void 0||r.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,xf().observe(this.element),bf().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(i=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,n,i,r,s;(e=xf())===null||e===void 0||e.unobserve(this.element),(n=bf())===null||n===void 0||n.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(i=window.documentPictureInPicture)===null||i===void 0||i.removeEventListener("enter",this.onEnterPiP),(s=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||s===void 0||s.removeEventListener("pagehide",this.onLeavePiP)}}function Qr(t){var e,n;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?Zl(t,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function Zl(t,e){const n=e||window;let i=t.offsetTop,r=t.offsetLeft;const s=t.offsetWidth,o=t.offsetHeight,{hidden:a}=t,{display:c}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,i+=t.offsetTop,r+=t.offsetLeft;return i<n.pageYOffset+n.innerHeight&&r<n.pageXOffset+n.innerWidth&&i+o>n.pageYOffset&&r+s>n.pageXOffset&&!a&&c!=="none"}class Tn extends vn.EventEmitter{constructor(e,n,i,r){var s;super(),this.metadataMuted=!1,this.encryption=Ct.NONE,this.log=ye,this.handleMuted=()=>{this.emit(ne.Muted)},this.handleUnmuted=()=>{this.emit(ne.Unmuted)},this.log=Nn((s=r==null?void 0:r.loggerName)!==null&&s!==void 0?s:Zt.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=n,this.trackName=i,this.source=D.Source.Unknown}setTrack(e){this.track&&(this.track.off(ne.Muted,this.handleMuted),this.track.off(ne.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(ne.Muted,this.handleMuted),e.on(ne.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ve(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==Ct.NONE}get audioTrack(){if(ln(this.track))return this.track}get videoTrack(){if(jr(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=D.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===D.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(Tn||(Tn={}));class Yl extends Tn{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,n,i,r){super(e,n.sid,n.name,r),this.track=void 0,this.handleTrackEnded=()=>{this.emit(ne.Ended)},this.updateInfo(n),this.setTrack(i)}setTrack(e){this.track&&this.track.off(ne.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(ne.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return R(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return R(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return R(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return R(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(ln(this.track)){const n=this.track.getSourceTrackSettings(),i=new Set;return n.autoGainControl&&i.add(st.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&i.add(st.TF_ECHO_CANCELLATION),n.noiseSuppression&&i.add(st.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&i.add(st.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||i.add(st.TF_NO_DTX),this.track.enhancedNoiseCancellation&&i.add(st.TF_ENHANCED_NOISE_CANCELLATION),Array.from(i.values())}else return[]}}function Pa(t,e){return R(this,void 0,void 0,function*(){t??(t={});let n=!1;const{audioProcessor:i,videoProcessor:r,optionsWithoutProcessor:s}=Sv(t);let o=s.audio,a=s.video;if(i&&typeof s.audio=="object"&&(s.audio.processor=i),r&&typeof s.video=="object"&&(s.video.processor=r),t.audio&&typeof s.audio=="object"&&typeof s.audio.deviceId=="string"){const u=s.audio.deviceId;s.audio.deviceId={exact:u},n=!0,o=Object.assign(Object.assign({},s.audio),{deviceId:{ideal:u}})}if(s.video&&typeof s.video=="object"&&typeof s.video.deviceId=="string"){const u=s.video.deviceId;s.video.deviceId={exact:u},n=!0,a=Object.assign(Object.assign({},s.video),{deviceId:{ideal:u}})}(s.audio===!0||typeof s.audio=="object"&&!s.audio.deviceId)&&(s.audio={deviceId:"default"}),s.video===!0?s.video={deviceId:"default"}:typeof s.video=="object"&&!s.video.deviceId&&(s.video.deviceId="default");const c=xv(s,Cv,Tv),l=su(c),d=navigator.mediaDevices.getUserMedia(l);s.audio&&(ot.userMediaPromiseMap.set("audioinput",d),d.catch(()=>ot.userMediaPromiseMap.delete("audioinput"))),s.video&&(ot.userMediaPromiseMap.set("videoinput",d),d.catch(()=>ot.userMediaPromiseMap.delete("videoinput")));try{const u=yield d;return yield Promise.all(u.getTracks().map(h=>R(this,void 0,void 0,function*(){const p=h.kind==="audio";let v=p?c.audio:c.video;(typeof v=="boolean"||!v)&&(v={});let f;const y=p?l.audio:l.video;typeof y!="boolean"&&(f=y);const b=h.getSettings().deviceId;f!=null&&f.deviceId&&Jn(f.deviceId)!==b?f.deviceId=b:f||(f={deviceId:b});const S=YC(h,f,e);return S.kind===D.Kind.Video?S.source=D.Source.Camera:S.kind===D.Kind.Audio&&(S.source=D.Source.Microphone),S.mediaStream=u,ln(S)&&i?yield S.setProcessor(i):jr(S)&&r&&(yield S.setProcessor(r)),S})))}catch(u){if(!n)throw u;return Pa(Object.assign(Object.assign({},t),{audio:o,video:a}),e)}})}function xT(t){return R(this,void 0,void 0,function*(){return(yield Pa({audio:!1,video:!0}))[0]})}function wT(t){return R(this,void 0,void 0,function*(){return(yield Pa({audio:!0,video:!1}))[0]})}var Gn;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(Gn||(Gn={}));function ST(t){switch(t){case rs.EXCELLENT:return Gn.Excellent;case rs.GOOD:return Gn.Good;case rs.POOR:return Gn.Poor;case rs.LOST:return Gn.Lost;default:return Gn.Unknown}}class Ov extends vn.EventEmitter{get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===Oi.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===hr.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,n,i,r,s,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Oi.STANDARD;var c;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Gn.Unknown,this.log=ye,this.log=Nn((c=o==null?void 0:o.loggerName)!==null&&c!==void 0?c:Zt.Participant),this.loggerOptions=o,this.setMaxListeners(100),this.sid=e,this.identity=n,this.name=i,this.metadata=r,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=a,this._attributes=s??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,n]of this.trackPublications)if(n.source===e)return n}getTrackPublicationByName(e){for(const[,n]of this.trackPublications)if(n.trackName===e)return n}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new sr,this.once(q.Active,()=>{var e,n;(n=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||n===void 0||n.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const n=this.getTrackPublication(D.Source.Camera);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const n=this.getTrackPublication(D.Source.Microphone);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(D.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var n;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===hr.ACTIVE&&((n=this.participantInfo)===null||n===void 0?void 0:n.state)!==hr.ACTIVE&&this.emit(q.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const n=this.metadata!==e,i=this.metadata;this.metadata=e,n&&this.emit(q.ParticipantMetadataChanged,i)}_setName(e){const n=this.name!==e;this.name=e,n&&this.emit(q.ParticipantNameChanged,e)}_setAttributes(e){const n=CC(this.attributes,e);this._attributes=e,Object.keys(n).length>0&&this.emit(q.AttributesChanged,n)}setPermissions(e){var n,i,r,s,o,a;const c=this.permissions,l=e.canPublish!==((n=this.permissions)===null||n===void 0?void 0:n.canPublish)||e.canSubscribe!==((i=this.permissions)===null||i===void 0?void 0:i.canSubscribe)||e.canPublishData!==((r=this.permissions)===null||r===void 0?void 0:r.canPublishData)||e.hidden!==((s=this.permissions)===null||s===void 0?void 0:s.hidden)||e.recorder!==((o=this.permissions)===null||o===void 0?void 0:o.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((d,u)=>{var h;return d!==((h=this.permissions)===null||h===void 0?void 0:h.canPublishSources[u])})||e.canSubscribeMetrics!==((a=this.permissions)===null||a===void 0?void 0:a.canSubscribeMetrics);return this.permissions=e,l&&this.emit(q.ParticipantPermissionsChanged,c),l}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(q.IsSpeakingChanged,e))}setConnectionQuality(e){const n=this._connectionQuality;this._connectionQuality=ST(e),n!==this._connectionQuality&&this.emit(q.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,n;this.activeFuture&&((n=(e=this.activeFuture).reject)===null||n===void 0||n.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(n=>ln(n.track)&&n.track.setAudioContext(e))}addTrackPublication(e){e.on(ne.Muted,()=>{this.emit(q.TrackMuted,e)}),e.on(ne.Unmuted,()=>{this.emit(q.TrackUnmuted,e)});const n=e;switch(n.track&&(n.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case D.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case D.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function kT(t){var e,n,i;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new _0({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(n=t.participantSid)!==null&&n!==void 0?n:"",allTracks:(i=t.allowAll)!==null&&i!==void 0?i:!1,trackSids:t.allowedTrackSids||[]})}const Ff=15e3;class CT extends Ov{constructor(e,n,i,r,s){super(e,n,void 0,void 0,void 0,{loggerName:r.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=Ct.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new sr)},this.handleReconnected=()=>{var o,a;(a=(o=this.reconnectFuture)===null||o===void 0?void 0:o.resolve)===null||a===void 0||a.call(o),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var o,a,c,l,d,u;this.reconnectFuture&&(this.reconnectFuture.promise.catch(h=>this.log.warn(h.message,this.logContext)),(a=(o=this.reconnectFuture)===null||o===void 0?void 0:o.reject)===null||a===void 0||a.call(o,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0),this.signalConnectedFuture&&((l=(c=this.signalConnectedFuture).reject)===null||l===void 0||l.call(c,"Got disconnected without signal connected"),this.signalConnectedFuture=void 0),(u=(d=this.activeAgentFuture)===null||d===void 0?void 0:d.reject)===null||u===void 0||u.call(d,"Got disconnected without active agent present"),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=o=>{var a,c;o.participant&&this.updateInfo(o.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new sr),(c=(a=this.signalConnectedFuture).resolve)===null||c===void 0||c.call(a)},this.handleSignalRequestResponse=o=>{const{requestId:a,reason:c,message:l}=o,d=this.pendingSignalRequests.get(a);d&&(c!==tu.OK&&d.reject(new ff(l,c)),this.pendingSignalRequests.delete(a))},this.handleDataPacket=o=>{switch(o.value.case){case"rpcResponse":let a=o.value.value,c=null,l=null;a.value.case==="payload"?c=a.value.value:a.value.case==="error"&&(l=ze.fromProto(a.value.value)),this.handleIncomingRpcResponse(a.requestId,c,l);break;case"rpcAck":let d=o.value.value;this.handleIncomingRpcAck(d.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(o=>kT(o)))},this.onTrackUnmuted=o=>{this.onTrackMuted(o,o.isUpstreamPaused)},this.onTrackMuted=(o,a)=>{if(a===void 0&&(a=!0),!o.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),ve(o)));return}this.engine.updateMuteStatus(o.sid,a)},this.onTrackUpstreamPaused=o=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),ve(o))),this.onTrackMuted(o,!0)},this.onTrackUpstreamResumed=o=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),ve(o))),this.onTrackMuted(o,o.isMuted)},this.onTrackFeatureUpdate=o=>{const a=this.audioTrackPublications.get(o.sid);if(!a){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(o.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(a.trackSid,a.getTrackFeatures())},this.handleSubscribedQualityUpdate=o=>R(this,void 0,void 0,function*(){var a,c,l,d,u;if(!(!((u=this.roomOptions)===null||u===void 0)&&u.dynacast))return;const h=this.videoTrackPublications.get(o.trackSid);if(!h){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:o.trackSid}));return}if(!h.videoTrack)return;const p=yield h.videoTrack.setPublishingCodecs(o.subscribedCodecs);try{for(var v=!0,f=Rn(p),y;y=yield f.next(),a=y.done,!a;v=!0){d=y.value,v=!1;const b=d;eC(b)&&(this.log.debug("publish ".concat(b," for ").concat(h.videoTrack.sid),Object.assign(Object.assign({},this.logContext),ve(h))),yield this.publishAdditionalCodecForTrack(h.videoTrack,b,h.options))}}catch(b){c={error:b}}finally{try{!v&&!a&&(l=f.return)&&(yield l.call(f))}finally{if(c)throw c.error}}}),this.handleLocalTrackUnpublished=o=>{const a=this.trackPublications.get(o.trackSid);if(!a){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:o.trackSid}));return}this.unpublishTrack(a.track)},this.handleTrackEnded=o=>R(this,void 0,void 0,function*(){if(o.source===D.Source.ScreenShare||o.source===D.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),ve(o))),this.unpublishTrack(o);else if(o.isUserProvided)yield o.mute();else if(Cn(o)||$n(o))try{if(bt())try{const a=yield navigator==null?void 0:navigator.permissions.query({name:o.source===D.Source.Camera?"camera":"microphone"});if(a&&a.state==="denied")throw this.log.warn("user has revoked access to ".concat(o.source),Object.assign(Object.assign({},this.logContext),ve(o))),a.onchange=()=>{a.state!=="denied"&&(o.isMuted||o.restartTrack(),a.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}o.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),ve(o))),Cn(o)?yield o.restartTrack({deviceId:"default"}):yield o.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),ve(o))),yield o.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=i,this.roomOptions=r,this.setupEngine(i),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=s}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==Ct.NONE}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setupEngine(e){this.engine=e,this.engine.on(re.RemoteMute,(n,i)=>{const r=this.trackPublications.get(n);!r||!r.track||(i?r.mute():r.unmute())}),this.engine.on(re.Connected,this.handleReconnected).on(re.SignalConnected,this.handleSignalConnected).on(re.SignalRestarted,this.handleReconnected).on(re.SignalResumed,this.handleReconnected).on(re.Restarting,this.handleReconnecting).on(re.Resuming,this.handleReconnecting).on(re.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(re.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(re.Disconnected,this.handleDisconnected).on(re.SignalRequestResponse,this.handleSignalRequestResponse).on(re.DataPacketReceived,this.handleDataPacket),this.signalConnectedFuture=void 0}setMetadata(e){return R(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return R(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return R(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return R(this,arguments,void 0,function(n){var i=this;let{metadata:r,name:s,attributes:o}=n;return function*(){return new Promise((a,c)=>R(i,void 0,void 0,function*(){var l,d;try{let u=!1;const h=yield this.engine.client.sendUpdateLocalMetadata((l=r??this.metadata)!==null&&l!==void 0?l:"",(d=s??this.name)!==null&&d!==void 0?d:"",o),p=performance.now();for(this.pendingSignalRequests.set(h,{resolve:a,reject:v=>{c(v),u=!0},values:{name:s,metadata:r,attributes:o}});performance.now()-p<5e3&&!u;){if((!s||this.name===s)&&(!r||this.metadata===r)&&(!o||Object.entries(o).every(v=>{let[f,y]=v;return this.attributes[f]===y||y===""&&!this.attributes[f]}))){this.pendingSignalRequests.delete(h),a();return}yield wt(50)}c(new ff("Request to update local metadata timed out","TimeoutError"))}catch(u){u instanceof Error&&c(u)}}))}()})}setCameraEnabled(e,n,i){return this.setTrackEnabled(D.Source.Camera,e,n,i)}setMicrophoneEnabled(e,n,i){return this.setTrackEnabled(D.Source.Microphone,e,n,i)}setScreenShareEnabled(e,n,i){return this.setTrackEnabled(D.Source.ScreenShare,e,n,i)}setPermissions(e){const n=this.permissions,i=super.setPermissions(e);return i&&n&&this.emit(q.ParticipantPermissionsChanged,n),i}setE2EEEnabled(e){return R(this,void 0,void 0,function*(){this.encryptionType=e?Ct.GCM:Ct.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,n,i,r){return R(this,void 0,void 0,function*(){var s,o;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:n})),this.republishPromise&&(yield this.republishPromise);let a=this.getTrackPublication(e);if(n)if(a)yield a.unmute();else{let c;if(this.pendingPublishing.has(e)){const l=yield this.waitForPendingPublicationOfSource(e);return l||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield l==null?void 0:l.unmute(),l}this.pendingPublishing.add(e);try{switch(e){case D.Source.Camera:c=yield this.createTracks({video:(s=i)!==null&&s!==void 0?s:!0});break;case D.Source.Microphone:c=yield this.createTracks({audio:(o=i)!==null&&o!==void 0?o:!0});break;case D.Source.ScreenShare:c=yield this.createScreenTracks(Object.assign({},i));break;default:throw new An(e)}}catch(l){throw c==null||c.forEach(d=>{d.stop()}),l instanceof Error&&this.emit(q.MediaDevicesError,l,zl(e)),this.pendingPublishing.delete(e),l}for(const l of c)e===D.Source.Microphone&&ln(l)&&(r!=null&&r.preConnectBuffer)&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),l.startPreConnectBuffer());try{const l=[];for(const u of c)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),ve(u))),l.push(this.publishTrack(u,r));[a]=yield Promise.all(l)}catch(l){throw c==null||c.forEach(d=>{d.stop()}),l}finally{this.pendingPublishing.delete(e)}}else if(!(a!=null&&a.track)&&this.pendingPublishing.has(e)&&(a=yield this.waitForPendingPublicationOfSource(e),a||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),a&&a.track)if(e===D.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const c=this.getTrackPublication(D.Source.ScreenShareAudio);c&&c.track&&this.unpublishTrack(c.track)}else yield a.mute();return a})}enableCameraAndMicrophone(){return R(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(D.Source.Camera)||this.pendingPublishing.has(D.Source.Microphone))){this.pendingPublishing.add(D.Source.Camera),this.pendingPublishing.add(D.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(n=>this.publishTrack(n)))}finally{this.pendingPublishing.delete(D.Source.Camera),this.pendingPublishing.delete(D.Source.Microphone)}}})}createTracks(e){return R(this,void 0,void 0,function*(){var n,i;e??(e={});const r=xv(e,(n=this.roomOptions)===null||n===void 0?void 0:n.audioCaptureDefaults,(i=this.roomOptions)===null||i===void 0?void 0:i.videoCaptureDefaults);try{return(yield Pa(r,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(a=>(ln(a)&&(this.microphoneError=void 0,a.setAudioContext(this.audioContext),a.source=D.Source.Microphone,this.emit(q.AudioStreamAcquired)),jr(a)&&(this.cameraError=void 0,a.source=D.Source.Camera),a))}catch(s){throw s instanceof Error&&(e.audio&&(this.microphoneError=s),e.video&&(this.cameraError=s)),s}})}createScreenTracks(e){return R(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new iu("getDisplayMedia not supported");e.resolution===void 0&&!oC()&&(e.resolution=ru.h1080fps30.resolution);const n=wC(e),i=yield navigator.mediaDevices.getDisplayMedia(n),r=i.getVideoTracks();if(r.length===0)throw new An("no video track found");const s=new na(r[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=D.Source.ScreenShare,e.contentHint&&(s.mediaStreamTrack.contentHint=e.contentHint);const o=[s];if(i.getAudioTracks().length>0){this.emit(q.AudioStreamAcquired);const a=new ta(i.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});a.source=D.Source.ScreenShareAudio,o.push(a)}return o})}publishTrack(e,n){return R(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,n)})}publishOrRepublishTrack(e,n){return R(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var a,c,l,d;Cn(i)&&i.setAudioContext(s.audioContext),yield(a=s.reconnectFuture)===null||a===void 0?void 0:a.promise,s.republishPromise&&!o&&(yield s.republishPromise),gr(i)&&s.pendingPublishPromises.has(i)&&(yield s.pendingPublishPromises.get(i));let u;if(i instanceof MediaStreamTrack)u=i.getConstraints();else{u=i.constraints;let b;switch(i.source){case D.Source.Microphone:b="audioinput";break;case D.Source.Camera:b="videoinput"}b&&s.activeDeviceMap.has(b)&&(u=Object.assign(Object.assign({},u),{deviceId:s.activeDeviceMap.get(b)}))}if(i instanceof MediaStreamTrack)switch(i.kind){case"audio":i=new ta(i,u,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":i=new na(i,u,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new An("unsupported MediaStreamTrack kind ".concat(i.kind))}else i.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let h;if(s.trackPublications.forEach(b=>{b.track&&b.track===i&&(h=b)}),h)return s.log.warn("track has already been published, skipping",Object.assign(Object.assign({},s.logContext),ve(h))),h;const p="channelCount"in i.mediaStreamTrack.getSettings()&&i.mediaStreamTrack.getSettings().channelCount===2||i.mediaStreamTrack.getConstraints().channelCount===2,v=(c=r==null?void 0:r.forceStereo)!==null&&c!==void 0?c:p;v&&(r||(r={}),r.dtx===void 0&&s.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},s.logContext),ve(i))),r.red===void 0&&s.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(l=r.dtx)!==null&&l!==void 0||(r.dtx=!1),(d=r.red)!==null&&d!==void 0||(r.red=!1));const f=Object.assign(Object.assign({},s.roomOptions.publishDefaults),r);!cC()&&s.roomOptions.e2ee&&(s.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},s.logContext)),f.simulcast=!1),f.source&&(i.source=f.source);const y=new Promise((b,S)=>R(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==_e.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:ve(i)}));const k=setTimeout(()=>{S(new hf("publishing rejected as engine not connected within timeout",408))},15e3);yield this.waitUntilEngineConnected(),clearTimeout(k);const w=yield this.publish(i,f,v);b(w)}else try{const k=yield this.publish(i,f,v);b(k)}catch(k){S(k)}}catch(k){S(k)}}));s.pendingPublishPromises.set(i,y);try{return yield y}catch(b){throw b}finally{s.pendingPublishPromises.delete(i)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new sr),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),ve(e))),!1;const{canPublish:n,canPublishSources:i}=this.permissions;return n&&(i.length===0||i.map(r=>TC(r)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),ve(e))),!1)}publish(e,n,i){return R(this,void 0,void 0,function*(){var r,s,o,a,c,l,d,u,h,p;if(!this.hasPermissionsToPublish(e))throw new hf("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(I=>gr(e)&&I.source===e.source)&&e.source!==D.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),ve(e))),n.stopMicTrackOnMute&&ln(e)&&(e.stopOnMute=!0),e.source===D.Source.ScreenShare&&Er()&&(n.simulcast=!1),n.videoCodec==="av1"&&!iC()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!rC()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=Wl),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(I=>n.videoCodec===Do(I.mime))||(n.videoCodec=Do(this.enabledPublishVideoCodecs[0].mime)));const f=n.videoCodec;e.on(ne.Muted,this.onTrackMuted),e.on(ne.Unmuted,this.onTrackUnmuted),e.on(ne.Ended,this.handleTrackEnded),e.on(ne.UpstreamPaused,this.onTrackUpstreamPaused),e.on(ne.UpstreamResumed,this.onTrackUpstreamResumed),e.on(ne.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const y=[],b=!(!((r=n.dtx)!==null&&r!==void 0)||r),S=e.getSourceTrackSettings();S.autoGainControl&&y.push(st.TF_AUTO_GAIN_CONTROL),S.echoCancellation&&y.push(st.TF_ECHO_CANCELLATION),S.noiseSuppression&&y.push(st.TF_NOISE_SUPPRESSION),S.channelCount&&S.channelCount>1&&y.push(st.TF_STEREO),b&&y.push(st.TF_NO_DTX),Cn(e)&&e.hasPreConnectBuffer&&y.push(st.TF_PRECONNECT_BUFFER);const k=new Tl({cid:e.mediaStreamTrack.id,name:n.name,type:D.kindToProto(e.kind),muted:e.isMuted,source:D.sourceToProto(e.source),disableDtx:b,encryption:this.encryptionType,stereo:i,disableRed:this.isE2EEEnabled||!(!((s=n.red)!==null&&s!==void 0)||s),stream:n==null?void 0:n.stream,backupCodecPolicy:n==null?void 0:n.backupCodecPolicy,audioFeatures:y});let w;if(e.kind===D.Kind.Video){let I={width:0,height:0};try{I=yield e.waitForDimensions()}catch{const A=(a=(o=this.roomOptions.videoCaptureDefaults)===null||o===void 0?void 0:o.resolution)!==null&&a!==void 0?a:bs.h720.resolution;I={width:A.width,height:A.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),ve(e)),{dims:I}))}k.width=I.width,k.height=I.height,$n(e)&&(Mn(f)&&(e.source===D.Source.ScreenShare&&(n.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),ve(e))))),n.scalabilityMode=(c=n.scalabilityMode)!==null&&c!==void 0?c:"L3T3_KEY"),k.simulcastCodecs=[new Cl({codec:f,cid:e.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:Wl}),n.backupCodec&&f!==n.backupCodec.codec&&k.encryption===Ct.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),k.simulcastCodecs.push(new Cl({codec:n.backupCodec.codec,cid:""})))),w=Gl(e.source===D.Source.ScreenShare,k.width,k.height,n),k.layers=jf(k.width,k.height,w,Mn(n.videoCodec))}else e.kind===D.Kind.Audio&&(w=[{maxBitrate:(l=n.audioPreset)===null||l===void 0?void 0:l.maxBitrate,priority:(u=(d=n.audioPreset)===null||d===void 0?void 0:d.priority)!==null&&u!==void 0?u:"high",networkPriority:(p=(h=n.audioPreset)===null||h===void 0?void 0:h.priority)!==null&&p!==void 0?p:"high"}]);if(!this.engine||this.engine.isClosed)throw new nt("cannot publish track when not connected");const x=()=>R(this,void 0,void 0,function*(){var I,C,A;if(!this.engine.pcManager)throw new nt("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,n,w),$n(e)&&((I=n.degradationPreference)!==null&&I!==void 0||(n.degradationPreference=oT(e)),e.setDegradationPreference(n.degradationPreference)),w)if(Er()&&e.kind===D.Kind.Audio){let N;for(const Z of this.engine.pcManager.publisher.getTransceivers())if(Z.sender===e.sender){N=Z;break}N&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:N,codec:"opus",maxbr:!((C=w[0])===null||C===void 0)&&C.maxBitrate?w[0].maxBitrate/1e3:0})}else e.codec&&Mn(e.codec)&&(!((A=w[0])===null||A===void 0)&&A.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:k.cid,codec:e.codec,maxbr:w[0].maxBitrate/1e3});yield this.engine.negotiate()});let T;const E=new Promise((I,C)=>R(this,void 0,void 0,function*(){var A;try{T=yield this.engine.addTrack(k),I(T)}catch(N){e.sender&&(!((A=this.engine.pcManager)===null||A===void 0)&&A.publisher)&&(this.engine.pcManager.publisher.removeTrack(e.sender),yield this.engine.negotiate().catch(Z=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),ve(e)),{error:Z}))})),C(N)}}));if(this.enabledPublishVideoCodecs.length>0)T=(yield Promise.all([E,x()]))[0];else{T=yield E;let I;if(T.codecs.forEach(C=>{I===void 0&&(I=C.mimeType)}),I&&e.kind===D.Kind.Video){const C=Do(I);C!==f&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),ve(e)),{codec:C})),n.videoCodec=C,w=Gl(e.source===D.Source.ScreenShare,k.width,k.height,n))}yield x()}const P=new Yl(e.kind,T,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(P.options=n,e.sid=T.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:w,trackInfo:T})),$n(e)?e.startMonitor(this.engine.client):Cn(e)&&e.startMonitor(),this.addTrackPublication(P),this.emit(q.LocalTrackPublished,P),Cn(e)&&T.audioFeatures.includes(st.TF_PRECONNECT_BUFFER)){const I=e.getPreConnectBuffer();this.on(q.LocalTrackSubscribed,C=>{if(C.trackSid===T.sid){if(!e.hasPreConnectBuffer){this.log.warn("subscribe event came to late, buffer already closed",this.logContext);return}this.log.debug("finished recording preconnect buffer",Object.assign(Object.assign({},this.logContext),ve(e))),e.stopPreConnectBuffer()}}),I&&new Promise((A,N)=>R(this,void 0,void 0,function*(){var Z,Q,se,te,Y,_;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),ve(e)));const ee=setTimeout(()=>{N(new Error("agent not active within 10 seconds"))},1e4),j=yield this.waitUntilActiveAgentPresent();clearTimeout(ee),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),ve(e)));const W=yield this.streamBytes({name:"preconnect-buffer",mimeType:"audio/opus",topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[j.identity],attributes:{trackId:P.trackSid,sampleRate:String((Y=S.sampleRate)!==null&&Y!==void 0?Y:"48000"),channels:String((_=S.channelCount)!==null&&_!==void 0?_:"1")}});try{for(var ie=!0,L=Rn(I),F;F=yield L.next(),Z=F.done,!Z;ie=!0){te=F.value,ie=!1;const J=te;yield W.write(J)}}catch(J){Q={error:J}}finally{try{!ie&&!Z&&(se=L.return)&&(yield se.call(L))}finally{if(Q)throw Q.error}}yield W.close(),A()}catch(ee){N(ee)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),ve(e)))}).catch(A=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),ve(e)),{error:A}))})}return P})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,n,i){return R(this,void 0,void 0,function*(){var r;if(this.encryptionType!==Ct.NONE)return;let s;if(this.trackPublications.forEach(p=>{p.track&&p.track===e&&(s=p)}),!s)throw new An("track is not published");if(!$n(e))throw new An("track is not a video track");const o=Object.assign(Object.assign({},(r=this.roomOptions)===null||r===void 0?void 0:r.publishDefaults),i),a=iT(e,n,o);if(!a){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),ve(e)));return}const c=e.addSimulcastTrack(n,a);if(!c)return;const l=new Tl({cid:c.mediaStreamTrack.id,type:D.kindToProto(e.kind),muted:e.isMuted,source:D.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:c.mediaStreamTrack.id}]});if(l.layers=jf(l.width,l.height,a),!this.engine||this.engine.isClosed)throw new nt("cannot publish track when not connected");const d=()=>R(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,c,o,a),yield this.engine.negotiate()}),h=(yield Promise.all([this.engine.addTrack(l),d()]))[0];this.log.debug("published ".concat(n," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:a,trackInfo:h}))})}unpublishTrack(e,n){return R(this,void 0,void 0,function*(){var i,r;if(gr(e)){const l=this.pendingPublishPromises.get(e);l&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),ve(e))),yield l)}const s=this.getPublicationForTrack(e),o=s?ve(s):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),o)),!s||!s.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),o));return}e=s.track,e.off(ne.Muted,this.onTrackMuted),e.off(ne.Unmuted,this.onTrackUnmuted),e.off(ne.Ended,this.handleTrackEnded),e.off(ne.UpstreamPaused,this.onTrackUpstreamPaused),e.off(ne.UpstreamResumed,this.onTrackUpstreamResumed),e.off(ne.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),n===void 0&&(n=(r=(i=this.roomOptions)===null||i===void 0?void 0:i.stopLocalTrackOnUnpublish)!==null&&r!==void 0?r:!0),n?e.stop():e.stopMonitor();let a=!1;const c=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<$e.FAILED&&c)try{for(const l of this.engine.pcManager.publisher.getTransceivers())l.sender===c&&(l.direction="inactive",a=!0);if(this.engine.removeTrack(c)&&(a=!0),$n(e)){for(const[,l]of e.simulcastCodecs)l.sender&&(this.engine.removeTrack(l.sender)&&(a=!0),l.sender=void 0);e.simulcastCodecs.clear()}}catch(l){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),o),{error:l}))}switch(this.trackPublications.delete(s.trackSid),s.kind){case D.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case D.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}return this.emit(q.LocalTrackUnpublished,s),s.setTrack(void 0),a&&(yield this.engine.negotiate()),s})}unpublishTracks(e){return R(this,void 0,void 0,function*(){return(yield Promise.all(e.map(i=>this.unpublishTrack(i)))).filter(i=>!!i)})}republishAllTracks(e){return R(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){i.republishPromise&&(yield i.republishPromise),i.republishPromise=new Promise((s,o)=>R(i,void 0,void 0,function*(){try{const a=[];this.trackPublications.forEach(c=>{c.track&&(n&&(c.options=Object.assign(Object.assign({},c.options),n)),a.push(c))}),yield Promise.all(a.map(c=>R(this,void 0,void 0,function*(){const l=c.track;yield this.unpublishTrack(l,!1),r&&!l.isMuted&&l.source!==D.Source.ScreenShare&&l.source!==D.Source.ScreenShareAudio&&(Cn(l)||$n(l))&&!l.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:c.trackSid})),yield l.restartTrack()),yield this.publishOrRepublishTrack(l,c.options,!0)}))),s()}catch(a){o(a)}finally{this.republishPromise=void 0}})),yield i.republishPromise}()})}publishData(e){return R(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const s=r.reliable?me.RELIABLE:me.LOSSY,o=r.destinationIdentities,a=r.topic,c=new gt({kind:s,value:{case:"user",value:new m0({participantIdentity:i.identity,payload:n,destinationIdentities:o,topic:a})}});yield i.engine.sendDataPacket(c,s)}()})}publishDtmf(e,n){return R(this,void 0,void 0,function*(){const i=new gt({kind:me.RELIABLE,value:{case:"sipDtmf",value:new p0({code:e,digit:n})}});yield this.engine.sendDataPacket(i,me.RELIABLE)})}sendChatMessage(e,n){return R(this,void 0,void 0,function*(){const i={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:n==null?void 0:n.attachments},r=new gt({value:{case:"chatMessage",value:new yl(Object.assign(Object.assign({},i),{timestamp:De.parse(i.timestamp)}))}});return yield this.engine.sendDataPacket(r,me.RELIABLE),this.emit(q.ChatMessage,i),i})}editChatMessage(e,n){return R(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},n),{message:e,editTimestamp:Date.now()}),r=new gt({value:{case:"chatMessage",value:new yl(Object.assign(Object.assign({},i),{timestamp:De.parse(i.timestamp),editTimestamp:De.parse(i.editTimestamp)}))}});return yield this.engine.sendDataPacket(r,me.RELIABLE),this.emit(q.ChatMessage,i),i})}sendText(e,n){return R(this,void 0,void 0,function*(){var i;const r=crypto.randomUUID(),o=new TextEncoder().encode(e).byteLength,a=(i=n==null?void 0:n.attachments)===null||i===void 0?void 0:i.map(()=>crypto.randomUUID()),c=new Array(a?a.length+1:1).fill(0),l=(u,h)=>{var p;c[h]=u;const v=c.reduce((f,y)=>f+y,0);(p=n==null?void 0:n.onProgress)===null||p===void 0||p.call(n,v)},d=yield this.streamText({streamId:r,totalSize:o,destinationIdentities:n==null?void 0:n.destinationIdentities,topic:n==null?void 0:n.topic,attachedStreamIds:a,attributes:n==null?void 0:n.attributes});return yield d.write(e),l(1,0),yield d.close(),n!=null&&n.attachments&&a&&(yield Promise.all(n.attachments.map((u,h)=>R(this,void 0,void 0,function*(){return this._sendFile(a[h],u,{topic:n.topic,mimeType:u.type,onProgress:p=>{l(p,h+1)}})})))),d.info})}streamText(e){return R(this,void 0,void 0,function*(){var n,i;const r=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),s={id:r,mimeType:"text/plain",timestamp:Date.now(),topic:(i=e==null?void 0:e.topic)!==null&&i!==void 0?i:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes},o=new xl({streamId:r,mimeType:s.mimeType,topic:s.topic,timestamp:wi(s.timestamp),totalLength:wi(e==null?void 0:e.totalSize),attributes:s.attributes,contentHeader:{case:"textHeader",value:new E0({version:e==null?void 0:e.version,attachedStreamIds:e==null?void 0:e.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?bl.UPDATE:bl.CREATE})}}),a=e==null?void 0:e.destinationIdentities,c=new gt({destinationIdentities:a,value:{case:"streamHeader",value:o}});yield this.engine.sendDataPacket(c,me.RELIABLE);let l=0;const d=this,u=new WritableStream({write(v){return R(this,void 0,void 0,function*(){for(const f of bC(v,Ff)){yield d.engine.waitForBufferStatusLow(me.RELIABLE);const y=new wl({content:f,streamId:r,chunkIndex:wi(l)}),b=new gt({destinationIdentities:a,value:{case:"streamChunk",value:y}});yield d.engine.sendDataPacket(b,me.RELIABLE),l+=1}})},close(){return R(this,void 0,void 0,function*(){const v=new Sl({streamId:r}),f=new gt({destinationIdentities:a,value:{case:"streamTrailer",value:v}});yield d.engine.sendDataPacket(f,me.RELIABLE)})},abort(v){console.log("Sink error:",v)}});let h=()=>R(this,void 0,void 0,function*(){yield p.close()});d.engine.once(re.Closing,h);const p=new gT(u,s,()=>this.engine.off(re.Closing,h));return p})}sendFile(e,n){return R(this,void 0,void 0,function*(){const i=crypto.randomUUID();return yield this._sendFile(i,e,n),{id:i}})}_sendFile(e,n,i){return R(this,void 0,void 0,function*(){var r;const s=yield this.streamBytes({streamId:e,totalSize:n.size,name:n.name,mimeType:(r=i==null?void 0:i.mimeType)!==null&&r!==void 0?r:n.type,topic:i==null?void 0:i.topic,destinationIdentities:i==null?void 0:i.destinationIdentities}),o=n.stream().getReader();for(;;){const{done:a,value:c}=yield o.read();if(a)break;yield s.write(c)}return yield s.close(),s.info})}streamBytes(e){return R(this,void 0,void 0,function*(){var n,i,r,s,o;const a=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),c=e==null?void 0:e.destinationIdentities,l={id:a,mimeType:(i=e==null?void 0:e.mimeType)!==null&&i!==void 0?i:"application/octet-stream",topic:(r=e==null?void 0:e.topic)!==null&&r!==void 0?r:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(s=e==null?void 0:e.name)!==null&&s!==void 0?s:"unknown"},d=new xl({totalLength:wi((o=l.size)!==null&&o!==void 0?o:0),mimeType:l.mimeType,streamId:a,topic:l.topic,timestamp:wi(Date.now()),attributes:l.attributes,contentHeader:{case:"byteHeader",value:new P0({name:l.name})}}),u=new gt({destinationIdentities:c,value:{case:"streamHeader",value:d}});yield this.engine.sendDataPacket(u,me.RELIABLE);let h=0;const p=new yt,v=this.engine,f=this.log,y=new WritableStream({write(S){return R(this,void 0,void 0,function*(){const k=yield p.lock();let w=0;try{for(;w<S.byteLength;){const x=S.slice(w,w+Ff);yield v.waitForBufferStatusLow(me.RELIABLE);const T=new gt({destinationIdentities:c,value:{case:"streamChunk",value:new wl({content:x,streamId:a,chunkIndex:wi(h)})}});yield v.sendDataPacket(T,me.RELIABLE),h+=1,w+=x.byteLength}}finally{k()}})},close(){return R(this,void 0,void 0,function*(){const S=new Sl({streamId:a}),k=new gt({destinationIdentities:c,value:{case:"streamTrailer",value:S}});yield v.sendDataPacket(k,me.RELIABLE)})},abort(S){f.error("Sink error:",S)}});return new vT(y,l)})}performRpc(e){return R(this,arguments,void 0,function(n){var i=this;let{destinationIdentity:r,method:s,payload:o,responseTimeout:a=1e4}=n;return function*(){return new Promise((l,d)=>R(i,void 0,void 0,function*(){var u,h,p,v;if(uu(o)>Ev){d(ze.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((h=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||h===void 0)&&h.version&&Qn((v=(p=this.engine.latestJoinResponse)===null||p===void 0?void 0:p.serverInfo)===null||v===void 0?void 0:v.version,"1.8.0")<0){d(ze.builtIn("UNSUPPORTED_SERVER"));return}const f=crypto.randomUUID();yield this.publishRpcRequest(r,f,s,o,a-2e3);const y=setTimeout(()=>{this.pendingAcks.delete(f),d(ze.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(f),clearTimeout(b)},2e3);this.pendingAcks.set(f,{resolve:()=>{clearTimeout(y)},participantIdentity:r});const b=setTimeout(()=>{this.pendingResponses.delete(f),d(ze.builtIn("RESPONSE_TIMEOUT"))},a);this.pendingResponses.set(f,{resolve:(S,k)=>{clearTimeout(b),this.pendingAcks.has(f)&&(console.warn("RPC response received before ack",f),this.pendingAcks.delete(f),clearTimeout(y)),k?d(k):l(S??"")},participantIdentity:r})}))}()})}registerRpcMethod(e,n){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=n,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const n=this.pendingAcks.get(e);n?(n.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,n,i){const r=this.pendingResponses.get(e);r?(r.resolve(n,i),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,n,i,r,s){return R(this,void 0,void 0,function*(){const o=new gt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcRequest",value:new g0({id:n,method:i,payload:r,responseTimeoutMs:s,version:1})}});yield this.engine.sendDataPacket(o,me.RELIABLE)})}handleParticipantDisconnected(e){for(const[n,{participantIdentity:i}]of this.pendingAcks)i===e&&this.pendingAcks.delete(n);for(const[n,{participantIdentity:i,resolve:r}]of this.pendingResponses)i===e&&(r(null,ze.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(n))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(n=>n.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(n=>{var i,r;const s=this.trackPublications.get(n.sid);if(s){const o=s.isMuted||((r=(i=s.track)===null||i===void 0?void 0:i.isUpstreamPaused)!==null&&r!==void 0?r:!1);o!==n.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),ve(s)),{mutedOnServer:o})),this.engine.client.sendMuteTrack(n.sid,o))}}),!0):!1}setActiveAgent(e){var n,i,r,s;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?(i=(n=this.activeAgentFuture)===null||n===void 0?void 0:n.resolve)===null||i===void 0||i.call(n,e):(s=(r=this.activeAgentFuture)===null||r===void 0?void 0:r.reject)===null||s===void 0||s.call(r,"Agent disconnected"),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new sr),this.activeAgentFuture.promise)}getPublicationForTrack(e){let n;return this.trackPublications.forEach(i=>{const r=i.track;r&&(e instanceof MediaStreamTrack?(Cn(r)||$n(r))&&r.mediaStreamTrack===e&&(n=i):e===r&&(n=i))}),n}waitForPendingPublicationOfSource(e){return R(this,void 0,void 0,function*(){const i=Date.now();for(;Date.now()<i+1e4;){const r=Array.from(this.pendingPublishPromises.entries()).find(s=>{let[o]=s;return o.source===e});if(r)return r[1];yield wt(20)}})}}class ia extends Tn{constructor(e,n,i,r){super(e,n.sid,n.name,r),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=Dt.HIGH,this.handleEnded=s=>{this.setTrack(void 0),this.emit(ne.Ended,s)},this.handleVisibilityChange=s=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(s),this.logContext),this.disabled=!s,this.emitTrackUpdate()},this.handleVideoDimensionsChange=s=>{this.log.debug("adaptivestream video dimensions ".concat(s.width,"x").concat(s.height),this.logContext),this.videoDimensions=s,this.emitTrackUpdate()},this.subscribed=i,this.updateInfo(n)}setSubscribed(e){const n=this.subscriptionStatus,i=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const r=new ka({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new x0({participantSid:"",trackSids:[this.trackSid]})]});this.emit(ne.UpdateSubscription,r),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(i)}get subscriptionStatus(){return this.subscribed===!1?Tn.SubscriptionStatus.Unsubscribed:super.isSubscribed?Tn.SubscriptionStatus.Subscribed:Tn.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Tn.PermissionStatus.Allowed:Tn.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var n,i;this.isManualOperationAllowed()&&(((n=this.videoDimensions)===null||n===void 0?void 0:n.width)===e.width&&((i=this.videoDimensions)===null||i===void 0?void 0:i.height)===e.height||(gc(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&gc(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const n=this.subscriptionStatus,i=this.permissionStatus,r=this.track;r!==e&&(r&&(r.off(ne.VideoDimensionsChanged,this.handleVideoDimensionsChange),r.off(ne.VisibilityChanged,this.handleVisibilityChange),r.off(ne.Ended,this.handleEnded),r.detach(),r.stopMonitor(),this.emit(ne.Unsubscribed,r)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(ne.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(ne.VisibilityChanged,this.handleVisibilityChange),e.on(ne.Ended,this.handleEnded),this.emit(ne.Subscribed,e)),this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(n))}setAllowed(e){const n=this.subscriptionStatus,i=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(n)}setSubscriptionError(e){this.emit(ne.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const n=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):n!==e.muted&&this.emit(e.muted?ne.Muted:ne.Unmuted)}emitSubscriptionUpdateIfChanged(e){const n=this.subscriptionStatus;e!==n&&this.emit(ne.SubscriptionStatusChanged,n,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(ne.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===D.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return gc(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new R0({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=Dt.HIGH,this.emit(ne.UpdateSettings,e)}}class ra extends Ov{static fromParticipantInfo(e,n,i){return new ra(e,n.sid,n.identity,n.name,n.metadata,n.attributes,i,n.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,n,i,r,s,o,a){let c=arguments.length>7&&arguments[7]!==void 0?arguments[7]:Oi.STANDARD;super(n,i||"",r,s,o,a,c),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(ne.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),ve(e))),this.signalClient.sendUpdateTrackSettings(n)}),e.on(ne.UpdateSubscription,n=>{n.participantTracks.forEach(i=>{i.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),e.on(ne.SubscriptionPermissionChanged,n=>{this.emit(q.TrackSubscriptionPermissionChanged,e,n)}),e.on(ne.SubscriptionStatusChanged,n=>{this.emit(q.TrackSubscriptionStatusChanged,e,n)}),e.on(ne.Subscribed,n=>{this.emit(q.TrackSubscribed,n,e)}),e.on(ne.Unsubscribed,n=>{this.emit(q.TrackUnsubscribed,n,e)}),e.on(ne.SubscriptionFailed,n=>{this.emit(q.TrackSubscriptionFailed,e.trackSid,n)})}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setVolume(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:D.Source.Microphone;this.volumeMap.set(n,e);const i=this.getTrackPublication(n);i&&i.track&&i.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D.Source.Microphone;const n=this.getTrackPublication(e);return n&&n.track?n.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,n,i,r,s,o){let a=this.getTrackPublicationBySid(n);if(a||n.startsWith("TR")||this.trackPublications.forEach(d=>{!a&&e.kind===d.kind.toString()&&(a=d)}),!a){if(o===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:n})),this.emit(q.TrackSubscriptionFailed,n);return}o===void 0&&(o=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,n,i,r,s,o-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),ve(a))),this.emit(q.TrackSubscriptionFailed,n);return}const c=e.kind==="video";let l;return c?l=new yT(e,n,r,s):l=new _v(e,n,r,this.audioContext,this.audioOutput),l.source=a.source,l.isMuted=a.isMuted,l.setMediaStream(i),l.start(),a.setTrack(l),this.volumeMap.has(a.source)&&$l(l)&&ln(l)&&l.setVolume(this.volumeMap.get(a.source)),a}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const n=new Map,i=new Map;return e.tracks.forEach(r=>{var s,o;let a=this.getTrackPublicationBySid(r.sid);if(a)a.updateInfo(r);else{const c=D.kindFromProto(r.type);if(!c)return;a=new ia(c,r,(s=this.signalClient.connectOptions)===null||s===void 0?void 0:s.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(o=this.loggerOptions)===null||o===void 0?void 0:o.loggerName}),a.updateInfo(r),i.set(r.sid,a);const l=Array.from(this.trackPublications.values()).find(d=>d.source===(a==null?void 0:a.source));l&&a.source!==D.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(a.source),Object.assign(Object.assign({},this.logContext),{oldTrack:ve(l),newTrack:ve(a)})),this.addTrackPublication(a)}n.set(r.sid,a)}),this.trackPublications.forEach(r=>{n.has(r.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),ve(r))),this.unpublishTrack(r.trackSid,!0))}),i.forEach(r=>{this.emit(q.TrackPublished,r)}),!0}unpublishTrack(e,n){const i=this.trackPublications.get(e);if(!i)return;const{track:r}=i;switch(r&&(r.stop(),i.setTrack(void 0)),this.trackPublications.delete(e),i.kind){case D.Kind.Audio:this.audioTrackPublications.delete(e);break;case D.Kind.Video:this.videoTrackPublications.delete(e);break}n&&this.emit(q.TrackUnpublished,i)}setAudioOutput(e){return R(this,void 0,void 0,function*(){this.audioOutput=e;const n=[];this.audioTrackPublications.forEach(i=>{var r;ln(i.track)&&$l(i.track)&&n.push(i.track.setSinkId((r=e.deviceId)!==null&&r!==void 0?r:"default"))}),yield Promise.all(n)})}emit(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:i})),super.emit(e,...i)}}var he;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(he||(he={}));const TT=4*1e3;class ei extends vn.EventEmitter{constructor(e){var n,i,r,s;if(super(),n=this,this.state=he.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=ye,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(o,a,c)=>R(this,void 0,void 0,function*(){var l;if(!sC())throw mn()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const d=yield this.disconnectLock.lock();if(this.state===he.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),d(),Promise.resolve();if(this.connectFuture)return d(),this.connectFuture.promise;this.setAndEmitConnectionState(he.Connecting),((l=this.regionUrlProvider)===null||l===void 0?void 0:l.getServerUrl().toString())!==o&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),Ul(new URL(o))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Kl(o,a):this.regionUrlProvider.updateToken(a),this.regionUrlProvider.fetchRegionSettings().then(p=>{var v;(v=this.regionUrlProvider)===null||v===void 0||v.setServerReportedRegions(p)}).catch(p=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:p}))}));const u=(p,v,f)=>R(this,void 0,void 0,function*(){var y,b;this.abortController&&this.abortController.abort();const S=new AbortController;this.abortController=S,d==null||d();try{yield this.attemptConnection(f??o,a,c,S),this.abortController=void 0,p()}catch(k){if(this.regionUrlProvider&&k instanceof Ne&&k.reason!==be.Cancelled&&k.reason!==be.NotAllowed){let w=null;try{w=yield this.regionUrlProvider.getNextBestRegionUrl((y=this.abortController)===null||y===void 0?void 0:y.signal)}catch(x){if(x instanceof Ne&&(x.status===401||x.reason===be.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),v(x);return}}w&&!(!((b=this.abortController)===null||b===void 0)&&b.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(k.message,". Retrying with another region: ").concat(w),this.logContext),this.recreateEngine(),yield u(p,v,w)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Sf(k)),v(k))}else{let w=Gt.UNKNOWN_REASON;k instanceof Ne&&(w=Sf(k)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,w),v(k)}}}),h=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new sr((p,v)=>{u(p,v,h)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(o,a,c,l,d,u)=>R(this,void 0,void 0,function*(){var h,p,v;const f=yield c.join(o,a,{autoSubscribe:l.autoSubscribe,adaptiveStream:typeof d.adaptiveStream=="object"?!0:d.adaptiveStream,maxRetries:l.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:l.websocketTimeout},u.signal);let y=f.serverInfo;if(y||(y={version:f.serverVersion,region:f.serverRegion}),this.serverInfo=y,this.log.debug("connected to Livekit Server ".concat(Object.entries(y).map(b=>{let[S,k]=b;return"".concat(S,": ").concat(k)}).join(", ")),{room:(h=f.room)===null||h===void 0?void 0:h.name,roomSid:(p=f.room)===null||p===void 0?void 0:p.sid,identity:(v=f.participant)===null||v===void 0?void 0:v.identity}),!y.version)throw new zk("unknown server version");return y.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),d.dynacast=!1),f}),this.applyJoinResponse=o=>{const a=o.participant;if(this.localParticipant.sid=a.sid,this.localParticipant.identity=a.identity,this.localParticipant.setEnabledPublishCodecs(o.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(o.sifTrailer)}catch(c){this.log.error(c instanceof Error?c.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:c}))}this.handleParticipantUpdates([a,...o.otherParticipants]),o.room&&this.handleRoomUpdate(o.room)},this.attemptConnection=(o,a,c,l)=>R(this,void 0,void 0,function*(){var d,u;this.state===he.Reconnecting||this.isResuming||!((d=this.engine)===null||d===void 0)&&d.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((u=this.regionUrlProvider)===null||u===void 0)&&u.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},du),c),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const h=yield this.connectSignal(o,a,this.engine,this.connOptions,this.options,l);this.applyJoinResponse(h),this.setupLocalParticipantEvents(),this.emit(V.SignalConnected)}catch(h){yield this.engine.close(),this.recreateEngine();const p=new Ne("could not establish signal connection",be.ServerUnreachable);throw h instanceof Error&&(p.message="".concat(p.message,": ").concat(h.message)),h instanceof Ne&&(p.reason=h.reason,p.status=h.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:h})),p}if(l.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ne("Connection attempt aborted",be.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,l)}catch(h){throw yield this.engine.close(),this.recreateEngine(),h}bt()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),bt()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(he.Connected),this.emit(V.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];return R(n,[...a],void 0,function(){var l=this;let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var u,h,p,v;const f=yield l.disconnectLock.lock();try{if(l.state===he.Disconnected){l.log.debug("already disconnected",l.logContext);return}l.log.info("disconnect from room",Object.assign({},l.logContext)),(l.state===he.Connecting||l.state===he.Reconnecting||l.isResuming)&&(l.log.warn("abort connection attempt",l.logContext),(u=l.abortController)===null||u===void 0||u.abort(),(p=(h=l.connectFuture)===null||h===void 0?void 0:h.reject)===null||p===void 0||p.call(h,new Ne("Client initiated disconnect",be.Cancelled)),l.connectFuture=void 0),!((v=l.engine)===null||v===void 0)&&v.client.isDisconnected||(yield l.engine.client.sendLeave()),l.engine&&(yield l.engine.close()),l.handleDisconnect(d,Gt.CLIENT_INITIATED),l.engine=void 0}finally{f()}}()})},this.onPageLeave=()=>R(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>R(this,void 0,void 0,function*(){const o=[],a=Pt();if(a&&a.os==="iOS"){const c="livekit-dummy-audio-el";let l=document.getElementById(c);if(!l){l=document.createElement("audio"),l.id=c,l.autoplay=!0,l.hidden=!0;const d=pc();d.enabled=!0;const u=new MediaStream([d]);l.srcObject=u,document.addEventListener("visibilitychange",()=>{l&&(l.srcObject=document.hidden?null:u,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(l),this.once(V.Disconnected,()=>{l==null||l.remove(),l=null})}o.push(l)}this.remoteParticipants.forEach(c=>{c.audioTrackPublications.forEach(l=>{l.track&&l.track.attachedElements.forEach(d=>{o.push(d)})})});try{yield Promise.all([this.acquireAudioContext(),...o.map(c=>(c.muted=!1,c.play()))]),this.handleAudioPlaybackStarted()}catch(c){throw this.handleAudioPlaybackFailed(c),c}}),this.startVideo=()=>R(this,void 0,void 0,function*(){const o=[];for(const a of this.remoteParticipants.values())a.videoTrackPublications.forEach(c=>{var l;(l=c.track)===null||l===void 0||l.attachedElements.forEach(d=>{o.includes(d)||o.push(d)})});yield Promise.all(o.map(a=>a.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(a=>{a.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const o of this.remoteParticipants.values())this.handleParticipantDisconnected(o.identity,o);this.setAndEmitConnectionState(he.Reconnecting)&&this.emit(V.Reconnecting)},this.handleSignalRestarted=o=>R(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(o.serverRegion),Object.assign(Object.assign({},this.logContext),{region:o.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(o);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(a){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:a}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:o.serverRegion}))}catch{return}this.setAndEmitConnectionState(he.Connected),this.emit(V.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=o=>{o.forEach(a=>{var c;if(a.identity===this.localParticipant.identity){this.localParticipant.updateInfo(a);return}a.identity===""&&(a.identity=(c=this.sidToIdentity.get(a.sid))!==null&&c!==void 0?c:"");let l=this.remoteParticipants.get(a.identity);a.state===hr.DISCONNECTED?this.handleParticipantDisconnected(a.identity,l):l=this.getOrCreateParticipant(a.identity,a)})},this.handleActiveSpeakersUpdate=o=>{const a=[],c={};o.forEach(l=>{if(c[l.sid]=!0,l.sid===this.localParticipant.sid)this.localParticipant.audioLevel=l.level,this.localParticipant.setIsSpeaking(!0),a.push(this.localParticipant);else{const d=this.getRemoteParticipantBySid(l.sid);d&&(d.audioLevel=l.level,d.setIsSpeaking(!0),a.push(d))}}),c[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(l=>{c[l.sid]||(l.audioLevel=0,l.setIsSpeaking(!1))}),this.activeSpeakers=a,this.emitWhenConnected(V.ActiveSpeakersChanged,a)},this.handleSpeakersChanged=o=>{const a=new Map;this.activeSpeakers.forEach(l=>{const d=this.remoteParticipants.get(l.identity);d&&d.sid!==l.sid||a.set(l.sid,l)}),o.forEach(l=>{let d=this.getRemoteParticipantBySid(l.sid);l.sid===this.localParticipant.sid&&(d=this.localParticipant),d&&(d.audioLevel=l.level,d.setIsSpeaking(l.active),l.active?a.set(l.sid,d):a.delete(l.sid))});const c=Array.from(a.values());c.sort((l,d)=>d.audioLevel-l.audioLevel),this.activeSpeakers=c,this.emitWhenConnected(V.ActiveSpeakersChanged,c)},this.handleStreamStateUpdate=o=>{o.streamStates.forEach(a=>{const c=this.getRemoteParticipantBySid(a.participantSid);if(!c)return;const l=c.getTrackPublicationBySid(a.trackSid);if(!l||!l.track)return;const d=D.streamStateFromProto(a.state);d!==l.track.streamState&&(l.track.streamState=d,c.emit(q.TrackStreamStateChanged,l,l.track.streamState),this.emitWhenConnected(V.TrackStreamStateChanged,l,l.track.streamState,c))})},this.handleSubscriptionPermissionUpdate=o=>{const a=this.getRemoteParticipantBySid(o.participantSid);if(!a)return;const c=a.getTrackPublicationBySid(o.trackSid);c&&c.setAllowed(o.allowed)},this.handleSubscriptionError=o=>{const a=Array.from(this.remoteParticipants.values()).find(l=>l.trackPublications.has(o.trackSid));if(!a)return;const c=a.getTrackPublicationBySid(o.trackSid);c&&c.setSubscriptionError(o.err)},this.handleDataPacket=o=>{const a=this.remoteParticipants.get(o.participantIdentity);if(o.value.case==="user")this.handleUserPacket(a,o.value.value,o.kind);else if(o.value.case==="transcription")this.handleTranscription(a,o.value.value);else if(o.value.case==="sipDtmf")this.handleSipDtmf(a,o.value.value);else if(o.value.case==="chatMessage")this.handleChatMessage(a,o.value.value);else if(o.value.case==="metrics")this.handleMetrics(o.value.value,a);else if(o.value.case==="streamHeader")this.handleStreamHeader(o.value.value,o.participantIdentity);else if(o.value.case==="streamChunk")this.handleStreamChunk(o.value.value);else if(o.value.case==="streamTrailer")this.handleStreamTrailer(o.value.value);else if(o.value.case==="rpcRequest"){const c=o.value.value;this.handleIncomingRpcRequest(o.participantIdentity,c.id,c.method,c.payload,c.responseTimeoutMs,c.version)}},this.handleUserPacket=(o,a,c)=>{this.emit(V.DataReceived,a.payload,o,c,a.topic),o==null||o.emit(q.DataReceived,a.payload,c)},this.handleSipDtmf=(o,a)=>{this.emit(V.SipDTMFReceived,a,o),o==null||o.emit(q.SipDTMFReceived,a)},this.bufferedSegments=new Map,this.handleTranscription=(o,a)=>{const c=a.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(a.transcribedParticipantIdentity),l=c==null?void 0:c.trackPublications.get(a.trackId),d=pC(a,this.transcriptionReceivedTimes);l==null||l.emit(ne.TranscriptionReceived,d),c==null||c.emit(q.TranscriptionReceived,d,l),this.emit(V.TranscriptionReceived,d,c,l)},this.handleChatMessage=(o,a)=>{const c=gC(a);this.emit(V.ChatMessage,c,o)},this.handleMetrics=(o,a)=>{this.emit(V.MetricsReceived,o,a)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(V.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=o=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:o})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(V.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(V.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(V.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>R(this,void 0,void 0,function*(){var o;((o=Pt())===null||o===void 0?void 0:o.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(V.MediaDevicesChanged)}),this.handleRoomUpdate=o=>{const a=this.roomInfo;this.roomInfo=o,a&&a.metadata!==o.metadata&&this.emitWhenConnected(V.RoomMetadataChanged,o.metadata),(a==null?void 0:a.activeRecording)!==o.activeRecording&&this.emitWhenConnected(V.RecordingStatusChanged,o.activeRecording)},this.handleConnectionQualityUpdate=o=>{o.updates.forEach(a=>{if(a.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(a.quality);return}const c=this.getRemoteParticipantBySid(a.participantSid);c&&c.setConnectionQuality(a.quality)})},this.onLocalParticipantMetadataChanged=o=>{this.emit(V.ParticipantMetadataChanged,o,this.localParticipant)},this.onLocalParticipantNameChanged=o=>{this.emit(V.ParticipantNameChanged,o,this.localParticipant)},this.onLocalAttributesChanged=o=>{this.emit(V.ParticipantAttributesChanged,o,this.localParticipant)},this.onLocalTrackMuted=o=>{this.emit(V.TrackMuted,o,this.localParticipant)},this.onLocalTrackUnmuted=o=>{this.emit(V.TrackUnmuted,o,this.localParticipant)},this.onTrackProcessorUpdate=o=>{var a;(a=o==null?void 0:o.onPublish)===null||a===void 0||a.call(o,this)},this.onLocalTrackPublished=o=>R(this,void 0,void 0,function*(){var a,c,l,d,u,h;(a=o.track)===null||a===void 0||a.on(ne.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=o.track)===null||c===void 0||c.on(ne.Restarted,this.onLocalTrackRestarted),(u=(d=(l=o.track)===null||l===void 0?void 0:l.getProcessor())===null||d===void 0?void 0:d.onPublish)===null||u===void 0||u.call(d,this),this.emit(V.LocalTrackPublished,o,this.localParticipant),Cn(o.track)&&(yield o.track.checkForSilence())&&this.emit(V.LocalAudioSilenceDetected,o);const p=yield(h=o.track)===null||h===void 0?void 0:h.getDeviceId(!1),v=zl(o.source);v&&p&&p!==this.localParticipant.activeDeviceMap.get(v)&&(this.localParticipant.activeDeviceMap.set(v,p),this.emit(V.ActiveDeviceChanged,v,p))}),this.onLocalTrackUnpublished=o=>{var a,c;(a=o.track)===null||a===void 0||a.off(ne.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=o.track)===null||c===void 0||c.off(ne.Restarted,this.onLocalTrackRestarted),this.emit(V.LocalTrackUnpublished,o,this.localParticipant)},this.onLocalTrackRestarted=o=>R(this,void 0,void 0,function*(){const a=yield o.getDeviceId(!1),c=zl(o.source);c&&a&&a!==this.localParticipant.activeDeviceMap.get(c)&&(this.log.debug("local track restarted, setting ".concat(c," ").concat(a," active"),this.logContext),this.localParticipant.activeDeviceMap.set(c,a),this.emit(V.ActiveDeviceChanged,c,a))}),this.onLocalConnectionQualityChanged=o=>{this.emit(V.ConnectionQualityChanged,o,this.localParticipant)},this.onMediaDevicesError=(o,a)=>{this.emit(V.MediaDevicesError,o,a)},this.onLocalParticipantPermissionsChanged=o=>{this.emit(V.ParticipantPermissionsChanged,o,this.localParticipant)},this.onLocalChatMessageSent=o=>{this.emit(V.ChatMessage,o,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},$C),e),this.log=Nn((i=this.options.loggerName)!==null&&i!==void 0?i:Zt.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Cv),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Tv),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},BC),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new yt,this.localParticipant=new CT("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Jn(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Jn(this.options.audioCaptureDefaults.deviceId)),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&this.switchActiveDevice("audiooutput",Jn(this.options.audioOutput.deviceId)).catch(o=>this.log.warn("Could not set audio output: ".concat(o.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),bt()){const o=new AbortController;(s=navigator.mediaDevices)===null||s===void 0||s.addEventListener("devicechange",this.handleDeviceChange,{signal:o.signal}),ei.cleanupRegistry&&ei.cleanupRegistry.register(this,()=>{o.abort()})}}registerTextStreamHandler(e,n){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,n)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,n){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,n)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,n){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,n,i,r,s,o){return R(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,n),o!==1){yield this.engine.publishRpcResponse(e,n,null,ze.builtIn("UNSUPPORTED_VERSION"));return}const a=this.rpcHandlers.get(i);if(!a){yield this.engine.publishRpcResponse(e,n,null,ze.builtIn("UNSUPPORTED_METHOD"));return}let c=null,l=null;try{const d=yield a({requestId:n,callerIdentity:e,payload:r,responseTimeout:s});uu(d)>Ev?(c=ze.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(i))):l=d}catch(d){d instanceof ze?c=d:(console.warn("Uncaught error returned by RPC handler for ".concat(i,". Returning APPLICATION_ERROR instead."),d),c=ze.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,n,l,c)})}setE2EEEnabled(e){return R(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new EC(this.options.e2ee),this.e2eeManager.on(Zn.ParticipantEncryptionStatusChanged,(n,i)=>{yC(i)&&(this.isE2EEEnabled=n),this.emit(V.ParticipantEncryptionStatusChanged,n,i)}),this.e2eeManager.on(Zn.EncryptionError,n=>this.emit(V.EncryptionError,n)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&n!==void 0?n:!1}getSid(){return R(this,void 0,void 0,function*(){return this.state===he.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,n)=>{const i=r=>{r.sid!==""&&(this.engine.off(re.RoomUpdate,i),e(r.sid))};this.engine.on(re.RoomUpdate,i),this.once(V.Disconnected,()=>{this.engine.off(re.RoomUpdate,i),n("Room disconnected before room server id was available")})})})}get name(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&n!==void 0?n:0}get numPublishers(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&n!==void 0?n:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new dT(this.options),this.engine.on(re.ParticipantUpdate,this.handleParticipantUpdates).on(re.RoomUpdate,this.handleRoomUpdate).on(re.SpeakersChanged,this.handleSpeakersChanged).on(re.StreamStateChanged,this.handleStreamStateUpdate).on(re.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(re.SubscriptionError,this.handleSubscriptionError).on(re.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(re.MediaTrackAdded,(e,n,i)=>{this.onTrackAdded(e,n,i)}).on(re.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(re.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(re.DataPacketReceived,this.handleDataPacket).on(re.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(he.SignalReconnecting)&&this.emit(V.SignalReconnecting)}).on(re.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(he.Connected)&&this.emit(V.Reconnected)}).on(re.SignalResumed,()=>{this.bufferedEvents=[],(this.state===he.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(re.Restarting,this.handleRestarting).on(re.SignalRestarted,this.handleSignalRestarted).on(re.Offline,()=>{this.setAndEmitConnectionState(he.Reconnecting)&&this.emit(V.Reconnecting)}).on(re.DCBufferStatusChanged,(e,n)=>{this.emit(V.DCBufferStatusChanged,e,n)}).on(re.LocalTrackSubscribed,e=>{const n=this.localParticipant.getTrackPublications().find(i=>{let{trackSid:r}=i;return r===e});if(!n){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(q.LocalTrackSubscribed,n),this.emitWhenConnected(V.LocalTrackSubscribed,n,this.localParticipant)}).on(re.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((n,i)=>{this.handleParticipantDisconnected(i,n)}),this.emit(V.Moved,e.room.name),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ot.getInstance().getDevices(e,n)}prepareConnection(e,n){return R(this,void 0,void 0,function*(){if(this.state===he.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(Ul(new URL(e))&&n){this.regionUrlProvider=new Kl(e,n);const i=yield this.regionUrlProvider.getNextBestRegionUrl();i&&this.state===he.Disconnected&&(this.regionUrl=i,yield fetch(Bl(i),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(i),this.logContext))}else yield fetch(Bl(e),{method:"HEAD"})}catch(i){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:i}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,n){return R(this,void 0,void 0,function*(){let i=()=>{},r;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":r=new nn({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":r=new nn({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":r=new nn({scenario:{case:"serverLeave",value:!0}});break;case"migration":r=new nn({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":i=()=>R(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new nn({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>R(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new nn({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":r=new nn({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),i=()=>R(this,void 0,void 0,function*(){const s=this.engine.client.onLeave;s&&s(new Ca({reason:Gt.CLIENT_INITIATED,action:fr.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");r=new nn({scenario:{case:"subscriberBandwidth",value:wi(n)}});break;case"leave-full-reconnect":r=new nn({scenario:{case:"leaveRequestFullReconnect",value:!0}})}r&&(yield this.engine.client.sendSimulateScenario(r),yield i())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,n){return R(this,arguments,void 0,function(i,r){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var a,c,l,d,u,h,p;let v=!0,f=!1;const y=o?{exact:r}:r;if(i==="audioinput"){f=s.localParticipant.audioTrackPublications.size===0;const b=(a=s.getActiveDevice(i))!==null&&a!==void 0?a:s.options.audioCaptureDefaults.deviceId;s.options.audioCaptureDefaults.deviceId=y;const S=Array.from(s.localParticipant.audioTrackPublications.values()).filter(w=>w.source===D.Source.Microphone);try{v=(yield Promise.all(S.map(w=>{var x;return(x=w.audioTrack)===null||x===void 0?void 0:x.setDeviceId(y)}))).every(w=>w===!0)}catch(w){throw s.options.audioCaptureDefaults.deviceId=b,w}const k=S.some(w=>{var x,T;return(T=(x=w.track)===null||x===void 0?void 0:x.isMuted)!==null&&T!==void 0?T:!1});v&&k&&(f=!0)}else if(i==="videoinput"){f=s.localParticipant.videoTrackPublications.size===0;const b=(c=s.getActiveDevice(i))!==null&&c!==void 0?c:s.options.videoCaptureDefaults.deviceId;s.options.videoCaptureDefaults.deviceId=y;const S=Array.from(s.localParticipant.videoTrackPublications.values()).filter(k=>k.source===D.Source.Camera);try{v=(yield Promise.all(S.map(k=>{var w;return(w=k.videoTrack)===null||w===void 0?void 0:w.setDeviceId(y)}))).every(k=>k===!0)}catch(k){throw s.options.videoCaptureDefaults.deviceId=b,k}}else if(i==="audiooutput"){if(f=!0,!Fl()&&!s.options.webAudioMix||s.options.webAudioMix&&s.audioContext&&!("setSinkId"in s.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");s.options.webAudioMix&&(r=(l=yield ot.getInstance().normalizeDeviceId("audiooutput",r))!==null&&l!==void 0?l:""),(d=(p=s.options).audioOutput)!==null&&d!==void 0||(p.audioOutput={});const b=(u=s.getActiveDevice(i))!==null&&u!==void 0?u:s.options.audioOutput.deviceId;s.options.audioOutput.deviceId=r;try{s.options.webAudioMix&&((h=s.audioContext)===null||h===void 0||h.setSinkId(r)),yield Promise.all(Array.from(s.remoteParticipants.values()).map(S=>S.setAudioOutput({deviceId:r})))}catch(S){throw s.options.audioOutput.deviceId=b,S}}return f&&(s.localParticipant.activeDeviceMap.set(i,r),s.emit(V.ActiveDeviceChanged,i,r)),v}()})}setupLocalParticipantEvents(){this.localParticipant.on(q.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(q.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(q.AttributesChanged,this.onLocalAttributesChanged).on(q.TrackMuted,this.onLocalTrackMuted).on(q.TrackUnmuted,this.onLocalTrackUnmuted).on(q.LocalTrackPublished,this.onLocalTrackPublished).on(q.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(q.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(q.MediaDevicesError,this.onMediaDevicesError).on(q.AudioStreamAcquired,this.startAudio).on(q.ChatMessage,this.onLocalChatMessageSent).on(q.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,n,i){if(this.state===he.Connecting||this.state===he.Reconnecting){const d=()=>{this.onTrackAdded(e,n,i),u()},u=()=>{this.off(V.Reconnected,d),this.off(V.Connected,d),this.off(V.Disconnected,u)};this.once(V.Reconnected,d),this.once(V.Connected,d),this.once(V.Disconnected,u);return}if(this.state===he.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const r=nC(n.id),s=r[0];let o=r[1],a=e.id;if(o&&o.startsWith("TR")&&(a=o),s===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const c=Array.from(this.remoteParticipants.values()).find(d=>d.sid===s);if(!c){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(s),this.logContext);return}let l;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?l=this.options.adaptiveStream:l={}),c.addSubscribedMediaTrack(e,a,n,i,l)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1?arguments[1]:void 0;var i;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==he.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(r=>{r.trackPublications.forEach(s=>{r.unpublishTrack(s.trackSid)})}),this.localParticipant.trackPublications.forEach(r=>{var s,o,a;r.track&&this.localParticipant.unpublishTrack(r.track,e),e?((s=r.track)===null||s===void 0||s.detach(),(o=r.track)===null||o===void 0||o.stop()):(a=r.track)===null||a===void 0||a.stopMonitor()}),this.localParticipant.off(q.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(q.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(q.AttributesChanged,this.onLocalAttributesChanged).off(q.TrackMuted,this.onLocalTrackMuted).off(q.TrackUnmuted,this.onLocalTrackUnmuted).off(q.LocalTrackPublished,this.onLocalTrackPublished).off(q.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(q.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(q.MediaDevicesError,this.onMediaDevicesError).off(q.AudioStreamAcquired,this.startAudio).off(q.ChatMessage,this.onLocalChatMessageSent).off(q.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),bt()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(i=navigator.mediaDevices)===null||i===void 0||i.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(he.Disconnected),this.emit(V.Disconnected,n)}}}handleParticipantDisconnected(e,n){var i;this.remoteParticipants.delete(e),n&&(n.trackPublications.forEach(r=>{n.unpublishTrack(r.trackSid,!0)}),this.emit(V.ParticipantDisconnected,n),n.setDisconnected(),(i=this.localParticipant)===null||i===void 0||i.handleParticipantDisconnected(n.identity))}handleStreamHeader(e,n){return R(this,void 0,void 0,function*(){var i;if(e.contentHeader.case==="byteHeader"){const r=this.byteStreamHandlers.get(e.topic);if(!r){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let s;const o={id:e.streamId,name:(i=e.contentHeader.value.name)!==null&&i!==void 0?i:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Oo(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:c=>{s=c,this.byteStreamControllers.set(e.streamId,{info:o,controller:s,startTime:Date.now()})}});r(new mT(o,a,Oo(e.totalLength)),{identity:n})}else if(e.contentHeader.case==="textHeader"){const r=this.textStreamHandlers.get(e.topic);if(!r){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let s;const o={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:c=>{s=c,this.textStreamControllers.set(e.streamId,{info:o,controller:s,startTime:Date.now()})}});r(new pT(o,a,Oo(e.totalLength)),{identity:n})}})}handleStreamChunk(e){const n=this.byteStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e);const i=this.textStreamControllers.get(e.streamId);i&&e.content.length>0&&i.controller.enqueue(e)}handleStreamTrailer(e){const n=this.textStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId));const i=this.byteStreamControllers.get(e.streamId);i&&(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),e.attributes),i.controller.close(),this.byteStreamControllers.delete(e.streamId))}selectDefaultDevices(){return R(this,void 0,void 0,function*(){var e,n,i;const r=ot.getInstance().previousDevices,s=yield ot.getInstance().getDevices(void 0,!1),o=Pt();if((o==null?void 0:o.name)==="Chrome"&&o.os!=="iOS")for(let c of s){const l=r.find(d=>d.deviceId===c.deviceId);l&&l.label!==""&&l.kind===c.kind&&l.label!==c.label&&this.getActiveDevice(c.kind)==="default"&&this.emit(V.ActiveDeviceChanged,c.kind,c.deviceId)}const a=["audiooutput","audioinput","videoinput"];for(let c of a){const l=xC(c),d=this.localParticipant.getTrackPublication(l);if(d&&(!((e=d.track)===null||e===void 0)&&e.isUserProvided))continue;const u=s.filter(p=>p.kind===c),h=this.getActiveDevice(c);if(h===((n=r.filter(p=>p.kind===c)[0])===null||n===void 0?void 0:n.deviceId)&&u.length>0&&((i=u[0])===null||i===void 0?void 0:i.deviceId)!==h){yield this.switchActiveDevice(c,u[0].deviceId);continue}c==="audioinput"&&!vf()||c==="videoinput"||u.length>0&&!u.find(p=>p.deviceId===this.getActiveDevice(c))&&(c!=="audiooutput"||!vf())&&(yield this.switchActiveDevice(c,u[0].deviceId))}})}acquireAudioContext(){return R(this,void 0,void 0,function*(){var e,n;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=ou())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(r=>r.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),wt(200)])}catch(r){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:r}))}const i=((n=this.audioContext)===null||n===void 0?void 0:n.state)==="running";i!==this.canPlaybackAudio&&(this.audioEnabled=i,this.emit(V.AudioPlaybackStatusChanged,i))})}createParticipant(e,n){var i;let r;return n?r=ra.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):r=new ra(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&r.setAudioContext(this.audioContext),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&r.setAudioOutput(this.options.audioOutput).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),r}getOrCreateParticipant(e,n){if(this.remoteParticipants.has(e)){const r=this.remoteParticipants.get(e);return n&&r.updateInfo(n)&&this.sidToIdentity.set(n.sid,n.identity),r}const i=this.createParticipant(e,n);return this.remoteParticipants.set(e,i),this.sidToIdentity.set(n.sid,n.identity),this.emitWhenConnected(V.ParticipantConnected,i),i.on(q.TrackPublished,r=>{this.emitWhenConnected(V.TrackPublished,r,i)}).on(q.TrackSubscribed,(r,s)=>{r.kind===D.Kind.Audio?(r.on(ne.AudioPlaybackStarted,this.handleAudioPlaybackStarted),r.on(ne.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):r.kind===D.Kind.Video&&(r.on(ne.VideoPlaybackFailed,this.handleVideoPlaybackFailed),r.on(ne.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(V.TrackSubscribed,r,s,i)}).on(q.TrackUnpublished,r=>{this.emit(V.TrackUnpublished,r,i)}).on(q.TrackUnsubscribed,(r,s)=>{this.emit(V.TrackUnsubscribed,r,s,i)}).on(q.TrackMuted,r=>{this.emitWhenConnected(V.TrackMuted,r,i)}).on(q.TrackUnmuted,r=>{this.emitWhenConnected(V.TrackUnmuted,r,i)}).on(q.ParticipantMetadataChanged,r=>{this.emitWhenConnected(V.ParticipantMetadataChanged,r,i)}).on(q.ParticipantNameChanged,r=>{this.emitWhenConnected(V.ParticipantNameChanged,r,i)}).on(q.AttributesChanged,r=>{this.emitWhenConnected(V.ParticipantAttributesChanged,r,i)}).on(q.ConnectionQualityChanged,r=>{this.emitWhenConnected(V.ConnectionQualityChanged,r,i)}).on(q.ParticipantPermissionsChanged,r=>{this.emitWhenConnected(V.ParticipantPermissionsChanged,r,i)}).on(q.TrackSubscriptionStatusChanged,(r,s)=>{this.emitWhenConnected(V.TrackSubscriptionStatusChanged,r,s,i)}).on(q.TrackSubscriptionFailed,(r,s)=>{this.emit(V.TrackSubscriptionFailed,r,i,s)}).on(q.TrackSubscriptionPermissionChanged,(r,s)=>{this.emitWhenConnected(V.TrackSubscriptionPermissionChanged,r,s,i)}).on(q.Active,()=>{this.emitWhenConnected(V.ParticipantActive,i),i.kind===Oi.AGENT&&this.localParticipant.setActiveAgent(i)}),n&&i.updateInfo(n),i}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((i,r)=>(i.push(...r.getTrackPublications()),i),[]),n=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,n)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const n of e.videoTrackPublications.values())n.isSubscribed&&vC(n)&&n.emitTrackUpdate()}getRemoteParticipantBySid(e){const n=this.sidToIdentity.get(e);if(n)return this.remoteParticipants.get(n)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=lt.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Gt.STATE_MISMATCH))):e=0},TT)}clearConnectionReconcile(){this.connectionReconcileInterval&<.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(V.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[n,i]=e;this.emit(n,...i)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if(this.state===he.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,i]);else if(this.state===he.Connected)return this.emit(e,...i);return!1}simulateParticipants(e){return R(this,void 0,void 0,function*(){var n,i;const r=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),s=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new Sa({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:De.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new _i({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(V.SignalConnected),this.emit(V.Connected),this.setAndEmitConnectionState(he.Connected),r.video){const o=new Yl(D.Kind.Video,new ir({source:Xe.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.AUDIO,name:"video-dummy"}),new na(r.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:wf(160*((n=s.aspectRatios[0])!==null&&n!==void 0?n:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(o),this.localParticipant.emit(q.LocalTrackPublished,o)}if(r.audio){const o=new Yl(D.Kind.Audio,new ir({source:Xe.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.AUDIO}),new ta(r.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:pc(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(o),this.localParticipant.emit(q.LocalTrackPublished,o)}for(let o=0;o<s.count-1;o+=1){let a=new _i({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(o),state:hr.ACTIVE,tracks:[],joinedAt:De.parse(Date.now())});const c=this.getOrCreateParticipant(a.identity,a);if(s.video){const l=wf(160*((i=s.aspectRatios[o%s.aspectRatios.length])!==null&&i!==void 0?i:1),160,!1,!0),d=new ir({source:Xe.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.AUDIO});c.addSubscribedMediaTrack(l,d.sid,new MediaStream([l]),new RTCRtpReceiver),a.tracks=[...a.tracks,d]}if(s.audio){const l=pc(),d=new ir({source:Xe.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Wt.AUDIO});c.addSubscribedMediaTrack(l,d.sid,new MediaStream([l]),new RTCRtpReceiver),a.tracks=[...a.tracks,d]}c.updateInfo(a)}})}emit(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if(e!==V.ActiveSpeakersChanged&&e!==V.TranscriptionReceived){const s=Dv(i).filter(o=>o!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:s}))}return super.emit(e,...i)}}ei.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function Dv(t){return t.map(e=>{if(e)return Array.isArray(e)?Dv(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var zt;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(zt||(zt={}));class di extends vn.EventEmitter{constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=zt.IDLE,this.logs=[],this.options={},this.url=e,this.token=n,this.name=this.constructor.name,this.room=new ei(i.roomOptions),this.connectOptions=i.connectOptions,this.options=i}run(e){return R(this,void 0,void 0,function*(){if(this.status!==zt.IDLE)throw Error("check is running already");this.setStatus(zt.RUNNING);try{yield this.perform()}catch(n){n instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(n.message):this.appendError(n.message))}return yield this.disconnect(),yield new Promise(n=>setTimeout(n,500)),this.status!==zt.SKIPPED&&this.setStatus(this.isSuccess()?zt.SUCCESS:zt.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return R(this,void 0,void 0,function*(){return this.room.state===he.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return R(this,void 0,void 0,function*(){this.room&&this.room.state!==he.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(zt.SKIPPED)}switchProtocol(e){return R(this,void 0,void 0,function*(){let n=!1,i=!1;if(this.room.on(V.Reconnecting,()=>{n=!0}),this.room.once(V.Reconnected,()=>{i=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(s=>setTimeout(s,1e3)),!n)return;const r=Date.now()+1e4;for(;Date.now()<r;){if(i)return;yield wt(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class ET extends di{get description(){return"Cloud regions"}perform(){return R(this,void 0,void 0,function*(){const e=new Kl(this.url,this.token);if(!e.isCloud()){this.skip();return}const n=[],i=new Set;for(let s=0;s<3;s++){const o=yield e.getNextBestRegionUrl();if(!o)break;if(i.has(o))continue;i.add(o);const a=yield this.checkCloudRegion(o);this.appendMessage("".concat(a.region," RTT: ").concat(a.rtt,"ms, duration: ").concat(a.duration,"ms")),n.push(a)}n.sort((s,o)=>(s.duration-o.duration)*.5+(s.rtt-o.rtt)*.5);const r=n[0];this.bestStats=r,this.appendMessage("best Cloud region: ".concat(r.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return R(this,void 0,void 0,function*(){var n,i;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const r=(n=this.room.serverInfo)===null||n===void 0?void 0:n.region;if(!r)throw new Error("Region not found");const s=yield this.room.localParticipant.streamText({topic:"test"}),o=1e3,c=1e6/o,l="A".repeat(o),d=Date.now();for(let v=0;v<c;v++)yield s.write(l);yield s.close();const u=Date.now(),h=yield(i=this.room.engine.pcManager)===null||i===void 0?void 0:i.publisher.getStats(),p={region:r,rtt:1e4,duration:u-d};return h==null||h.forEach(v=>{v.type==="candidate-pair"&&v.nominated&&(p.rtt=v.currentRoundTripTime*1e3)}),yield this.disconnect(),p})}}const Cc=1e4;class PT extends di{get description(){return"Connection via UDP vs TCP"}perform(){return R(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),n=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-n.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-n.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=n):this.appendMessage("best connection quality via udp");const i=this.bestStats;this.appendMessage("upstream bitrate: ".concat((i.bitrateTotal/i.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((i.rttTotal/i.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((i.jitterTotal/i.count*1e3).toFixed(2)," ms")),i.packetsLost>0&&this.appendWarning("packets lost: ".concat((i.packetsLost/i.packetsSent*100).toFixed(2),"%")),i.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((i.qualityLimitationDurations.bandwidth/(Cc/1e3)*100).toFixed(2),"%")),i.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((i.qualityLimitationDurations.cpu/(Cc/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return R(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const n=document.createElement("canvas");n.width=1280,n.height=720;const i=n.getContext("2d");if(!i)throw new Error("Could not get canvas context");let r=0;const s=()=>{r=(r+1)%360,i.fillStyle="hsl(".concat(r,", 100%, 50%)"),i.fillRect(0,0,n.width,n.height),requestAnimationFrame(s)};s();const a=n.captureStream(30).getVideoTracks()[0],l=(yield this.room.localParticipant.publishTrack(a,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,d={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},u=setInterval(()=>R(this,void 0,void 0,function*(){const h=yield l.getRTCStatsReport();h==null||h.forEach(p=>{p.type==="outbound-rtp"?(d.packetsSent=p.packetsSent,d.qualityLimitationDurations=p.qualityLimitationDurations,d.bitrateTotal+=p.targetBitrate,d.count++):p.type==="remote-inbound-rtp"&&(d.packetsLost=p.packetsLost,d.rttTotal+=p.roundTripTime,d.jitterTotal+=p.jitter)})}),1e3);return yield new Promise(h=>setTimeout(h,Cc)),clearInterval(u),a.stop(),n.remove(),yield this.disconnect(),d})}}class RT extends di{get description(){return"Can publish audio"}perform(){return R(this,void 0,void 0,function*(){var e;const n=yield this.connect(),i=yield wT();if(yield wv(i,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),n.localParticipant.publishTrack(i),yield new Promise(a=>setTimeout(a,3e3));const s=yield(e=i.sender)===null||e===void 0?void 0:e.getStats();if(!s)throw new Error("Could not get RTCStats");let o=0;if(s.forEach(a=>{a.type==="outbound-rtp"&&(a.kind==="audio"||!a.kind&&a.mediaType==="audio")&&(o=a.packetsSent)}),o===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(o," audio packets"))})}}class AT extends di{get description(){return"Can publish video"}perform(){return R(this,void 0,void 0,function*(){var e;const n=yield this.connect(),i=yield xT();yield this.checkForVideo(i.mediaStreamTrack),n.localParticipant.publishTrack(i),yield new Promise(o=>setTimeout(o,5e3));const r=yield(e=i.sender)===null||e===void 0?void 0:e.getStats();if(!r)throw new Error("Could not get RTCStats");let s=0;if(r.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="video"||!o.kind&&o.mediaType==="video")&&(s+=o.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," video packets"))})}checkForVideo(e){return R(this,void 0,void 0,function*(){const n=new MediaStream;n.addTrack(e.clone());const i=document.createElement("video");i.srcObject=n,i.muted=!0,yield new Promise(r=>{i.onplay=()=>{setTimeout(()=>{var s,o,a,c;const l=document.createElement("canvas"),d=e.getSettings(),u=(o=(s=d.width)!==null&&s!==void 0?s:i.videoWidth)!==null&&o!==void 0?o:1280,h=(c=(a=d.height)!==null&&a!==void 0?a:i.videoHeight)!==null&&c!==void 0?c:720;l.width=u,l.height=h;const p=l.getContext("2d");p.drawImage(i,0,0);const f=p.getImageData(0,0,l.width,l.height).data;let y=!0;for(let b=0;b<f.length;b+=4)if(f[b]!==0||f[b+1]!==0||f[b+2]!==0){y=!1;break}y?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),r()},1e3)},i.play()}),n.getTracks().forEach(r=>r.stop()),i.remove()})}}class IT extends di{get description(){return"Resuming connection after interruption"}perform(){return R(this,void 0,void 0,function*(){var e;const n=yield this.connect();let i=!1,r=!1,s;const o=new Promise(l=>{setTimeout(l,5e3),s=l}),a=()=>{i=!0};n.on(V.SignalReconnecting,a).on(V.Reconnecting,a).on(V.Reconnected,()=>{r=!0,s(!0)}),(e=n.engine.client.ws)===null||e===void 0||e.close();const c=n.engine.client.onClose;if(c&&c(""),yield o,i){if(!r||n.state!==he.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class MT extends di{get description(){return"Can connect via TURN"}perform(){return R(this,void 0,void 0,function*(){var e,n;const i=new au,r=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let s=!1,o=!1,a=!1;for(let c of r.iceServers)for(let l of c.urls)l.startsWith("turn:")?(o=!0,a=!0):l.startsWith("turns:")&&(o=!0,a=!0,s=!0),l.startsWith("stun:")&&(a=!0);a?o&&!s&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield i.close(),!((n=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||n===void 0)&&n.iceServers||o?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(c=>setTimeout(c,0)))})}}class NT extends di{get description(){return"Establishing WebRTC connection"}perform(){return R(this,void 0,void 0,function*(){let e=!1,n=!1;this.room.on(V.SignalConnected,()=>{const i=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(r,s)=>{if(r.candidate){const o=new RTCIceCandidate(r);let a="".concat(o.protocol," ").concat(o.address,":").concat(o.port," ").concat(o.type);o.address&&(_T(o.address)?a+=" (private)":o.protocol==="tcp"&&o.tcpType==="passive"?(e=!0,a+=" (passive)"):o.protocol==="udp"&&(n=!0)),this.appendMessage(a)}i&&i(r,s)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=r=>{r instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(r.errorCode," ").concat(r.errorText," ").concat(r.url))})});try{yield this.connect(),ye.info("now the room is connected")}catch(i){throw this.appendWarning("ports need to be open on firewall in order to connect."),i}e||this.appendWarning("Server is not configured for ICE/TCP"),n||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function _T(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const n=parseInt(e[1],10);if(n>=16&&n<=31)return!0}}return!1}class OT extends di{get description(){return"Connecting to signal connection via WebSocket"}perform(){return R(this,void 0,void 0,function*(){var e,n,i;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let r=new au;const s=yield r.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(s.serverVersion,".")),((e=s.serverInfo)===null||e===void 0?void 0:e.edition)===S0.Cloud&&(!((n=s.serverInfo)===null||n===void 0)&&n.region)&&this.appendMessage("LiveKit Cloud: ".concat((i=s.serverInfo)===null||i===void 0?void 0:i.region)),yield r.close()})}}class Fj extends vn.EventEmitter{constructor(e,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=n,this.options=i}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:zt.IDLE,name:"",description:""}),e}updateCheck(e,n){this.checkResults.set(e,n),this.emit("checkUpdate",e,n)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==zt.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return R(this,void 0,void 0,function*(){const n=this.getNextCheckId(),i=new e(this.url,this.token,this.options),r=o=>{this.updateCheck(n,o)};i.on("update",r);const s=yield i.run();return i.off("update",r),s})}checkWebsocket(){return R(this,void 0,void 0,function*(){return this.createAndRunCheck(OT)})}checkWebRTC(){return R(this,void 0,void 0,function*(){return this.createAndRunCheck(NT)})}checkTURN(){return R(this,void 0,void 0,function*(){return this.createAndRunCheck(MT)})}checkReconnect(){return R(this,void 0,void 0,function*(){return this.createAndRunCheck(IT)})}checkPublishAudio(){return R(this,void 0,void 0,function*(){return this.createAndRunCheck(RT)})}checkPublishVideo(){return R(this,void 0,void 0,function*(){return this.createAndRunCheck(AT)})}checkConnectionProtocol(){return R(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(PT);if(e.data&&"protocol"in e.data){const n=e.data;this.options.protocol=n.protocol}return e})}checkCloudRegion(){return R(this,void 0,void 0,function*(){return this.createAndRunCheck(ET)})}}const mu=M.createContext({});function pu(t){const e=M.useRef(null);return e.current===null&&(e.current=t()),e.current}const gu=typeof window<"u",jv=gu?M.useLayoutEffect:M.useEffect,Ra=M.createContext(null);function vu(t,e){t.indexOf(e)===-1&&t.push(e)}function yu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const _n=(t,e,n)=>n>e?e:n<t?t:n;function Jl(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Lr=()=>{},On=()=>{};process.env.NODE_ENV!=="production"&&(Lr=(t,e,n)=>{!t&&typeof console<"u"&&console.warn(Jl(e,n))},On=(t,e,n)=>{if(!t)throw new Error(Jl(e,n))});const Dn={},Lv=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Vv(t){return typeof t=="object"&&t!==null}const Fv=t=>/^0[^.\s]+$/u.test(t);function bu(t){let e;return()=>(e===void 0&&(e=t()),e)}const jt=t=>t,DT=(t,e)=>n=>e(t(n)),Ls=(...t)=>t.reduce(DT),xs=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i};class xu{constructor(){this.subscriptions=[]}add(e){return vu(this.subscriptions,e),()=>yu(this.subscriptions,e)}notify(e,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,i);else for(let s=0;s<r;s++){const o=this.subscriptions[s];o&&o(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Kt=t=>t*1e3,dn=t=>t/1e3;function Uv(t,e){return e?t*(1e3/e):0}const Uf=new Set;function wu(t,e,n){t||Uf.has(e)||(console.warn(Jl(e,n)),Uf.add(e))}const Bv=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,jT=1e-7,LT=12;function VT(t,e,n,i,r){let s,o,a=0;do o=e+(n-e)/2,s=Bv(o,i,r)-t,s>0?n=o:e=o;while(Math.abs(s)>jT&&++a<LT);return o}function Vs(t,e,n,i){if(t===e&&n===i)return jt;const r=s=>VT(s,0,1,t,n);return s=>s===0||s===1?s:Bv(r(s),e,i)}const $v=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Hv=t=>e=>1-t(1-e),zv=Vs(.33,1.53,.69,.99),Su=Hv(zv),Wv=$v(Su),qv=t=>(t*=2)<1?.5*Su(t):.5*(2-Math.pow(2,-10*(t-1))),ku=t=>1-Math.sin(Math.acos(t)),Gv=Hv(ku),Kv=$v(ku),FT=Vs(.42,0,1,1),UT=Vs(0,0,.58,1),Zv=Vs(.42,0,.58,1),BT=t=>Array.isArray(t)&&typeof t[0]!="number",Yv=t=>Array.isArray(t)&&typeof t[0]=="number",Bf={linear:jt,easeIn:FT,easeInOut:Zv,easeOut:UT,circIn:ku,circInOut:Kv,circOut:Gv,backIn:Su,backInOut:Wv,backOut:zv,anticipate:qv},$T=t=>typeof t=="string",$f=t=>{if(Yv(t)){On(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,i,r]=t;return Vs(e,n,i,r)}else if($T(t))return On(Bf[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Bf[t];return t},Qs=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function HT(t,e){let n=new Set,i=new Set,r=!1,s=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(l.schedule(d),t()),d(a)}const l={schedule:(d,u=!1,h=!1)=>{const v=h&&r?n:i;return u&&o.add(d),v.has(d)||v.add(d),d},cancel:d=>{i.delete(d),o.delete(d)},process:d=>{if(a=d,r){s=!0;return}r=!0,[n,i]=[i,n],n.forEach(c),n.clear(),r=!1,s&&(s=!1,l.process(d))}};return l}const zT=40;function Jv(t,e){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=Qs.reduce((k,w)=>(k[w]=HT(s),k),{}),{setup:a,read:c,resolveKeyframes:l,preUpdate:d,update:u,preRender:h,render:p,postRender:v}=o,f=()=>{const k=Dn.useManualTiming?r.timestamp:performance.now();n=!1,Dn.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(k-r.timestamp,zT),1)),r.timestamp=k,r.isProcessing=!0,a.process(r),c.process(r),l.process(r),d.process(r),u.process(r),h.process(r),p.process(r),v.process(r),r.isProcessing=!1,n&&e&&(i=!1,t(f))},y=()=>{n=!0,i=!0,r.isProcessing||t(f)};return{schedule:Qs.reduce((k,w)=>{const x=o[w];return k[w]=(T,E=!1,P=!1)=>(n||y(),x.schedule(T,E,P)),k},{}),cancel:k=>{for(let w=0;w<Qs.length;w++)o[Qs[w]].cancel(k)},state:r,steps:o}}const{schedule:je,cancel:ti,state:at,steps:Tc}=Jv(typeof requestAnimationFrame<"u"?requestAnimationFrame:jt,!0);let jo;function WT(){jo=void 0}const xt={now:()=>(jo===void 0&&xt.set(at.isProcessing||Dn.useManualTiming?at.timestamp:performance.now()),jo),set:t=>{jo=t,queueMicrotask(WT)}},Xv=t=>e=>typeof e=="string"&&e.startsWith(t),Cu=Xv("--"),qT=Xv("var(--"),Tu=t=>qT(t)?GT.test(t.split("/*")[0].trim()):!1,GT=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Vr={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ws={...Vr,transform:t=>_n(0,1,t)},eo={...Vr,default:1},fs=t=>Math.round(t*1e5)/1e5,Eu=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function KT(t){return t==null}const ZT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Pu=(t,e)=>n=>!!(typeof n=="string"&&ZT.test(n)&&n.startsWith(t)||e&&!KT(n)&&Object.prototype.hasOwnProperty.call(n,e)),Qv=(t,e,n)=>i=>{if(typeof i!="string")return i;const[r,s,o,a]=i.match(Eu);return{[t]:parseFloat(r),[e]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},YT=t=>_n(0,255,t),Ec={...Vr,transform:t=>Math.round(YT(t))},Ci={test:Pu("rgb","red"),parse:Qv("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Ec.transform(t)+", "+Ec.transform(e)+", "+Ec.transform(n)+", "+fs(ws.transform(i))+")"};function JT(t){let e="",n="",i="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const Xl={test:Pu("#"),parse:JT,transform:Ci.transform},Fs=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Wn=Fs("deg"),un=Fs("%"),de=Fs("px"),XT=Fs("vh"),QT=Fs("vw"),Hf={...un,parse:t=>un.parse(t)/100,transform:t=>un.transform(t*100)},or={test:Pu("hsl","hue"),parse:Qv("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+un.transform(fs(e))+", "+un.transform(fs(n))+", "+fs(ws.transform(i))+")"},Je={test:t=>Ci.test(t)||Xl.test(t)||or.test(t),parse:t=>Ci.test(t)?Ci.parse(t):or.test(t)?or.parse(t):Xl.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ci.transform(t):or.transform(t),getAnimatableNone:t=>{const e=Je.parse(t);return e.alpha=0,Je.transform(e)}},e2=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function t2(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Eu))==null?void 0:e.length)||0)+(((n=t.match(e2))==null?void 0:n.length)||0)>0}const ey="number",ty="color",n2="var",i2="var(",zf="${}",r2=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ss(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const a=e.replace(r2,c=>(Je.test(c)?(i.color.push(s),r.push(ty),n.push(Je.parse(c))):c.startsWith(i2)?(i.var.push(s),r.push(n2),n.push(c)):(i.number.push(s),r.push(ey),n.push(parseFloat(c))),++s,zf)).split(zf);return{values:n,split:a,indexes:i,types:r}}function ny(t){return Ss(t).values}function iy(t){const{split:e,types:n}=Ss(t),i=e.length;return r=>{let s="";for(let o=0;o<i;o++)if(s+=e[o],r[o]!==void 0){const a=n[o];a===ey?s+=fs(r[o]):a===ty?s+=Je.transform(r[o]):s+=r[o]}return s}}const s2=t=>typeof t=="number"?0:Je.test(t)?Je.getAnimatableNone(t):t;function o2(t){const e=ny(t);return iy(t)(e.map(s2))}const ni={test:t2,parse:ny,createTransformer:iy,getAnimatableNone:o2};function Pc(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function a2({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let r=0,s=0,o=0;if(!e)r=s=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;r=Pc(c,a,t+1/3),s=Pc(c,a,t),o=Pc(c,a,t-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}function sa(t,e){return n=>n>0?e:t}const Ve=(t,e,n)=>t+(e-t)*n,Rc=(t,e,n)=>{const i=t*t,r=n*(e*e-i)+i;return r<0?0:Math.sqrt(r)},c2=[Xl,Ci,or],l2=t=>c2.find(e=>e.test(t));function Wf(t){const e=l2(t);if(Lr(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===or&&(n=a2(n)),n}const qf=(t,e)=>{const n=Wf(t),i=Wf(e);if(!n||!i)return sa(t,e);const r={...n};return s=>(r.red=Rc(n.red,i.red,s),r.green=Rc(n.green,i.green,s),r.blue=Rc(n.blue,i.blue,s),r.alpha=Ve(n.alpha,i.alpha,s),Ci.transform(r))},Ql=new Set(["none","hidden"]);function d2(t,e){return Ql.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function u2(t,e){return n=>Ve(t,e,n)}function Ru(t){return typeof t=="number"?u2:typeof t=="string"?Tu(t)?sa:Je.test(t)?qf:m2:Array.isArray(t)?ry:typeof t=="object"?Je.test(t)?qf:h2:sa}function ry(t,e){const n=[...t],i=n.length,r=t.map((s,o)=>Ru(s)(s,e[o]));return s=>{for(let o=0;o<i;o++)n[o]=r[o](s);return n}}function h2(t,e){const n={...t,...e},i={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(i[r]=Ru(t[r])(t[r],e[r]));return r=>{for(const s in i)n[s]=i[s](r);return n}}function f2(t,e){const n=[],i={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const s=e.types[r],o=t.indexes[s][i[s]],a=t.values[o]??0;n[r]=a,i[s]++}return n}const m2=(t,e)=>{const n=ni.createTransformer(e),i=Ss(t),r=Ss(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Ql.has(t)&&!r.values.length||Ql.has(e)&&!i.values.length?d2(t,e):Ls(ry(f2(i,r),r.values),n):(Lr(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),sa(t,e))};function sy(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ve(t,e,n):Ru(t)(t,e)}const p2=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>je.update(e,n),stop:()=>ti(e),now:()=>at.isProcessing?at.timestamp:xt.now()}},oy=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let s=0;s<r;s++)i+=Math.round(t(s/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},oa=2e4;function Au(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<oa;)e+=n,i=t.next(e);return e>=oa?1/0:e}function g2(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Au(i),oa);return{type:"keyframes",ease:s=>i.next(r*s).value/e,duration:dn(r)}}const v2=5;function ay(t,e,n){const i=Math.max(e-v2,0);return Uv(n-t(i),e-i)}const Le={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ac=.001;function y2({duration:t=Le.duration,bounce:e=Le.bounce,velocity:n=Le.velocity,mass:i=Le.mass}){let r,s;Lr(t<=Kt(Le.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=_n(Le.minDamping,Le.maxDamping,o),t=_n(Le.minDuration,Le.maxDuration,dn(t)),o<1?(r=l=>{const d=l*o,u=d*t,h=d-n,p=ed(l,o),v=Math.exp(-u);return Ac-h/p*v},s=l=>{const u=l*o*t,h=u*n+n,p=Math.pow(o,2)*Math.pow(l,2)*t,v=Math.exp(-u),f=ed(Math.pow(l,2),o);return(-r(l)+Ac>0?-1:1)*((h-p)*v)/f}):(r=l=>{const d=Math.exp(-l*t),u=(l-n)*t+1;return-Ac+d*u},s=l=>{const d=Math.exp(-l*t),u=(n-l)*(t*t);return d*u});const a=5/t,c=x2(r,s,a);if(t=Kt(t),isNaN(c))return{stiffness:Le.stiffness,damping:Le.damping,duration:t};{const l=Math.pow(c,2)*i;return{stiffness:l,damping:o*2*Math.sqrt(i*l),duration:t}}}const b2=12;function x2(t,e,n){let i=n;for(let r=1;r<b2;r++)i=i-t(i)/e(i);return i}function ed(t,e){return t*Math.sqrt(1-e*e)}const w2=["duration","bounce"],S2=["stiffness","damping","mass"];function Gf(t,e){return e.some(n=>t[n]!==void 0)}function k2(t){let e={velocity:Le.velocity,stiffness:Le.stiffness,damping:Le.damping,mass:Le.mass,isResolvedFromDuration:!1,...t};if(!Gf(t,S2)&&Gf(t,w2))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*_n(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Le.mass,stiffness:r,damping:s}}else{const n=y2(t);e={...e,...n,mass:Le.mass},e.isResolvedFromDuration=!0}return e}function aa(t=Le.visualDuration,e=Le.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:r}=n;const s=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:s},{stiffness:c,damping:l,mass:d,duration:u,velocity:h,isResolvedFromDuration:p}=k2({...n,velocity:-dn(n.velocity||0)}),v=h||0,f=l/(2*Math.sqrt(c*d)),y=o-s,b=dn(Math.sqrt(c/d)),S=Math.abs(y)<5;i||(i=S?Le.restSpeed.granular:Le.restSpeed.default),r||(r=S?Le.restDelta.granular:Le.restDelta.default);let k;if(f<1){const x=ed(b,f);k=T=>{const E=Math.exp(-f*b*T);return o-E*((v+f*b*y)/x*Math.sin(x*T)+y*Math.cos(x*T))}}else if(f===1)k=x=>o-Math.exp(-b*x)*(y+(v+b*y)*x);else{const x=b*Math.sqrt(f*f-1);k=T=>{const E=Math.exp(-f*b*T),P=Math.min(x*T,300);return o-E*((v+f*b*y)*Math.sinh(P)+x*y*Math.cosh(P))/x}}const w={calculatedDuration:p&&u||null,next:x=>{const T=k(x);if(p)a.done=x>=u;else{let E=x===0?v:0;f<1&&(E=x===0?Kt(v):ay(k,x,T));const P=Math.abs(E)<=i,I=Math.abs(o-T)<=r;a.done=P&&I}return a.value=a.done?o:T,a},toString:()=>{const x=Math.min(Au(w),oa),T=oy(E=>w.next(x*E).value,x,30);return x+"ms "+T},toTransition:()=>{}};return w}aa.applyToOptions=t=>{const e=g2(t,100,aa);return t.ease=e.ease,t.duration=Kt(e.duration),t.type="keyframes",t};function td({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:c,restDelta:l=.5,restSpeed:d}){const u=t[0],h={done:!1,value:u},p=P=>a!==void 0&&P<a||c!==void 0&&P>c,v=P=>a===void 0?c:c===void 0||Math.abs(a-P)<Math.abs(c-P)?a:c;let f=n*e;const y=u+f,b=o===void 0?y:o(y);b!==y&&(f=b-u);const S=P=>-f*Math.exp(-P/i),k=P=>b+S(P),w=P=>{const I=S(P),C=k(P);h.done=Math.abs(I)<=l,h.value=h.done?b:C};let x,T;const E=P=>{p(h.value)&&(x=P,T=aa({keyframes:[h.value,v(h.value)],velocity:ay(k,P,h.value),damping:r,stiffness:s,restDelta:l,restSpeed:d}))};return E(0),{calculatedDuration:null,next:P=>{let I=!1;return!T&&x===void 0&&(I=!0,w(P),E(P)),x!==void 0&&P>=x?T.next(P-x):(!I&&w(P),h)}}}function C2(t,e,n){const i=[],r=n||Dn.mix||sy,s=t.length-1;for(let o=0;o<s;o++){let a=r(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||jt:e;a=Ls(c,a)}i.push(a)}return i}function T2(t,e,{clamp:n=!0,ease:i,mixer:r}={}){const s=t.length;if(On(s===e.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>e[0];if(s===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=C2(e,i,r),c=a.length,l=d=>{if(o&&d<t[0])return e[0];let u=0;if(c>1)for(;u<t.length-2&&!(d<t[u+1]);u++);const h=xs(t[u],t[u+1],d);return a[u](h)};return n?d=>l(_n(t[0],t[s-1],d)):l}function E2(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=xs(0,e,i);t.push(Ve(n,1,r))}}function P2(t){const e=[0];return E2(e,t.length-1),e}function R2(t,e){return t.map(n=>n*e)}function A2(t,e){return t.map(()=>e||Zv).splice(0,t.length-1)}function ar({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const r=BT(i)?i.map($f):$f(i),s={done:!1,value:e[0]},o=R2(n&&n.length===e.length?n:P2(e),t),a=T2(o,e,{ease:Array.isArray(r)?r:A2(e,r)});return{calculatedDuration:t,next:c=>(s.value=a(c),s.done=c>=t,s)}}const I2=t=>t!==null;function Iu(t,{repeat:e,repeatType:n="loop"},i,r=1){const s=t.filter(I2),a=r<0||e&&n!=="loop"&&e%2===1?0:s.length-1;return!a||i===void 0?s[a]:i}const M2={decay:td,inertia:td,tween:ar,keyframes:ar,spring:aa};function cy(t){typeof t.type=="string"&&(t.type=M2[t.type])}class Mu{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const N2=t=>t/100;class Nu extends Mu{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var i,r;const{motionValue:n}=this.options;n&&n.updatedAt!==xt.now()&&this.tick(xt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(i=this.options).onStop)==null||r.call(i))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;cy(e);const{type:n=ar,repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:o=0}=e;let{keyframes:a}=e;const c=n||ar;process.env.NODE_ENV!=="production"&&c!==ar&&On(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),c!==ar&&typeof a[0]!="number"&&(this.mixKeyframes=Ls(N2,sy(a[0],a[1])),a=[0,100]);const l=c({...e,keyframes:a});s==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...a].reverse(),velocity:-o})),l.calculatedDuration===null&&(l.calculatedDuration=Au(l));const{calculatedDuration:d}=l;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=l}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:i,totalDuration:r,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:c}=this;if(this.startTime===null)return i.next(0);const{delay:l=0,keyframes:d,repeat:u,repeatType:h,repeatDelay:p,type:v,onUpdate:f,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const b=this.currentTime-l*(this.playbackSpeed>=0?1:-1),S=this.playbackSpeed>=0?b<0:b>r;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let k=this.currentTime,w=i;if(u){const P=Math.min(this.currentTime,r)/a;let I=Math.floor(P),C=P%1;!C&&P>=1&&(C=1),C===1&&I--,I=Math.min(I,u+1),!!(I%2)&&(h==="reverse"?(C=1-C,p&&(C-=p/a)):h==="mirror"&&(w=o)),k=_n(0,1,C)*a}const x=S?{done:!1,value:d[0]}:w.next(k);s&&(x.value=s(x.value));let{done:T}=x;!S&&c!==null&&(T=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return E&&v!==td&&(x.value=Iu(d,this.options,y,this.speed)),f&&f(x.value),E&&this.finish(),x}then(e,n){return this.finished.then(e,n)}get duration(){return dn(this.calculatedDuration)}get time(){return dn(this.currentTime)}set time(e){var n;e=Kt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(xt.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=dn(this.currentTime))}play(){var r,s;if(this.isStopped)return;const{driver:e=p2,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(s=(r=this.options).onPlay)==null||s.call(r);const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(xt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function _2(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ti=t=>t*180/Math.PI,nd=t=>{const e=Ti(Math.atan2(t[1],t[0]));return id(e)},O2={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:nd,rotateZ:nd,skewX:t=>Ti(Math.atan(t[1])),skewY:t=>Ti(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},id=t=>(t=t%360,t<0&&(t+=360),t),Kf=nd,Zf=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Yf=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),D2={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Zf,scaleY:Yf,scale:t=>(Zf(t)+Yf(t))/2,rotateX:t=>id(Ti(Math.atan2(t[6],t[5]))),rotateY:t=>id(Ti(Math.atan2(-t[2],t[0]))),rotateZ:Kf,rotate:Kf,skewX:t=>Ti(Math.atan(t[4])),skewY:t=>Ti(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function rd(t){return t.includes("scale")?1:0}function sd(t,e){if(!t||t==="none")return rd(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(n)i=D2,r=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=O2,r=a}if(!r)return rd(e);const s=i[e],o=r[1].split(",").map(L2);return typeof s=="function"?s(o):o[s]}const j2=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return sd(n,e)};function L2(t){return parseFloat(t.trim())}const Fr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ur=new Set(Fr),Jf=t=>t===Vr||t===de,V2=new Set(["x","y","z"]),F2=Fr.filter(t=>!V2.has(t));function U2(t){const e=[];return F2.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const Ri={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>sd(e,"x"),y:(t,{transform:e})=>sd(e,"y")};Ri.translateX=Ri.x;Ri.translateY=Ri.y;const Ai=new Set;let od=!1,ad=!1,cd=!1;function ly(){if(ad){const t=Array.from(Ai).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const r=U2(i);r.length&&(n.set(i,r),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,o])=>{var a;(a=i.getValue(s))==null||a.set(o)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}ad=!1,od=!1,Ai.forEach(t=>t.complete(cd)),Ai.clear()}function dy(){Ai.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ad=!0)})}function B2(){cd=!0,dy(),ly(),cd=!1}class _u{constructor(e,n,i,r,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Ai.add(this),od||(od=!0,je.read(dy),je.resolveKeyframes(ly))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:r}=this;if(e[0]===null){const s=r==null?void 0:r.get(),o=e[e.length-1];if(s!==void 0)e[0]=s;else if(i&&n){const a=i.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),r&&s===void 0&&r.set(e[0])}_2(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ai.delete(this)}cancel(){this.state==="scheduled"&&(Ai.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const $2=t=>t.startsWith("--");function H2(t,e,n){$2(e)?t.style.setProperty(e,n):t.style[e]=n}const z2=bu(()=>window.ScrollTimeline!==void 0),W2={};function q2(t,e){const n=bu(t);return()=>W2[e]??n()}const uy=q2(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),os=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Xf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:os([0,.65,.55,1]),circOut:os([.55,0,1,.45]),backIn:os([.31,.01,.66,-.59]),backOut:os([.33,1.53,.69,.99])};function hy(t,e){if(t)return typeof t=="function"?uy()?oy(t,e):"ease-out":Yv(t)?os(t):Array.isArray(t)?t.map(n=>hy(n,e)||Xf.easeOut):Xf[t]}function G2(t,e,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:o="loop",ease:a="easeOut",times:c}={},l=void 0){const d={[e]:n};c&&(d.offset=c);const u=hy(a,r);Array.isArray(u)&&(d.easing=u);const h={delay:i,duration:r,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return l&&(h.pseudoElement=l),t.animate(d,h)}function fy(t){return typeof t=="function"&&"applyToOptions"in t}function K2({type:t,...e}){return fy(t)&&uy()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Z2 extends Mu{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:i,keyframes:r,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:a,onComplete:c}=e;this.isPseudoElement=!!s,this.allowFlatten=o,this.options=e,On(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=K2(e);this.animation=G2(n,i,r,l,s),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const d=Iu(r,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(d):H2(n,i,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,i;const e=((i=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:i.call(n).duration)||0;return dn(Number(e))}get time(){return dn(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Kt(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&z2()?(this.animation.timeline=e,jt):n(this)}}const my={anticipate:qv,backInOut:Wv,circInOut:Kv};function Y2(t){return t in my}function J2(t){typeof t.ease=="string"&&Y2(t.ease)&&(t.ease=my[t.ease])}const Qf=10;class X2 extends Z2{constructor(e){J2(e),cy(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:i,onComplete:r,element:s,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new Nu({...o,autoplay:!1}),c=Kt(this.finishedTime??this.time);n.setWithVelocity(a.sample(c-Qf).value,a.sample(c).value,Qf),a.stop()}}const em=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(ni.test(t)||t==="0")&&!t.startsWith("url("));function Q2(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function eE(t,e,n,i){const r=t[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const s=t[t.length-1],o=em(r,e),a=em(s,e);return Lr(o===a,`You are trying to animate ${e} from "${r}" to "${s}". "${o?s:r}" is not an animatable value.`,"value-not-animatable"),!o||!a?!1:Q2(t)||(n==="spring"||fy(n))&&i}function ld(t){t.duration=0,t.type}const tE=new Set(["opacity","clipPath","filter","transform"]),nE=bu(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function iE(t){var d;const{motionValue:e,name:n,repeatDelay:i,repeatType:r,damping:s,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:l}=e.owner.getProps();return nE()&&n&&tE.has(n)&&(n!=="transform"||!l)&&!c&&!i&&r!=="mirror"&&s!==0&&o!=="inertia"}const rE=40;class sE extends Mu{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:o="loop",keyframes:a,name:c,motionValue:l,element:d,...u}){var v;super(),this.stop=()=>{var f,y;this._animation&&(this._animation.stop(),(f=this.stopTimeline)==null||f.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=xt.now();const h={autoplay:e,delay:n,type:i,repeat:r,repeatDelay:s,repeatType:o,name:c,motionValue:l,element:d,...u},p=(d==null?void 0:d.KeyframeResolver)||_u;this.keyframeResolver=new p(a,(f,y,b)=>this.onKeyframesResolved(f,y,h,!b),c,l,d),(v=this.keyframeResolver)==null||v.scheduleResolve()}onKeyframesResolved(e,n,i,r){this.keyframeResolver=void 0;const{name:s,type:o,velocity:a,delay:c,isHandoff:l,onUpdate:d}=i;this.resolvedAt=xt.now(),eE(e,s,o,a)||((Dn.instantAnimations||!c)&&(d==null||d(Iu(e,i,n))),e[0]=e[e.length-1],ld(i),i.repeat=0);const h={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>rE?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},p=!l&&iE(h)?new X2({...h,element:h.motionValue.owner.current}):new Nu(h);p.finished.then(()=>this.notifyFinished()).catch(jt),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),B2()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const oE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aE(t){const e=oE.exec(t);if(!e)return[,];const[,n,i,r]=e;return[`--${n??i}`,r]}const cE=4;function py(t,e,n=1){On(n<=cE,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=aE(t);if(!i)return;const s=window.getComputedStyle(e).getPropertyValue(i);if(s){const o=s.trim();return Lv(o)?parseFloat(o):o}return Tu(r)?py(r,e,n+1):r}function Ou(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const gy=new Set(["width","height","top","left","right","bottom",...Fr]),lE={test:t=>t==="auto",parse:t=>t},vy=t=>e=>e.test(t),yy=[Vr,de,un,Wn,QT,XT,lE],tm=t=>yy.find(vy(t));function dE(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Fv(t):!0}const uE=new Set(["brightness","contrast","saturate","opacity"]);function hE(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Eu)||[];if(!i)return t;const r=n.replace(i,"");let s=uE.has(e)?1:0;return i!==n&&(s*=100),e+"("+s+r+")"}const fE=/\b([a-z-]*)\(.*?\)/gu,dd={...ni,getAnimatableNone:t=>{const e=t.match(fE);return e?e.map(hE).join(" "):t}},nm={...Vr,transform:Math.round},mE={rotate:Wn,rotateX:Wn,rotateY:Wn,rotateZ:Wn,scale:eo,scaleX:eo,scaleY:eo,scaleZ:eo,skew:Wn,skewX:Wn,skewY:Wn,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:ws,originX:Hf,originY:Hf,originZ:de},Du={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de,...mE,zIndex:nm,fillOpacity:ws,strokeOpacity:ws,numOctaves:nm},pE={...Du,color:Je,backgroundColor:Je,outlineColor:Je,fill:Je,stroke:Je,borderColor:Je,borderTopColor:Je,borderRightColor:Je,borderBottomColor:Je,borderLeftColor:Je,filter:dd,WebkitFilter:dd},by=t=>pE[t];function xy(t,e){let n=by(t);return n!==dd&&(n=ni),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const gE=new Set(["auto","none","0"]);function vE(t,e,n){let i=0,r;for(;i<t.length&&!r;){const s=t[i];typeof s=="string"&&!gE.has(s)&&Ss(s).values.length&&(r=t[i]),i++}if(r&&n)for(const s of e)t[s]=xy(n,r)}class yE extends _u{constructor(e,n,i,r,s){super(e,n,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let l=e[c];if(typeof l=="string"&&(l=l.trim(),Tu(l))){const d=py(l,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!gy.has(i)||e.length!==2)return;const[r,s]=e,o=tm(r),a=tm(s);if(o!==a)if(Jf(o)&&Jf(a))for(let c=0;c<e.length;c++){const l=e[c];typeof l=="string"&&(e[c]=parseFloat(l))}else Ri[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let r=0;r<e.length;r++)(e[r]===null||dE(e[r]))&&i.push(r);i.length&&vE(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ri[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&e.getValue(i,r).jump(r,!1)}measureEndState(){var a;const{element:e,name:n,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const r=e.getValue(n);r&&r.jump(this.measuredOrigin,!1);const s=i.length-1,o=i[s];i[s]=Ri[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([c,l])=>{e.getValue(c).set(l)}),this.resolveNoneKeyframes()}}function bE(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let i=document;const r=(n==null?void 0:n[t])??i.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}const wy=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Sy(t){return Vv(t)&&"offsetHeight"in t}const im=30,xE=t=>!isNaN(parseFloat(t));class wE{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var s;const r=xt.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=xt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=xE(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&wu(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new xu);const i=this.events[e].add(n);return e==="change"?()=>{i(),je.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=xt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>im)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,im);return Uv(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Pr(t,e){return new wE(t,e)}const{schedule:ju}=Jv(queueMicrotask,!1),$t={x:!1,y:!1};function ky(){return $t.x||$t.y}function SE(t){return t==="x"||t==="y"?$t[t]?null:($t[t]=!0,()=>{$t[t]=!1}):$t.x||$t.y?null:($t.x=$t.y=!0,()=>{$t.x=$t.y=!1})}function Cy(t,e){const n=bE(t),i=new AbortController,r={passive:!0,...e,signal:i.signal};return[n,r,()=>i.abort()]}function rm(t){return!(t.pointerType==="touch"||ky())}function kE(t,e,n={}){const[i,r,s]=Cy(t,n),o=a=>{if(!rm(a))return;const{target:c}=a,l=e(c,a);if(typeof l!="function"||!c)return;const d=u=>{rm(u)&&(l(u),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,r)};return i.forEach(a=>{a.addEventListener("pointerenter",o,r)}),s}const Ty=(t,e)=>e?t===e?!0:Ty(t,e.parentElement):!1,Lu=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,CE=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function TE(t){return CE.has(t.tagName)||t.tabIndex!==-1}const Lo=new WeakSet;function sm(t){return e=>{e.key==="Enter"&&t(e)}}function Ic(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const EE=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=sm(()=>{if(Lo.has(n))return;Ic(n,"down");const r=sm(()=>{Ic(n,"up")}),s=()=>Ic(n,"cancel");n.addEventListener("keyup",r,e),n.addEventListener("blur",s,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function om(t){return Lu(t)&&!ky()}function PE(t,e,n={}){const[i,r,s]=Cy(t,n),o=a=>{const c=a.currentTarget;if(!om(a))return;Lo.add(c);const l=e(c,a),d=(p,v)=>{window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",h),Lo.has(c)&&Lo.delete(c),om(p)&&typeof l=="function"&&l(p,{success:v})},u=p=>{d(p,c===window||c===document||n.useGlobalTarget||Ty(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",u,r),window.addEventListener("pointercancel",h,r)};return i.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),Sy(a)&&(a.addEventListener("focus",l=>EE(l,r)),!TE(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function Ey(t){return Vv(t)&&"ownerSVGElement"in t}function RE(t){return Ey(t)&&t.tagName==="svg"}const mt=t=>!!(t&&t.getVelocity),AE=[...yy,Je,ni],IE=t=>AE.find(vy(t)),Vu=M.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class ME extends g.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=n.offsetParent,r=Sy(i)&&i.offsetWidth||0,s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft,s.right=r-s.width-s.left}return null}componentDidUpdate(){}render(){return this.props.children}}function NE({children:t,isPresent:e,anchorX:n,root:i}){const r=M.useId(),s=M.useRef(null),o=M.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=M.useContext(Vu);return M.useInsertionEffect(()=>{const{width:c,height:l,top:d,left:u,right:h}=o.current;if(e||!s.current||!c||!l)return;const p=n==="left"?`left: ${u}`:`right: ${h}`;s.current.dataset.motionPopId=r;const v=document.createElement("style");a&&(v.nonce=a);const f=i??document.head;return f.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
1
|
+
"use strict";var Nf=Object.defineProperty;var Rf=(e,t,n)=>t in e?Nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Rf(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("react"),J=require("livekit-client"),ke=require("@livekit/components-react"),yo=require("react-dom"),Ds=require("class-variance-authority"),Vf=require("clsx"),gt=require("@mui/icons-material");function Rl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const f=Rl(E),Ls=Rl(yo);var ns={exports:{}},Mn={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ti;function If(){if(Ti)return Mn;Ti=1;var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,d){var u,h={},m=null,g=null;d!==void 0&&(m=""+d),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(g=l.ref);for(u in l)s.call(l,u)&&!i.hasOwnProperty(u)&&(h[u]=l[u]);if(a&&a.defaultProps)for(u in l=a.defaultProps,l)h[u]===void 0&&(h[u]=l[u]);return{$$typeof:t,type:a,key:m,ref:g,props:h,_owner:r.current}}return Mn.Fragment=n,Mn.jsx=o,Mn.jsxs=o,Mn}var Nn={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ji;function Df(){return ji||(ji=1,process.env.NODE_ENV!=="production"&&function(){var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),x=Symbol.iterator,p="@@iterator";function v(C){if(C===null||typeof C!="object")return null;var R=x&&C[x]||C[p];return typeof R=="function"?R:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(C){{for(var R=arguments.length,z=new Array(R>1?R-1:0),ie=1;ie<R;ie++)z[ie-1]=arguments[ie];w("error",C,z)}}function w(C,R,z){{var ie=b.ReactDebugCurrentFrame,he=ie.getStackAddendum();he!==""&&(R+="%s",z=z.concat([he]));var ge=z.map(function(fe){return String(fe)});ge.unshift("Warning: "+R),Function.prototype.apply.call(console[C],console,ge)}}var S=!1,k=!1,T=!1,A=!1,j=!1,V;V=Symbol.for("react.module.reference");function I(C){return!!(typeof C=="string"||typeof C=="function"||C===s||C===i||j||C===r||C===d||C===u||A||C===g||S||k||T||typeof C=="object"&&C!==null&&(C.$$typeof===m||C.$$typeof===h||C.$$typeof===o||C.$$typeof===a||C.$$typeof===l||C.$$typeof===V||C.getModuleId!==void 0))}function $(C,R,z){var ie=C.displayName;if(ie)return ie;var he=R.displayName||R.name||"";return he!==""?z+"("+he+")":z}function F(C){return C.displayName||"Context"}function se(C){if(C==null)return null;if(typeof C.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof C=="function")return C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case s:return"Fragment";case n:return"Portal";case i:return"Profiler";case r:return"StrictMode";case d:return"Suspense";case u:return"SuspenseList"}if(typeof C=="object")switch(C.$$typeof){case a:var R=C;return F(R)+".Consumer";case o:var z=C;return F(z._context)+".Provider";case l:return $(C,C.render,"ForwardRef");case h:var ie=C.displayName||null;return ie!==null?ie:se(C.type)||"Memo";case m:{var he=C,ge=he._payload,fe=he._init;try{return se(fe(ge))}catch{return null}}}return null}var Z=Object.assign,ee=0,G,O,P,B,X,_,re;function M(){}M.__reactDisabledLog=!0;function H(){{if(ee===0){G=console.log,O=console.info,P=console.warn,B=console.error,X=console.group,_=console.groupCollapsed,re=console.groupEnd;var C={configurable:!0,enumerable:!0,value:M,writable:!0};Object.defineProperties(console,{info:C,log:C,warn:C,error:C,group:C,groupCollapsed:C,groupEnd:C})}ee++}}function q(){{if(ee--,ee===0){var C={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Z({},C,{value:G}),info:Z({},C,{value:O}),warn:Z({},C,{value:P}),error:Z({},C,{value:B}),group:Z({},C,{value:X}),groupCollapsed:Z({},C,{value:_}),groupEnd:Z({},C,{value:re})})}ee<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var U=b.ReactCurrentDispatcher,N;function L(C,R,z){{if(N===void 0)try{throw Error()}catch(he){var ie=he.stack.trim().match(/\n( *(at )?)/);N=ie&&ie[1]||""}return`
|
|
18
|
+
`+N+C}}var W=!1,D;{var ne=typeof WeakMap=="function"?WeakMap:Map;D=new ne}function te(C,R){if(!C||W)return"";{var z=D.get(C);if(z!==void 0)return z}var ie;W=!0;var he=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=U.current,U.current=null,H();try{if(R){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(Be){ie=Be}Reflect.construct(C,[],fe)}else{try{fe.call()}catch(Be){ie=Be}C.call(fe.prototype)}}else{try{throw Error()}catch(Be){ie=Be}C()}}catch(Be){if(Be&&ie&&typeof Be.stack=="string"){for(var ue=Be.stack.split(`
|
|
19
|
+
`),Oe=ie.stack.split(`
|
|
20
|
+
`),Se=ue.length-1,Te=Oe.length-1;Se>=1&&Te>=0&&ue[Se]!==Oe[Te];)Te--;for(;Se>=1&&Te>=0;Se--,Te--)if(ue[Se]!==Oe[Te]){if(Se!==1||Te!==1)do if(Se--,Te--,Te<0||ue[Se]!==Oe[Te]){var We=`
|
|
21
|
+
`+ue[Se].replace(" at new "," at ");return C.displayName&&We.includes("<anonymous>")&&(We=We.replace("<anonymous>",C.displayName)),typeof C=="function"&&D.set(C,We),We}while(Se>=1&&Te>=0);break}}}finally{W=!1,U.current=ge,q(),Error.prepareStackTrace=he}var Xt=C?C.displayName||C.name:"",It=Xt?L(Xt):"";return typeof C=="function"&&D.set(C,It),It}function de(C,R,z){return te(C,!1)}function me(C){var R=C.prototype;return!!(R&&R.isReactComponent)}function Ae(C,R,z){if(C==null)return"";if(typeof C=="function")return te(C,me(C));if(typeof C=="string")return L(C);switch(C){case d:return L("Suspense");case u:return L("SuspenseList")}if(typeof C=="object")switch(C.$$typeof){case l:return de(C.render);case h:return Ae(C.type,R,z);case m:{var ie=C,he=ie._payload,ge=ie._init;try{return Ae(ge(he),R,z)}catch{}}}return""}var De=Object.prototype.hasOwnProperty,rt={},ot=b.ReactDebugCurrentFrame;function Fe(C){if(C){var R=C._owner,z=Ae(C.type,C._source,R?R.type:null);ot.setExtraStackFrame(z)}else ot.setExtraStackFrame(null)}function Gs(C,R,z,ie,he){{var ge=Function.call.bind(De);for(var fe in C)if(ge(C,fe)){var ue=void 0;try{if(typeof C[fe]!="function"){var Oe=Error((ie||"React class")+": "+z+" type `"+fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof C[fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Oe.name="Invariant Violation",Oe}ue=C[fe](R,fe,ie,z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ue=Se}ue&&!(ue instanceof Error)&&(Fe(he),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ie||"React class",z,fe,typeof ue),Fe(null)),ue instanceof Error&&!(ue.message in rt)&&(rt[ue.message]=!0,Fe(he),y("Failed %s type: %s",z,ue.message),Fe(null))}}}var Xs=Array.isArray;function Rt(C){return Xs(C)}function Tn(C){{var R=typeof Symbol=="function"&&Symbol.toStringTag,z=R&&C[Symbol.toStringTag]||C.constructor.name||"Object";return z}}function jn(C){try{return Yt(C),!1}catch{return!0}}function Yt(C){return""+C}function Vt(C){if(jn(C))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Tn(C)),Yt(C)}var Pn=b.ReactCurrentOwner,ae={key:!0,ref:!0,__self:!0,__source:!0},qe,$e;function xe(C){if(De.call(C,"ref")){var R=Object.getOwnPropertyDescriptor(C,"ref").get;if(R&&R.isReactWarning)return!1}return C.ref!==void 0}function qs(C){if(De.call(C,"key")){var R=Object.getOwnPropertyDescriptor(C,"key").get;if(R&&R.isReactWarning)return!1}return C.key!==void 0}function gf(C,R){typeof C.ref=="string"&&Pn.current}function xf(C,R){{var z=function(){qe||(qe=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};z.isReactWarning=!0,Object.defineProperty(C,"key",{get:z,configurable:!0})}}function yf(C,R){{var z=function(){$e||($e=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};z.isReactWarning=!0,Object.defineProperty(C,"ref",{get:z,configurable:!0})}}var vf=function(C,R,z,ie,he,ge,fe){var ue={$$typeof:t,type:C,key:R,ref:z,props:fe,_owner:ge};return ue._store={},Object.defineProperty(ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.defineProperty(ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:he}),Object.freeze&&(Object.freeze(ue.props),Object.freeze(ue)),ue};function bf(C,R,z,ie,he){{var ge,fe={},ue=null,Oe=null;z!==void 0&&(Vt(z),ue=""+z),qs(R)&&(Vt(R.key),ue=""+R.key),xe(R)&&(Oe=R.ref,gf(R,he));for(ge in R)De.call(R,ge)&&!ae.hasOwnProperty(ge)&&(fe[ge]=R[ge]);if(C&&C.defaultProps){var Se=C.defaultProps;for(ge in Se)fe[ge]===void 0&&(fe[ge]=Se[ge])}if(ue||Oe){var Te=typeof C=="function"?C.displayName||C.name||"Unknown":C;ue&&xf(fe,Te),Oe&&yf(fe,Te)}return vf(C,ue,Oe,he,ie,Pn.current,fe)}}var Js=b.ReactCurrentOwner,bi=b.ReactDebugCurrentFrame;function Gt(C){if(C){var R=C._owner,z=Ae(C.type,C._source,R?R.type:null);bi.setExtraStackFrame(z)}else bi.setExtraStackFrame(null)}var Qs;Qs=!1;function er(C){return typeof C=="object"&&C!==null&&C.$$typeof===t}function wi(){{if(Js.current){var C=se(Js.current.type);if(C)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+C+"`."}return""}}function wf(C){return""}var Si={};function Sf(C){{var R=wi();if(!R){var z=typeof C=="string"?C:C.displayName||C.name;z&&(R=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+z+">.")}return R}}function Ci(C,R){{if(!C._store||C._store.validated||C.key!=null)return;C._store.validated=!0;var z=Sf(R);if(Si[z])return;Si[z]=!0;var ie="";C&&C._owner&&C._owner!==Js.current&&(ie=" It was passed a child from "+se(C._owner.type)+"."),Gt(C),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',z,ie),Gt(null)}}function Ei(C,R){{if(typeof C!="object")return;if(Rt(C))for(var z=0;z<C.length;z++){var ie=C[z];er(ie)&&Ci(ie,R)}else if(er(C))C._store&&(C._store.validated=!0);else if(C){var he=v(C);if(typeof he=="function"&&he!==C.entries)for(var ge=he.call(C),fe;!(fe=ge.next()).done;)er(fe.value)&&Ci(fe.value,R)}}}function Cf(C){{var R=C.type;if(R==null||typeof R=="string")return;var z;if(typeof R=="function")z=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===l||R.$$typeof===h))z=R.propTypes;else return;if(z){var ie=se(R);Gs(z,C.props,"prop",ie,C)}else if(R.PropTypes!==void 0&&!Qs){Qs=!0;var he=se(R);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",he||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ef(C){{for(var R=Object.keys(C.props),z=0;z<R.length;z++){var ie=R[z];if(ie!=="children"&&ie!=="key"){Gt(C),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ie),Gt(null);break}}C.ref!==null&&(Gt(C),y("Invalid attribute `ref` supplied to `React.Fragment`."),Gt(null))}}var ki={};function Ai(C,R,z,ie,he,ge){{var fe=I(C);if(!fe){var ue="";(C===void 0||typeof C=="object"&&C!==null&&Object.keys(C).length===0)&&(ue+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Oe=wf();Oe?ue+=Oe:ue+=wi();var Se;C===null?Se="null":Rt(C)?Se="array":C!==void 0&&C.$$typeof===t?(Se="<"+(se(C.type)||"Unknown")+" />",ue=" Did you accidentally export a JSX literal instead of a component?"):Se=typeof C,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Se,ue)}var Te=bf(C,R,z,he,ge);if(Te==null)return Te;if(fe){var We=R.children;if(We!==void 0)if(ie)if(Rt(We)){for(var Xt=0;Xt<We.length;Xt++)Ei(We[Xt],C);Object.freeze&&Object.freeze(We)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ei(We,C)}if(De.call(R,"key")){var It=se(C),Be=Object.keys(R).filter(function(Mf){return Mf!=="key"}),tr=Be.length>0?"{key: someKey, "+Be.join(": ..., ")+": ...}":"{key: someKey}";if(!ki[It+tr]){var Pf=Be.length>0?"{"+Be.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,tr,It,Pf,It),ki[It+tr]=!0}}return C===s?Ef(Te):Cf(Te),Te}}function kf(C,R,z){return Ai(C,R,z,!0)}function Af(C,R,z){return Ai(C,R,z,!1)}var Tf=Af,jf=kf;Nn.Fragment=s,Nn.jsx=Tf,Nn.jsxs=jf}()),Nn}var Pi;function Lf(){return Pi||(Pi=1,process.env.NODE_ENV==="production"?ns.exports=If():ns.exports=Df()),ns.exports}var c=Lf();const vo=E.createContext({});function bo(e){const t=E.useRef(null);return t.current===null&&(t.current=e()),t.current}const wo=typeof window<"u",Vl=wo?E.useLayoutEffect:E.useEffect,Fs=E.createContext(null);function So(e,t){e.indexOf(t)===-1&&e.push(t)}function Co(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const xt=(e,t,n)=>n>t?t:n<e?e:n;function Rr(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let yn=()=>{},yt=()=>{};process.env.NODE_ENV!=="production"&&(yn=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(Rr(t,n))},yt=(e,t,n)=>{if(!e)throw new Error(Rr(t,n))});const vt={},Il=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Dl(e){return typeof e=="object"&&e!==null}const Ll=e=>/^0[^.\s]+$/u.test(e);function Eo(e){let t;return()=>(t===void 0&&(t=e()),t)}const Xe=e=>e,Ff=(e,t)=>n=>t(e(n)),Gn=(...e)=>e.reduce(Ff),$n=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class ko{constructor(){this.subscriptions=[]}add(t){return So(this.subscriptions,t),()=>Co(this.subscriptions,t)}notify(t,n,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,s);else for(let i=0;i<r;i++){const o=this.subscriptions[i];o&&o(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const et=e=>e*1e3,lt=e=>e/1e3;function Fl(e,t){return t?e*(1e3/t):0}const Mi=new Set;function Ao(e,t,n){e||Mi.has(t)||(console.warn(Rr(t,n)),Mi.add(t))}const Ol=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Of=1e-7,_f=12;function $f(e,t,n,s,r){let i,o,a=0;do o=t+(n-t)/2,i=Ol(o,s,r)-e,i>0?n=o:t=o;while(Math.abs(i)>Of&&++a<_f);return o}function Xn(e,t,n,s){if(e===t&&n===s)return Xe;const r=i=>$f(i,0,1,e,n);return i=>i===0||i===1?i:Ol(r(i),t,s)}const _l=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$l=e=>t=>1-e(1-t),Bl=Xn(.33,1.53,.69,.99),To=$l(Bl),Hl=_l(To),Ul=e=>(e*=2)<1?.5*To(e):.5*(2-Math.pow(2,-10*(e-1))),jo=e=>1-Math.sin(Math.acos(e)),zl=$l(jo),Zl=_l(jo),Bf=Xn(.42,0,1,1),Hf=Xn(0,0,.58,1),Wl=Xn(.42,0,.58,1),Uf=e=>Array.isArray(e)&&typeof e[0]!="number",Kl=e=>Array.isArray(e)&&typeof e[0]=="number",Ni={linear:Xe,easeIn:Bf,easeInOut:Wl,easeOut:Hf,circIn:jo,circInOut:Zl,circOut:zl,backIn:To,backInOut:Hl,backOut:Bl,anticipate:Ul},zf=e=>typeof e=="string",Ri=e=>{if(Kl(e)){yt(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,s,r]=e;return Xn(t,n,s,r)}else if(zf(e))return yt(Ni[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),Ni[e];return e},ss=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Zf(e,t){let n=new Set,s=new Set,r=!1,i=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){o.has(u)&&(d.schedule(u),e()),u(a)}const d={schedule:(u,h=!1,m=!1)=>{const x=m&&r?n:s;return h&&o.add(u),x.has(u)||x.add(u),u},cancel:u=>{s.delete(u),o.delete(u)},process:u=>{if(a=u,r){i=!0;return}r=!0,[n,s]=[s,n],n.forEach(l),n.clear(),r=!1,i&&(i=!1,d.process(u))}};return d}const Wf=40;function Yl(e,t){let n=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=ss.reduce((w,S)=>(w[S]=Zf(i),w),{}),{setup:a,read:l,resolveKeyframes:d,preUpdate:u,update:h,preRender:m,render:g,postRender:x}=o,p=()=>{const w=vt.useManualTiming?r.timestamp:performance.now();n=!1,vt.useManualTiming||(r.delta=s?1e3/60:Math.max(Math.min(w-r.timestamp,Wf),1)),r.timestamp=w,r.isProcessing=!0,a.process(r),l.process(r),d.process(r),u.process(r),h.process(r),m.process(r),g.process(r),x.process(r),r.isProcessing=!1,n&&t&&(s=!1,e(p))},v=()=>{n=!0,s=!0,r.isProcessing||e(p)};return{schedule:ss.reduce((w,S)=>{const k=o[S];return w[S]=(T,A=!1,j=!1)=>(n||v(),k.schedule(T,A,j)),w},{}),cancel:w=>{for(let S=0;S<ss.length;S++)o[ss[S]].cancel(w)},state:r,steps:o}}const{schedule:ye,cancel:kt,state:Ne,steps:nr}=Yl(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xe,!0);let gs;function Kf(){gs=void 0}const He={now:()=>(gs===void 0&&He.set(Ne.isProcessing||vt.useManualTiming?Ne.timestamp:performance.now()),gs),set:e=>{gs=e,queueMicrotask(Kf)}},Gl=e=>t=>typeof t=="string"&&t.startsWith(e),Po=Gl("--"),Yf=Gl("var(--"),Mo=e=>Yf(e)?Gf.test(e.split("/*")[0].trim()):!1,Gf=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vn={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Bn={...vn,transform:e=>xt(0,1,e)},rs={...vn,default:1},Ln=e=>Math.round(e*1e5)/1e5,No=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Xf(e){return e==null}const qf=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ro=(e,t)=>n=>!!(typeof n=="string"&&qf.test(n)&&n.startsWith(e)||t&&!Xf(n)&&Object.prototype.hasOwnProperty.call(n,t)),Xl=(e,t,n)=>s=>{if(typeof s!="string")return s;const[r,i,o,a]=s.match(No);return{[e]:parseFloat(r),[t]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Jf=e=>xt(0,255,e),sr={...vn,transform:e=>Math.round(Jf(e))},Ot={test:Ro("rgb","red"),parse:Xl("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+sr.transform(e)+", "+sr.transform(t)+", "+sr.transform(n)+", "+Ln(Bn.transform(s))+")"};function Qf(e){let t="",n="",s="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,s+=s,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const Vr={test:Ro("#"),parse:Qf,transform:Ot.transform},qn=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ct=qn("deg"),ct=qn("%"),oe=qn("px"),eh=qn("vh"),th=qn("vw"),Vi={...ct,parse:e=>ct.parse(e)/100,transform:e=>ct.transform(e*100)},sn={test:Ro("hsl","hue"),parse:Xl("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+ct.transform(Ln(t))+", "+ct.transform(Ln(n))+", "+Ln(Bn.transform(s))+")"},Pe={test:e=>Ot.test(e)||Vr.test(e)||sn.test(e),parse:e=>Ot.test(e)?Ot.parse(e):sn.test(e)?sn.parse(e):Vr.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ot.transform(e):sn.transform(e),getAnimatableNone:e=>{const t=Pe.parse(e);return t.alpha=0,Pe.transform(t)}},nh=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function sh(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(No))==null?void 0:t.length)||0)+(((n=e.match(nh))==null?void 0:n.length)||0)>0}const ql="number",Jl="color",rh="var",oh="var(",Ii="${}",ih=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Hn(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},r=[];let i=0;const a=t.replace(ih,l=>(Pe.test(l)?(s.color.push(i),r.push(Jl),n.push(Pe.parse(l))):l.startsWith(oh)?(s.var.push(i),r.push(rh),n.push(l)):(s.number.push(i),r.push(ql),n.push(parseFloat(l))),++i,Ii)).split(Ii);return{values:n,split:a,indexes:s,types:r}}function Ql(e){return Hn(e).values}function ec(e){const{split:t,types:n}=Hn(e),s=t.length;return r=>{let i="";for(let o=0;o<s;o++)if(i+=t[o],r[o]!==void 0){const a=n[o];a===ql?i+=Ln(r[o]):a===Jl?i+=Pe.transform(r[o]):i+=r[o]}return i}}const ah=e=>typeof e=="number"?0:Pe.test(e)?Pe.getAnimatableNone(e):e;function lh(e){const t=Ql(e);return ec(e)(t.map(ah))}const At={test:sh,parse:Ql,createTransformer:ec,getAnimatableNone:lh};function rr(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function ch({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let r=0,i=0,o=0;if(!t)r=i=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=rr(l,a,e+1/3),i=rr(l,a,e),o=rr(l,a,e-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:s}}function ks(e,t){return n=>n>0?t:e}const be=(e,t,n)=>e+(t-e)*n,or=(e,t,n)=>{const s=e*e,r=n*(t*t-s)+s;return r<0?0:Math.sqrt(r)},dh=[Vr,Ot,sn],uh=e=>dh.find(t=>t.test(e));function Di(e){const t=uh(e);if(yn(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===sn&&(n=ch(n)),n}const Li=(e,t)=>{const n=Di(e),s=Di(t);if(!n||!s)return ks(e,t);const r={...n};return i=>(r.red=or(n.red,s.red,i),r.green=or(n.green,s.green,i),r.blue=or(n.blue,s.blue,i),r.alpha=be(n.alpha,s.alpha,i),Ot.transform(r))},Ir=new Set(["none","hidden"]);function fh(e,t){return Ir.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function hh(e,t){return n=>be(e,t,n)}function Vo(e){return typeof e=="number"?hh:typeof e=="string"?Mo(e)?ks:Pe.test(e)?Li:gh:Array.isArray(e)?tc:typeof e=="object"?Pe.test(e)?Li:mh:ks}function tc(e,t){const n=[...e],s=n.length,r=e.map((i,o)=>Vo(i)(i,t[o]));return i=>{for(let o=0;o<s;o++)n[o]=r[o](i);return n}}function mh(e,t){const n={...e,...t},s={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(s[r]=Vo(e[r])(e[r],t[r]));return r=>{for(const i in s)n[i]=s[i](r);return n}}function ph(e,t){const n=[],s={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const i=t.types[r],o=e.indexes[i][s[i]],a=e.values[o]??0;n[r]=a,s[i]++}return n}const gh=(e,t)=>{const n=At.createTransformer(t),s=Hn(e),r=Hn(t);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?Ir.has(e)&&!r.values.length||Ir.has(t)&&!s.values.length?fh(e,t):Gn(tc(ph(s,r),r.values),n):(yn(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),ks(e,t))};function nc(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?be(e,t,n):Vo(e)(e,t)}const xh=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ye.update(t,n),stop:()=>kt(t),now:()=>Ne.isProcessing?Ne.timestamp:He.now()}},sc=(e,t,n=10)=>{let s="";const r=Math.max(Math.round(t/n),2);for(let i=0;i<r;i++)s+=Math.round(e(i/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},As=2e4;function Io(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<As;)t+=n,s=e.next(t);return t>=As?1/0:t}function yh(e,t=100,n){const s=n({...e,keyframes:[0,t]}),r=Math.min(Io(s),As);return{type:"keyframes",ease:i=>s.next(r*i).value/t,duration:lt(r)}}const vh=5;function rc(e,t,n){const s=Math.max(t-vh,0);return Fl(n-e(s),t-s)}const ve={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ir=.001;function bh({duration:e=ve.duration,bounce:t=ve.bounce,velocity:n=ve.velocity,mass:s=ve.mass}){let r,i;yn(e<=et(ve.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-t;o=xt(ve.minDamping,ve.maxDamping,o),e=xt(ve.minDuration,ve.maxDuration,lt(e)),o<1?(r=d=>{const u=d*o,h=u*e,m=u-n,g=Dr(d,o),x=Math.exp(-h);return ir-m/g*x},i=d=>{const h=d*o*e,m=h*n+n,g=Math.pow(o,2)*Math.pow(d,2)*e,x=Math.exp(-h),p=Dr(Math.pow(d,2),o);return(-r(d)+ir>0?-1:1)*((m-g)*x)/p}):(r=d=>{const u=Math.exp(-d*e),h=(d-n)*e+1;return-ir+u*h},i=d=>{const u=Math.exp(-d*e),h=(n-d)*(e*e);return u*h});const a=5/e,l=Sh(r,i,a);if(e=et(e),isNaN(l))return{stiffness:ve.stiffness,damping:ve.damping,duration:e};{const d=Math.pow(l,2)*s;return{stiffness:d,damping:o*2*Math.sqrt(s*d),duration:e}}}const wh=12;function Sh(e,t,n){let s=n;for(let r=1;r<wh;r++)s=s-e(s)/t(s);return s}function Dr(e,t){return e*Math.sqrt(1-t*t)}const Ch=["duration","bounce"],Eh=["stiffness","damping","mass"];function Fi(e,t){return t.some(n=>e[n]!==void 0)}function kh(e){let t={velocity:ve.velocity,stiffness:ve.stiffness,damping:ve.damping,mass:ve.mass,isResolvedFromDuration:!1,...e};if(!Fi(e,Eh)&&Fi(e,Ch))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),r=s*s,i=2*xt(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:ve.mass,stiffness:r,damping:i}}else{const n=bh(e);t={...t,...n,mass:ve.mass},t.isResolvedFromDuration=!0}return t}function Ts(e=ve.visualDuration,t=ve.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:r}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:d,mass:u,duration:h,velocity:m,isResolvedFromDuration:g}=kh({...n,velocity:-lt(n.velocity||0)}),x=m||0,p=d/(2*Math.sqrt(l*u)),v=o-i,b=lt(Math.sqrt(l/u)),y=Math.abs(v)<5;s||(s=y?ve.restSpeed.granular:ve.restSpeed.default),r||(r=y?ve.restDelta.granular:ve.restDelta.default);let w;if(p<1){const k=Dr(b,p);w=T=>{const A=Math.exp(-p*b*T);return o-A*((x+p*b*v)/k*Math.sin(k*T)+v*Math.cos(k*T))}}else if(p===1)w=k=>o-Math.exp(-b*k)*(v+(x+b*v)*k);else{const k=b*Math.sqrt(p*p-1);w=T=>{const A=Math.exp(-p*b*T),j=Math.min(k*T,300);return o-A*((x+p*b*v)*Math.sinh(j)+k*v*Math.cosh(j))/k}}const S={calculatedDuration:g&&h||null,next:k=>{const T=w(k);if(g)a.done=k>=h;else{let A=k===0?x:0;p<1&&(A=k===0?et(x):rc(w,k,T));const j=Math.abs(A)<=s,V=Math.abs(o-T)<=r;a.done=j&&V}return a.value=a.done?o:T,a},toString:()=>{const k=Math.min(Io(S),As),T=sc(A=>S.next(k*A).value,k,30);return k+"ms "+T},toTransition:()=>{}};return S}Ts.applyToOptions=e=>{const t=yh(e,100,Ts);return e.ease=t.ease,e.duration=et(t.duration),e.type="keyframes",e};function Lr({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:d=.5,restSpeed:u}){const h=e[0],m={done:!1,value:h},g=j=>a!==void 0&&j<a||l!==void 0&&j>l,x=j=>a===void 0?l:l===void 0||Math.abs(a-j)<Math.abs(l-j)?a:l;let p=n*t;const v=h+p,b=o===void 0?v:o(v);b!==v&&(p=b-h);const y=j=>-p*Math.exp(-j/s),w=j=>b+y(j),S=j=>{const V=y(j),I=w(j);m.done=Math.abs(V)<=d,m.value=m.done?b:I};let k,T;const A=j=>{g(m.value)&&(k=j,T=Ts({keyframes:[m.value,x(m.value)],velocity:rc(w,j,m.value),damping:r,stiffness:i,restDelta:d,restSpeed:u}))};return A(0),{calculatedDuration:null,next:j=>{let V=!1;return!T&&k===void 0&&(V=!0,S(j),A(j)),k!==void 0&&j>=k?T.next(j-k):(!V&&S(j),m)}}}function Ah(e,t,n){const s=[],r=n||vt.mix||nc,i=e.length-1;for(let o=0;o<i;o++){let a=r(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]||Xe:t;a=Gn(l,a)}s.push(a)}return s}function Th(e,t,{clamp:n=!0,ease:s,mixer:r}={}){const i=e.length;if(yt(i===t.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Ah(t,s,r),l=a.length,d=u=>{if(o&&u<e[0])return t[0];let h=0;if(l>1)for(;h<e.length-2&&!(u<e[h+1]);h++);const m=$n(e[h],e[h+1],u);return a[h](m)};return n?u=>d(xt(e[0],e[i-1],u)):d}function jh(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const r=$n(0,t,s);e.push(be(n,1,r))}}function Ph(e){const t=[0];return jh(t,e.length-1),t}function Mh(e,t){return e.map(n=>n*t)}function Nh(e,t){return e.map(()=>t||Wl).splice(0,e.length-1)}function rn({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const r=Uf(s)?s.map(Ri):Ri(s),i={done:!1,value:t[0]},o=Mh(n&&n.length===t.length?n:Ph(t),e),a=Th(o,t,{ease:Array.isArray(r)?r:Nh(t,r)});return{calculatedDuration:e,next:l=>(i.value=a(l),i.done=l>=e,i)}}const Rh=e=>e!==null;function Do(e,{repeat:t,repeatType:n="loop"},s,r=1){const i=e.filter(Rh),a=r<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!a||s===void 0?i[a]:s}const Vh={decay:Lr,inertia:Lr,tween:rn,keyframes:rn,spring:Ts};function oc(e){typeof e.type=="string"&&(e.type=Vh[e.type])}class Lo{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Ih=e=>e/100;class Fo extends Lo{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,r;const{motionValue:n}=this.options;n&&n.updatedAt!==He.now()&&this.tick(He.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(s=this.options).onStop)==null||r.call(s))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;oc(t);const{type:n=rn,repeat:s=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=t;let{keyframes:a}=t;const l=n||rn;process.env.NODE_ENV!=="production"&&l!==rn&&yt(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),l!==rn&&typeof a[0]!="number"&&(this.mixKeyframes=Gn(Ih,nc(a[0],a[1])),a=[0,100]);const d=l({...t,keyframes:a});i==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=Io(d));const{calculatedDuration:u}=d;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:r,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return s.next(0);const{delay:d=0,keyframes:u,repeat:h,repeatType:m,repeatDelay:g,type:x,onUpdate:p,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const b=this.currentTime-d*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?b<0:b>r;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let w=this.currentTime,S=s;if(h){const j=Math.min(this.currentTime,r)/a;let V=Math.floor(j),I=j%1;!I&&j>=1&&(I=1),I===1&&V--,V=Math.min(V,h+1),!!(V%2)&&(m==="reverse"?(I=1-I,g&&(I-=g/a)):m==="mirror"&&(S=o)),w=xt(0,1,I)*a}const k=y?{done:!1,value:u[0]}:S.next(w);i&&(k.value=i(k.value));let{done:T}=k;!y&&l!==null&&(T=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return A&&x!==Lr&&(k.value=Do(u,this.options,v,this.speed)),p&&p(k.value),A&&this.finish(),k}then(t,n){return this.finished.then(t,n)}get duration(){return lt(this.calculatedDuration)}get time(){return lt(this.currentTime)}set time(t){var n;t=et(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(He.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=lt(this.currentTime))}play(){var r,i;if(this.isStopped)return;const{driver:t=xh,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(i=(r=this.options).onPlay)==null||i.call(r);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(He.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function Dh(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const _t=e=>e*180/Math.PI,Fr=e=>{const t=_t(Math.atan2(e[1],e[0]));return Or(t)},Lh={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Fr,rotateZ:Fr,skewX:e=>_t(Math.atan(e[1])),skewY:e=>_t(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Or=e=>(e=e%360,e<0&&(e+=360),e),Oi=Fr,_i=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),$i=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Fh={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:_i,scaleY:$i,scale:e=>(_i(e)+$i(e))/2,rotateX:e=>Or(_t(Math.atan2(e[6],e[5]))),rotateY:e=>Or(_t(Math.atan2(-e[2],e[0]))),rotateZ:Oi,rotate:Oi,skewX:e=>_t(Math.atan(e[4])),skewY:e=>_t(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _r(e){return e.includes("scale")?1:0}function $r(e,t){if(!e||e==="none")return _r(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(n)s=Fh,r=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Lh,r=a}if(!r)return _r(t);const i=s[t],o=r[1].split(",").map(_h);return typeof i=="function"?i(o):o[i]}const Oh=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return $r(n,t)};function _h(e){return parseFloat(e.trim())}const bn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],wn=new Set(bn),Bi=e=>e===vn||e===oe,$h=new Set(["x","y","z"]),Bh=bn.filter(e=>!$h.has(e));function Hh(e){const t=[];return Bh.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const $t={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>$r(t,"x"),y:(e,{transform:t})=>$r(t,"y")};$t.translateX=$t.x;$t.translateY=$t.y;const Bt=new Set;let Br=!1,Hr=!1,Ur=!1;function ic(){if(Hr){const e=Array.from(Bt).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const r=Hh(s);r.length&&(n.set(s,r),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const r=n.get(s);r&&r.forEach(([i,o])=>{var a;(a=s.getValue(i))==null||a.set(o)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Hr=!1,Br=!1,Bt.forEach(e=>e.complete(Ur)),Bt.clear()}function ac(){Bt.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Hr=!0)})}function Uh(){Ur=!0,ac(),ic(),Ur=!1}class Oo{constructor(t,n,s,r,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Bt.add(this),Br||(Br=!0,ye.read(ac),ye.resolveKeyframes(ic))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:r}=this;if(t[0]===null){const i=r==null?void 0:r.get(),o=t[t.length-1];if(i!==void 0)t[0]=i;else if(s&&n){const a=s.readValue(n,o);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=o),r&&i===void 0&&r.set(t[0])}Dh(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Bt.delete(this)}cancel(){this.state==="scheduled"&&(Bt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const zh=e=>e.startsWith("--");function Zh(e,t,n){zh(t)?e.style.setProperty(t,n):e.style[t]=n}const Wh=Eo(()=>window.ScrollTimeline!==void 0),Kh={};function Yh(e,t){const n=Eo(e);return()=>Kh[t]??n()}const lc=Yh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),In=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,Hi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:In([0,.65,.55,1]),circOut:In([.55,0,1,.45]),backIn:In([.31,.01,.66,-.59]),backOut:In([.33,1.53,.69,.99])};function cc(e,t){if(e)return typeof e=="function"?lc()?sc(e,t):"ease-out":Kl(e)?In(e):Array.isArray(e)?e.map(n=>cc(n,t)||Hi.easeOut):Hi[e]}function Gh(e,t,n,{delay:s=0,duration:r=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:l}={},d=void 0){const u={[t]:n};l&&(u.offset=l);const h=cc(a,r);Array.isArray(h)&&(u.easing=h);const m={delay:s,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return d&&(m.pseudoElement=d),e.animate(u,m)}function dc(e){return typeof e=="function"&&"applyToOptions"in e}function Xh({type:e,...t}){return dc(e)&&lc()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class qh extends Lo{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:r,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=t,yt(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const d=Xh(t);this.animation=Gh(n,s,r,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const u=Do(r,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(u):Zh(n,s,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,s;const t=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return lt(Number(t))}get time(){return lt(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=et(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Wh()?(this.animation.timeline=t,Xe):n(this)}}const uc={anticipate:Ul,backInOut:Hl,circInOut:Zl};function Jh(e){return e in uc}function Qh(e){typeof e.ease=="string"&&Jh(e.ease)&&(e.ease=uc[e.ease])}const Ui=10;class em extends qh{constructor(t){Qh(t),oc(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:r,element:i,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new Fo({...o,autoplay:!1}),l=et(this.finishedTime??this.time);n.setWithVelocity(a.sample(l-Ui).value,a.sample(l).value,Ui),a.stop()}}const zi=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(At.test(e)||e==="0")&&!e.startsWith("url("));function tm(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function nm(e,t,n,s){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=zi(r,t),a=zi(i,t);return yn(o===a,`You are trying to animate ${t} from "${r}" to "${i}". "${o?i:r}" is not an animatable value.`,"value-not-animatable"),!o||!a?!1:tm(e)||(n==="spring"||dc(n))&&s}function zr(e){e.duration=0,e.type}const sm=new Set(["opacity","clipPath","filter","transform"]),rm=Eo(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function om(e){var u;const{motionValue:t,name:n,repeatDelay:s,repeatType:r,damping:i,type:o}=e;if(!(((u=t==null?void 0:t.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:d}=t.owner.getProps();return rm()&&n&&sm.has(n)&&(n!=="transform"||!d)&&!l&&!s&&r!=="mirror"&&i!==0&&o!=="inertia"}const im=40;class am extends Lo{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",keyframes:a,name:l,motionValue:d,element:u,...h}){var x;super(),this.stop=()=>{var p,v;this._animation&&(this._animation.stop(),(p=this.stopTimeline)==null||p.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=He.now();const m={autoplay:t,delay:n,type:s,repeat:r,repeatDelay:i,repeatType:o,name:l,motionValue:d,element:u,...h},g=(u==null?void 0:u.KeyframeResolver)||Oo;this.keyframeResolver=new g(a,(p,v,b)=>this.onKeyframesResolved(p,v,m,!b),l,d,u),(x=this.keyframeResolver)==null||x.scheduleResolve()}onKeyframesResolved(t,n,s,r){this.keyframeResolver=void 0;const{name:i,type:o,velocity:a,delay:l,isHandoff:d,onUpdate:u}=s;this.resolvedAt=He.now(),nm(t,i,o,a)||((vt.instantAnimations||!l)&&(u==null||u(Do(t,s,n))),t[0]=t[t.length-1],zr(s),s.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>im?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},g=!d&&om(m)?new em({...m,element:m.motionValue.owner.current}):new Fo(m);g.finished.then(()=>this.notifyFinished()).catch(Xe),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Uh()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const lm=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cm(e){const t=lm.exec(e);if(!t)return[,];const[,n,s,r]=t;return[`--${n??s}`,r]}const dm=4;function fc(e,t,n=1){yt(n<=dm,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=cm(e);if(!s)return;const i=window.getComputedStyle(t).getPropertyValue(s);if(i){const o=i.trim();return Il(o)?parseFloat(o):o}return Mo(r)?fc(r,t,n+1):r}function _o(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const hc=new Set(["width","height","top","left","right","bottom",...bn]),um={test:e=>e==="auto",parse:e=>e},mc=e=>t=>t.test(e),pc=[vn,oe,ct,Ct,th,eh,um],Zi=e=>pc.find(mc(e));function fm(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Ll(e):!0}const hm=new Set(["brightness","contrast","saturate","opacity"]);function mm(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(No)||[];if(!s)return e;const r=n.replace(s,"");let i=hm.has(t)?1:0;return s!==n&&(i*=100),t+"("+i+r+")"}const pm=/\b([a-z-]*)\(.*?\)/gu,Zr={...At,getAnimatableNone:e=>{const t=e.match(pm);return t?t.map(mm).join(" "):e}},Wi={...vn,transform:Math.round},gm={rotate:Ct,rotateX:Ct,rotateY:Ct,rotateZ:Ct,scale:rs,scaleX:rs,scaleY:rs,scaleZ:rs,skew:Ct,skewX:Ct,skewY:Ct,distance:oe,translateX:oe,translateY:oe,translateZ:oe,x:oe,y:oe,z:oe,perspective:oe,transformPerspective:oe,opacity:Bn,originX:Vi,originY:Vi,originZ:oe},$o={borderWidth:oe,borderTopWidth:oe,borderRightWidth:oe,borderBottomWidth:oe,borderLeftWidth:oe,borderRadius:oe,radius:oe,borderTopLeftRadius:oe,borderTopRightRadius:oe,borderBottomRightRadius:oe,borderBottomLeftRadius:oe,width:oe,maxWidth:oe,height:oe,maxHeight:oe,top:oe,right:oe,bottom:oe,left:oe,padding:oe,paddingTop:oe,paddingRight:oe,paddingBottom:oe,paddingLeft:oe,margin:oe,marginTop:oe,marginRight:oe,marginBottom:oe,marginLeft:oe,backgroundPositionX:oe,backgroundPositionY:oe,...gm,zIndex:Wi,fillOpacity:Bn,strokeOpacity:Bn,numOctaves:Wi},xm={...$o,color:Pe,backgroundColor:Pe,outlineColor:Pe,fill:Pe,stroke:Pe,borderColor:Pe,borderTopColor:Pe,borderRightColor:Pe,borderBottomColor:Pe,borderLeftColor:Pe,filter:Zr,WebkitFilter:Zr},gc=e=>xm[e];function xc(e,t){let n=gc(e);return n!==Zr&&(n=At),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const ym=new Set(["auto","none","0"]);function vm(e,t,n){let s=0,r;for(;s<e.length&&!r;){const i=e[s];typeof i=="string"&&!ym.has(i)&&Hn(i).values.length&&(r=e[s]),s++}if(r&&n)for(const i of t)e[i]=xc(n,r)}class bm extends Oo{constructor(t,n,s,r,i){super(t,n,s,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l<t.length;l++){let d=t[l];if(typeof d=="string"&&(d=d.trim(),Mo(d))){const u=fc(d,n.current);u!==void 0&&(t[l]=u),l===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!hc.has(s)||t.length!==2)return;const[r,i]=t,o=Zi(r),a=Zi(i);if(o!==a)if(Bi(o)&&Bi(a))for(let l=0;l<t.length;l++){const d=t[l];typeof d=="string"&&(t[l]=parseFloat(d))}else $t[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let r=0;r<t.length;r++)(t[r]===null||fm(t[r]))&&s.push(r);s.length&&vm(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=$t[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&t.getValue(s,r).jump(r,!1)}measureEndState(){var a;const{element:t,name:n,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const r=t.getValue(n);r&&r.jump(this.measuredOrigin,!1);const i=s.length-1,o=s[i];s[i]=$t[n](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,d])=>{t.getValue(l).set(d)}),this.resolveNoneKeyframes()}}function wm(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const r=(n==null?void 0:n[e])??s.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}const yc=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function vc(e){return Dl(e)&&"offsetHeight"in e}const Ki=30,Sm=e=>!isNaN(parseFloat(e));class Cm{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var i;const r=He.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=He.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Sm(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&Ao(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new ko);const s=this.events[t].add(n);return t==="change"?()=>{s(),ye.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=He.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Ki)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Ki);return Fl(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mn(e,t){return new Cm(e,t)}const{schedule:Bo}=Yl(queueMicrotask,!1),Je={x:!1,y:!1};function bc(){return Je.x||Je.y}function Em(e){return e==="x"||e==="y"?Je[e]?null:(Je[e]=!0,()=>{Je[e]=!1}):Je.x||Je.y?null:(Je.x=Je.y=!0,()=>{Je.x=Je.y=!1})}function wc(e,t){const n=wm(e),s=new AbortController,r={passive:!0,...t,signal:s.signal};return[n,r,()=>s.abort()]}function Yi(e){return!(e.pointerType==="touch"||bc())}function km(e,t,n={}){const[s,r,i]=wc(e,n),o=a=>{if(!Yi(a))return;const{target:l}=a,d=t(l,a);if(typeof d!="function"||!l)return;const u=h=>{Yi(h)&&(d(h),l.removeEventListener("pointerleave",u))};l.addEventListener("pointerleave",u,r)};return s.forEach(a=>{a.addEventListener("pointerenter",o,r)}),i}const Sc=(e,t)=>t?e===t?!0:Sc(e,t.parentElement):!1,Ho=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Am=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Tm(e){return Am.has(e.tagName)||e.tabIndex!==-1}const xs=new WeakSet;function Gi(e){return t=>{t.key==="Enter"&&e(t)}}function ar(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const jm=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=Gi(()=>{if(xs.has(n))return;ar(n,"down");const r=Gi(()=>{ar(n,"up")}),i=()=>ar(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function Xi(e){return Ho(e)&&!bc()}function Pm(e,t,n={}){const[s,r,i]=wc(e,n),o=a=>{const l=a.currentTarget;if(!Xi(a))return;xs.add(l);const d=t(l,a),u=(g,x)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),xs.has(l)&&xs.delete(l),Xi(g)&&typeof d=="function"&&d(g,{success:x})},h=g=>{u(g,l===window||l===document||n.useGlobalTarget||Sc(l,g.target))},m=g=>{u(g,!1)};window.addEventListener("pointerup",h,r),window.addEventListener("pointercancel",m,r)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),vc(a)&&(a.addEventListener("focus",d=>jm(d,r)),!Tm(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}function Cc(e){return Dl(e)&&"ownerSVGElement"in e}function Mm(e){return Cc(e)&&e.tagName==="svg"}const Le=e=>!!(e&&e.getVelocity),Nm=[...pc,Pe,At],Rm=e=>Nm.find(mc(e)),Uo=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Vm extends f.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=n.offsetParent,r=vc(s)&&s.offsetWidth||0,i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft,i.right=r-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function Im({children:e,isPresent:t,anchorX:n,root:s}){const r=E.useId(),i=E.useRef(null),o=E.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=E.useContext(Uo);return E.useInsertionEffect(()=>{const{width:l,height:d,top:u,left:h,right:m}=o.current;if(t||!i.current||!l||!d)return;const g=n==="left"?`left: ${h}`:`right: ${m}`;i.current.dataset.motionPopId=r;const x=document.createElement("style");a&&(x.nonce=a);const p=s??document.head;return p.appendChild(x),x.sheet&&x.sheet.insertRule(`
|
|
39
31
|
[data-motion-pop-id="${r}"] {
|
|
40
32
|
position: absolute !important;
|
|
41
|
-
width: ${
|
|
42
|
-
height: ${
|
|
43
|
-
${
|
|
44
|
-
top: ${
|
|
33
|
+
width: ${l}px !important;
|
|
34
|
+
height: ${d}px !important;
|
|
35
|
+
${g}px !important;
|
|
36
|
+
top: ${u}px !important;
|
|
45
37
|
}
|
|
46
|
-
`),()=>{f.contains(v)&&f.removeChild(v)}},[e]),m.jsx(ME,{isPresent:e,childRef:s,sizeRef:o,children:g.cloneElement(t,{ref:s})})}const _E=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:o,anchorX:a,root:c})=>{const l=pu(OE),d=M.useId();let u=!0,h=M.useMemo(()=>(u=!1,{id:d,initial:e,isPresent:n,custom:r,onExitComplete:p=>{l.set(p,!0);for(const v of l.values())if(!v)return;i&&i()},register:p=>(l.set(p,!1),()=>l.delete(p))}),[n,l,i]);return s&&u&&(h={...h}),M.useMemo(()=>{l.forEach((p,v)=>l.set(v,!1))},[n]),g.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),o==="popLayout"&&(t=m.jsx(NE,{isPresent:n,anchorX:a,root:c,children:t})),m.jsx(Ra.Provider,{value:h,children:t})};function OE(){return new Map}function Py(t=!0){const e=M.useContext(Ra);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=e,s=M.useId();M.useEffect(()=>{if(t)return r(s)},[t]);const o=M.useCallback(()=>t&&i&&i(s),[s,i,t]);return!n&&i?[!1,o]:[!0]}const to=t=>t.key||"";function am(t){const e=[];return M.Children.forEach(t,n=>{M.isValidElement(n)&&e.push(n)}),e}const yr=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:o=!1,anchorX:a="left",root:c})=>{const[l,d]=Py(o),u=M.useMemo(()=>am(t),[t]),h=o&&!l?[]:u.map(to),p=M.useRef(!0),v=M.useRef(u),f=pu(()=>new Map),[y,b]=M.useState(u),[S,k]=M.useState(u);jv(()=>{p.current=!1,v.current=u;for(let T=0;T<S.length;T++){const E=to(S[T]);h.includes(E)?f.delete(E):f.get(E)!==!0&&f.set(E,!1)}},[S,h.length,h.join("-")]);const w=[];if(u!==y){let T=[...u];for(let E=0;E<S.length;E++){const P=S[E],I=to(P);h.includes(I)||(T.splice(E,0,P),w.push(P))}return s==="wait"&&w.length&&(T=w),k(am(T)),b(u),null}process.env.NODE_ENV!=="production"&&s==="wait"&&S.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:x}=M.useContext(mu);return m.jsx(m.Fragment,{children:S.map(T=>{const E=to(T),P=o&&!l?!1:u===S||h.includes(E),I=()=>{if(f.has(E))f.set(E,!0);else return;let C=!0;f.forEach(A=>{A||(C=!1)}),C&&(x==null||x(),k(v.current),o&&(d==null||d()),i&&i())};return m.jsx(_E,{isPresent:P,initial:!p.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:c,onExitComplete:P?void 0:I,anchorX:a,children:T},E)})})},Ry=M.createContext({strict:!1}),cm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Rr={};for(const t in cm)Rr[t]={isEnabled:e=>cm[t].some(n=>!!e[n])};function DE(t){for(const e in t)Rr[e]={...Rr[e],...t[e]}}const jE=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ca(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||jE.has(t)}let Ay=t=>!ca(t);function LE(t){typeof t=="function"&&(Ay=e=>e.startsWith("on")?!ca(e):t(e))}try{LE(require("@emotion/is-prop-valid").default)}catch{}function VE(t,e,n){const i={};for(const r in t)r==="values"&&typeof t.values=="object"||(Ay(r)||n===!0&&ca(r)||!e&&!ca(r)||t.draggable&&r.startsWith("onDrag"))&&(i[r]=t[r]);return i}const Aa=M.createContext({});function Ia(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function ks(t){return typeof t=="string"||Array.isArray(t)}const Fu=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Uu=["initial",...Fu];function Ma(t){return Ia(t.animate)||Uu.some(e=>ks(t[e]))}function Iy(t){return!!(Ma(t)||t.variants)}function FE(t,e){if(Ma(t)){const{initial:n,animate:i}=t;return{initial:n===!1||ks(n)?n:void 0,animate:ks(i)?i:void 0}}return t.inherit!==!1?e:{}}function UE(t){const{initial:e,animate:n}=FE(t,M.useContext(Aa));return M.useMemo(()=>({initial:e,animate:n}),[lm(e),lm(n)])}function lm(t){return Array.isArray(t)?t.join(" "):t}const Cs={};function BE(t){for(const e in t)Cs[e]=t[e],Cu(e)&&(Cs[e].isCSSVariable=!0)}function My(t,{layout:e,layoutId:n}){return Ur.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Cs[t]||t==="opacity")}const $E={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},HE=Fr.length;function zE(t,e,n){let i="",r=!0;for(let s=0;s<HE;s++){const o=Fr[s],a=t[o];if(a===void 0)continue;let c=!0;if(typeof a=="number"?c=a===(o.startsWith("scale")?1:0):c=parseFloat(a)===0,!c||n){const l=wy(a,Du[o]);if(!c){r=!1;const d=$E[o]||o;i+=`${d}(${l}) `}n&&(e[o]=l)}}return i=i.trim(),n?i=n(e,r?"":i):r&&(i="none"),i}function Bu(t,e,n){const{style:i,vars:r,transformOrigin:s}=t;let o=!1,a=!1;for(const c in e){const l=e[c];if(Ur.has(c)){o=!0;continue}else if(Cu(c)){r[c]=l;continue}else{const d=wy(l,Du[c]);c.startsWith("origin")?(a=!0,s[c]=d):i[c]=d}}if(e.transform||(o||n?i.transform=zE(e,t.transform,n):i.transform&&(i.transform="none")),a){const{originX:c="50%",originY:l="50%",originZ:d=0}=s;i.transformOrigin=`${c} ${l} ${d}`}}const $u=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ny(t,e,n){for(const i in e)!mt(e[i])&&!My(i,n)&&(t[i]=e[i])}function WE({transformTemplate:t},e){return M.useMemo(()=>{const n=$u();return Bu(n,e,t),Object.assign({},n.vars,n.style)},[e])}function qE(t,e){const n=t.style||{},i={};return Ny(i,n,t),Object.assign(i,WE(t,e)),i}function GE(t,e){const n={},i=qE(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const KE={offset:"stroke-dashoffset",array:"stroke-dasharray"},ZE={offset:"strokeDashoffset",array:"strokeDasharray"};function YE(t,e,n=1,i=0,r=!0){t.pathLength=1;const s=r?KE:ZE;t[s.offset]=de.transform(-i);const o=de.transform(e),a=de.transform(n);t[s.array]=`${o} ${a}`}function _y(t,{attrX:e,attrY:n,attrScale:i,pathLength:r,pathSpacing:s=1,pathOffset:o=0,...a},c,l,d){if(Bu(t,a,l),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:u,style:h}=t;u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete u.transformBox),e!==void 0&&(u.x=e),n!==void 0&&(u.y=n),i!==void 0&&(u.scale=i),r!==void 0&&YE(u,r,s,o,!1)}const Oy=()=>({...$u(),attrs:{}}),Dy=t=>typeof t=="string"&&t.toLowerCase()==="svg";function JE(t,e,n,i){const r=M.useMemo(()=>{const s=Oy();return _y(s,e,Dy(i),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};Ny(s,t.style,t),r.style={...s,...r.style}}return r}const XE=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Hu(t){return typeof t!="string"||t.includes("-")?!1:!!(XE.indexOf(t)>-1||/[A-Z]/u.test(t))}function QE(t,e,n,{latestValues:i},r,s=!1){const a=(Hu(t)?JE:GE)(e,i,r,t),c=VE(e,typeof t=="string",s),l=t!==M.Fragment?{...c,...a,ref:n}:{},{children:d}=e,u=M.useMemo(()=>mt(d)?d.get():d,[d]);return M.createElement(t,{...l,children:u})}function dm(t){const e=[{},{}];return t==null||t.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function zu(t,e,n,i){if(typeof e=="function"){const[r,s]=dm(i);e=e(n!==void 0?n:t.custom,r,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,s]=dm(i);e=e(n!==void 0?n:t.custom,r,s)}return e}function Vo(t){return mt(t)?t.get():t}function eP({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,r){return{latestValues:tP(n,i,r,t),renderState:e()}}function tP(t,e,n,i){const r={},s=i(t,{});for(const h in s)r[h]=Vo(s[h]);let{initial:o,animate:a}=t;const c=Ma(t),l=Iy(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const u=d?a:o;if(u&&typeof u!="boolean"&&!Ia(u)){const h=Array.isArray(u)?u:[u];for(let p=0;p<h.length;p++){const v=zu(t,h[p]);if(v){const{transitionEnd:f,transition:y,...b}=v;for(const S in b){let k=b[S];if(Array.isArray(k)){const w=d?k.length-1:0;k=k[w]}k!==null&&(r[S]=k)}for(const S in f)r[S]=f[S]}}}return r}const jy=t=>(e,n)=>{const i=M.useContext(Aa),r=M.useContext(Ra),s=()=>eP(t,e,i,r);return n?s():pu(s)};function Wu(t,e,n){var s;const{style:i}=t,r={};for(const o in i)(mt(i[o])||e.style&&mt(e.style[o])||My(o,t)||((s=n==null?void 0:n.getValue(o))==null?void 0:s.liveStyle)!==void 0)&&(r[o]=i[o]);return r}const nP=jy({scrapeMotionValuesFromProps:Wu,createRenderState:$u});function Ly(t,e,n){const i=Wu(t,e,n);for(const r in t)if(mt(t[r])||mt(e[r])){const s=Fr.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=t[r]}return i}const iP=jy({scrapeMotionValuesFromProps:Ly,createRenderState:Oy}),rP=Symbol.for("motionComponentSymbol");function cr(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function sP(t,e,n){return M.useCallback(i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):cr(n)&&(n.current=i))},[e])}const qu=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),oP="framerAppearId",Vy="data-"+qu(oP),Fy=M.createContext({});function aP(t,e,n,i,r){var f,y;const{visualElement:s}=M.useContext(Aa),o=M.useContext(Ry),a=M.useContext(Ra),c=M.useContext(Vu).reducedMotion,l=M.useRef(null);i=i||o.renderer,!l.current&&i&&(l.current=i(t,{visualState:e,parent:s,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:c}));const d=l.current,u=M.useContext(Fy);d&&!d.projection&&r&&(d.type==="html"||d.type==="svg")&&cP(l.current,n,r,u);const h=M.useRef(!1);M.useInsertionEffect(()=>{d&&h.current&&d.update(n,a)});const p=n[Vy],v=M.useRef(!!p&&!((f=window.MotionHandoffIsComplete)!=null&&f.call(window,p))&&((y=window.MotionHasOptimisedAnimation)==null?void 0:y.call(window,p)));return jv(()=>{d&&(h.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),v.current&&d.animationState&&d.animationState.animateChanges())}),M.useEffect(()=>{d&&(!v.current&&d.animationState&&d.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var b;(b=window.MotionHandoffMarkAsComplete)==null||b.call(window,p)}),v.current=!1),d.enteringChildren=void 0)}),d}function cP(t,e,n,i){const{layoutId:r,layout:s,drag:o,dragConstraints:a,layoutScroll:c,layoutRoot:l,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Uy(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||a&&cr(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,crossfade:d,layoutScroll:c,layoutRoot:l})}function Uy(t){if(t)return t.options.allowProjection!==!1?t.projection:Uy(t.parent)}function Mc(t,{forwardMotionProps:e=!1}={},n,i){n&&DE(n);const r=Hu(t)?iP:nP;function s(a,c){let l;const d={...M.useContext(Vu),...a,layoutId:lP(a)},{isStatic:u}=d,h=UE(a),p=r(a,u);if(!u&&gu){dP(d,n);const v=uP(d);l=v.MeasureLayout,h.visualElement=aP(t,p,d,i,v.ProjectionNode)}return m.jsxs(Aa.Provider,{value:h,children:[l&&h.visualElement?m.jsx(l,{visualElement:h.visualElement,...d}):null,QE(t,a,sP(p,h.visualElement,c),p,u,e)]})}s.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=M.forwardRef(s);return o[rP]=t,o}function lP({layoutId:t}){const e=M.useContext(mu).id;return e&&t!==void 0?e+"-"+t:t}function dP(t,e){const n=M.useContext(Ry).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const i="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Lr(!1,i,"lazy-strict-mode"):On(!1,i,"lazy-strict-mode")}}function uP(t){const{drag:e,layout:n}=Rr;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function hP(t,e){if(typeof Proxy>"u")return Mc;const n=new Map,i=(s,o)=>Mc(s,o,t,e),r=(s,o)=>(process.env.NODE_ENV!=="production"&&wu(!1,"motion() is deprecated. Use motion.create() instead."),i(s,o));return new Proxy(r,{get:(s,o)=>o==="create"?i:(n.has(o)||n.set(o,Mc(o,void 0,t,e)),n.get(o))})}function By({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function fP({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function mP(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function Nc(t){return t===void 0||t===1}function ud({scale:t,scaleX:e,scaleY:n}){return!Nc(t)||!Nc(e)||!Nc(n)}function Si(t){return ud(t)||$y(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function $y(t){return um(t.x)||um(t.y)}function um(t){return t&&t!=="0%"}function la(t,e,n){const i=t-n,r=e*i;return n+r}function hm(t,e,n,i,r){return r!==void 0&&(t=la(t,r,i)),la(t,n,i)+e}function hd(t,e=0,n=1,i,r){t.min=hm(t.min,e,n,i,r),t.max=hm(t.max,e,n,i,r)}function Hy(t,{x:e,y:n}){hd(t.x,e.translate,e.scale,e.originPoint),hd(t.y,n.translate,n.scale,n.originPoint)}const fm=.999999999999,mm=1.0000000000001;function pP(t,e,n,i=!1){const r=n.length;if(!r)return;e.x=e.y=1;let s,o;for(let a=0;a<r;a++){s=n[a],o=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(i&&s.options.layoutScroll&&s.scroll&&s!==s.root&&dr(t,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Hy(t,o)),i&&Si(s.latestValues)&&dr(t,s.latestValues))}e.x<mm&&e.x>fm&&(e.x=1),e.y<mm&&e.y>fm&&(e.y=1)}function lr(t,e){t.min=t.min+e,t.max=t.max+e}function pm(t,e,n,i,r=.5){const s=Ve(t.min,t.max,r);hd(t,e,n,s,i)}function dr(t,e){pm(t.x,e.x,e.scaleX,e.scale,e.originX),pm(t.y,e.y,e.scaleY,e.scale,e.originY)}function zy(t,e){return By(mP(t.getBoundingClientRect(),e))}function gP(t,e,n){const i=zy(t,n),{scroll:r}=e;return r&&(lr(i.x,r.offset.x),lr(i.y,r.offset.y)),i}const gm=()=>({translate:0,scale:1,origin:0,originPoint:0}),ur=()=>({x:gm(),y:gm()}),vm=()=>({min:0,max:0}),qe=()=>({x:vm(),y:vm()}),fd={current:null},Wy={current:!1};function vP(){if(Wy.current=!0,!!gu)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>fd.current=t.matches;t.addEventListener("change",e),e()}else fd.current=!1}const yP=new WeakMap;function bP(t,e,n){for(const i in e){const r=e[i],s=n[i];if(mt(r))t.addValue(i,r);else if(mt(s))t.addValue(i,Pr(r,{owner:t}));else if(s!==r)if(t.hasValue(i)){const o=t.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=t.getStaticValue(i);t.addValue(i,Pr(o!==void 0?o:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const ym=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class xP{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=_u,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=xt.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,je.render(this.render,!1,!0))};const{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=Ma(n),this.isVariantNode=Iy(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in u){const p=u[h];c[h]!==void 0&&mt(p)&&p.set(c[h])}}mount(e){var n;this.current=e,yP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,r)=>this.bindToMotionValue(r,i)),Wy.current||vP(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:fd.current,process.env.NODE_ENV!=="production"&&wu(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),ti(this.notifyUpdate),ti(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const i=this.features[n];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Ur.has(e);i&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&je.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{r(),s&&s(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Rr){const n=Rr[e];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[e]&&r&&i(this.props)&&(this.features[e]=new r(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):qe()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<ym.length;i++){const r=ym[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const s="on"+r,o=e[s];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=bP(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=Pr(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(Lv(i)||Fv(i))?i=parseFloat(i):!IE(i)&&ni.test(n)&&(i=xy(e,n)),this.setBaseTarget(e,mt(i)?i.get():i)),mt(i)?i.get():i}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var s;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=zu(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!mt(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new xu),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){ju.render(this.render)}}class qy extends xP{constructor(){super(...arguments),this.KeyframeResolver=yE}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;mt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Gy(t,{style:e,vars:n},i,r){const s=t.style;let o;for(o in e)s[o]=e[o];r==null||r.applyProjectionStyles(s,i);for(o in n)s.setProperty(o,n[o])}function wP(t){return window.getComputedStyle(t)}class SP extends qy{constructor(){super(...arguments),this.type="html",this.renderInstance=Gy}readValueFromInstance(e,n){var i;if(Ur.has(n))return(i=this.projection)!=null&&i.isProjecting?rd(n):j2(e,n);{const r=wP(e),s=(Cu(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return zy(e,n)}build(e,n,i){Bu(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return Wu(e,n,i)}}const Ky=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function kP(t,e,n,i){Gy(t,e,void 0,i);for(const r in e.attrs)t.setAttribute(Ky.has(r)?r:qu(r),e.attrs[r])}class CP extends qy{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=qe}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Ur.has(n)){const i=by(n);return i&&i.default||0}return n=Ky.has(n)?n:qu(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return Ly(e,n,i)}build(e,n,i){_y(e,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,n,i,r){kP(e,n,i,r)}mount(e){this.isSVGTag=Dy(e.tagName),super.mount(e)}}const TP=(t,e)=>Hu(t)?new CP(e):new SP(e,{allowProjection:t!==M.Fragment});function br(t,e,n){const i=t.getProps();return zu(i,e,n!==void 0?n:i.custom,t)}const md=t=>Array.isArray(t);function EP(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Pr(n))}function PP(t){return md(t)?t[t.length-1]||0:t}function RP(t,e){const n=br(t,e);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const o in s){const a=PP(s[o]);EP(t,o,a)}}function AP(t){return!!(mt(t)&&t.add)}function pd(t,e){const n=t.getValue("willChange");if(AP(n))return n.add(e);if(!n&&Dn.WillChange){const i=new Dn.WillChange("auto");t.addValue("willChange",i),i.add(e)}}function Zy(t){return t.props[Vy]}const IP=t=>t!==null;function MP(t,{repeat:e,repeatType:n="loop"},i){const r=t.filter(IP),s=e&&n!=="loop"&&e%2===1?0:r.length-1;return r[s]}const NP={type:"spring",stiffness:500,damping:25,restSpeed:10},_P=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),OP={type:"keyframes",duration:.8},DP={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},jP=(t,{keyframes:e})=>e.length>2?OP:Ur.has(t)?t.startsWith("scale")?_P(e[1]):NP:DP;function LP({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:o,repeatDelay:a,from:c,elapsed:l,...d}){return!!Object.keys(d).length}const Gu=(t,e,n,i={},r,s)=>o=>{const a=Ou(i,t)||{},c=a.delay||i.delay||0;let{elapsed:l=0}=i;l=l-Kt(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:h=>{e.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:r};LP(a)||Object.assign(d,jP(t,d)),d.duration&&(d.duration=Kt(d.duration)),d.repeatDelay&&(d.repeatDelay=Kt(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let u=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(ld(d),d.delay===0&&(u=!0)),(Dn.instantAnimations||Dn.skipAnimations)&&(u=!0,ld(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,u&&!s&&e.get()!==void 0){const h=MP(d.keyframes,a);if(h!==void 0){je.update(()=>{d.onUpdate(h),d.onComplete()});return}}return a.isSync?new Nu(d):new sE(d)};function VP({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function Yy(t,e,{delay:n=0,transitionOverride:i,type:r}={}){let{transition:s=t.getDefaultTransition(),transitionEnd:o,...a}=e;i&&(s=i);const c=[],l=r&&t.animationState&&t.animationState.getState()[r];for(const d in a){const u=t.getValue(d,t.latestValues[d]??null),h=a[d];if(h===void 0||l&&VP(l,d))continue;const p={delay:n,...Ou(s||{},d)},v=u.get();if(v!==void 0&&!u.isAnimating&&!Array.isArray(h)&&h===v&&!p.velocity)continue;let f=!1;if(window.MotionHandoffAnimation){const b=Zy(t);if(b){const S=window.MotionHandoffAnimation(b,d,je);S!==null&&(p.startTime=S,f=!0)}}pd(t,d),u.start(Gu(d,u,h,t.shouldReduceMotion&&gy.has(d)?{type:!1}:p,t,f));const y=u.animation;y&&c.push(y)}return o&&Promise.all(c).then(()=>{je.update(()=>{o&&RP(t,o)})}),c}function Jy(t,e,n,i=0,r=1){const s=Array.from(t).sort((l,d)=>l.sortNodePosition(d)).indexOf(e),o=t.size,a=(o-1)*i;return typeof n=="function"?n(s,o):r===1?s*i:a-s*i}function gd(t,e,n={}){var c;const i=br(t,e,n.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:r=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const s=i?()=>Promise.all(Yy(t,i,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:u,staggerDirection:h}=r;return FP(t,e,l,d,u,h,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[l,d]=a==="beforeChildren"?[s,o]:[o,s];return l().then(()=>d())}else return Promise.all([s(),o(n.delay)])}function FP(t,e,n=0,i=0,r=0,s=1,o){const a=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),a.push(gd(c,e,{...o,delay:n+(typeof i=="function"?0:i)+Jy(t.variantChildren,c,i,r,s)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(a)}function UP(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const r=e.map(s=>gd(t,s,n));i=Promise.all(r)}else if(typeof e=="string")i=gd(t,e,n);else{const r=typeof e=="function"?br(t,e,n.custom):e;i=Promise.all(Yy(t,r,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}function Xy(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const BP=Uu.length;function Qy(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Qy(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<BP;n++){const i=Uu[n],r=t.props[i];(ks(r)||r===!1)&&(e[i]=r)}return e}const $P=[...Fu].reverse(),HP=Fu.length;function zP(t){return e=>Promise.all(e.map(({animation:n,options:i})=>UP(t,n,i)))}function WP(t){let e=zP(t),n=bm(),i=!0;const r=c=>(l,d)=>{var h;const u=br(t,d,c==="exit"?(h=t.presenceContext)==null?void 0:h.custom:void 0);if(u){const{transition:p,transitionEnd:v,...f}=u;l={...l,...f,...v}}return l};function s(c){e=c(t)}function o(c){const{props:l}=t,d=Qy(t.parent)||{},u=[],h=new Set;let p={},v=1/0;for(let y=0;y<HP;y++){const b=$P[y],S=n[b],k=l[b]!==void 0?l[b]:d[b],w=ks(k),x=b===c?S.isActive:null;x===!1&&(v=y);let T=k===d[b]&&k!==l[b]&&w;if(T&&i&&t.manuallyAnimateOnMount&&(T=!1),S.protectedKeys={...p},!S.isActive&&x===null||!k&&!S.prevProp||Ia(k)||typeof k=="boolean")continue;const E=qP(S.prevProp,k);let P=E||b===c&&S.isActive&&!T&&w||y>v&&w,I=!1;const C=Array.isArray(k)?k:[k];let A=C.reduce(r(b),{});x===!1&&(A={});const{prevResolvedValues:N={}}=S,Z={...N,...A},Q=Y=>{P=!0,h.has(Y)&&(I=!0,h.delete(Y)),S.needsAnimating[Y]=!0;const _=t.getValue(Y);_&&(_.liveStyle=!1)};for(const Y in Z){const _=A[Y],ie=N[Y];if(p.hasOwnProperty(Y))continue;let L=!1;md(_)&&md(ie)?L=!Xy(_,ie):L=_!==ie,L?_!=null?Q(Y):h.add(Y):_!==void 0&&h.has(Y)?Q(Y):S.protectedKeys[Y]=!0}S.prevProp=k,S.prevResolvedValues=A,S.isActive&&(p={...p,...A}),i&&t.blockInitialAnimation&&(P=!1);const se=T&&E;P&&(!se||I)&&u.push(...C.map(Y=>{const _={type:b};if(typeof Y=="string"&&i&&!se&&t.manuallyAnimateOnMount&&t.parent){const{parent:ie}=t,L=br(ie,Y);if(ie.enteringChildren&&L){const{delayChildren:F}=L.transition||{};_.delay=Jy(ie.enteringChildren,t,F)}}return{animation:Y,options:_}}))}if(h.size){const y={};if(typeof l.initial!="boolean"){const b=br(t,Array.isArray(l.initial)?l.initial[0]:l.initial);b&&b.transition&&(y.transition=b.transition)}h.forEach(b=>{const S=t.getBaseTarget(b),k=t.getValue(b);k&&(k.liveStyle=!0),y[b]=S??null}),u.push({animation:y})}let f=!!u.length;return i&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(f=!1),i=!1,f?e(u):Promise.resolve()}function a(c,l){var u;if(n[c].isActive===l)return Promise.resolve();(u=t.variantChildren)==null||u.forEach(h=>{var p;return(p=h.animationState)==null?void 0:p.setActive(c,l)}),n[c].isActive=l;const d=o(c);for(const h in n)n[h].protectedKeys={};return d}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>n,reset:()=>{n=bm(),i=!0}}}function qP(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xy(e,t):!1}function bi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function bm(){return{animate:bi(!0),whileInView:bi(),whileHover:bi(),whileTap:bi(),whileDrag:bi(),whileFocus:bi(),exit:bi()}}class ui{constructor(e){this.isMounted=!1,this.node=e}update(){}}class GP extends ui{constructor(e){super(e),e.animationState||(e.animationState=WP(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ia(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let KP=0;class ZP extends ui{constructor(){super(...arguments),this.id=KP++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const YP={animation:{Feature:GP},exit:{Feature:ZP}};function Ts(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Us(t){return{point:{x:t.pageX,y:t.pageY}}}const JP=t=>e=>Lu(e)&&t(e,Us(e));function ms(t,e,n,i){return Ts(t,e,JP(n),i)}const eb=1e-4,XP=1-eb,QP=1+eb,tb=.01,eR=0-tb,tR=0+tb;function pt(t){return t.max-t.min}function nR(t,e,n){return Math.abs(t-e)<=n}function xm(t,e,n,i=.5){t.origin=i,t.originPoint=Ve(e.min,e.max,t.origin),t.scale=pt(n)/pt(e),t.translate=Ve(n.min,n.max,t.origin)-t.originPoint,(t.scale>=XP&&t.scale<=QP||isNaN(t.scale))&&(t.scale=1),(t.translate>=eR&&t.translate<=tR||isNaN(t.translate))&&(t.translate=0)}function ps(t,e,n,i){xm(t.x,e.x,n.x,i?i.originX:void 0),xm(t.y,e.y,n.y,i?i.originY:void 0)}function wm(t,e,n){t.min=n.min+e.min,t.max=t.min+pt(e)}function iR(t,e,n){wm(t.x,e.x,n.x),wm(t.y,e.y,n.y)}function Sm(t,e,n){t.min=e.min-n.min,t.max=t.min+pt(e)}function gs(t,e,n){Sm(t.x,e.x,n.x),Sm(t.y,e.y,n.y)}function Nt(t){return[t("x"),t("y")]}const nb=({current:t})=>t?t.ownerDocument.defaultView:null,km=(t,e)=>Math.abs(t-e);function rR(t,e){const n=km(t.x,e.x),i=km(t.y,e.y);return Math.sqrt(n**2+i**2)}class ib{constructor(e,n,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Oc(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,v=rR(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!v)return;const{point:f}=h,{timestamp:y}=at;this.history.push({...f,timestamp:y});const{onStart:b,onMove:S}=this.handlers;p||(b&&b(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=_c(p,this.transformPagePoint),je.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:v,onSessionEnd:f,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Oc(h.type==="pointercancel"?this.lastMoveEventInfo:_c(p,this.transformPagePoint),this.history);this.startEvent&&v&&v(h,b),f&&f(h,b)},!Lu(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=r||window;const a=Us(e),c=_c(a,this.transformPagePoint),{point:l}=c,{timestamp:d}=at;this.history=[{...l,timestamp:d}];const{onSessionStart:u}=n;u&&u(e,Oc(c,this.history)),this.removeListeners=Ls(ms(this.contextWindow,"pointermove",this.handlePointerMove),ms(this.contextWindow,"pointerup",this.handlePointerUp),ms(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ti(this.updatePoint)}}function _c(t,e){return e?{point:e(t.point)}:t}function Cm(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Oc({point:t},e){return{point:t,delta:Cm(t,rb(e)),offset:Cm(t,sR(e)),velocity:oR(e,.1)}}function sR(t){return t[0]}function rb(t){return t[t.length-1]}function oR(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const r=rb(t);for(;n>=0&&(i=t[n],!(r.timestamp-i.timestamp>Kt(e)));)n--;if(!i)return{x:0,y:0};const s=dn(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function aR(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Ve(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Ve(n,t,i.max):Math.min(t,n)),t}function Tm(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function cR(t,{top:e,left:n,bottom:i,right:r}){return{x:Tm(t.x,n,r),y:Tm(t.y,e,i)}}function Em(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function lR(t,e){return{x:Em(t.x,e.x),y:Em(t.y,e.y)}}function dR(t,e){let n=.5;const i=pt(t),r=pt(e);return r>i?n=xs(e.min,e.max-i,t.min):i>r&&(n=xs(t.min,t.max-r,e.min)),_n(0,1,n)}function uR(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const vd=.35;function hR(t=vd){return t===!1?t=0:t===!0&&(t=vd),{x:Pm(t,"left","right"),y:Pm(t,"top","bottom")}}function Pm(t,e,n){return{min:Rm(t,e),max:Rm(t,n)}}function Rm(t,e){return typeof t=="number"?t:t[e]||0}const fR=new WeakMap;class mR{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=qe(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=u=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Us(u).point)},o=(u,h)=>{const{drag:p,dragPropagation:v,onDragStart:f}=this.getProps();if(p&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=SE(p),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Nt(b=>{let S=this.getAxisMotionValue(b).get()||0;if(un.test(S)){const{projection:k}=this.visualElement;if(k&&k.layout){const w=k.layout.layoutBox[b];w&&(S=pt(w)*(parseFloat(S)/100))}}this.originPoint[b]=S}),f&&je.postRender(()=>f(u,h)),pd(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:v,onDirectionLock:f,onDrag:y}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:b}=h;if(v&&this.currentDirection===null){this.currentDirection=pR(b),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",h.point,b),this.updateAxis("y",h.point,b),this.visualElement.render(),y&&y(u,h)},c=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h,this.stop(u,h),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>Nt(u=>{var h;return this.getAnimationState(u)==="paused"&&((h=this.getAxisMotionValue(u).animation)==null?void 0:h.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new ib(e,{onSessionStart:s,onStart:o,onMove:a,onSessionEnd:c,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:i,contextWindow:nb(this.visualElement)})}stop(e,n){const i=e||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!i)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&je.postRender(()=>a(i,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:r}=this.getProps();if(!i||!no(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=aR(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var s;const{dragConstraints:e,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,r=this.constraints;e&&cr(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=cR(i.layoutBox,e):this.constraints=!1,this.elastic=hR(n),r!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Nt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=uR(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!cr(e))return!1;const i=e.current;On(i!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=gP(i,r.root,this.visualElement.getTransformPagePoint());let o=lR(r.layout.layoutBox,s);if(n){const a=n(fP(o));this.hasMutatedConstraints=!!a,a&&(o=By(a))}return o}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=Nt(d=>{if(!no(d,n,this.currentDirection))return;let u=c&&c[d]||{};o&&(u={min:0,max:0});const h=r?200:1e6,p=r?40:1e7,v={type:"inertia",velocity:i?e[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...u};return this.startAxisValueAnimation(d,v)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return pd(this.visualElement,e),i.start(Gu(e,i,0,n,this.visualElement,!1))}stopAnimation(){Nt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Nt(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Nt(n=>{const{drag:i}=this.getProps();if(!no(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[n];s.set(e[n]-Ve(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!cr(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Nt(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const c=a.get();r[o]=dR({min:c,max:c},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Nt(o=>{if(!no(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(Ve(c,l,r[o]))})}addListeners(){if(!this.visualElement.current)return;fR.set(this.visualElement,this);const e=this.visualElement.current,n=ms(e,"pointerdown",c=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();cr(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),je.read(i);const o=Ts(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(Nt(d=>{const u=this.getAxisMotionValue(d);u&&(this.originPoint[d]+=c[d].translate,u.set(u.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=vd,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function no(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function pR(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class gR extends ui{constructor(e){super(e),this.removeGroupControls=jt,this.removeListeners=jt,this.controls=new mR(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jt}unmount(){this.removeGroupControls(),this.removeListeners()}}const Am=t=>(e,n)=>{t&&je.postRender(()=>t(e,n))};class vR extends ui{constructor(){super(...arguments),this.removePointerDownListener=jt}onPointerDown(e){this.session=new ib(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:nb(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:Am(e),onStart:Am(n),onMove:i,onEnd:(s,o)=>{delete this.session,r&&je.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=ms(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Fo={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Im(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const es={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Im(t,e.target.x),i=Im(t,e.target.y);return`${n}% ${i}%`}},yR={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,r=ni.parse(t);if(r.length>5)return i;const s=ni.createTransformer(t),o=typeof r[0]!="number"?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;r[0+o]/=a,r[1+o]/=c;const l=Ve(a,c,.5);return typeof r[2+o]=="number"&&(r[2+o]/=l),typeof r[3+o]=="number"&&(r[3+o]/=l),s(r)}};let Dc=!1;class bR extends M.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;BE(xR),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),Dc&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Fo.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,{projection:o}=i;return o&&(o.isPresent=s,Dc=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==s?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||je.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ju.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=e;Dc=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function sb(t){const[e,n]=Py(),i=M.useContext(mu);return m.jsx(bR,{...t,layoutGroup:i,switchLayoutGroup:M.useContext(Fy),isPresent:e,safeToRemove:n})}const xR={borderRadius:{...es,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:es,borderTopRightRadius:es,borderBottomLeftRadius:es,borderBottomRightRadius:es,boxShadow:yR};function wR(t,e,n){const i=mt(t)?t:Pr(t);return i.start(Gu("",i,e,n)),i.animation}const SR=(t,e)=>t.depth-e.depth;class kR{constructor(){this.children=[],this.isDirty=!1}add(e){vu(this.children,e),this.isDirty=!0}remove(e){yu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(SR),this.isDirty=!1,this.children.forEach(e)}}function CR(t,e){const n=xt.now(),i=({timestamp:r})=>{const s=r-n;s>=e&&(ti(i),t(s-e))};return je.setup(i,!0),()=>ti(i)}const ob=["TopLeft","TopRight","BottomLeft","BottomRight"],TR=ob.length,Mm=t=>typeof t=="string"?parseFloat(t):t,Nm=t=>typeof t=="number"||de.test(t);function ER(t,e,n,i,r,s){r?(t.opacity=Ve(0,n.opacity??1,PR(i)),t.opacityExit=Ve(e.opacity??1,0,RR(i))):s&&(t.opacity=Ve(e.opacity??1,n.opacity??1,i));for(let o=0;o<TR;o++){const a=`border${ob[o]}Radius`;let c=_m(e,a),l=_m(n,a);if(c===void 0&&l===void 0)continue;c||(c=0),l||(l=0),c===0||l===0||Nm(c)===Nm(l)?(t[a]=Math.max(Ve(Mm(c),Mm(l),i),0),(un.test(l)||un.test(c))&&(t[a]+="%")):t[a]=l}(e.rotate||n.rotate)&&(t.rotate=Ve(e.rotate||0,n.rotate||0,i))}function _m(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const PR=ab(0,.5,Gv),RR=ab(.5,.95,jt);function ab(t,e,n){return i=>i<t?0:i>e?1:n(xs(t,e,i))}function Om(t,e){t.min=e.min,t.max=e.max}function Mt(t,e){Om(t.x,e.x),Om(t.y,e.y)}function Dm(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function jm(t,e,n,i,r){return t-=e,t=la(t,1/n,i),r!==void 0&&(t=la(t,1/r,i)),t}function AR(t,e=0,n=1,i=.5,r,s=t,o=t){if(un.test(e)&&(e=parseFloat(e),e=Ve(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Ve(s.min,s.max,i);t===s&&(a-=e),t.min=jm(t.min,e,n,a,r),t.max=jm(t.max,e,n,a,r)}function Lm(t,e,[n,i,r],s,o){AR(t,e[n],e[i],e[r],e.scale,s,o)}const IR=["x","scaleX","originX"],MR=["y","scaleY","originY"];function Vm(t,e,n,i){Lm(t.x,e,IR,n?n.x:void 0,i?i.x:void 0),Lm(t.y,e,MR,n?n.y:void 0,i?i.y:void 0)}function Fm(t){return t.translate===0&&t.scale===1}function cb(t){return Fm(t.x)&&Fm(t.y)}function Um(t,e){return t.min===e.min&&t.max===e.max}function NR(t,e){return Um(t.x,e.x)&&Um(t.y,e.y)}function Bm(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function lb(t,e){return Bm(t.x,e.x)&&Bm(t.y,e.y)}function $m(t){return pt(t.x)/pt(t.y)}function Hm(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class _R{constructor(){this.members=[]}add(e){vu(this.members,e),e.scheduleRender()}remove(e){if(yu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(r=>e===r);if(n===0)return!1;let i;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function OR(t,e,n){let i="";const r=t.x.translate/e.x,s=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((r||s||o)&&(i=`translate3d(${r}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:l,rotate:d,rotateX:u,rotateY:h,skewX:p,skewY:v}=n;l&&(i=`perspective(${l}px) ${i}`),d&&(i+=`rotate(${d}deg) `),u&&(i+=`rotateX(${u}deg) `),h&&(i+=`rotateY(${h}deg) `),p&&(i+=`skewX(${p}deg) `),v&&(i+=`skewY(${v}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return(a!==1||c!==1)&&(i+=`scale(${a}, ${c})`),i||"none"}const jc=["","X","Y","Z"],DR=1e3;let jR=0;function Lc(t,e,n,i){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),i&&(i[t]=0))}function db(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Zy(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",je,!(r||s))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&db(i)}function ub({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(o={},a=e==null?void 0:e()){this.id=jR++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(FR),this.nodes.forEach(HR),this.nodes.forEach(zR),this.nodes.forEach(UR)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new kR)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new xu),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const c=this.eventHandlers.get(o);c&&c.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Ey(o)&&!RE(o),this.instance=o;const{layoutId:a,layout:c,visualElement:l}=this.options;if(l&&!l.current&&l.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),t){let d,u=0;const h=()=>this.root.updateBlockedByResize=!1;je.read(()=>{u=window.innerWidth}),t(o,()=>{const p=window.innerWidth;p!==u&&(u=p,this.root.updateBlockedByResize=!0,d&&d(),d=CR(h,250),Fo.hasAnimatedSinceResize&&(Fo.hasAnimatedSinceResize=!1,this.nodes.forEach(qm)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&l&&(a||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:u,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||l.getDefaultTransition()||ZR,{onLayoutAnimationStart:f,onLayoutAnimationComplete:y}=l.getProps(),b=!this.targetLayout||!lb(this.targetLayout,p),S=!u&&h;if(this.options.layoutRoot||this.resumeFrom||S||u&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...Ou(v,"layout"),onPlay:f,onComplete:y};(l.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(d,S)}else u||qm(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ti(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(WR),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&db(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const u=this.path[d];u.shouldResetTransform=!0,u.updateScroll("snapshot"),u.options.layoutRoot&&u.willUpdate(!1)}const{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(zm);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Wm);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach($R),this.nodes.forEach(LR),this.nodes.forEach(VR)):this.nodes.forEach(Wm),this.clearAllSnapshots();const a=xt.now();at.delta=_n(0,1e3/60,a-at.timestamp),at.timestamp=a,at.isProcessing=!0,Tc.update.process(at),Tc.preRender.process(at),Tc.render.process(at),at.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ju.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(BR),this.sharedNodes.forEach(qR)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,je.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){je.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!pt(this.snapshot.measuredBox.x)&&!pt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=qe(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const c=i(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!cb(this.projectionDelta),c=this.getTransformTemplate(),l=c?c(this.latestValues,""):void 0,d=l!==this.prevTransformTemplateValue;o&&this.instance&&(a||Si(this.latestValues)||d)&&(r(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let c=this.removeElementScroll(a);return o&&(c=this.removeTransform(c)),YR(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var l;const{visualElement:o}=this.options;if(!o)return qe();const a=o.measureViewportBox();if(!(((l=this.scroll)==null?void 0:l.wasRoot)||this.path.some(JR))){const{scroll:d}=this.root;d&&(lr(a.x,d.offset.x),lr(a.y,d.offset.y))}return a}removeElementScroll(o){var c;const a=qe();if(Mt(a,o),(c=this.scroll)!=null&&c.wasRoot)return a;for(let l=0;l<this.path.length;l++){const d=this.path[l],{scroll:u,options:h}=d;d!==this.root&&u&&h.layoutScroll&&(u.wasRoot&&Mt(a,o),lr(a.x,u.offset.x),lr(a.y,u.offset.y))}return a}applyTransform(o,a=!1){const c=qe();Mt(c,o);for(let l=0;l<this.path.length;l++){const d=this.path[l];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&dr(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Si(d.latestValues)&&dr(c,d.latestValues)}return Si(this.latestValues)&&dr(c,this.latestValues),c}removeTransform(o){const a=qe();Mt(a,o);for(let c=0;c<this.path.length;c++){const l=this.path[c];if(!l.instance||!Si(l.latestValues))continue;ud(l.latestValues)&&l.updateSnapshot();const d=qe(),u=l.measurePageBox();Mt(d,u),Vm(a,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,d)}return Si(this.latestValues)&&Vm(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==at.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var h;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==a;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(h=this.parent)!=null&&h.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:u}=this.options;if(!(!this.layout||!(d||u))){if(this.resolvedRelativeTargetAt=at.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qe(),this.relativeTargetOrigin=qe(),gs(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Mt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=qe(),this.targetWithTransforms=qe()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),iR(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Mt(this.target,this.layout.layoutBox),Hy(this.target,this.targetDelta)):Mt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qe(),this.relativeTargetOrigin=qe(),gs(this.relativeTargetOrigin,this.target,p.target),Mt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||ud(this.parent.latestValues)||$y(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var v;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(v=this.parent)!=null&&v.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===at.timestamp&&(c=!1),c)return;const{layout:l,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(l||d))return;Mt(this.layoutCorrected,this.layout.layoutBox);const u=this.treeScale.x,h=this.treeScale.y;pP(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=qe());const{target:p}=o;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Dm(this.prevProjectionDelta.x,this.projectionDelta.x),Dm(this.prevProjectionDelta.y,this.projectionDelta.y)),ps(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==u||this.treeScale.y!==h||!Hm(this.projectionDelta.x,this.prevProjectionDelta.x)||!Hm(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ur(),this.projectionDelta=ur(),this.projectionDeltaWithTransform=ur()}setAnimationOrigin(o,a=!1){const c=this.snapshot,l=c?c.latestValues:{},d={...this.latestValues},u=ur();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const h=qe(),p=c?c.source:void 0,v=this.layout?this.layout.source:void 0,f=p!==v,y=this.getStack(),b=!y||y.members.length<=1,S=!!(f&&!b&&this.options.crossfade===!0&&!this.path.some(KR));this.animationProgress=0;let k;this.mixTargetDelta=w=>{const x=w/1e3;Gm(u.x,o.x,x),Gm(u.y,o.y,x),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(gs(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),GR(this.relativeTarget,this.relativeTargetOrigin,h,x),k&&NR(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=qe()),Mt(k,this.relativeTarget)),f&&(this.animationValues=d,ER(d,l,this.latestValues,x,S,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=x},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,c,l;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(l=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||l.stop(),this.pendingAnimation&&(ti(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=je.update(()=>{Fo.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Pr(0)),this.currentAnimation=wR(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(DR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:d}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&hb(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||qe();const u=pt(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+u;const h=pt(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Mt(a,c),dr(a,d),ps(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new _R),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const l={};c.z&&Lc("z",o,l,this.animationValues);for(let d=0;d<jc.length;d++)Lc(`rotate${jc[d]}`,o,l,this.animationValues),Lc(`skew${jc[d]}`,o,l,this.animationValues);o.render();for(const d in l)o.setStaticValue(d,l[d]),this.animationValues&&(this.animationValues[d]=l[d]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Vo(a==null?void 0:a.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Vo(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Si(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=l.animationValues||l.latestValues;this.applyTransformsToTarget();let u=OR(this.projectionDeltaWithTransform,this.treeScale,d);c&&(u=c(d,u)),o.transform=u;const{x:h,y:p}=this.projectionDelta;o.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,l.animationValues?o.opacity=l===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=l===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const v in Cs){if(d[v]===void 0)continue;const{correct:f,applyTo:y,isCSSVariable:b}=Cs[v],S=u==="none"?d[v]:f(d[v],l);if(y){const k=y.length;for(let w=0;w<k;w++)o[y[w]]=S}else b?this.options.visualElement.renderState.vars[v]=S:o[v]=S}this.options.layoutId&&(o.pointerEvents=l===this?Vo(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(zm),this.root.sharedNodes.clear()}}}function LR(t){t.updateLayout()}function VR(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=t.layout,{animationType:s}=t.options,o=e.source!==t.layout.source;s==="size"?Nt(u=>{const h=o?e.measuredBox[u]:e.layoutBox[u],p=pt(h);h.min=i[u].min,h.max=h.min+p}):hb(s,e.layoutBox,i)&&Nt(u=>{const h=o?e.measuredBox[u]:e.layoutBox[u],p=pt(i[u]);h.max=h.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+p)});const a=ur();ps(a,i,e.layoutBox);const c=ur();o?ps(c,t.applyTransform(r,!0),e.measuredBox):ps(c,i,e.layoutBox);const l=!cb(a);let d=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:p}=u;if(h&&p){const v=qe();gs(v,e.layoutBox,h.layoutBox);const f=qe();gs(f,i,p.layoutBox),lb(v,f)||(d=!0),u.options.layoutRoot&&(t.relativeTarget=f,t.relativeTargetOrigin=v,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function FR(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function UR(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function BR(t){t.clearSnapshot()}function zm(t){t.clearMeasurements()}function Wm(t){t.isLayoutDirty=!1}function $R(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function qm(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function HR(t){t.resolveTargetDelta()}function zR(t){t.calcProjection()}function WR(t){t.resetSkewAndRotation()}function qR(t){t.removeLeadSnapshot()}function Gm(t,e,n){t.translate=Ve(e.translate,0,n),t.scale=Ve(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Km(t,e,n,i){t.min=Ve(e.min,n.min,i),t.max=Ve(e.max,n.max,i)}function GR(t,e,n,i){Km(t.x,e.x,n.x,i),Km(t.y,e.y,n.y,i)}function KR(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ZR={duration:.45,ease:[.4,0,.1,1]},Zm=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Ym=Zm("applewebkit/")&&!Zm("chrome/")?Math.round:jt;function Jm(t){t.min=Ym(t.min),t.max=Ym(t.max)}function YR(t){Jm(t.x),Jm(t.y)}function hb(t,e,n){return t==="position"||t==="preserve-aspect"&&!nR($m(e),$m(n),.2)}function JR(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const XR=ub({attachResizeListener:(t,e)=>Ts(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Vc={current:void 0},fb=ub({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Vc.current){const t=new XR({});t.mount(window),t.setOptions({layoutScroll:!0}),Vc.current=t}return Vc.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),QR={pan:{Feature:vR},drag:{Feature:gR,ProjectionNode:fb,MeasureLayout:sb}};function Xm(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&je.postRender(()=>s(e,Us(e)))}class eA extends ui{mount(){const{current:e}=this.node;e&&(this.unmount=kE(e,(n,i)=>(Xm(this.node,i,"Start"),r=>Xm(this.node,r,"End"))))}unmount(){}}class tA extends ui{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ls(Ts(this.node.current,"focus",()=>this.onFocus()),Ts(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Qm(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&je.postRender(()=>s(e,Us(e)))}class nA extends ui{mount(){const{current:e}=this.node;e&&(this.unmount=PE(e,(n,i)=>(Qm(this.node,i,"Start"),(r,{success:s})=>Qm(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const yd=new WeakMap,Fc=new WeakMap,iA=t=>{const e=yd.get(t.target);e&&e(t)},rA=t=>{t.forEach(iA)};function sA({root:t,...e}){const n=t||document;Fc.has(n)||Fc.set(n,{});const i=Fc.get(n),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(rA,{root:t,...e})),i[r]}function oA(t,e,n){const i=sA(e);return yd.set(t,n),i.observe(t),()=>{yd.delete(t),i.unobserve(t)}}const aA={some:0,all:1};class cA extends ui{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=e,o={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:aA[r]},a=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:u}=this.node.getProps(),h=l?d:u;h&&h(c)};return oA(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(lA(e,n))&&this.startObserver()}unmount(){}}function lA({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const dA={inView:{Feature:cA},tap:{Feature:nA},focus:{Feature:tA},hover:{Feature:eA}},uA={layout:{ProjectionNode:fb,MeasureLayout:sb}},hA={...YP,...dA,...QR,...uA},ge=hP(hA,TP);var io=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bd={exports:{}},fA=bd.exports,ep;function mA(){return ep||(ep=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(fA,function(){var e=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(f,y){var b=f[y];if(typeof b.bind=="function")return b.bind(f);try{return Function.prototype.bind.call(b,f)}catch{return function(){return Function.prototype.apply.apply(b,[f,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(f){return f==="debug"&&(f="log"),typeof console===n?!1:f==="trace"&&i?c:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):e}function d(){for(var f=this.getLevel(),y=0;y<r.length;y++){var b=r[y];this[b]=y<f?e:this.methodFactory(b,f,this.name)}if(this.log=this.debug,typeof console===n&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==n&&(d.call(this),this[f].apply(this,arguments))}}function h(f,y,b){return l(f)||u.apply(this,arguments)}function p(f,y){var b=this,S,k,w,x="loglevel";typeof f=="string"?x+=":"+f:typeof f=="symbol"&&(x=void 0);function T(A){var N=(r[A]||"silent").toUpperCase();if(!(typeof window===n||!x)){try{window.localStorage[x]=N;return}catch{}try{window.document.cookie=encodeURIComponent(x)+"="+N+";"}catch{}}}function E(){var A;if(!(typeof window===n||!x)){try{A=window.localStorage[x]}catch{}if(typeof A===n)try{var N=window.document.cookie,Z=encodeURIComponent(x),Q=N.indexOf(Z+"=");Q!==-1&&(A=/^([^;]+)/.exec(N.slice(Q+Z.length+1))[1])}catch{}return b.levels[A]===void 0&&(A=void 0),A}}function P(){if(!(typeof window===n||!x)){try{window.localStorage.removeItem(x)}catch{}try{window.document.cookie=encodeURIComponent(x)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function I(A){var N=A;if(typeof N=="string"&&b.levels[N.toUpperCase()]!==void 0&&(N=b.levels[N.toUpperCase()]),typeof N=="number"&&N>=0&&N<=b.levels.SILENT)return N;throw new TypeError("log.setLevel() called with invalid level: "+A)}b.name=f,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=y||h,b.getLevel=function(){return w??k??S},b.setLevel=function(A,N){return w=I(A),N!==!1&&T(w),d.call(b)},b.setDefaultLevel=function(A){k=I(A),E()||b.setLevel(A,!1)},b.resetLevel=function(){w=null,P(),d.call(b)},b.enableAll=function(A){b.setLevel(b.levels.TRACE,A)},b.disableAll=function(A){b.setLevel(b.levels.SILENT,A)},b.rebuild=function(){if(o!==b&&(S=I(o.getLevel())),d.call(b),o===b)for(var A in s)s[A].rebuild()},S=I(o?o.getLevel():"WARN");var C=E();C!=null&&(w=I(C)),d.call(b)}o=new p,o.getLogger=function(f){if(typeof f!="symbol"&&typeof f!="string"||f==="")throw new TypeError("You must supply a name when creating a logger.");var y=s[f];return y||(y=s[f]=new p(f,o.methodFactory)),y};var v=typeof window!==n?window.log:void 0;return o.noConflict=function(){return typeof window!==n&&window.log===o&&(window.log=v),o},o.getLoggers=function(){return s},o.default=o,o})}(bd)),bd.exports}var pA=mA();const gA=mb(pA);var xd=function(t,e){return xd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])},xd(t,e)};function Fn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");xd(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function vA(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{l(i.next(d))}catch(u){o(u)}}function c(d){try{l(i.throw(d))}catch(u){o(u)}}function l(d){d.done?s(d.value):r(d.value).then(a,c)}l((i=i.apply(t,[])).next())})}function pb(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return c([l,d])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(n=0)),n;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,r=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}s[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(d){l=[6,d],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Ar(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Es(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function Ps(t,e,n){if(arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function xr(t){return this instanceof xr?(this.v=t,this):new xr(t)}function yA(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(t,e||[]),r,s=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),r[Symbol.asyncIterator]=function(){return this},r;function o(p){return function(v){return Promise.resolve(v).then(p,u)}}function a(p,v){i[p]&&(r[p]=function(f){return new Promise(function(y,b){s.push([p,f,y,b])>1||c(p,f)})},v&&(r[p]=v(r[p])))}function c(p,v){try{l(i[p](v))}catch(f){h(s[0][3],f)}}function l(p){p.value instanceof xr?Promise.resolve(p.value.v).then(d,u):h(s[0][2],p)}function d(p){c("next",p)}function u(p){c("throw",p)}function h(p,v){p(v),s.shift(),s.length&&c(s[0][0],s[0][1])}}function bA(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Ar=="function"?Ar(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(s){n[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),r(a,c,o.done,o.value)})}}function r(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}function et(t){return typeof t=="function"}function Ku(t){var e=function(i){Error.call(i),i.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Uc=Ku(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
|
|
47
|
-
|
|
48
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function da(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Bs=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,i,r,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Ar(o),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(f){e={error:f}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(et(d))try{d()}catch(f){s=f instanceof Uc?f.errors:[f]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var h=Ar(u),p=h.next();!p.done;p=h.next()){var v=p.value;try{tp(v)}catch(f){s=s??[],f instanceof Uc?s=Ps(Ps([],Es(s)),Es(f.errors)):s.push(f)}}}catch(f){i={error:f}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}}if(s)throw new Uc(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)tp(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&da(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&da(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),gb=Bs.EMPTY;function vb(t){return t instanceof Bs||t&&"closed"in t&&et(t.remove)&&et(t.add)&&et(t.unsubscribe)}function tp(t){et(t)?t():t.unsubscribe()}var xA={Promise:void 0},wA={setTimeout:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,Ps([t,e],Es(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function yb(t){wA.setTimeout(function(){throw t})}function wd(){}function Uo(t){t()}var Zu=function(t){Fn(e,t);function e(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,vb(n)&&n.add(i)):i.destination=CA,i}return e.create=function(n,i,r){return new Rs(n,i,r)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Bs),SA=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(i){ro(i)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(i){ro(i)}else ro(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){ro(n)}},t}(),Rs=function(t){Fn(e,t);function e(n,i,r){var s=t.call(this)||this,o;return et(n)||!n?o={next:n??void 0,error:i??void 0,complete:r??void 0}:o=n,s.destination=new SA(o),s}return e}(Zu);function ro(t){yb(t)}function kA(t){throw t}var CA={closed:!0,next:wd,error:kA,complete:wd},Yu=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ju(t){return t}function TA(t){return t.length===0?Ju:t.length===1?t[0]:function(e){return t.reduce(function(n,i){return i(n)},e)}}var it=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,i){var r=this,s=PA(e)?e:new Rs(e,n,i);return Uo(function(){var o=r,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?r._subscribe(s):r._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var i=this;return n=np(n),new n(function(r,s){var o=new Rs({next:function(a){try{e(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:r});i.subscribe(o)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[Yu]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return TA(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=np(e),new e(function(i,r){var s;n.subscribe(function(o){return s=o},function(o){return r(o)},function(){return i(s)})})},t.create=function(e){return new t(e)},t}();function np(t){var e;return(e=t??xA.Promise)!==null&&e!==void 0?e:Promise}function EA(t){return t&&et(t.next)&&et(t.error)&&et(t.complete)}function PA(t){return t&&t instanceof Zu||EA(t)&&vb(t)}function RA(t){return et(t==null?void 0:t.lift)}function yn(t){return function(e){if(RA(e))return e.lift(function(n){try{return t(n,this)}catch(i){this.error(i)}});throw new TypeError("Unable to lift unknown Observable type")}}function ii(t,e,n,i,r){return new AA(t,e,n,i,r)}var AA=function(t){Fn(e,t);function e(n,i,r,s,o,a){var c=t.call(this,n)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=i?function(l){try{i(l)}catch(d){n.error(d)}}:t.prototype._next,c._error=s?function(l){try{s(l)}catch(d){n.error(d)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=r?function(){try{r()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;t.prototype.unsubscribe.call(this),!i&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Zu),IA=Ku(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Ir=function(t){Fn(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var i=new ip(this,this);return i.operator=n,i},e.prototype._throwIfClosed=function(){if(this.closed)throw new IA},e.prototype.next=function(n){var i=this;Uo(function(){var r,s;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var o=Ar(i.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(n)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}}})},e.prototype.error=function(n){var i=this;Uo(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var r=i.observers;r.length;)r.shift().error(n)}})},e.prototype.complete=function(){var n=this;Uo(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var i=this,r=this,s=r.hasError,o=r.isStopped,a=r.observers;return s||o?gb:(this.currentObservers=null,a.push(n),new Bs(function(){i.currentObservers=null,da(a,n)}))},e.prototype._checkFinalizedStatuses=function(n){var i=this,r=i.hasError,s=i.thrownError,o=i.isStopped;r?n.error(s):o&&n.complete()},e.prototype.asObservable=function(){var n=new it;return n.source=this,n},e.create=function(n,i){return new ip(n,i)},e}(it),ip=function(t){Fn(e,t);function e(n,i){var r=t.call(this)||this;return r.destination=n,r.source=i,r}return e.prototype.next=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.next)===null||r===void 0||r.call(i,n)},e.prototype.error=function(n){var i,r;(r=(i=this.destination)===null||i===void 0?void 0:i.error)===null||r===void 0||r.call(i,n)},e.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},e.prototype._subscribe=function(n){var i,r;return(r=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&r!==void 0?r:gb},e}(Ir),MA=function(t){Fn(e,t);function e(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},e.prototype.getValue=function(){var n=this,i=n.hasError,r=n.thrownError,s=n._value;if(i)throw r;return this._throwIfClosed(),s},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(Ir),NA={now:function(){return Date.now()}},_A=function(t){Fn(e,t);function e(n,i){return t.call(this)||this}return e.prototype.schedule=function(n,i){return this},e}(Bs),rp={setInterval:function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setInterval.apply(void 0,Ps([t,e],Es(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},OA=function(t){Fn(e,t);function e(n,i){var r=t.call(this,n,i)||this;return r.scheduler=n,r.work=i,r.pending=!1,r}return e.prototype.schedule=function(n,i){var r;if(i===void 0&&(i=0),this.closed)return this;this.state=n;var s=this.id,o=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(o,s,i)),this.pending=!0,this.delay=i,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(o,this.id,i),this},e.prototype.requestAsyncId=function(n,i,r){return r===void 0&&(r=0),rp.setInterval(n.flush.bind(n,this),r)},e.prototype.recycleAsyncId=function(n,i,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return i;i!=null&&rp.clearInterval(i)},e.prototype.execute=function(n,i){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(n,i);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,i){var r=!1,s;try{this.work(n)}catch(o){r=!0,s=o||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,i=n.id,r=n.scheduler,s=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,da(s,this),i!=null&&(this.id=this.recycleAsyncId(r,i,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(_A),sp=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,i){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(i,n)},t.now=NA.now,t}(),DA=function(t){Fn(e,t);function e(n,i){i===void 0&&(i=sp.now);var r=t.call(this,n,i)||this;return r.actions=[],r._active=!1,r}return e.prototype.flush=function(n){var i=this.actions;if(this._active){i.push(n);return}var r;this._active=!0;do if(r=n.execute(n.state,n.delay))break;while(n=i.shift());if(this._active=!1,r){for(;n=i.shift();)n.unsubscribe();throw r}},e}(sp);new DA(OA);function jA(t){return t&&et(t.schedule)}function LA(t){return t[t.length-1]}function bb(t){return jA(LA(t))?t.pop():void 0}var xb=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function wb(t){return et(t==null?void 0:t.then)}function Sb(t){return et(t[Yu])}function kb(t){return Symbol.asyncIterator&&et(t==null?void 0:t[Symbol.asyncIterator])}function Cb(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function VA(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Tb=VA();function Eb(t){return et(t==null?void 0:t[Tb])}function Pb(t){return yA(this,arguments,function(){var e,n,i,r;return pb(this,function(s){switch(s.label){case 0:e=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,xr(e.read())];case 3:return n=s.sent(),i=n.value,r=n.done,r?[4,xr(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,xr(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function Rb(t){return et(t==null?void 0:t.getReader)}function hi(t){if(t instanceof it)return t;if(t!=null){if(Sb(t))return FA(t);if(xb(t))return UA(t);if(wb(t))return BA(t);if(kb(t))return Ab(t);if(Eb(t))return $A(t);if(Rb(t))return HA(t)}throw Cb(t)}function FA(t){return new it(function(e){var n=t[Yu]();if(et(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function UA(t){return new it(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function BA(t){return new it(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,yb)})}function $A(t){return new it(function(e){var n,i;try{for(var r=Ar(t),s=r.next();!s.done;s=r.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){n={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}e.complete()})}function Ab(t){return new it(function(e){zA(t,e).catch(function(n){return e.error(n)})})}function HA(t){return Ab(Pb(t))}function zA(t,e){var n,i,r,s;return vA(this,void 0,void 0,function(){var o,a;return pb(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=bA(t),c.label=1;case 1:return[4,n.next()];case 2:if(i=c.sent(),!!i.done)return[3,4];if(o=i.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),r={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),i&&!i.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(r)throw r.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Ii(t,e,n,i,r){i===void 0&&(i=0),r===void 0&&(r=!1);var s=e.schedule(function(){n(),r?t.add(this.schedule(null,i)):this.unsubscribe()},i);if(t.add(s),!r)return s}function Ib(t,e){return e===void 0&&(e=0),yn(function(n,i){n.subscribe(ii(i,function(r){return Ii(i,t,function(){return i.next(r)},e)},function(){return Ii(i,t,function(){return i.complete()},e)},function(r){return Ii(i,t,function(){return i.error(r)},e)}))})}function Mb(t,e){return e===void 0&&(e=0),yn(function(n,i){i.add(t.schedule(function(){return n.subscribe(i)},e))})}function WA(t,e){return hi(t).pipe(Mb(e),Ib(e))}function qA(t,e){return hi(t).pipe(Mb(e),Ib(e))}function GA(t,e){return new it(function(n){var i=0;return e.schedule(function(){i===t.length?n.complete():(n.next(t[i++]),n.closed||this.schedule())})})}function KA(t,e){return new it(function(n){var i;return Ii(n,e,function(){i=t[Tb](),Ii(n,e,function(){var r,s,o;try{r=i.next(),s=r.value,o=r.done}catch(a){n.error(a);return}o?n.complete():n.next(s)},0,!0)}),function(){return et(i==null?void 0:i.return)&&i.return()}})}function Nb(t,e){if(!t)throw new Error("Iterable cannot be null");return new it(function(n){Ii(n,e,function(){var i=t[Symbol.asyncIterator]();Ii(n,e,function(){i.next().then(function(r){r.done?n.complete():n.next(r.value)})},0,!0)})})}function ZA(t,e){return Nb(Pb(t),e)}function YA(t,e){if(t!=null){if(Sb(t))return WA(t,e);if(xb(t))return GA(t,e);if(wb(t))return qA(t,e);if(kb(t))return Nb(t,e);if(Eb(t))return KA(t,e);if(Rb(t))return ZA(t,e)}throw Cb(t)}function Xu(t,e){return e?YA(t,e):hi(t)}Ku(function(t){return function(e){e===void 0&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}});function Lt(t,e){return yn(function(n,i){var r=0;n.subscribe(ii(i,function(s){i.next(t.call(e,s,r++))}))})}function JA(t,e,n,i,r,s,o,a){var c=[],l=0,d=0,u=!1,h=function(){u&&!c.length&&!l&&e.complete()},p=function(f){return l<i?v(f):c.push(f)},v=function(f){l++;var y=!1;hi(n(f,d++)).subscribe(ii(e,function(b){e.next(b)},function(){y=!0},void 0,function(){if(y)try{l--;for(var b=function(){var S=c.shift();o||v(S)};c.length&&l<i;)b();h()}catch(S){e.error(S)}}))};return t.subscribe(ii(e,p,function(){u=!0,h()})),function(){}}function _b(t,e,n){return n===void 0&&(n=1/0),et(e)?_b(function(i,r){return Lt(function(s,o){return e(i,s,r,o)})(hi(t(i,r)))},n):(typeof e=="number"&&(n=e),yn(function(i,r){return JA(i,r,t,n)}))}function XA(t){return _b(Ju,t)}function QA(){return XA(1)}function op(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return QA()(Xu(t,bb(t)))}function Ob(t,e){return yn(function(n,i){var r=0;n.subscribe(ii(i,function(s){return t.call(e,s,r++)&&i.next(s)}))})}function eI(t,e,n,i,r){return function(s,o){var a=n,c=e,l=0;s.subscribe(ii(o,function(d){var u=l++;c=a?t(c,d,u):(a=!0,d),o.next(c)},r))}}function Sd(t,e){return yn(eI(t,e,arguments.length>=2,!0))}function tI(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new Ir}:e,i=t.resetOnError,r=i===void 0?!0:i,s=t.resetOnComplete,o=s===void 0?!0:s,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(l){var d,u,h,p=0,v=!1,f=!1,y=function(){u==null||u.unsubscribe(),u=void 0},b=function(){y(),d=h=void 0,v=f=!1},S=function(){var k=d;b(),k==null||k.unsubscribe()};return yn(function(k,w){p++,!f&&!v&&y();var x=h=h??n();w.add(function(){p--,p===0&&!f&&!v&&(u=Bc(S,c))}),x.subscribe(w),!d&&p>0&&(d=new Rs({next:function(T){return x.next(T)},error:function(T){f=!0,y(),u=Bc(b,r,T),x.error(T)},complete:function(){v=!0,y(),u=Bc(b,o),x.complete()}}),hi(k).subscribe(d))})(l)}}function Bc(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(e===!0){t();return}if(e!==!1){var r=new Rs({next:function(){r.unsubscribe(),t()}});return hi(e.apply(void 0,Ps([],Es(n)))).subscribe(r)}}function fi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=bb(t);return yn(function(i,r){(n?op(t,i,n):op(t,i)).subscribe(r)})}function ap(t){return yn(function(e,n){hi(t).subscribe(ii(n,function(){return n.complete()},wd)),!n.closed&&e.subscribe(n)})}function nI(t,e,n){var i=et(t)||e||n?{next:t,error:e,complete:n}:t;return i?yn(function(r,s){var o;(o=i.subscribe)===null||o===void 0||o.call(i);var a=!0;r.subscribe(ii(s,function(c){var l;(l=i.next)===null||l===void 0||l.call(i,c),s.next(c)},function(){var c;a=!1,(c=i.complete)===null||c===void 0||c.call(i),s.complete()},function(c){var l;a=!1,(l=i.error)===null||l===void 0||l.call(i,c),s.error(c)},function(){var c,l;a&&((c=i.unsubscribe)===null||c===void 0||c.call(i)),(l=i.finalize)===null||l===void 0||l.call(i)}))}):Ju}var iI=Object.defineProperty,rI=Object.defineProperties,sI=Object.getOwnPropertyDescriptors,cp=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,lp=(t,e,n)=>e in t?iI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kn=(t,e)=>{for(var n in e||(e={}))oI.call(e,n)&&lp(t,n,e[n]);if(cp)for(var n of cp(e))aI.call(e,n)&&lp(t,n,e[n]);return t},ki=(t,e)=>rI(t,sI(e)),Mr=(t,e,n)=>new Promise((i,r)=>{var s=c=>{try{a(n.next(c))}catch(l){r(l)}},o=c=>{try{a(n.throw(c))}catch(l){r(l)}},a=c=>c.done?i(c.value):Promise.resolve(c.value).then(s,o);a((n=n.apply(t,e)).next())}),cI="lk";function Qu(t){return typeof t>"u"?!1:lI(t)||dI(t)}function lI(t){var e;return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&t.hasOwnProperty("track")&&typeof((e=t.publication)==null?void 0:e.track)<"u":!1}function dI(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&t.hasOwnProperty("publication")&&typeof t.publication<"u":!1}function uI(t){return t?t.hasOwnProperty("participant")&&t.hasOwnProperty("source")&&typeof t.publication>"u":!1}function Db(t){if(typeof t=="string"||typeof t=="number")return`${t}`;if(uI(t))return`${t.participant.identity}_${t.source}_placeholder`;if(Qu(t))return`${t.participant.identity}_${t.publication.source}_${t.publication.trackSid}`;throw new Error(`Can't generate a id for the given track reference: ${t}`)}var hI=[V.ConnectionStateChanged,V.RoomMetadataChanged,V.ActiveSpeakersChanged,V.ConnectionQualityChanged,V.ParticipantConnected,V.ParticipantDisconnected,V.ParticipantPermissionsChanged,V.ParticipantMetadataChanged,V.ParticipantNameChanged,V.ParticipantAttributesChanged,V.TrackMuted,V.TrackUnmuted,V.TrackPublished,V.TrackUnpublished,V.TrackStreamStateChanged,V.TrackSubscriptionFailed,V.TrackSubscriptionPermissionChanged,V.TrackSubscriptionStatusChanged],jb=[...hI,V.LocalTrackPublished,V.LocalTrackUnpublished],fI=[q.TrackPublished,q.TrackUnpublished,q.TrackMuted,q.TrackUnmuted,q.TrackStreamStateChanged,q.TrackSubscribed,q.TrackUnsubscribed,q.TrackSubscriptionPermissionChanged,q.TrackSubscriptionFailed,q.LocalTrackPublished,q.LocalTrackUnpublished],mI=[q.ConnectionQualityChanged,q.IsSpeakingChanged,q.ParticipantMetadataChanged,q.ParticipantPermissionsChanged,q.TrackMuted,q.TrackUnmuted,q.TrackPublished,q.TrackUnpublished,q.TrackStreamStateChanged,q.TrackSubscriptionFailed,q.TrackSubscriptionPermissionChanged,q.TrackSubscriptionStatusChanged];[...mI,q.LocalTrackPublished,q.LocalTrackUnpublished];var pn=gA.getLogger("lk-components-js");pn.setDefaultLevel("WARN");function pI(t,e){var n;return ki(Kn({},t),{receivedAtMediaTimestamp:(n=e.rtpTimestamp)!=null?n:0,receivedAt:e.timestamp})}function gI(t,e,n){return[...t,...e].reduceRight((i,r)=>(i.find(s=>s.id===r.id)||i.unshift(r),i),[]).slice(0-n)}function Lb(t){return typeof t=="object"}function Vb(t){return Array.isArray(t)&&t.filter(Lb).length>0}function Fb(t){return`${cI}-${t}`}function vI(t){const e=kd(t),n=$b(t.participant).pipe(Lt(()=>kd(t)),fi(e));return{className:Fb(t.source===D.Source.Camera||t.source===D.Source.ScreenShare?"participant-media-video":"participant-media-audio"),trackObserver:n}}function kd(t){if(Qu(t))return t.publication;{const{source:e,name:n,participant:i}=t;if(e&&n)return i.getTrackPublications().find(r=>r.source===e&&r.trackName===n);if(n)return i.getTrackPublicationByName(n);if(e)return i.getTrackPublication(e);throw new Error("At least one of source and name needs to be defined")}}function eh(t,...e){return new it(n=>{const i=()=>{n.next(t)};return e.forEach(r=>{t.on(r,i)}),()=>{e.forEach(r=>{t.off(r,i)})}}).pipe(fi(t))}function Ub(t,e){return new it(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function yI(t){return Ub(t,V.ConnectionStateChanged).pipe(Lt(([e])=>e),fi(t.state))}function bI(t){return Ub(t,V.DataReceived)}function xI(t){return eh(t,V.AudioPlaybackStatusChanged).pipe(Lt(e=>({canPlayAudio:e.canPlaybackAudio})))}function Bb(t,...e){return new it(n=>{const i=()=>{n.next(t)};return e.forEach(r=>{t.on(r,i)}),()=>{e.forEach(r=>{t.off(r,i)})}}).pipe(fi(t))}function $b(t){return Bb(t,q.TrackMuted,q.TrackUnmuted,q.ParticipantPermissionsChanged,q.TrackPublished,q.TrackUnpublished,q.LocalTrackPublished,q.LocalTrackUnpublished,q.MediaDevicesError,q.TrackSubscriptionStatusChanged).pipe(Lt(e=>{const{isMicrophoneEnabled:n,isCameraEnabled:i,isScreenShareEnabled:r}=e,s=e.getTrackPublication(D.Source.Microphone),o=e.getTrackPublication(D.Source.Camera);return{isCameraEnabled:i,isMicrophoneEnabled:n,isScreenShareEnabled:r,cameraTrack:o,microphoneTrack:s,participant:e}}))}function wI(t,e){return new it(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function SI(t,e={}){var n;let i;const r=new it(c=>(i=c,()=>a.unsubscribe())).pipe(fi(Array.from(t.remoteParticipants.values()))),s=(n=e.additionalRoomEvents)!=null?n:jb,o=Array.from(new Set([V.ParticipantConnected,V.ParticipantDisconnected,V.ConnectionStateChanged,...s])),a=eh(t,...o).subscribe(c=>i==null?void 0:i.next(Array.from(c.remoteParticipants.values())));return t.remoteParticipants.size>0&&(i==null||i.next(Array.from(t.remoteParticipants.values()))),r}function dp(t){return typeof t>"u"?new it:wI(t,q.AttributesChanged).pipe(Lt(([e])=>({changed:e,attributes:t.attributes})),fi({changed:t.attributes,attributes:t.attributes}))}var Hb={CHAT:"lk.chat",TRANSCRIPTION:"lk.transcription"},kI={CHAT:"lk-chat-topic"};function zb(t,e){return Mr(this,arguments,function*(n,i,r={}){const{reliable:s,destinationIdentities:o,topic:a}=r;yield n.publishData(i,{destinationIdentities:o,topic:a,reliable:s})})}function CI(t,e,n){const i=Array.isArray(e)?e:[e],r=bI(t).pipe(Ob(([,,,a])=>e===void 0||a!==void 0&&i.includes(a)),Lt(([a,c,,l])=>({payload:a,topic:l,from:c})));let s;const o=new it(a=>{s=a});return{messageObservable:r,isSendingObservable:o,send:(a,...c)=>Mr(this,[a,...c],function*(l,d={}){s.next(!0);try{yield zb(t.localParticipant,l,Kn({topic:i[0]},d))}finally{s.next(!1)}})}}var so=new WeakMap;function TI(t){return t.ignoreLegacy==!0}var EI=t=>JSON.parse(new TextDecoder().decode(t)),PI=t=>new TextEncoder().encode(JSON.stringify(t));function RI(t,e){var n,i,r,s,o,a;const c=()=>{var x,T,E;return((x=t.serverInfo)==null?void 0:x.edition)===1||!!((T=t.serverInfo)!=null&&T.version)&&Qn((E=t.serverInfo)==null?void 0:E.version,"1.8.2")>0},l=new Ir,d=(n=void 0)!=null?n:Hb.CHAT,u=(i=void 0)!=null?i:kI.CHAT;let h=!1;so.has(t)||(h=!0);const p=(r=so.get(t))!=null?r:new Map,v=(s=p.get(d))!=null?s:new Ir;p.set(d,v),so.set(t,p);const f=(o=void 0)!=null?o:EI;if(h){t.registerTextStreamHandler(d,(T,E)=>Mr(this,null,function*(){const{id:P,timestamp:I}=T.info;Xu(T).pipe(Sd((C,A)=>C+A),Lt(C=>({id:P,timestamp:I,message:C,from:t.getParticipantByIdentity(E.identity)}))).subscribe({next:C=>v.next(C)})}));const{messageObservable:x}=CI(t,[u]);x.pipe(Lt(T=>{const E=f(T.payload);return TI(E)?void 0:ki(Kn({},E),{from:T.from})}),Ob(T=>!!T),ap(l)).subscribe(v)}const y=v.pipe(Sd((x,T)=>{if("id"in T&&x.find(E=>{var P,I;return((P=E.from)==null?void 0:P.identity)===((I=T.from)==null?void 0:I.identity)&&E.id===T.id})){const E=x.findIndex(P=>P.id===T.id);if(E>-1){const P=x[E];x[E]=ki(Kn({},T),{timestamp:P.timestamp,editTimestamp:T.timestamp})}return[...x]}return[...x,T]},[]),ap(l)),b=new MA(!1),S=(a=void 0)!=null?a:PI,k=(x,T)=>Mr(this,null,function*(){T||(T={}),T.topic!=null||(T.topic=d),b.next(!0);try{const E={id:(yield t.localParticipant.sendText(x,T)).id,timestamp:Date.now(),message:x},P=ki(Kn({},E),{attachedFiles:T.attachments}),I=ki(Kn({},P),{from:t.localParticipant,attributes:T.attributes});v.next(I);const C=S(ki(Kn({},E),{ignoreLegacy:c()}));try{yield zb(t.localParticipant,C,{reliable:!0,topic:u})}catch(A){pn.info("could not send message in legacy chat format",A)}return I}finally{b.next(!1)}});function w(){l.next(),l.complete(),v.complete(),so.delete(t),t.unregisterTextStreamHandler(d)}return t.once(V.Disconnected,w),{messageObservable:y,isSendingObservable:b,send:k}}function AI(){const t=e=>Mr(this,null,function*(){pn.info("Start Audio for room: ",e),yield e.startAudio()});return{className:Fb("start-audio-button"),roomAudioPlaybackAllowedObservable:xI,handleStartAudioPlayback:t}}function up(t,e,n=!0){const i=[t.localParticipant,...Array.from(t.remoteParticipants.values())],r=[];return i.forEach(s=>{e.forEach(o=>{const a=Array.from(s.trackPublications.values()).filter(c=>c.source===o&&(!n||c.track)).map(c=>({participant:s,publication:c,source:c.source}));r.push(...a)})}),{trackReferences:r,participants:i}}function hp(t,e,n=!1){const{sources:i,kind:r,name:s}=e;return Array.from(t.trackPublications.values()).filter(o=>(!i||i.includes(o.source))&&(!r||o.kind===r)&&(!s||o.trackName===s)&&(!n||o.track)).map(o=>({participant:t,publication:o,source:o.source}))}function II(t,e,n){var i,r;const s=(i=n.additionalRoomEvents)!=null?i:jb,o=(r=n.onlySubscribed)!=null?r:!0,a=Array.from(new Set([V.ParticipantConnected,V.ParticipantDisconnected,V.ConnectionStateChanged,V.LocalTrackPublished,V.LocalTrackUnpublished,V.TrackPublished,V.TrackUnpublished,V.TrackSubscriptionStatusChanged,...s]).values());return eh(t,...a).pipe(Lt(c=>{const l=up(c,e,o);return pn.debug(`TrackReference[] was updated. (length ${l.trackReferences.length})`,l),l}),fi(up(t,e,o)))}function MI(t,e){return Bb(t,...fI).pipe(Lt(n=>{const i=hp(n,e);return pn.debug(`TrackReference[] was updated. (length ${i.length})`,i),i}),fi(hp(t,e)))}function Wb(t,e){return new it(n=>{const i=(...r)=>{n.next(r)};return t.on(e,i),()=>{t.off(e,i)}})}function NI(t){return Wb(t,ne.TranscriptionReceived)}function _I(t){return Wb(t,ne.TimeSyncUpdate).pipe(Lt(([e])=>e))}var $c=null,Hc=null,OI=0;function fp(){return $c||($c=new Map),$c}function DI(){return Hc||(Hc=new WeakMap),Hc}function jI(t,e){const n=DI();let i=n.get(t);return i||(i=`room_${OI++}`,n.set(t,i)),`${i}:${e}`}function LI(t,e){const n=jI(t,e),i=fp(),r=i.get(n);if(r)return r;const s=new Ir;let o=[];const a="lk.segment_id",c=s.pipe(nI({subscribe:()=>{t.registerTextStreamHandler(e,(l,d)=>Mr(this,null,function*(){var u;const h=Xu(l).pipe(Sd((v,f)=>v+f,"")),p=!!((u=l.info.attributes)!=null&&u[a]);h.subscribe(v=>{const f=o.findIndex(y=>{var b,S;return y.streamInfo.id===l.info.id||p&&((b=y.streamInfo.attributes)==null?void 0:b[a])===((S=l.info.attributes)==null?void 0:S[a])});f!==-1?(o[f]=ki(Kn({},o[f]),{text:v}),s.next([...o])):(o.push({text:v,participantInfo:d,streamInfo:l.info}),s.next([...o]))})}))},finalize:()=>{t.unregisterTextStreamHandler(e)}}),tI());return i.set(n,c),t.on(V.Disconnected,()=>{fp().delete(n),o=[],s.next([])}),c}g.createContext(void 0);const VI=g.createContext(void 0);function qb(){return g.useContext(VI)}function Gb(t){const e=qb(),n=t??e;if(!n)throw new Error("No TrackRef, make sure you are inside a TrackRefContext or pass the TrackRef explicitly");return n}const FI=g.createContext(void 0);function Kb(){return g.useContext(FI)}const ua=g.createContext(void 0);function $s(){const t=g.useContext(ua);if(!t)throw Error("tried to access room context outside of livekit room component");return t}function Zb(){return g.useContext(ua)}function Hs(t){const e=Zb(),n=t??e;if(!n)throw new Error("No room provided, make sure you are inside a Room context or pass the room explicitly");return n}g.createContext(void 0);function Yb(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=Yb(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Jb(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Yb(t))&&(i&&(i+=" "),i+=e);return i}function UI(...t){return(...e)=>{for(const n of t)if(typeof n=="function")try{n(...e)}catch(i){console.error(i)}}}function Xb(...t){const e={...t[0]};for(let n=1;n<t.length;n++){const i=t[n];for(const r in i){const s=e[r],o=i[r];typeof s=="function"&&typeof o=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?e[r]=UI(s,o):(r==="className"||r==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[r]=Jb(s,o):e[r]=o!==void 0?o:s}}return e}function BI(t){return t!==void 0}function Qb(...t){return Xb(...t.filter(BI))}function $I(t,e,n){return g.Children.map(t,i=>g.isValidElement(i)&&g.Children.only(t)?(i.props.className&&(e??(e={}),e.className=Jb(i.props.className,e.className),e.style={...i.props.style,...e.style}),g.cloneElement(i,{...e,key:n})):i)}function ri(t,e,n=!0){const[i,r]=g.useState(e);return g.useEffect(()=>{if(n&&r(e),typeof window>"u"||!t)return;const s=t.subscribe(r);return()=>s.unsubscribe()},[t,n]),i}function th(t){const e=Hs(t),n=g.useMemo(()=>yI(e),[e]);return ri(n,e.state)}function HI(t={}){const e=Hs(t.room),[n,i]=g.useState(e.localParticipant),[r,s]=g.useState(n.isMicrophoneEnabled),[o,a]=g.useState(n.isCameraEnabled),[c,l]=g.useState(n.isScreenShareEnabled),[d,u]=g.useState(n.lastMicrophoneError),[h,p]=g.useState(n.lastCameraError),[v,f]=g.useState(void 0),[y,b]=g.useState(void 0),S=k=>{a(k.isCameraEnabled),s(k.isMicrophoneEnabled),l(k.isScreenShareEnabled),b(k.cameraTrack),f(k.microphoneTrack),u(k.participant.lastMicrophoneError),p(k.participant.lastCameraError),i(k.participant)};return g.useEffect(()=>{const k=$b(e.localParticipant).subscribe(S);return()=>k.unsubscribe()},[e]),{isMicrophoneEnabled:r,isScreenShareEnabled:c,isCameraEnabled:o,microphoneTrack:v,cameraTrack:y,lastMicrophoneError:d,lastCameraError:h,localParticipant:n}}function e1(t={}){const e=Hs(t.room),[n,i]=g.useState([]);return g.useEffect(()=>{const r=SI(e,{additionalRoomEvents:t.updateOnlyOn}).subscribe(i);return()=>r.unsubscribe()},[e,JSON.stringify(t.updateOnlyOn)]),n}function zI({room:t,props:e}){const n=Hs(t),{className:i,roomAudioPlaybackAllowedObservable:r,handleStartAudioPlayback:s}=g.useMemo(()=>AI(),[]),o=g.useMemo(()=>r(n),[n,r]),{canPlayAudio:a}=ri(o,{canPlayAudio:n.canPlaybackAudio});return{mergedProps:g.useMemo(()=>Xb(e,{className:i,onClick:()=>{s(n)},style:{display:a?"none":"block"}}),[e,i,a,s,n]),canPlayAudio:a}}function nh(t=[D.Source.Camera,D.Source.Microphone,D.Source.ScreenShare,D.Source.ScreenShareAudio,D.Source.Unknown],e={}){const n=Hs(e.room),[i,r]=g.useState([]),[s,o]=g.useState([]),a=g.useMemo(()=>t.map(c=>Lb(c)?c.source:c),[JSON.stringify(t)]);return g.useEffect(()=>{const c=II(n,a,{additionalRoomEvents:e.updateOnlyOn,onlySubscribed:e.onlySubscribed}).subscribe(({trackReferences:l,participants:d})=>{pn.debug("setting track bundles",l,d),r(l),o(d)});return()=>c.unsubscribe()},[n,JSON.stringify(e.onlySubscribed),JSON.stringify(e.updateOnlyOn),JSON.stringify(t)]),g.useMemo(()=>{if(Vb(t)){const c=qI(t,s),l=Array.from(i);return s.forEach(d=>{c.has(d.identity)&&(c.get(d.identity)??[]).forEach(u=>{if(i.find(({participant:p,publication:v})=>d.identity===p.identity&&v.source===u))return;pn.debug(`Add ${u} placeholder for participant ${d.identity}.`);const h={participant:d,source:u};l.push(h)})}),l}else return i},[i,s,t])}function WI(t,e){const n=new Set(t);for(const i of e)n.delete(i);return n}function qI(t,e){const n=new Map;if(Vb(t)){const i=t.filter(r=>r.withPlaceholder).map(r=>r.source);e.forEach(r=>{const s=r.getTrackPublications().map(a=>{var c;return(c=a.track)==null?void 0:c.source}).filter(a=>a!==void 0),o=Array.from(WI(new Set(i),new Set(s)));o.length>0&&n.set(r.identity,o)})}return n}function GI(t){const e=$s(),n=th(e),i=g.useMemo(()=>n===he.Disconnected,[n]),r=g.useMemo(()=>RI(e),[e,t,i]),s=ri(r.isSendingObservable,!1),o=ri(r.messageObservable,[]);return{send:r.send,chatMessages:o,isSending:s}}const KI=t=>{const e=n=>{let i=1-Math.max(-100,Math.min(-10,n))*-1/100;return i=Math.sqrt(i),i};return t.map(n=>n===-1/0?0:e(n))},ZI={bands:5,loPass:100,hiPass:600,updateInterval:32,analyserOptions:{fftSize:2048}};function YI(t,e={}){var n;const i=t instanceof D?t:(n=t==null?void 0:t.publication)==null?void 0:n.track,r={...ZI,...e},[s,o]=g.useState(new Array(r.bands).fill(0));return g.useEffect(()=>{if(!i||!(i!=null&&i.mediaStream))return;const{analyser:a,cleanup:c}=hC(i,r.analyserOptions),l=a.frequencyBinCount,d=new Float32Array(l),u=setInterval(()=>{a.getFloatFrequencyData(d);let h=new Float32Array(d.length);for(let y=0;y<d.length;y++)h[y]=d[y];h=h.slice(e.loPass,e.hiPass);const p=KI(h),v=Math.ceil(p.length/r.bands),f=[];for(let y=0;y<r.bands;y++){const b=p.slice(y*v,(y+1)*v).reduce((S,k)=>S+=k,0);f.push(b/v)}o(f)},r.updateInterval);return()=>{c(),clearInterval(u)}},[i,i==null?void 0:i.mediaStream,JSON.stringify(e)]),s}function mp(t,e){const n=Kb(),i=e1({updateOnlyOn:[]}),r=g.useMemo(()=>e?i.find(o=>o.identity===e):n,[e,i,n]),s=g.useMemo(()=>{if(r)return MI(r,{sources:t})},[r,JSON.stringify(t)]);return ri(s,[])}function JI(t){var e,n,i;const r=g.useMemo(()=>{var s;return(s=t==null?void 0:t.publication)!=null&&s.track?_I(t==null?void 0:t.publication.track):void 0},[(e=t==null?void 0:t.publication)==null?void 0:e.track]);return ri(r,{timestamp:Date.now(),rtpTimestamp:(i=(n=t==null?void 0:t.publication)==null?void 0:n.track)==null?void 0:i.rtpTimestamp})}const XI={bufferSize:100};function QI(t,e){const n={...XI,...e},[i,r]=g.useState([]),s=JI(t),o=a=>{var c;(c=n.onTranscription)==null||c.call(n,a),r(l=>gI(l,a.map(d=>pI(d,s)),n.bufferSize))};return g.useEffect(()=>{if(!(t!=null&&t.publication))return;const a=NI(t.publication).subscribe(c=>{o(...c)});return()=>{a.unsubscribe()}},[t&&Db(t),o]),{segments:i}}function e4(t={}){const e=Kb(),n=t.participant??e,i=g.useMemo(()=>dp(n),[n]);return ri(i,{attributes:n==null?void 0:n.attributes})}const pp="lk.agent.state";function t1(){const t=e1(),e=t.find(u=>u.kind===Oi.AGENT&&!("lk.publish_on_behalf"in u.attributes)),n=t.find(u=>u.kind===Oi.AGENT&&u.attributes["lk.publish_on_behalf"]===(e==null?void 0:e.identity)),i=mp([D.Source.Microphone,D.Source.Camera],e==null?void 0:e.identity),r=mp([D.Source.Microphone,D.Source.Camera],n==null?void 0:n.identity),s=i.find(u=>u.source===D.Source.Microphone)??r.find(u=>u.source===D.Source.Microphone),o=i.find(u=>u.source===D.Source.Camera)??r.find(u=>u.source===D.Source.Camera),{segments:a}=QI(s),c=th(),{attributes:l}=e4({participant:e}),d=g.useMemo(()=>c===he.Disconnected?"disconnected":c===he.Connecting||!e||!(l!=null&&l[pp])?"connecting":l[pp],[l,e,c]);return{agent:e,state:d,audioTrack:s,videoTrack:o,agentTranscriptions:a,agentAttributes:l}}function t4(t){const e=$s(),n=th(e)===he.Disconnected,i=g.useMemo(()=>LI(e,t),[e,t]);return{textStreams:ri(n?void 0:i,[])}}function n4(t){const{participantIdentities:e,trackSids:n}={},{textStreams:i}=t4(Hb.TRANSCRIPTION);return g.useMemo(()=>i.filter(r=>e?e.includes(r.participantInfo.identity):!0).filter(r=>{var s;return n?n.includes(((s=r.streamInfo.attributes)==null?void 0:s["lk.transcribed_track_id"])??""):!0}),[i,e,n])}const gp=g.forwardRef(function({label:t="Allow Audio",...e},n){const i=$s(),{mergedProps:r}=zI({room:i,props:e});return g.createElement("button",{ref:n,...r},t)});function n1(t,e={}){const[n,i]=g.useState(kd(t)),[r,s]=g.useState(n==null?void 0:n.isMuted),[o,a]=g.useState(n==null?void 0:n.isSubscribed),[c,l]=g.useState(n==null?void 0:n.track),[d,u]=g.useState("landscape"),h=g.useRef(),{className:p,trackObserver:v}=g.useMemo(()=>vI(t),[t.participant.sid??t.participant.identity,t.source,Qu(t)&&t.publication.trackSid]);return g.useEffect(()=>{const f=v.subscribe(y=>{pn.debug("update track",y),i(y),s(y==null?void 0:y.isMuted),a(y==null?void 0:y.isSubscribed),l(y==null?void 0:y.track)});return()=>f==null?void 0:f.unsubscribe()},[v]),g.useEffect(()=>{var f,y;return c&&(h.current&&c.detach(h.current),(f=e.element)!=null&&f.current&&!(t.participant.isLocal&&(c==null?void 0:c.kind)==="audio")&&c.attach(e.element.current)),h.current=(y=e.element)==null?void 0:y.current,()=>{h.current&&(c==null||c.detach(h.current))}},[c,e.element]),g.useEffect(()=>{var f,y;if(typeof((f=n==null?void 0:n.dimensions)==null?void 0:f.width)=="number"&&typeof((y=n==null?void 0:n.dimensions)==null?void 0:y.height)=="number"){const b=n.dimensions.width>n.dimensions.height?"landscape":"portrait";u(b)}},[n]),{publication:n,isMuted:r,isSubscribed:o,track:c,elementProps:Qb(e.props,{className:p,"data-lk-local-participant":t.participant.isLocal,"data-lk-source":n==null?void 0:n.source,...(n==null?void 0:n.kind)==="video"&&{"data-lk-orientation":d}})}}var zc,vp;function i4(){if(vp)return zc;vp=1;var t="Expected a function",e=NaN,n="[object Symbol]",i=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,c=typeof io=="object"&&io&&io.Object===Object&&io,l=typeof self=="object"&&self&&self.Object===Object&&self,d=c||l||Function("return this")(),u=Object.prototype,h=u.toString,p=Math.max,v=Math.min,f=function(){return d.Date.now()};function y(x,T,E){var P,I,C,A,N,Z,Q=0,se=!1,te=!1,Y=!0;if(typeof x!="function")throw new TypeError(t);T=w(T)||0,b(E)&&(se=!!E.leading,te="maxWait"in E,C=te?p(w(E.maxWait)||0,T):C,Y="trailing"in E?!!E.trailing:Y);function _(O){var $=P,X=I;return P=I=void 0,Q=O,A=x.apply(X,$),A}function ie(O){return Q=O,N=setTimeout(ee,T),se?_(O):A}function L(O){var $=O-Z,X=O-Q,z=T-$;return te?v(z,C-X):z}function F(O){var $=O-Z,X=O-Q;return Z===void 0||$>=T||$<0||te&&X>=C}function ee(){var O=f();if(F(O))return j(O);N=setTimeout(ee,L(O))}function j(O){return N=void 0,Y&&P?_(O):(P=I=void 0,A)}function W(){N!==void 0&&clearTimeout(N),Q=0,P=Z=I=N=void 0}function J(){return N===void 0?A:j(f())}function G(){var O=f(),$=F(O);if(P=arguments,I=this,Z=O,$){if(N===void 0)return ie(Z);if(te)return N=setTimeout(ee,T),_(Z)}return N===void 0&&(N=setTimeout(ee,T)),A}return G.cancel=W,G.flush=J,G}function b(x){var T=typeof x;return!!x&&(T=="object"||T=="function")}function S(x){return!!x&&typeof x=="object"}function k(x){return typeof x=="symbol"||S(x)&&h.call(x)==n}function w(x){if(typeof x=="number")return x;if(k(x))return e;if(b(x)){var T=typeof x.valueOf=="function"?x.valueOf():x;x=b(T)?T+"":T}if(typeof x!="string")return x===0?x:+x;x=x.replace(i,"");var E=s.test(x);return E||o.test(x)?a(x.slice(2),E?2:8):r.test(x)?e:+x}return zc=y,zc}var r4=i4();const yp=mb(r4);function s4(t){const e=M.useRef(t);e.current=t,M.useEffect(()=>()=>{e.current()},[])}function o4(t,e=500,n){const i=M.useRef();s4(()=>{i.current&&i.current.cancel()});const r=M.useMemo(()=>{const s=yp(t,e,n),o=(...a)=>s(...a);return o.cancel=()=>{s.cancel()},o.isPending=()=>!!i.current,o.flush=()=>s.flush(),o},[t,e,n]);return M.useEffect(()=>{i.current=yp(t,e,n)},[t,e,n]),r}function a4(t,e,n){const i=(l,d)=>l===d,r=t instanceof Function?t():t,[s,o]=M.useState(r),a=M.useRef(r),c=o4(o,e,n);return i(a.current,r)||(c(r),a.current=r),[s,c]}function c4({threshold:t=0,root:e=null,rootMargin:n="0%",freezeOnceVisible:i=!1,initialIsIntersecting:r=!1,onChange:s}={}){var o;const[a,c]=M.useState(null),[l,d]=M.useState(()=>({isIntersecting:r,entry:void 0})),u=M.useRef();u.current=s;const h=((o=l.entry)==null?void 0:o.isIntersecting)&&i;M.useEffect(()=>{if(!a||!("IntersectionObserver"in window)||h)return;const f=new IntersectionObserver(y=>{const b=Array.isArray(f.thresholds)?f.thresholds:[f.thresholds];y.forEach(S=>{const k=S.isIntersecting&&b.some(w=>S.intersectionRatio>=w);d({isIntersecting:k,entry:S}),u.current&&u.current(k,S)})},{threshold:t,root:e,rootMargin:n});return f.observe(a),()=>{f.disconnect()}},[a,JSON.stringify(t),e,n,h,i]);const p=M.useRef(null);M.useEffect(()=>{var f;!a&&(f=l.entry)!=null&&f.target&&!i&&!h&&p.current!==l.entry.target&&(p.current=l.entry.target,d({isIntersecting:r,entry:void 0}))},[a,l.entry,i,h,r]);const v=[c,!!l.isIntersecting,l.entry];return v.ref=v[0],v.isIntersecting=v[1],v.entry=v[2],v}const ih=g.forwardRef(function({onTrackClick:t,onClick:e,onSubscriptionStatusChanged:n,trackRef:i,manageSubscription:r,...s},o){const a=Gb(i),c=g.useRef(null);g.useImperativeHandle(o,()=>c.current);const l=c4({root:c.current}),[d]=a4(l,3e3);g.useEffect(()=>{r&&a.publication instanceof ia&&(d==null?void 0:d.isIntersecting)===!1&&(l==null?void 0:l.isIntersecting)===!1&&a.publication.setSubscribed(!1)},[d,a,r]),g.useEffect(()=>{r&&a.publication instanceof ia&&(l==null?void 0:l.isIntersecting)===!0&&a.publication.setSubscribed(!0)},[l,a,r]);const{elementProps:u,publication:h,isSubscribed:p}=n1(a,{element:c,props:s});g.useEffect(()=>{n==null||n(!!p)},[p,n]);const v=f=>{e==null||e(f),t==null||t({participant:a==null?void 0:a.participant,track:h})};return g.createElement("video",{ref:c,...u,muted:!0,onClick:v})}),l4=g.forwardRef(function({trackRef:t,onSubscriptionStatusChanged:e,volume:n,...i},r){const s=Gb(t),o=g.useRef(null);g.useImperativeHandle(r,()=>o.current);const{elementProps:a,isSubscribed:c,track:l,publication:d}=n1(s,{element:o,props:i});return g.useEffect(()=>{e==null||e(!!c)},[c,e]),g.useEffect(()=>{l===void 0||n===void 0||(l instanceof _v?l.setVolume(n):pn.warn("Volume can only be set on remote audio tracks."))},[n,l]),g.useEffect(()=>{d===void 0||i.muted===void 0||(d instanceof ia?d.setEnabled(!i.muted):pn.warn("Can only call setEnabled on remote track publications."))},[i.muted,d,l]),g.createElement("audio",{ref:o,...a})});function bp({volume:t,muted:e}){const n=nh([D.Source.Microphone,D.Source.ScreenShareAudio,D.Source.Unknown],{updateOnlyOn:[],onlySubscribed:!0}).filter(i=>!i.participant.isLocal&&i.publication.kind===D.Kind.Audio);return g.createElement("div",{style:{display:"none"}},n.map(i=>g.createElement(l4,{key:Db(i),trackRef:i,volume:t,muted:e})))}const d4=t=>{const e=[];for(let n=0;n<t;n++)e.push([n,t-1-n]);return e},xp=t=>[[Math.floor(t/2)],[-1]],u4=(t,e,n)=>{const[i,r]=M.useState(0),[s,o]=M.useState([[]]);M.useEffect(()=>{if(t==="thinking")o(xp(e));else if(t==="connecting"||t==="initializing"){const c=[...d4(e)];o(c)}else o(t==="listening"?xp(e):t===void 0||t==="speaking"?[new Array(e).fill(0).map((c,l)=>l)]:[[]]);r(0)},[t,e]);const a=M.useRef(null);return M.useEffect(()=>{let c=performance.now();const l=d=>{d-c>=n&&(r(u=>u+1),c=d),a.current=requestAnimationFrame(l)};return a.current=requestAnimationFrame(l),()=>{a.current!==null&&cancelAnimationFrame(a.current)}},[n,e,t,s.length]),s[i%s.length]},h4=new Map([["connecting",2e3],["initializing",2e3],["listening",500],["thinking",150]]),f4=(t,e)=>{if(t===void 0)return 1e3;let n=h4.get(t);if(n)switch(t){case"connecting":n/=e;break}return n},i1=g.forwardRef(function({state:t,options:e,barCount:n=15,trackRef:i,children:r,...s},o){const a=Qb(s,{className:"lk-audio-bar-visualizer"});let c=qb();i&&(c=i);const l=YI(c,{bands:n,loPass:100,hiPass:200}),d=(e==null?void 0:e.minHeight)??20,u=(e==null?void 0:e.maxHeight)??100,h=u4(t,n,f4(t,n)??100);return g.createElement("div",{ref:o,...a,"data-lk-va-state":t},l.map((p,v)=>r?$I(r,{"data-lk-highlighted":h.includes(v),"data-lk-bar-index":v,className:"lk-audio-bar",style:{height:`${Math.min(u,Math.max(d,p*100+5))}%`}}):g.createElement("span",{key:v,"data-lk-highlighted":h.includes(v),"data-lk-bar-index":v,className:`lk-audio-bar ${h.includes(v)&&"lk-highlighted"}`,style:{height:`${Math.min(u,Math.max(d,p*100+5))}%`}})))});function m4(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}Array(12).fill(0);let Cd=1;class p4{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:i,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Cd++,o=this.toasts.find(c=>c.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...e,id:s,title:i}),{...c,...e,id:s,dismissible:a,title:i}):c):this.addToast({title:i,...r,dismissible:a,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(i=>i({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let i;n.loading!==void 0&&(i=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let s=i!==void 0,o;const a=r.then(async l=>{if(o=["resolve",l],g.default.isValidElement(l))s=!1,this.create({id:i,type:"default",message:l});else if(v4(l)&&!l.ok){s=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${l.status}`):n.error,h=typeof n.description=="function"?await n.description(`HTTP error! status: ${l.status}`):n.description,v=typeof u=="object"&&!g.default.isValidElement(u)?u:{message:u};this.create({id:i,type:"error",description:h,...v})}else if(l instanceof Error){s=!1;const u=typeof n.error=="function"?await n.error(l):n.error,h=typeof n.description=="function"?await n.description(l):n.description,v=typeof u=="object"&&!g.default.isValidElement(u)?u:{message:u};this.create({id:i,type:"error",description:h,...v})}else if(n.success!==void 0){s=!1;const u=typeof n.success=="function"?await n.success(l):n.success,h=typeof n.description=="function"?await n.description(l):n.description,v=typeof u=="object"&&!g.default.isValidElement(u)?u:{message:u};this.create({id:i,type:"success",description:h,...v})}}).catch(async l=>{if(o=["reject",l],n.error!==void 0){s=!1;const d=typeof n.error=="function"?await n.error(l):n.error,u=typeof n.description=="function"?await n.description(l):n.description,p=typeof d=="object"&&!g.default.isValidElement(d)?d:{message:d};this.create({id:i,type:"error",description:u,...p})}}).finally(()=>{s&&(this.dismiss(i),i=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((l,d)=>a.then(()=>o[0]==="reject"?d(o[1]):l(o[1])).catch(d));return typeof i!="string"&&typeof i!="number"?{unwrap:c}:Object.assign(i,{unwrap:c})},this.custom=(e,n)=>{const i=(n==null?void 0:n.id)||Cd++;return this.create({jsx:e(i),id:i,...n}),i},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const _t=new p4,g4=(t,e)=>{const n=(e==null?void 0:e.id)||Cd++;return _t.addToast({title:t,...e,id:n}),n},v4=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",y4=g4,b4=()=>_t.toasts,x4=()=>_t.getActiveToasts(),r1=Object.assign(y4,{success:_t.success,info:_t.info,warning:_t.warning,error:_t.error,custom:_t.custom,message:_t.message,promise:_t.promise,dismiss:_t.dismiss,loading:_t.loading},{getHistory:b4,getToasts:x4});m4("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const Xt=g.forwardRef((t,e)=>{const{alt:n,color:i="currentColor",size:r="1em",weight:s="regular",mirrored:o=!1,children:a,weights:c,...l}=t;return g.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:i,viewBox:"0 0 256 256",transform:o?"scale(-1, 1)":void 0,...l},!!n&&g.createElement("title",null,n),a,c.get(s))});Xt.displayName="SSRBase";const w4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),g.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),rh=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:w4}));rh.displayName="CaretDownIcon";const S4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),g.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),s1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:S4}));s1.displayName="CaretUpIcon";const k4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),g.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),o1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:k4}));o1.displayName="ChatTextIcon";const C4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),g.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),a1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:C4}));a1.displayName="CheckIcon";const T4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),g.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),c1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:T4}));c1.displayName="MicrophoneIcon";const E4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),g.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),l1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:E4}));l1.displayName="MicrophoneSlashIcon";const P4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),g.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),d1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:P4}));d1.displayName="MonitorArrowUpIcon";const R4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),g.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),sh=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:R4}));sh.displayName="SpinnerIcon";const A4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),g.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),u1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:A4}));u1.displayName="VideoCameraIcon";const I4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),g.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),h1=g.forwardRef((t,e)=>g.createElement(Xt,{ref:e,...t,weights:I4}));h1.displayName="VideoCameraSlashIcon";const M4=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),g.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),N4=M.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),f1=g.forwardRef((t,e)=>{const{alt:n,color:i,size:r,weight:s,mirrored:o,children:a,weights:c,...l}=t,{color:d="currentColor",size:u,weight:h="regular",mirrored:p=!1,...v}=g.useContext(N4);return g.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:r??u,height:r??u,fill:i??d,viewBox:"0 0 256 256",transform:o||p?"scale(-1, 1)":void 0,...v,...l},!!n&&g.createElement("title",null,n),a,c.get(s??h))});f1.displayName="IconBase";const m1=g.forwardRef((t,e)=>g.createElement(f1,{ref:e,...t,weights:M4}));m1.displayName="WarningIcon";function p1(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=p1(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Na(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=p1(t))&&(i&&(i+=" "),i+=e);return i}const wp=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Sp=Na,_a=(t,e)=>n=>{var i;if((e==null?void 0:e.variants)==null)return Sp(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=e,o=Object.keys(r).map(l=>{const d=n==null?void 0:n[l],u=s==null?void 0:s[l];if(d===null)return null;const h=wp(d)||wp(u);return r[l][h]}),a=n&&Object.entries(n).reduce((l,d)=>{let[u,h]=d;return h===void 0||(l[u]=h),l},{}),c=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((l,d)=>{let{class:u,className:h,...p}=d;return Object.entries(p).every(v=>{let[f,y]=v;return Array.isArray(y)?y.includes({...s,...a}[f]):{...s,...a}[f]===y})?[...l,u,h]:l},[]);return Sp(t,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},oh="-",_4=t=>{const e=D4(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:o=>{const a=o.split(oh);return a[0]===""&&a.length!==1&&a.shift(),g1(a,e)||O4(o)},getConflictingClassGroupIds:(o,a)=>{const c=n[o]||[];return a&&i[o]?[...c,...i[o]]:c}}},g1=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],i=e.nextPart.get(n),r=i?g1(t.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const s=t.join(oh);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},kp=/^\[(.+)\]$/,O4=t=>{if(kp.test(t)){const e=kp.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},D4=t=>{const{theme:e,classGroups:n}=t,i={nextPart:new Map,validators:[]};for(const r in n)Td(n[r],i,r,e);return i},Td=(t,e,n,i)=>{t.forEach(r=>{if(typeof r=="string"){const s=r===""?e:Cp(e,r);s.classGroupId=n;return}if(typeof r=="function"){if(j4(r)){Td(r(i),e,n,i);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,o])=>{Td(o,Cp(e,s),n,i)})})},Cp=(t,e)=>{let n=t;return e.split(oh).forEach(i=>{n.nextPart.has(i)||n.nextPart.set(i,{nextPart:new Map,validators:[]}),n=n.nextPart.get(i)}),n},j4=t=>t.isThemeGetter,L4=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,i=new Map;const r=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,i=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=i.get(s))!==void 0)return r(s,o),o},set(s,o){n.has(s)?n.set(s,o):r(s,o)}}},Ed="!",Pd=":",V4=Pd.length,F4=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=r=>{const s=[];let o=0,a=0,c=0,l;for(let v=0;v<r.length;v++){let f=r[v];if(o===0&&a===0){if(f===Pd){s.push(r.slice(c,v)),c=v+V4;continue}if(f==="/"){l=v;continue}}f==="["?o++:f==="]"?o--:f==="("?a++:f===")"&&a--}const d=s.length===0?r:r.substring(c),u=U4(d),h=u!==d,p=l&&l>c?l-c:void 0;return{modifiers:s,hasImportantModifier:h,baseClassName:u,maybePostfixModifierPosition:p}};if(e){const r=e+Pd,s=i;i=o=>o.startsWith(r)?s(o.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const r=i;i=s=>n({className:s,parseClassName:r})}return i},U4=t=>t.endsWith(Ed)?t.substring(0,t.length-1):t.startsWith(Ed)?t.substring(1):t,B4=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(i=>[i,!0]));return i=>{if(i.length<=1)return i;const r=[];let s=[];return i.forEach(o=>{o[0]==="["||e[o]?(r.push(...s.sort(),o),s=[]):s.push(o)}),r.push(...s.sort()),r}},$4=t=>({cache:L4(t.cacheSize),parseClassName:F4(t),sortModifiers:B4(t),..._4(t)}),H4=/\s+/,z4=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:s}=e,o=[],a=t.trim().split(H4);let c="";for(let l=a.length-1;l>=0;l-=1){const d=a[l],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:f}=n(d);if(u){c=d+(c.length>0?" "+c:c);continue}let y=!!f,b=i(y?v.substring(0,f):v);if(!b){if(!y){c=d+(c.length>0?" "+c:c);continue}if(b=i(v),!b){c=d+(c.length>0?" "+c:c);continue}y=!1}const S=s(h).join(":"),k=p?S+Ed:S,w=k+b;if(o.includes(w))continue;o.push(w);const x=r(b,y);for(let T=0;T<x.length;++T){const E=x[T];o.push(k+E)}c=d+(c.length>0?" "+c:c)}return c};function W4(){let t=0,e,n,i="";for(;t<arguments.length;)(e=arguments[t++])&&(n=v1(e))&&(i&&(i+=" "),i+=n);return i}const v1=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=v1(t[i]))&&(n&&(n+=" "),n+=e);return n};function q4(t,...e){let n,i,r,s=o;function o(c){const l=e.reduce((d,u)=>u(d),t());return n=$4(l),i=n.cache.get,r=n.cache.set,s=a,a(c)}function a(c){const l=i(c);if(l)return l;const d=z4(c,n);return r(c,d),d}return function(){return s(W4.apply(null,arguments))}}const tt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},y1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,b1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G4=/^\d+\/\d+$/,K4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Z4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Y4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,J4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,X4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gi=t=>G4.test(t),fe=t=>!!t&&!Number.isNaN(Number(t)),Hn=t=>!!t&&Number.isInteger(Number(t)),Wc=t=>t.endsWith("%")&&fe(t.slice(0,-1)),wn=t=>K4.test(t),Q4=()=>!0,eM=t=>Z4.test(t)&&!Y4.test(t),x1=()=>!1,tM=t=>J4.test(t),nM=t=>X4.test(t),iM=t=>!ae(t)&&!ce(t),rM=t=>Br(t,k1,x1),ae=t=>y1.test(t),xi=t=>Br(t,C1,eM),qc=t=>Br(t,lM,fe),Tp=t=>Br(t,w1,x1),sM=t=>Br(t,S1,nM),oo=t=>Br(t,T1,tM),ce=t=>b1.test(t),ts=t=>$r(t,C1),oM=t=>$r(t,dM),Ep=t=>$r(t,w1),aM=t=>$r(t,k1),cM=t=>$r(t,S1),ao=t=>$r(t,T1,!0),Br=(t,e,n)=>{const i=y1.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},$r=(t,e,n=!1)=>{const i=b1.exec(t);return i?i[1]?e(i[1]):n:!1},w1=t=>t==="position"||t==="percentage",S1=t=>t==="image"||t==="url",k1=t=>t==="length"||t==="size"||t==="bg-size",C1=t=>t==="length",lM=t=>t==="number",dM=t=>t==="family-name",T1=t=>t==="shadow",uM=()=>{const t=tt("color"),e=tt("font"),n=tt("text"),i=tt("font-weight"),r=tt("tracking"),s=tt("leading"),o=tt("breakpoint"),a=tt("container"),c=tt("spacing"),l=tt("radius"),d=tt("shadow"),u=tt("inset-shadow"),h=tt("text-shadow"),p=tt("drop-shadow"),v=tt("blur"),f=tt("perspective"),y=tt("aspect"),b=tt("ease"),S=tt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],x=()=>[...w(),ce,ae],T=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],P=()=>[ce,ae,c],I=()=>[Gi,"full","auto",...P()],C=()=>[Hn,"none","subgrid",ce,ae],A=()=>["auto",{span:["full",Hn,ce,ae]},Hn,ce,ae],N=()=>[Hn,"auto",ce,ae],Z=()=>["auto","min","max","fr",ce,ae],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],se=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...P()],Y=()=>[Gi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],_=()=>[t,ce,ae],ie=()=>[...w(),Ep,Tp,{position:[ce,ae]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",aM,rM,{size:[ce,ae]}],ee=()=>[Wc,ts,xi],j=()=>["","none","full",l,ce,ae],W=()=>["",fe,ts,xi],J=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[fe,Wc,Ep,Tp],$=()=>["","none",v,ce,ae],X=()=>["none",fe,ce,ae],z=()=>["none",fe,ce,ae],oe=()=>[fe,ce,ae],H=()=>[Gi,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[wn],breakpoint:[wn],color:[Q4],container:[wn],"drop-shadow":[wn],ease:["in","out","in-out"],font:[iM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[wn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[wn],shadow:[wn],spacing:["px",fe],text:[wn],"text-shadow":[wn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Gi,ae,ce,y]}],container:["container"],columns:[{columns:[fe,ae,ce,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:x()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Hn,"auto",ce,ae]}],basis:[{basis:[Gi,"full","auto",a,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[fe,Gi,"auto","initial","none",ae]}],grow:[{grow:["",fe,ce,ae]}],shrink:[{shrink:["",fe,ce,ae]}],order:[{order:[Hn,"first","last","none",ce,ae]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Z()}],"auto-rows":[{"auto-rows":Z()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...se(),"normal"]}],"justify-self":[{"justify-self":["auto",...se()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...se(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...se(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...se(),"baseline"]}],"place-self":[{"place-self":["auto",...se()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[a,"screen",...Y()]}],"min-w":[{"min-w":[a,"screen","none",...Y()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,ts,xi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ce,qc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wc,ae]}],"font-family":[{font:[oM,ae,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ce,ae]}],"line-clamp":[{"line-clamp":[fe,"none",ce,qc]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",ce,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[fe,"from-font","auto",ce,xi]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[fe,"auto",ce,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce,ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ce,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hn,ce,ae],radial:["",ce,ae],conic:[Hn,ce,ae]},cM,sM]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:j()}],"rounded-s":[{"rounded-s":j()}],"rounded-e":[{"rounded-e":j()}],"rounded-t":[{"rounded-t":j()}],"rounded-r":[{"rounded-r":j()}],"rounded-b":[{"rounded-b":j()}],"rounded-l":[{"rounded-l":j()}],"rounded-ss":[{"rounded-ss":j()}],"rounded-se":[{"rounded-se":j()}],"rounded-ee":[{"rounded-ee":j()}],"rounded-es":[{"rounded-es":j()}],"rounded-tl":[{"rounded-tl":j()}],"rounded-tr":[{"rounded-tr":j()}],"rounded-br":[{"rounded-br":j()}],"rounded-bl":[{"rounded-bl":j()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[fe,ce,ae]}],"outline-w":[{outline:["",fe,ts,xi]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",d,ao,oo]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",u,ao,oo]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[fe,xi]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",h,ao,oo]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[fe,ce,ae]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[ce,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,ae]}],filter:[{filter:["","none",ce,ae]}],blur:[{blur:$()}],brightness:[{brightness:[fe,ce,ae]}],contrast:[{contrast:[fe,ce,ae]}],"drop-shadow":[{"drop-shadow":["","none",p,ao,oo]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",fe,ce,ae]}],"hue-rotate":[{"hue-rotate":[fe,ce,ae]}],invert:[{invert:["",fe,ce,ae]}],saturate:[{saturate:[fe,ce,ae]}],sepia:[{sepia:["",fe,ce,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,ae]}],"backdrop-blur":[{"backdrop-blur":$()}],"backdrop-brightness":[{"backdrop-brightness":[fe,ce,ae]}],"backdrop-contrast":[{"backdrop-contrast":[fe,ce,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",fe,ce,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[fe,ce,ae]}],"backdrop-invert":[{"backdrop-invert":["",fe,ce,ae]}],"backdrop-opacity":[{"backdrop-opacity":[fe,ce,ae]}],"backdrop-saturate":[{"backdrop-saturate":[fe,ce,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",fe,ce,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ce,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[fe,"initial",ce,ae]}],ease:[{ease:["linear","initial",b,ce,ae]}],delay:[{delay:[fe,ce,ae]}],animate:[{animate:["none",S,ce,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,ce,ae]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:X()}],"rotate-x":[{"rotate-x":X()}],"rotate-y":[{"rotate-y":X()}],"rotate-z":[{"rotate-z":X()}],scale:[{scale:z()}],"scale-x":[{"scale-x":z()}],"scale-y":[{"scale-y":z()}],"scale-z":[{"scale-z":z()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[ce,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ce,ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ce,ae]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[fe,ts,xi,qc]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},hM=q4(uM);function le(...t){return hM(Na(t))}function fM(t,e){return{id:t.streamInfo.id,timestamp:t.streamInfo.timestamp,message:t.text,from:t.participantInfo.identity===e.localParticipant.identity?e.localParticipant:Array.from(e.remoteParticipants.values()).find(n=>n.identity===t.participantInfo.identity)}}const mM=_a(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function pM({className:t,variant:e,...n}){return m.jsx("div",{"data-slot":"alert",role:"alert",className:le(mM({variant:e}),t),...n})}function gM({className:t,...e}){return m.jsx("div",{"data-slot":"alert-title",className:le("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...e})}function vM({className:t,...e}){return m.jsx("div",{"data-slot":"alert-description",className:le("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...e})}function co(t){return r1.custom(e=>m.jsx(yM,{id:e,title:t.title,description:t.description}),{duration:1e4})}function yM(t){const{title:e,id:n,description:i}=t;return m.jsxs(pM,{onClick:()=>r1.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[m.jsx(m1,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),m.jsxs("div",{className:"flex flex-col",children:[m.jsx(gM,{className:"text-base font-semibold text-white mb-1",children:e}),m.jsx(vM,{className:"text-sm text-gray-300 leading-snug",children:i})]})]})}function Pp(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function E1(...t){return e=>{let n=!1;const i=t.map(r=>{const s=Pp(r,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():Pp(t[r],null)}}}}function dt(...t){return g.useCallback(E1(...t),t)}function As(t){const e=xM(t),n=g.forwardRef((i,r)=>{const{children:s,...o}=i,a=g.Children.toArray(s),c=a.find(SM);if(c){const l=c.props.children,d=a.map(u=>u===c?g.Children.count(l)>1?g.Children.only(null):g.isValidElement(l)?l.props.children:null:u);return m.jsx(e,{...o,ref:r,children:g.isValidElement(l)?g.cloneElement(l,void 0,d):null})}return m.jsx(e,{...o,ref:r,children:s})});return n.displayName=`${t}.Slot`,n}var bM=As("Slot");function xM(t){const e=g.forwardRef((n,i)=>{const{children:r,...s}=n;if(g.isValidElement(r)){const o=CM(r),a=kM(s,r.props);return r.type!==g.Fragment&&(a.ref=i?E1(i,o):o),g.cloneElement(r,a)}return g.Children.count(r)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var wM=Symbol("radix.slottable");function SM(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===wM}function kM(t,e){const n={...e};for(const i in e){const r=t[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...a)=>{const c=s(...a);return r(...a),c}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...t,...n}}function CM(t){var i,r;let e=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const TM=_a(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function EM({className:t,variant:e,size:n,asChild:i=!1,...r}){const s=i?bM:"button";return m.jsx(s,{"data-slot":"button",className:le(TM({variant:e,size:n,className:t})),...r})}function PM({onSend:t,className:e,disabled:n,...i}){const r=M.useRef(null),[s,o]=M.useState(""),a=l=>{var d,u;l.preventDefault(),(d=i.onSubmit)==null||d.call(i,l),t==null||t(s),o(""),(u=r.current)==null||u.focus({preventScroll:!0})},c=n||s.trim().length===0;return m.jsxs("form",{...i,onSubmit:a,className:le("flex items-center rounded-md pl-1 text-sm",e),children:[m.jsx("input",{ref:r,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:s,onChange:l=>o(l.target.value),disabled:n}),m.jsx(EM,{size:"sm",type:"submit",variant:c?"secondary":"primary",disabled:c,className:"font-mono",children:"SEND"})]})}function Ge(t,e,{checkForDefaultPrevented:n=!0}={}){return function(r){if(t==null||t(r),n===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}var St=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},RM=g[" useInsertionEffect ".trim().toString()]||St;function Rd({prop:t,defaultProp:e,onChange:n=()=>{},caller:i}){const[r,s,o]=AM({defaultProp:e,onChange:n}),a=t!==void 0,c=a?t:r;{const d=g.useRef(t!==void 0);g.useEffect(()=>{const u=d.current;u!==a&&console.warn(`${i} is changing from ${u?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,i])}const l=g.useCallback(d=>{var u;if(a){const h=IM(d)?d(t):d;h!==t&&((u=o.current)==null||u.call(o,h))}else s(d)},[a,t,s,o]);return[c,l]}function AM({defaultProp:t,onChange:e}){const[n,i]=g.useState(t),r=g.useRef(n),s=g.useRef(e);return RM(()=>{s.current=e},[e]),g.useEffect(()=>{var o;r.current!==n&&((o=s.current)==null||o.call(s,n),r.current=n)},[n,r]),[n,i,s]}function IM(t){return typeof t=="function"}var MM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],We=MM.reduce((t,e)=>{const n=As(`Primitive.${e}`),i=g.forwardRef((r,s)=>{const{asChild:o,...a}=r,c=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(c,{...a,ref:s})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});function NM(t,e){t&&js.flushSync(()=>t.dispatchEvent(e))}var P1="Toggle",R1=g.forwardRef((t,e)=>{const{pressed:n,defaultPressed:i,onPressedChange:r,...s}=t,[o,a]=Rd({prop:n,onChange:r,defaultProp:i??!1,caller:P1});return m.jsx(We.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:Ge(t.onClick,()=>{t.disabled||a(!o)})})});R1.displayName=P1;var _M=R1;const OM=_a(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function A1({className:t,variant:e,size:n,...i}){return m.jsx(_M,{"data-slot":"toggle",className:le(OM({variant:e,size:n,className:t})),...i})}function DM(t){const[e,n]=M.useState(()=>t.getPublishPermissions());return M.useEffect(()=>{const i=()=>{n(t.getPublishPermissions())},r=()=>{i()};return t.on("connection.connected",r),t.on("connection.disconnected",r),()=>{t.off("connection.connected",r),t.off("connection.disconnected",r)}},[t]),e}function jM(t){const[e,n]=M.useState(()=>t.getLocalParticipant()),[i,r]=M.useState(()=>t.getMicrophoneTrack());return M.useEffect(()=>{const s=()=>{const a=t.getLocalParticipant(),c=t.getMicrophoneTrack();console.log("🎤 useVoxketLocalParticipant: Updating state:",{hasParticipant:!!a,hasMicTrack:!!c,isMicEnabled:t.isMicrophoneEnabled,trackPublications:a?a.trackPublications.size:0}),n(a),r(c)};s(),t.on("connection.connected",s),t.on("connection.disconnected",s),t.on("track.muted",s),t.on("track.unmuted",s);const o=t.getRoom();if(o){const a=()=>{console.log("🎤 Track published, updating participant state"),s()},c=()=>{console.log("🎤 Track unpublished, updating participant state"),s()};return o.on("localTrackPublished",a),o.on("localTrackUnpublished",c),()=>{t.off("connection.connected",s),t.off("connection.disconnected",s),t.off("track.muted",s),t.off("track.unmuted",s),o.off("localTrackPublished",a),o.off("localTrackUnpublished",c)}}else return()=>{t.off("connection.connected",s),t.off("connection.disconnected",s),t.off("track.muted",s),t.off("track.unmuted",s)}},[t]),{localParticipant:e,microphoneTrack:i}}function Gc(t,e,n){const[i,r]=M.useState(!1),[s,o]=M.useState(!1);return M.useEffect(()=>{const c=()=>{let l=!1;switch(e){case"microphone":l=t.isMicrophoneEnabled;break;case"camera":l=t.isCameraEnabled;break;case"screenShare":l=t.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${e} enabled state updated to:`,l),r(l)};return c(),t.on("track.muted",c),t.on("track.unmuted",c),t.on("connection.connected",c),()=>{t.off("track.muted",c),t.off("track.unmuted",c),t.off("connection.connected",c)}},[t,e]),{enabled:i,pending:s,toggle:async c=>{var l;try{o(!0);const d=c!==void 0?c:!i;switch(e){case"microphone":await t.toggleMicrophone(d);break;case"camera":await t.toggleCamera(d);break;case"screenShare":d?await t.startScreenShare():await t.stopScreenShare();break}}catch(d){(l=n==null?void 0:n.onDeviceError)==null||l.call(n,d)}finally{o(!1)}}}}function LM(t){const[e,n]=M.useState(()=>t.getRoom()),[i,r]=M.useState(()=>t.getConnectionState());return M.useEffect(()=>{const s=()=>{n(t.getRoom()),r(t.getConnectionState())};return t.on("connection.connected",s),t.on("connection.disconnected",s),t.on("connection.connecting",s),()=>{t.off("connection.connected",s),t.off("connection.disconnected",s),t.off("connection.connecting",s)}},[t]),e}function VM(t,e){const[n,i]=M.useState([]),[r,s]=M.useState("");return M.useEffect(()=>{var l;const a=async()=>{try{const d=e==="audioinput"?await t.getAudioInputDevices():await t.getVideoInputDevices();i(d)}catch(d){console.error("Failed to load devices:",d)}};a();const c=()=>{a()};return(l=navigator.mediaDevices)==null||l.addEventListener("devicechange",c),()=>{var d;(d=navigator.mediaDevices)==null||d.removeEventListener("devicechange",c)}},[t,e]),{devices:n,activeDeviceId:r,setActiveMediaDevice:async a=>{try{e==="audioinput"?await t.setAudioInputDevice(a):await t.setVideoInputDevice(a),s(a)}catch(c){console.error("Failed to set device:",c)}}}}function FM(t){const{preventSave:e=!1}=t||{};return{saveAudioInputEnabled:o=>{e||localStorage.setItem("voxket-audio-input-enabled",o.toString())},saveAudioInputDeviceId:o=>{e||localStorage.setItem("voxket-audio-input-device-id",o)},saveVideoInputEnabled:o=>{e||localStorage.setItem("voxket-video-input-enabled",o.toString())},saveVideoInputDeviceId:o=>{e||localStorage.setItem("voxket-video-input-device-id",o)}}}function Rp(t,[e,n]){return Math.min(n,Math.max(e,t))}function ah(t,e=[]){let n=[];function i(s,o){const a=g.createContext(o),c=n.length;n=[...n,o];const l=u=>{var b;const{scope:h,children:p,...v}=u,f=((b=h==null?void 0:h[t])==null?void 0:b[c])||a,y=g.useMemo(()=>v,Object.values(v));return m.jsx(f.Provider,{value:y,children:p})};l.displayName=s+"Provider";function d(u,h){var f;const p=((f=h==null?void 0:h[t])==null?void 0:f[c])||a,v=g.useContext(p);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[l,d]}const r=()=>{const s=n.map(o=>g.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return g.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return r.scopeName=t,[i,UM(r,...e)]}function UM(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const i=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function BM(t){const e=t+"CollectionProvider",[n,i]=ah(e),[r,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=f=>{const{scope:y,children:b}=f,S=g.default.useRef(null),k=g.default.useRef(new Map).current;return m.jsx(r,{scope:y,itemMap:k,collectionRef:S,children:b})};o.displayName=e;const a=t+"CollectionSlot",c=As(a),l=g.default.forwardRef((f,y)=>{const{scope:b,children:S}=f,k=s(a,b),w=dt(y,k.collectionRef);return m.jsx(c,{ref:w,children:S})});l.displayName=a;const d=t+"CollectionItemSlot",u="data-radix-collection-item",h=As(d),p=g.default.forwardRef((f,y)=>{const{scope:b,children:S,...k}=f,w=g.default.useRef(null),x=dt(y,w),T=s(d,b);return g.default.useEffect(()=>(T.itemMap.set(w,{ref:w,...k}),()=>void T.itemMap.delete(w))),m.jsx(h,{[u]:"",ref:x,children:S})});p.displayName=d;function v(f){const y=s(t+"CollectionConsumer",f);return g.default.useCallback(()=>{const S=y.collectionRef.current;if(!S)return[];const k=Array.from(S.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((T,E)=>k.indexOf(T.ref.current)-k.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},v,i]}var $M=g.createContext(void 0);function HM(t){const e=g.useContext($M);return t||e||"ltr"}function Li(t){const e=g.useRef(t);return g.useEffect(()=>{e.current=t}),g.useMemo(()=>(...n)=>{var i;return(i=e.current)==null?void 0:i.call(e,...n)},[])}function zM(t,e=globalThis==null?void 0:globalThis.document){const n=Li(t);g.useEffect(()=>{const i=r=>{r.key==="Escape"&&n(r)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[n,e])}var WM="DismissableLayer",Ad="dismissableLayer.update",qM="dismissableLayer.pointerDownOutside",GM="dismissableLayer.focusOutside",Ap,I1=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),M1=g.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=t,l=g.useContext(I1),[d,u]=g.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),v=dt(e,E=>u(E)),f=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=f.indexOf(y),S=d?f.indexOf(d):-1,k=l.layersWithOutsidePointerEventsDisabled.size>0,w=S>=b,x=YM(E=>{const P=E.target,I=[...l.branches].some(C=>C.contains(P));!w||I||(r==null||r(E),o==null||o(E),E.defaultPrevented||a==null||a())},h),T=JM(E=>{const P=E.target;[...l.branches].some(C=>C.contains(P))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},h);return zM(E=>{S===l.layers.size-1&&(i==null||i(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},h),g.useEffect(()=>{if(d)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Ap=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),Ip(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ap)}},[d,h,n,l]),g.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),Ip())},[d,l]),g.useEffect(()=>{const E=()=>p({});return document.addEventListener(Ad,E),()=>document.removeEventListener(Ad,E)},[]),m.jsx(We.div,{...c,ref:v,style:{pointerEvents:k?w?"auto":"none":void 0,...t.style},onFocusCapture:Ge(t.onFocusCapture,T.onFocusCapture),onBlurCapture:Ge(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ge(t.onPointerDownCapture,x.onPointerDownCapture)})});M1.displayName=WM;var KM="DismissableLayerBranch",ZM=g.forwardRef((t,e)=>{const n=g.useContext(I1),i=g.useRef(null),r=dt(e,i);return g.useEffect(()=>{const s=i.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),m.jsx(We.div,{...t,ref:r})});ZM.displayName=KM;function YM(t,e=globalThis==null?void 0:globalThis.document){const n=Li(t),i=g.useRef(!1),r=g.useRef(()=>{});return g.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let c=function(){N1(qM,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=c,e.addEventListener("click",r.current,{once:!0})):c()}else e.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",r.current)}},[e,n]),{onPointerDownCapture:()=>i.current=!0}}function JM(t,e=globalThis==null?void 0:globalThis.document){const n=Li(t),i=g.useRef(!1);return g.useEffect(()=>{const r=s=>{s.target&&!i.current&&N1(GM,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function Ip(){const t=new CustomEvent(Ad);document.dispatchEvent(t)}function N1(t,e,n,{discrete:i}){const r=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),i?NM(r,s):r.dispatchEvent(s)}var Kc=0;function XM(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Mp()),document.body.insertAdjacentElement("beforeend",t[1]??Mp()),Kc++,()=>{Kc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Kc--}},[])}function Mp(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Zc="focusScope.autoFocusOnMount",Yc="focusScope.autoFocusOnUnmount",Np={bubbles:!1,cancelable:!0},QM="FocusScope",_1=g.forwardRef((t,e)=>{const{loop:n=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=t,[a,c]=g.useState(null),l=Li(r),d=Li(s),u=g.useRef(null),h=dt(e,f=>c(f)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let f=function(k){if(p.paused||!a)return;const w=k.target;a.contains(w)?u.current=w:qn(u.current,{select:!0})},y=function(k){if(p.paused||!a)return;const w=k.relatedTarget;w!==null&&(a.contains(w)||qn(u.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const x of k)x.removedNodes.length>0&&qn(a)};document.addEventListener("focusin",f),document.addEventListener("focusout",y);const S=new MutationObserver(b);return a&&S.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",y),S.disconnect()}}},[i,a,p.paused]),g.useEffect(()=>{if(a){Op.add(p);const f=document.activeElement;if(!a.contains(f)){const b=new CustomEvent(Zc,Np);a.addEventListener(Zc,l),a.dispatchEvent(b),b.defaultPrevented||(eN(sN(O1(a)),{select:!0}),document.activeElement===f&&qn(a))}return()=>{a.removeEventListener(Zc,l),setTimeout(()=>{const b=new CustomEvent(Yc,Np);a.addEventListener(Yc,d),a.dispatchEvent(b),b.defaultPrevented||qn(f??document.body,{select:!0}),a.removeEventListener(Yc,d),Op.remove(p)},0)}}},[a,l,d,p]);const v=g.useCallback(f=>{if(!n&&!i||p.paused)return;const y=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,b=document.activeElement;if(y&&b){const S=f.currentTarget,[k,w]=tN(S);k&&w?!f.shiftKey&&b===w?(f.preventDefault(),n&&qn(k,{select:!0})):f.shiftKey&&b===k&&(f.preventDefault(),n&&qn(w,{select:!0})):b===S&&f.preventDefault()}},[n,i,p.paused]);return m.jsx(We.div,{tabIndex:-1,...o,ref:h,onKeyDown:v})});_1.displayName=QM;function eN(t,{select:e=!1}={}){const n=document.activeElement;for(const i of t)if(qn(i,{select:e}),document.activeElement!==n)return}function tN(t){const e=O1(t),n=_p(e,t),i=_p(e.reverse(),t);return[n,i]}function O1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function _p(t,e){for(const n of t)if(!nN(n,{upTo:e}))return n}function nN(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function iN(t){return t instanceof HTMLInputElement&&"select"in t}function qn(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&iN(t)&&e&&t.select()}}var Op=rN();function rN(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Dp(t,e),t.unshift(e)},remove(e){var n;t=Dp(t,e),(n=t[0])==null||n.resume()}}}function Dp(t,e){const n=[...t],i=n.indexOf(e);return i!==-1&&n.splice(i,1),n}function sN(t){return t.filter(e=>e.tagName!=="A")}var oN=g[" useId ".trim().toString()]||(()=>{}),aN=0;function ch(t){const[e,n]=g.useState(oN());return St(()=>{n(i=>i??String(aN++))},[t]),t||(e?`radix-${e}`:"")}const cN=["top","right","bottom","left"],si=Math.min,Tt=Math.max,ha=Math.round,lo=Math.floor,hn=t=>({x:t,y:t}),lN={left:"right",right:"left",bottom:"top",top:"bottom"},dN={start:"end",end:"start"};function Id(t,e,n){return Tt(t,si(e,n))}function jn(t,e){return typeof t=="function"?t(e):t}function Ln(t){return t.split("-")[0]}function Hr(t){return t.split("-")[1]}function lh(t){return t==="x"?"y":"x"}function dh(t){return t==="y"?"height":"width"}const uN=new Set(["top","bottom"]);function cn(t){return uN.has(Ln(t))?"y":"x"}function uh(t){return lh(cn(t))}function hN(t,e,n){n===void 0&&(n=!1);const i=Hr(t),r=uh(t),s=dh(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=fa(o)),[o,fa(o)]}function fN(t){const e=fa(t);return[Md(t),e,Md(e)]}function Md(t){return t.replace(/start|end/g,e=>dN[e])}const jp=["left","right"],Lp=["right","left"],mN=["top","bottom"],pN=["bottom","top"];function gN(t,e,n){switch(t){case"top":case"bottom":return n?e?Lp:jp:e?jp:Lp;case"left":case"right":return e?mN:pN;default:return[]}}function vN(t,e,n,i){const r=Hr(t);let s=gN(Ln(t),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(Md)))),s}function fa(t){return t.replace(/left|right|bottom|top/g,e=>lN[e])}function yN(t){return{top:0,right:0,bottom:0,left:0,...t}}function D1(t){return typeof t!="number"?yN(t):{top:t,right:t,bottom:t,left:t}}function ma(t){const{x:e,y:n,width:i,height:r}=t;return{width:i,height:r,top:n,left:e,right:e+i,bottom:n+r,x:e,y:n}}function Vp(t,e,n){let{reference:i,floating:r}=t;const s=cn(e),o=uh(e),a=dh(o),c=Ln(e),l=s==="y",d=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,h=i[a]/2-r[a]/2;let p;switch(c){case"top":p={x:d,y:i.y-r.height};break;case"bottom":p={x:d,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:u};break;case"left":p={x:i.x-r.width,y:u};break;default:p={x:i.x,y:i.y}}switch(Hr(e)){case"start":p[o]-=h*(n&&l?-1:1);break;case"end":p[o]+=h*(n&&l?-1:1);break}return p}const bN=async(t,e,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:u}=Vp(l,i,c),h=i,p={},v=0;for(let f=0;f<a.length;f++){const{name:y,fn:b}=a[f],{x:S,y:k,data:w,reset:x}=await b({x:d,y:u,initialPlacement:i,placement:h,strategy:r,middlewareData:p,rects:l,platform:o,elements:{reference:t,floating:e}});d=S??d,u=k??u,p={...p,[y]:{...p[y],...w}},x&&v<=50&&(v++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:r}):x.rects),{x:d,y:u}=Vp(l,h,c)),f=-1)}return{x:d,y:u,placement:h,strategy:r,middlewareData:p}};async function Is(t,e){var n;e===void 0&&(e={});const{x:i,y:r,platform:s,rects:o,elements:a,strategy:c}=t,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=jn(e,t),v=D1(p),y=a[h?u==="floating"?"reference":"floating":u],b=ma(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),S=u==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},x=ma(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:S,offsetParent:k,strategy:c}):S);return{top:(b.top-x.top+v.top)/w.y,bottom:(x.bottom-b.bottom+v.bottom)/w.y,left:(b.left-x.left+v.left)/w.x,right:(x.right-b.right+v.right)/w.x}}const xN=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:d=0}=jn(t,e)||{};if(l==null)return{};const u=D1(d),h={x:n,y:i},p=uh(r),v=dh(p),f=await o.getDimensions(l),y=p==="y",b=y?"top":"left",S=y?"bottom":"right",k=y?"clientHeight":"clientWidth",w=s.reference[v]+s.reference[p]-h[p]-s.floating[v],x=h[p]-s.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let E=T?T[k]:0;(!E||!await(o.isElement==null?void 0:o.isElement(T)))&&(E=a.floating[k]||s.floating[v]);const P=w/2-x/2,I=E/2-f[v]/2-1,C=si(u[b],I),A=si(u[S],I),N=C,Z=E-f[v]-A,Q=E/2-f[v]/2+P,se=Id(N,Q,Z),te=!c.arrow&&Hr(r)!=null&&Q!==se&&s.reference[v]/2-(Q<N?C:A)-f[v]/2<0,Y=te?Q<N?Q-N:Q-Z:0;return{[p]:h[p]+Y,data:{[p]:se,centerOffset:Q-se-Y,...te&&{alignmentOffset:Y}},reset:te}}}),wN=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:a,platform:c,elements:l}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:f=!0,...y}=jn(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Ln(r),S=cn(a),k=Ln(a)===a,w=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=h||(k||!f?[fa(a)]:fN(a)),T=v!=="none";!h&&T&&x.push(...vN(a,f,v,w));const E=[a,...x],P=await Is(e,y),I=[];let C=((i=s.flip)==null?void 0:i.overflows)||[];if(d&&I.push(P[b]),u){const Q=hN(r,o,w);I.push(P[Q[0]],P[Q[1]])}if(C=[...C,{placement:r,overflows:I}],!I.every(Q=>Q<=0)){var A,N;const Q=(((A=s.flip)==null?void 0:A.index)||0)+1,se=E[Q];if(se&&(!(u==="alignment"?S!==cn(se):!1)||C.every(_=>_.overflows[0]>0&&cn(_.placement)===S)))return{data:{index:Q,overflows:C},reset:{placement:se}};let te=(N=C.filter(Y=>Y.overflows[0]<=0).sort((Y,_)=>Y.overflows[1]-_.overflows[1])[0])==null?void 0:N.placement;if(!te)switch(p){case"bestFit":{var Z;const Y=(Z=C.filter(_=>{if(T){const ie=cn(_.placement);return ie===S||ie==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(ie=>ie>0).reduce((ie,L)=>ie+L,0)]).sort((_,ie)=>_[1]-ie[1])[0])==null?void 0:Z[0];Y&&(te=Y);break}case"initialPlacement":te=a;break}if(r!==te)return{reset:{placement:te}}}return{}}}};function Fp(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Up(t){return cN.some(e=>t[e]>=0)}const SN=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:i="referenceHidden",...r}=jn(t,e);switch(i){case"referenceHidden":{const s=await Is(e,{...r,elementContext:"reference"}),o=Fp(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Up(o)}}}case"escaped":{const s=await Is(e,{...r,altBoundary:!0}),o=Fp(s,n.floating);return{data:{escapedOffsets:o,escaped:Up(o)}}}default:return{}}}}},j1=new Set(["left","top"]);async function kN(t,e){const{placement:n,platform:i,elements:r}=t,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Ln(n),a=Hr(n),c=cn(n)==="y",l=j1.has(o)?-1:1,d=s&&c?-1:1,u=jn(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:v}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof v=="number"&&(p=a==="end"?v*-1:v),c?{x:p*d,y:h*l}:{x:h*l,y:p*d}}const CN=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:r,y:s,placement:o,middlewareData:a}=e,c=await kN(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:o}}}}},TN=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:b,y:S}=y;return{x:b,y:S}}},...c}=jn(t,e),l={x:n,y:i},d=await Is(e,c),u=cn(Ln(r)),h=lh(u);let p=l[h],v=l[u];if(s){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",S=p+d[y],k=p-d[b];p=Id(S,p,k)}if(o){const y=u==="y"?"top":"left",b=u==="y"?"bottom":"right",S=v+d[y],k=v-d[b];v=Id(S,v,k)}const f=a.fn({...e,[h]:p,[u]:v});return{...f,data:{x:f.x-n,y:f.y-i,enabled:{[h]:s,[u]:o}}}}}},EN=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:i,placement:r,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=jn(t,e),d={x:n,y:i},u=cn(r),h=lh(u);let p=d[h],v=d[u];const f=jn(a,e),y=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const k=h==="y"?"height":"width",w=s.reference[h]-s.floating[k]+y.mainAxis,x=s.reference[h]+s.reference[k]-y.mainAxis;p<w?p=w:p>x&&(p=x)}if(l){var b,S;const k=h==="y"?"width":"height",w=j1.has(Ln(r)),x=s.reference[u]-s.floating[k]+(w&&((b=o.offset)==null?void 0:b[u])||0)+(w?0:y.crossAxis),T=s.reference[u]+s.reference[k]+(w?0:((S=o.offset)==null?void 0:S[u])||0)-(w?y.crossAxis:0);v<x?v=x:v>T&&(v=T)}return{[h]:p,[u]:v}}}},PN=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:r,rects:s,platform:o,elements:a}=e,{apply:c=()=>{},...l}=jn(t,e),d=await Is(e,l),u=Ln(r),h=Hr(r),p=cn(r)==="y",{width:v,height:f}=s.floating;let y,b;u==="top"||u==="bottom"?(y=u,b=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,y=h==="end"?"top":"bottom");const S=f-d.top-d.bottom,k=v-d.left-d.right,w=si(f-d[y],S),x=si(v-d[b],k),T=!e.middlewareData.shift;let E=w,P=x;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=k),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(E=S),T&&!h){const C=Tt(d.left,0),A=Tt(d.right,0),N=Tt(d.top,0),Z=Tt(d.bottom,0);p?P=v-2*(C!==0||A!==0?C+A:Tt(d.left,d.right)):E=f-2*(N!==0||Z!==0?N+Z:Tt(d.top,d.bottom))}await c({...e,availableWidth:P,availableHeight:E});const I=await o.getDimensions(a.floating);return v!==I.width||f!==I.height?{reset:{rects:!0}}:{}}}};function Oa(){return typeof window<"u"}function zr(t){return L1(t)?(t.nodeName||"").toLowerCase():"#document"}function Rt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function bn(t){var e;return(e=(L1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function L1(t){return Oa()?t instanceof Node||t instanceof Rt(t).Node:!1}function Yt(t){return Oa()?t instanceof Element||t instanceof Rt(t).Element:!1}function gn(t){return Oa()?t instanceof HTMLElement||t instanceof Rt(t).HTMLElement:!1}function Bp(t){return!Oa()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Rt(t).ShadowRoot}const RN=new Set(["inline","contents"]);function zs(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=Jt(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!RN.has(r)}const AN=new Set(["table","td","th"]);function IN(t){return AN.has(zr(t))}const MN=[":popover-open",":modal"];function Da(t){return MN.some(e=>{try{return t.matches(e)}catch{return!1}})}const NN=["transform","translate","scale","rotate","perspective"],_N=["transform","translate","scale","rotate","perspective","filter"],ON=["paint","layout","strict","content"];function hh(t){const e=fh(),n=Yt(t)?Jt(t):t;return NN.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||_N.some(i=>(n.willChange||"").includes(i))||ON.some(i=>(n.contain||"").includes(i))}function DN(t){let e=oi(t);for(;gn(e)&&!Nr(e);){if(hh(e))return e;if(Da(e))return null;e=oi(e)}return null}function fh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const jN=new Set(["html","body","#document"]);function Nr(t){return jN.has(zr(t))}function Jt(t){return Rt(t).getComputedStyle(t)}function ja(t){return Yt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function oi(t){if(zr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Bp(t)&&t.host||bn(t);return Bp(e)?e.host:e}function V1(t){const e=oi(t);return Nr(e)?t.ownerDocument?t.ownerDocument.body:t.body:gn(e)&&zs(e)?e:V1(e)}function Ms(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=V1(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),o=Rt(r);if(s){const a=Nd(o);return e.concat(o,o.visualViewport||[],zs(r)?r:[],a&&n?Ms(a):[])}return e.concat(r,Ms(r,[],n))}function Nd(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function F1(t){const e=Jt(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=gn(t),s=r?t.offsetWidth:n,o=r?t.offsetHeight:i,a=ha(n)!==s||ha(i)!==o;return a&&(n=s,i=o),{width:n,height:i,$:a}}function mh(t){return Yt(t)?t:t.contextElement}function wr(t){const e=mh(t);if(!gn(e))return hn(1);const n=e.getBoundingClientRect(),{width:i,height:r,$:s}=F1(e);let o=(s?ha(n.width):n.width)/i,a=(s?ha(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const LN=hn(0);function U1(t){const e=Rt(t);return!fh()||!e.visualViewport?LN:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function VN(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Rt(t)?!1:e}function Vi(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=mh(t);let o=hn(1);e&&(i?Yt(i)&&(o=wr(i)):o=wr(t));const a=VN(s,n,i)?U1(s):hn(0);let c=(r.left+a.x)/o.x,l=(r.top+a.y)/o.y,d=r.width/o.x,u=r.height/o.y;if(s){const h=Rt(s),p=i&&Yt(i)?Rt(i):i;let v=h,f=Nd(v);for(;f&&i&&p!==v;){const y=wr(f),b=f.getBoundingClientRect(),S=Jt(f),k=b.left+(f.clientLeft+parseFloat(S.paddingLeft))*y.x,w=b.top+(f.clientTop+parseFloat(S.paddingTop))*y.y;c*=y.x,l*=y.y,d*=y.x,u*=y.y,c+=k,l+=w,v=Rt(f),f=Nd(v)}}return ma({width:d,height:u,x:c,y:l})}function ph(t,e){const n=ja(t).scrollLeft;return e?e.left+n:Vi(bn(t)).left+n}function B1(t,e,n){n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=i.left+e.scrollLeft-(n?0:ph(t,i)),s=i.top+e.scrollTop;return{x:r,y:s}}function FN(t){let{elements:e,rect:n,offsetParent:i,strategy:r}=t;const s=r==="fixed",o=bn(i),a=e?Da(e.floating):!1;if(i===o||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=hn(1);const d=hn(0),u=gn(i);if((u||!u&&!s)&&((zr(i)!=="body"||zs(o))&&(c=ja(i)),gn(i))){const p=Vi(i);l=wr(i),d.x=p.x+i.clientLeft,d.y=p.y+i.clientTop}const h=o&&!u&&!s?B1(o,c,!0):hn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x+h.x,y:n.y*l.y-c.scrollTop*l.y+d.y+h.y}}function UN(t){return Array.from(t.getClientRects())}function BN(t){const e=bn(t),n=ja(t),i=t.ownerDocument.body,r=Tt(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Tt(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-n.scrollLeft+ph(t);const a=-n.scrollTop;return Jt(i).direction==="rtl"&&(o+=Tt(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function $N(t,e){const n=Rt(t),i=bn(t),r=n.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,c=0;if(r){s=r.width,o=r.height;const l=fh();(!l||l&&e==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}return{width:s,height:o,x:a,y:c}}const HN=new Set(["absolute","fixed"]);function zN(t,e){const n=Vi(t,!0,e==="fixed"),i=n.top+t.clientTop,r=n.left+t.clientLeft,s=gn(t)?wr(t):hn(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,c=r*s.x,l=i*s.y;return{width:o,height:a,x:c,y:l}}function $p(t,e,n){let i;if(e==="viewport")i=$N(t,n);else if(e==="document")i=BN(bn(t));else if(Yt(e))i=zN(e,n);else{const r=U1(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return ma(i)}function $1(t,e){const n=oi(t);return n===e||!Yt(n)||Nr(n)?!1:Jt(n).position==="fixed"||$1(n,e)}function WN(t,e){const n=e.get(t);if(n)return n;let i=Ms(t,[],!1).filter(a=>Yt(a)&&zr(a)!=="body"),r=null;const s=Jt(t).position==="fixed";let o=s?oi(t):t;for(;Yt(o)&&!Nr(o);){const a=Jt(o),c=hh(o);!c&&a.position==="fixed"&&(r=null),(s?!c&&!r:!c&&a.position==="static"&&!!r&&HN.has(r.position)||zs(o)&&!c&&$1(t,o))?i=i.filter(d=>d!==o):r=a,o=oi(o)}return e.set(t,i),i}function qN(t){let{element:e,boundary:n,rootBoundary:i,strategy:r}=t;const o=[...n==="clippingAncestors"?Da(e)?[]:WN(e,this._c):[].concat(n),i],a=o[0],c=o.reduce((l,d)=>{const u=$p(e,d,r);return l.top=Tt(u.top,l.top),l.right=si(u.right,l.right),l.bottom=si(u.bottom,l.bottom),l.left=Tt(u.left,l.left),l},$p(e,a,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function GN(t){const{width:e,height:n}=F1(t);return{width:e,height:n}}function KN(t,e,n){const i=gn(e),r=bn(e),s=n==="fixed",o=Vi(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const c=hn(0);function l(){c.x=ph(r)}if(i||!i&&!s)if((zr(e)!=="body"||zs(r))&&(a=ja(e)),i){const p=Vi(e,!0,s,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else r&&l();s&&!i&&r&&l();const d=r&&!i&&!s?B1(r,a):hn(0),u=o.left+a.scrollLeft-c.x-d.x,h=o.top+a.scrollTop-c.y-d.y;return{x:u,y:h,width:o.width,height:o.height}}function Jc(t){return Jt(t).position==="static"}function Hp(t,e){if(!gn(t)||Jt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bn(t)===n&&(n=n.ownerDocument.body),n}function H1(t,e){const n=Rt(t);if(Da(t))return n;if(!gn(t)){let r=oi(t);for(;r&&!Nr(r);){if(Yt(r)&&!Jc(r))return r;r=oi(r)}return n}let i=Hp(t,e);for(;i&&IN(i)&&Jc(i);)i=Hp(i,e);return i&&Nr(i)&&Jc(i)&&!hh(i)?n:i||DN(t)||n}const ZN=async function(t){const e=this.getOffsetParent||H1,n=this.getDimensions,i=await n(t.floating);return{reference:KN(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function YN(t){return Jt(t).direction==="rtl"}const JN={convertOffsetParentRelativeRectToViewportRelativeRect:FN,getDocumentElement:bn,getClippingRect:qN,getOffsetParent:H1,getElementRects:ZN,getClientRects:UN,getDimensions:GN,getScale:wr,isElement:Yt,isRTL:YN};function z1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function XN(t,e){let n=null,i;const r=bn(t);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const l=t.getBoundingClientRect(),{left:d,top:u,width:h,height:p}=l;if(a||e(),!h||!p)return;const v=lo(u),f=lo(r.clientWidth-(d+h)),y=lo(r.clientHeight-(u+p)),b=lo(d),k={rootMargin:-v+"px "+-f+"px "+-y+"px "+-b+"px",threshold:Tt(0,si(1,c))||1};let w=!0;function x(T){const E=T[0].intersectionRatio;if(E!==c){if(!w)return o();E?o(!1,E):i=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!z1(l,t.getBoundingClientRect())&&o(),w=!1}try{n=new IntersectionObserver(x,{...k,root:r.ownerDocument})}catch{n=new IntersectionObserver(x,k)}n.observe(t)}return o(!0),s}function QN(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=mh(t),d=r||s?[...l?Ms(l):[],...Ms(e)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const u=l&&a?XN(l,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(b=>{let[S]=b;S&&S.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),n()}),l&&!c&&p.observe(l),p.observe(e));let v,f=c?Vi(t):null;c&&y();function y(){const b=Vi(t);f&&!z1(f,b)&&n(),f=b,v=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(S=>{r&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),u==null||u(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(v)}}const e_=CN,t_=TN,n_=wN,i_=PN,r_=SN,zp=xN,s_=EN,o_=(t,e,n)=>{const i=new Map,r={platform:JN,...n},s={...r.platform,_c:i};return bN(t,e,{...r,platform:s})};var a_=typeof document<"u",c_=function(){},Bo=a_?M.useLayoutEffect:c_;function pa(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!pa(t[i],e[i]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!(s==="_owner"&&t.$$typeof)&&!pa(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function W1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Wp(t,e){const n=W1(t);return Math.round(e*n)/n}function Xc(t){const e=g.useRef(t);return Bo(()=>{e.current=t}),e}function l_(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[d,u]=g.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=g.useState(i);pa(h,i)||p(i);const[v,f]=g.useState(null),[y,b]=g.useState(null),S=g.useCallback(_=>{_!==T.current&&(T.current=_,f(_))},[]),k=g.useCallback(_=>{_!==E.current&&(E.current=_,b(_))},[]),w=s||v,x=o||y,T=g.useRef(null),E=g.useRef(null),P=g.useRef(d),I=c!=null,C=Xc(c),A=Xc(r),N=Xc(l),Z=g.useCallback(()=>{if(!T.current||!E.current)return;const _={placement:e,strategy:n,middleware:h};A.current&&(_.platform=A.current),o_(T.current,E.current,_).then(ie=>{const L={...ie,isPositioned:N.current!==!1};Q.current&&!pa(P.current,L)&&(P.current=L,js.flushSync(()=>{u(L)}))})},[h,e,n,A,N]);Bo(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})))},[l]);const Q=g.useRef(!1);Bo(()=>(Q.current=!0,()=>{Q.current=!1}),[]),Bo(()=>{if(w&&(T.current=w),x&&(E.current=x),w&&x){if(C.current)return C.current(w,x,Z);Z()}},[w,x,Z,C,I]);const se=g.useMemo(()=>({reference:T,floating:E,setReference:S,setFloating:k}),[S,k]),te=g.useMemo(()=>({reference:w,floating:x}),[w,x]),Y=g.useMemo(()=>{const _={position:n,left:0,top:0};if(!te.floating)return _;const ie=Wp(te.floating,d.x),L=Wp(te.floating,d.y);return a?{..._,transform:"translate("+ie+"px, "+L+"px)",...W1(te.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ie,top:L}},[n,a,te.floating,d.x,d.y]);return g.useMemo(()=>({...d,update:Z,refs:se,elements:te,floatingStyles:Y}),[d,Z,se,te,Y])}const d_=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:i,padding:r}=typeof t=="function"?t(n):t;return i&&e(i)?i.current!=null?zp({element:i.current,padding:r}).fn(n):{}:i?zp({element:i,padding:r}).fn(n):{}}}},u_=(t,e)=>({...e_(t),options:[t,e]}),h_=(t,e)=>({...t_(t),options:[t,e]}),f_=(t,e)=>({...s_(t),options:[t,e]}),m_=(t,e)=>({...n_(t),options:[t,e]}),p_=(t,e)=>({...i_(t),options:[t,e]}),g_=(t,e)=>({...r_(t),options:[t,e]}),v_=(t,e)=>({...d_(t),options:[t,e]});var y_="Arrow",q1=g.forwardRef((t,e)=>{const{children:n,width:i=10,height:r=5,...s}=t;return m.jsx(We.svg,{...s,ref:e,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});q1.displayName=y_;var b_=q1;function x_(t){const[e,n]=g.useState(void 0);return St(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}var gh="Popper",[G1,K1]=ah(gh),[w_,Z1]=G1(gh),Y1=t=>{const{__scopePopper:e,children:n}=t,[i,r]=g.useState(null);return m.jsx(w_,{scope:e,anchor:i,onAnchorChange:r,children:n})};Y1.displayName=gh;var J1="PopperAnchor",X1=g.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:i,...r}=t,s=Z1(J1,n),o=g.useRef(null),a=dt(e,o);return g.useEffect(()=>{s.onAnchorChange((i==null?void 0:i.current)||o.current)}),i?null:m.jsx(We.div,{...r,ref:a})});X1.displayName=J1;var vh="PopperContent",[S_,k_]=G1(vh),Q1=g.forwardRef((t,e)=>{var O,$,X,z,oe,H;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:v,...f}=t,y=Z1(vh,n),[b,S]=g.useState(null),k=dt(e,ue=>S(ue)),[w,x]=g.useState(null),T=x_(w),E=(T==null?void 0:T.width)??0,P=(T==null?void 0:T.height)??0,I=i+(s!=="center"?"-"+s:""),C=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(l)?l:[l],N=A.length>0,Z={padding:C,boundary:A.filter(T_),altBoundary:N},{refs:Q,floatingStyles:se,placement:te,isPositioned:Y,middlewareData:_}=l_({strategy:"fixed",placement:I,whileElementsMounted:(...ue)=>QN(...ue,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[u_({mainAxis:r+P,alignmentAxis:o}),c&&h_({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?f_():void 0,...Z}),c&&m_({...Z}),p_({...Z,apply:({elements:ue,rects:we,availableWidth:rt,availableHeight:Qt})=>{const{width:vi,height:yi}=we.reference,en=ue.floating.style;en.setProperty("--radix-popper-available-width",`${rt}px`),en.setProperty("--radix-popper-available-height",`${Qt}px`),en.setProperty("--radix-popper-anchor-width",`${vi}px`),en.setProperty("--radix-popper-anchor-height",`${yi}px`)}}),w&&v_({element:w,padding:a}),E_({arrowWidth:E,arrowHeight:P}),h&&g_({strategy:"referenceHidden",...Z})]}),[ie,L]=nx(te),F=Li(v);St(()=>{Y&&(F==null||F())},[Y,F]);const ee=(O=_.arrow)==null?void 0:O.x,j=($=_.arrow)==null?void 0:$.y,W=((X=_.arrow)==null?void 0:X.centerOffset)!==0,[J,G]=g.useState();return St(()=>{b&&G(window.getComputedStyle(b).zIndex)},[b]),m.jsx("div",{ref:Q.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:Y?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(z=_.transformOrigin)==null?void 0:z.x,(oe=_.transformOrigin)==null?void 0:oe.y].join(" "),...((H=_.hide)==null?void 0:H.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:m.jsx(S_,{scope:n,placedSide:ie,onArrowChange:x,arrowX:ee,arrowY:j,shouldHideArrow:W,children:m.jsx(We.div,{"data-side":ie,"data-align":L,...f,ref:k,style:{...f.style,animation:Y?void 0:"none"}})})})});Q1.displayName=vh;var ex="PopperArrow",C_={top:"bottom",right:"left",bottom:"top",left:"right"},tx=g.forwardRef(function(e,n){const{__scopePopper:i,...r}=e,s=k_(ex,i),o=C_[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(b_,{...r,ref:n,style:{...r.style,display:"block"}})})});tx.displayName=ex;function T_(t){return t!==null}var E_=t=>({name:"transformOrigin",options:t,fn(e){var y,b,S;const{placement:n,rects:i,middlewareData:r}=e,o=((y=r.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[l,d]=nx(n),u={start:"0%",center:"50%",end:"100%"}[d],h=(((b=r.arrow)==null?void 0:b.x)??0)+a/2,p=(((S=r.arrow)==null?void 0:S.y)??0)+c/2;let v="",f="";return l==="bottom"?(v=o?u:`${h}px`,f=`${-c}px`):l==="top"?(v=o?u:`${h}px`,f=`${i.floating.height+c}px`):l==="right"?(v=`${-c}px`,f=o?u:`${p}px`):l==="left"&&(v=`${i.floating.width+c}px`,f=o?u:`${p}px`),{data:{x:v,y:f}}}});function nx(t){const[e,n="center"]=t.split("-");return[e,n]}var P_=Y1,R_=X1,A_=Q1,I_=tx,M_="Portal",ix=g.forwardRef((t,e)=>{var a;const{container:n,...i}=t,[r,s]=g.useState(!1);St(()=>s(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?js.default.createPortal(m.jsx(We.div,{...i,ref:e}),o):null});ix.displayName=M_;function N_(t){const e=g.useRef({value:t,previous:t});return g.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var rx=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),__="VisuallyHidden",O_=g.forwardRef((t,e)=>m.jsx(We.span,{...t,ref:e,style:{...rx,...t.style}}));O_.displayName=__;var D_=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ki=new WeakMap,uo=new WeakMap,ho={},Qc=0,sx=function(t){return t&&(t.host||sx(t.parentNode))},j_=function(t,e){return e.map(function(n){if(t.contains(n))return n;var i=sx(n);return i&&t.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},L_=function(t,e,n,i){var r=j_(e,Array.isArray(t)?t:[t]);ho[n]||(ho[n]=new WeakMap);var s=ho[n],o=[],a=new Set,c=new Set(r),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};r.forEach(l);var d=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(a.has(h))d(h);else try{var p=h.getAttribute(i),v=p!==null&&p!=="false",f=(Ki.get(h)||0)+1,y=(s.get(h)||0)+1;Ki.set(h,f),s.set(h,y),o.push(h),f===1&&v&&uo.set(h,!0),y===1&&h.setAttribute(n,"true"),v||h.setAttribute(i,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),a.clear(),Qc++,function(){o.forEach(function(u){var h=Ki.get(u)-1,p=s.get(u)-1;Ki.set(u,h),s.set(u,p),h||(uo.has(u)||u.removeAttribute(i),uo.delete(u)),p||u.removeAttribute(n)}),Qc--,Qc||(Ki=new WeakMap,Ki=new WeakMap,uo=new WeakMap,ho={})}},V_=function(t,e,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),r=D_(t);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live], script"))),L_(i,r,n,"aria-hidden")):function(){return null}},an=function(){return an=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},an.apply(this,arguments)};function ox(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function F_(t,e,n){if(n||arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}var $o="right-scroll-bar-position",Ho="width-before-scroll-bar",U_="with-scroll-bars-hidden",B_="--removed-body-scroll-bar-size";function el(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function $_(t,e){var n=M.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(i){var r=n.value;r!==i&&(n.value=i,n.callback(i,r))}}}})[0];return n.callback=e,n.facade}var H_=typeof window<"u"?g.useLayoutEffect:g.useEffect,qp=new WeakMap;function z_(t,e){var n=$_(null,function(i){return t.forEach(function(r){return el(r,i)})});return H_(function(){var i=qp.get(n);if(i){var r=new Set(i),s=new Set(t),o=n.current;r.forEach(function(a){s.has(a)||el(a,null)}),s.forEach(function(a){r.has(a)||el(a,o)})}qp.set(n,t)},[t]),n}function W_(t){return t}function q_(t,e){e===void 0&&(e=W_);var n=[],i=!1,r={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,i);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(i=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){i=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var c=function(){var d=o;o=[],d.forEach(s)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(d){o.push(d),l()},filter:function(d){return o=o.filter(d),n}}}};return r}function G_(t){t===void 0&&(t={});var e=q_(null);return e.options=an({async:!0,ssr:!1},t),e}var ax=function(t){var e=t.sideCar,n=ox(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=e.read();if(!i)throw new Error("Sidecar medium not found");return g.createElement(i,an({},n))};ax.isSideCarExport=!0;function K_(t,e){return t.useMedium(e),ax}var cx=G_(),tl=function(){},La=g.forwardRef(function(t,e){var n=g.useRef(null),i=g.useState({onScrollCapture:tl,onWheelCapture:tl,onTouchMoveCapture:tl}),r=i[0],s=i[1],o=t.forwardProps,a=t.children,c=t.className,l=t.removeScrollBar,d=t.enabled,u=t.shards,h=t.sideCar,p=t.noRelative,v=t.noIsolation,f=t.inert,y=t.allowPinchZoom,b=t.as,S=b===void 0?"div":b,k=t.gapMode,w=ox(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=h,T=z_([n,e]),E=an(an({},w),r);return g.createElement(g.Fragment,null,d&&g.createElement(x,{sideCar:cx,removeScrollBar:l,shards:u,noRelative:p,noIsolation:v,inert:f,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:k}),o?g.cloneElement(g.Children.only(a),an(an({},E),{ref:T})):g.createElement(S,an({},E,{className:c,ref:T}),a))});La.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};La.classNames={fullWidth:Ho,zeroRight:$o};var Z_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Y_(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Z_();return e&&t.setAttribute("nonce",e),t}function J_(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function X_(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Q_=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Y_())&&(J_(e,n),X_(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},e6=function(){var t=Q_();return function(e,n){g.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},lx=function(){var t=e6(),e=function(n){var i=n.styles,r=n.dynamic;return t(i,r),null};return e},t6={left:0,top:0,right:0,gap:0},nl=function(t){return parseInt(t||"",10)||0},n6=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],i=e[t==="padding"?"paddingTop":"marginTop"],r=e[t==="padding"?"paddingRight":"marginRight"];return[nl(n),nl(i),nl(r)]},i6=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return t6;var e=n6(t),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-n+e[2]-e[0])}},r6=lx(),Sr="data-scroll-locked",s6=function(t,e,n,i){var r=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
|
|
49
|
-
|
|
50
|
-
overflow: hidden `).concat(i,`;
|
|
51
|
-
padding-right: `).concat(a,"px ").concat(i,`;
|
|
38
|
+
`),()=>{p.contains(x)&&p.removeChild(x)}},[t]),c.jsx(Vm,{isPresent:t,childRef:i,sizeRef:o,children:f.cloneElement(e,{ref:i})})}const Dm=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:i,mode:o,anchorX:a,root:l})=>{const d=bo(Lm),u=E.useId();let h=!0,m=E.useMemo(()=>(h=!1,{id:u,initial:t,isPresent:n,custom:r,onExitComplete:g=>{d.set(g,!0);for(const x of d.values())if(!x)return;s&&s()},register:g=>(d.set(g,!1),()=>d.delete(g))}),[n,d,s]);return i&&h&&(m={...m}),E.useMemo(()=>{d.forEach((g,x)=>d.set(x,!1))},[n]),f.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),o==="popLayout"&&(e=c.jsx(Im,{isPresent:n,anchorX:a,root:l,children:e})),c.jsx(Fs.Provider,{value:m,children:e})};function Lm(){return new Map}function Ec(e=!0){const t=E.useContext(Fs);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=t,i=E.useId();E.useEffect(()=>{if(e)return r(i)},[e]);const o=E.useCallback(()=>e&&s&&s(i),[i,s,e]);return!n&&s?[!1,o]:[!0]}const os=e=>e.key||"";function qi(e){const t=[];return E.Children.forEach(e,n=>{E.isValidElement(n)&&t.push(n)}),t}const dn=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:i="sync",propagate:o=!1,anchorX:a="left",root:l})=>{const[d,u]=Ec(o),h=E.useMemo(()=>qi(e),[e]),m=o&&!d?[]:h.map(os),g=E.useRef(!0),x=E.useRef(h),p=bo(()=>new Map),[v,b]=E.useState(h),[y,w]=E.useState(h);Vl(()=>{g.current=!1,x.current=h;for(let T=0;T<y.length;T++){const A=os(y[T]);m.includes(A)?p.delete(A):p.get(A)!==!0&&p.set(A,!1)}},[y,m.length,m.join("-")]);const S=[];if(h!==v){let T=[...h];for(let A=0;A<y.length;A++){const j=y[A],V=os(j);m.includes(V)||(T.splice(A,0,j),S.push(j))}return i==="wait"&&S.length&&(T=S),w(qi(T)),b(h),null}process.env.NODE_ENV!=="production"&&i==="wait"&&y.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:k}=E.useContext(vo);return c.jsx(c.Fragment,{children:y.map(T=>{const A=os(T),j=o&&!d?!1:h===y||m.includes(A),V=()=>{if(p.has(A))p.set(A,!0);else return;let I=!0;p.forEach($=>{$||(I=!1)}),I&&(k==null||k(),w(x.current),o&&(u==null||u()),s&&s())};return c.jsx(Dm,{isPresent:j,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:i,root:l,onExitComplete:j?void 0:V,anchorX:a,children:T},A)})})},kc=E.createContext({strict:!1}),Ji={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},pn={};for(const e in Ji)pn[e]={isEnabled:t=>Ji[e].some(n=>!!t[n])};function Fm(e){for(const t in e)pn[t]={...pn[t],...e[t]}}const Om=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function js(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Om.has(e)}let Ac=e=>!js(e);function _m(e){typeof e=="function"&&(Ac=t=>t.startsWith("on")?!js(t):e(t))}try{_m(require("@emotion/is-prop-valid").default)}catch{}function $m(e,t,n){const s={};for(const r in e)r==="values"&&typeof e.values=="object"||(Ac(r)||n===!0&&js(r)||!t&&!js(r)||e.draggable&&r.startsWith("onDrag"))&&(s[r]=e[r]);return s}const Os=E.createContext({});function _s(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Un(e){return typeof e=="string"||Array.isArray(e)}const zo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Zo=["initial",...zo];function $s(e){return _s(e.animate)||Zo.some(t=>Un(e[t]))}function Tc(e){return!!($s(e)||e.variants)}function Bm(e,t){if($s(e)){const{initial:n,animate:s}=e;return{initial:n===!1||Un(n)?n:void 0,animate:Un(s)?s:void 0}}return e.inherit!==!1?t:{}}function Hm(e){const{initial:t,animate:n}=Bm(e,E.useContext(Os));return E.useMemo(()=>({initial:t,animate:n}),[Qi(t),Qi(n)])}function Qi(e){return Array.isArray(e)?e.join(" "):e}const zn={};function Um(e){for(const t in e)zn[t]=e[t],Po(t)&&(zn[t].isCSSVariable=!0)}function jc(e,{layout:t,layoutId:n}){return wn.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!zn[e]||e==="opacity")}const zm={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Zm=bn.length;function Wm(e,t,n){let s="",r=!0;for(let i=0;i<Zm;i++){const o=bn[i],a=e[o];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(o.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||n){const d=yc(a,$o[o]);if(!l){r=!1;const u=zm[o]||o;s+=`${u}(${d}) `}n&&(t[o]=d)}}return s=s.trim(),n?s=n(t,r?"":s):r&&(s="none"),s}function Wo(e,t,n){const{style:s,vars:r,transformOrigin:i}=e;let o=!1,a=!1;for(const l in t){const d=t[l];if(wn.has(l)){o=!0;continue}else if(Po(l)){r[l]=d;continue}else{const u=yc(d,$o[l]);l.startsWith("origin")?(a=!0,i[l]=u):s[l]=u}}if(t.transform||(o||n?s.transform=Wm(t,e.transform,n):s.transform&&(s.transform="none")),a){const{originX:l="50%",originY:d="50%",originZ:u=0}=i;s.transformOrigin=`${l} ${d} ${u}`}}const Ko=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Pc(e,t,n){for(const s in t)!Le(t[s])&&!jc(s,n)&&(e[s]=t[s])}function Km({transformTemplate:e},t){return E.useMemo(()=>{const n=Ko();return Wo(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ym(e,t){const n=e.style||{},s={};return Pc(s,n,e),Object.assign(s,Km(e,t)),s}function Gm(e,t){const n={},s=Ym(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const Xm={offset:"stroke-dashoffset",array:"stroke-dasharray"},qm={offset:"strokeDashoffset",array:"strokeDasharray"};function Jm(e,t,n=1,s=0,r=!0){e.pathLength=1;const i=r?Xm:qm;e[i.offset]=oe.transform(-s);const o=oe.transform(t),a=oe.transform(n);e[i.array]=`${o} ${a}`}function Mc(e,{attrX:t,attrY:n,attrScale:s,pathLength:r,pathSpacing:i=1,pathOffset:o=0,...a},l,d,u){if(Wo(e,a,d),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:m}=e;h.transform&&(m.transform=h.transform,delete h.transform),(m.transform||h.transformOrigin)&&(m.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),m.transform&&(m.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete h.transformBox),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),s!==void 0&&(h.scale=s),r!==void 0&&Jm(h,r,i,o,!1)}const Nc=()=>({...Ko(),attrs:{}}),Rc=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Qm(e,t,n,s){const r=E.useMemo(()=>{const i=Nc();return Mc(i,t,Rc(s),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Pc(i,e.style,e),r.style={...i,...r.style}}return r}const ep=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Yo(e){return typeof e!="string"||e.includes("-")?!1:!!(ep.indexOf(e)>-1||/[A-Z]/u.test(e))}function tp(e,t,n,{latestValues:s},r,i=!1){const a=(Yo(e)?Qm:Gm)(t,s,r,e),l=$m(t,typeof e=="string",i),d=e!==E.Fragment?{...l,...a,ref:n}:{},{children:u}=t,h=E.useMemo(()=>Le(u)?u.get():u,[u]);return E.createElement(e,{...d,children:h})}function ea(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Go(e,t,n,s){if(typeof t=="function"){const[r,i]=ea(s);t=t(n!==void 0?n:e.custom,r,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,i]=ea(s);t=t(n!==void 0?n:e.custom,r,i)}return t}function ys(e){return Le(e)?e.get():e}function np({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,r){return{latestValues:sp(n,s,r,e),renderState:t()}}function sp(e,t,n,s){const r={},i=s(e,{});for(const m in i)r[m]=ys(i[m]);let{initial:o,animate:a}=e;const l=$s(e),d=Tc(e);t&&d&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!_s(h)){const m=Array.isArray(h)?h:[h];for(let g=0;g<m.length;g++){const x=Go(e,m[g]);if(x){const{transitionEnd:p,transition:v,...b}=x;for(const y in b){let w=b[y];if(Array.isArray(w)){const S=u?w.length-1:0;w=w[S]}w!==null&&(r[y]=w)}for(const y in p)r[y]=p[y]}}}return r}const Vc=e=>(t,n)=>{const s=E.useContext(Os),r=E.useContext(Fs),i=()=>np(e,t,s,r);return n?i():bo(i)};function Xo(e,t,n){var i;const{style:s}=e,r={};for(const o in s)(Le(s[o])||t.style&&Le(t.style[o])||jc(o,e)||((i=n==null?void 0:n.getValue(o))==null?void 0:i.liveStyle)!==void 0)&&(r[o]=s[o]);return r}const rp=Vc({scrapeMotionValuesFromProps:Xo,createRenderState:Ko});function Ic(e,t,n){const s=Xo(e,t,n);for(const r in e)if(Le(e[r])||Le(t[r])){const i=bn.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[i]=e[r]}return s}const op=Vc({scrapeMotionValuesFromProps:Ic,createRenderState:Nc}),ip=Symbol.for("motionComponentSymbol");function on(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function ap(e,t,n){return E.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):on(n)&&(n.current=s))},[t])}const qo=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),lp="framerAppearId",Dc="data-"+qo(lp),Lc=E.createContext({});function cp(e,t,n,s,r){var p,v;const{visualElement:i}=E.useContext(Os),o=E.useContext(kc),a=E.useContext(Fs),l=E.useContext(Uo).reducedMotion,d=E.useRef(null);s=s||o.renderer,!d.current&&s&&(d.current=s(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const u=d.current,h=E.useContext(Lc);u&&!u.projection&&r&&(u.type==="html"||u.type==="svg")&&dp(d.current,n,r,h);const m=E.useRef(!1);E.useInsertionEffect(()=>{u&&m.current&&u.update(n,a)});const g=n[Dc],x=E.useRef(!!g&&!((p=window.MotionHandoffIsComplete)!=null&&p.call(window,g))&&((v=window.MotionHasOptimisedAnimation)==null?void 0:v.call(window,g)));return Vl(()=>{u&&(m.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),x.current&&u.animationState&&u.animationState.animateChanges())}),E.useEffect(()=>{u&&(!x.current&&u.animationState&&u.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var b;(b=window.MotionHandoffMarkAsComplete)==null||b.call(window,g)}),x.current=!1),u.enteringChildren=void 0)}),u}function dp(e,t,n,s){const{layoutId:r,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Fc(e.parent)),e.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!o||a&&on(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:l,layoutRoot:d})}function Fc(e){if(e)return e.options.allowProjection!==!1?e.projection:Fc(e.parent)}function lr(e,{forwardMotionProps:t=!1}={},n,s){n&&Fm(n);const r=Yo(e)?op:rp;function i(a,l){let d;const u={...E.useContext(Uo),...a,layoutId:up(a)},{isStatic:h}=u,m=Hm(a),g=r(a,h);if(!h&&wo){fp(u,n);const x=hp(u);d=x.MeasureLayout,m.visualElement=cp(e,g,u,s,x.ProjectionNode)}return c.jsxs(Os.Provider,{value:m,children:[d&&m.visualElement?c.jsx(d,{visualElement:m.visualElement,...u}):null,tp(e,a,ap(g,m.visualElement,l),g,h,t)]})}i.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const o=E.forwardRef(i);return o[ip]=e,o}function up({layoutId:e}){const t=E.useContext(vo).id;return t&&e!==void 0?t+"-"+e:e}function fp(e,t){const n=E.useContext(kc).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?yn(!1,s,"lazy-strict-mode"):yt(!1,s,"lazy-strict-mode")}}function hp(e){const{drag:t,layout:n}=pn;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function mp(e,t){if(typeof Proxy>"u")return lr;const n=new Map,s=(i,o)=>lr(i,o,e,t),r=(i,o)=>(process.env.NODE_ENV!=="production"&&Ao(!1,"motion() is deprecated. Use motion.create() instead."),s(i,o));return new Proxy(r,{get:(i,o)=>o==="create"?s:(n.has(o)||n.set(o,lr(o,void 0,e,t)),n.get(o))})}function Oc({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function pp({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function gp(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function cr(e){return e===void 0||e===1}function Wr({scale:e,scaleX:t,scaleY:n}){return!cr(e)||!cr(t)||!cr(n)}function Ft(e){return Wr(e)||_c(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function _c(e){return ta(e.x)||ta(e.y)}function ta(e){return e&&e!=="0%"}function Ps(e,t,n){const s=e-n,r=t*s;return n+r}function na(e,t,n,s,r){return r!==void 0&&(e=Ps(e,r,s)),Ps(e,n,s)+t}function Kr(e,t=0,n=1,s,r){e.min=na(e.min,t,n,s,r),e.max=na(e.max,t,n,s,r)}function $c(e,{x:t,y:n}){Kr(e.x,t.translate,t.scale,t.originPoint),Kr(e.y,n.translate,n.scale,n.originPoint)}const sa=.999999999999,ra=1.0000000000001;function xp(e,t,n,s=!1){const r=n.length;if(!r)return;t.x=t.y=1;let i,o;for(let a=0;a<r;a++){i=n[a],o=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(s&&i.options.layoutScroll&&i.scroll&&i!==i.root&&ln(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,$c(e,o)),s&&Ft(i.latestValues)&&ln(e,i.latestValues))}t.x<ra&&t.x>sa&&(t.x=1),t.y<ra&&t.y>sa&&(t.y=1)}function an(e,t){e.min=e.min+t,e.max=e.max+t}function oa(e,t,n,s,r=.5){const i=be(e.min,e.max,r);Kr(e,t,n,i,s)}function ln(e,t){oa(e.x,t.x,t.scaleX,t.scale,t.originX),oa(e.y,t.y,t.scaleY,t.scale,t.originY)}function Bc(e,t){return Oc(gp(e.getBoundingClientRect(),t))}function yp(e,t,n){const s=Bc(e,n),{scroll:r}=t;return r&&(an(s.x,r.offset.x),an(s.y,r.offset.y)),s}const ia=()=>({translate:0,scale:1,origin:0,originPoint:0}),cn=()=>({x:ia(),y:ia()}),aa=()=>({min:0,max:0}),Ce=()=>({x:aa(),y:aa()}),Yr={current:null},Hc={current:!1};function vp(){if(Hc.current=!0,!!wo)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Yr.current=e.matches;e.addEventListener("change",t),t()}else Yr.current=!1}const bp=new WeakMap;function wp(e,t,n){for(const s in t){const r=t[s],i=n[s];if(Le(r))e.addValue(s,r);else if(Le(i))e.addValue(s,mn(r,{owner:e}));else if(i!==r)if(e.hasValue(s)){const o=e.getValue(s);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=e.getStaticValue(s);e.addValue(s,mn(o!==void 0?o:r,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const la=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Sp{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Oo,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=He.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,ye.render(this.render,!1,!0))};const{latestValues:l,renderState:d}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=$s(n),this.isVariantNode=Tc(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in h){const g=h[m];l[m]!==void 0&&Le(g)&&g.set(l[m])}}mount(t){var n;this.current=t,bp.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),Hc.current||vp(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Yr.current,process.env.NODE_ENV!=="production"&&Ao(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),kt(this.notifyUpdate),kt(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=wn.has(t);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&ye.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in pn){const n=pn[t];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[t]&&r&&s(this.props)&&(this.features[t]=new r(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ce()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<la.length;s++){const r=la[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i="on"+r,o=t[i];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=wp(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=mn(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(Il(s)||Ll(s))?s=parseFloat(s):!Rm(s)&&At.test(n)&&(s=xc(t,n)),this.setBaseTarget(t,Le(s)?s.get():s)),Le(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var i;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const o=Go(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(s=o[t])}if(n&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Le(r)?r:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new ko),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Bo.render(this.render)}}class Uc extends Sp{constructor(){super(...arguments),this.KeyframeResolver=bm}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Le(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function zc(e,{style:t,vars:n},s,r){const i=e.style;let o;for(o in t)i[o]=t[o];r==null||r.applyProjectionStyles(i,s);for(o in n)i.setProperty(o,n[o])}function Cp(e){return window.getComputedStyle(e)}class Ep extends Uc{constructor(){super(...arguments),this.type="html",this.renderInstance=zc}readValueFromInstance(t,n){var s;if(wn.has(n))return(s=this.projection)!=null&&s.isProjecting?_r(n):Oh(t,n);{const r=Cp(t),i=(Po(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Bc(t,n)}build(t,n,s){Wo(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Xo(t,n,s)}}const Zc=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function kp(e,t,n,s){zc(e,t,void 0,s);for(const r in t.attrs)e.setAttribute(Zc.has(r)?r:qo(r),t.attrs[r])}class Ap extends Uc{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ce}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(wn.has(n)){const s=gc(n);return s&&s.default||0}return n=Zc.has(n)?n:qo(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return Ic(t,n,s)}build(t,n,s){Mc(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,r){kp(t,n,s,r)}mount(t){this.isSVGTag=Rc(t.tagName),super.mount(t)}}const Tp=(e,t)=>Yo(e)?new Ap(t):new Ep(t,{allowProjection:e!==E.Fragment});function un(e,t,n){const s=e.getProps();return Go(s,t,n!==void 0?n:s.custom,e)}const Gr=e=>Array.isArray(e);function jp(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,mn(n))}function Pp(e){return Gr(e)?e[e.length-1]||0:e}function Mp(e,t){const n=un(e,t);let{transitionEnd:s={},transition:r={},...i}=n||{};i={...i,...s};for(const o in i){const a=Pp(i[o]);jp(e,o,a)}}function Np(e){return!!(Le(e)&&e.add)}function Xr(e,t){const n=e.getValue("willChange");if(Np(n))return n.add(t);if(!n&&vt.WillChange){const s=new vt.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function Wc(e){return e.props[Dc]}const Rp=e=>e!==null;function Vp(e,{repeat:t,repeatType:n="loop"},s){const r=e.filter(Rp),i=t&&n!=="loop"&&t%2===1?0:r.length-1;return r[i]}const Ip={type:"spring",stiffness:500,damping:25,restSpeed:10},Dp=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Lp={type:"keyframes",duration:.8},Fp={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Op=(e,{keyframes:t})=>t.length>2?Lp:wn.has(e)?e.startsWith("scale")?Dp(t[1]):Ip:Fp;function _p({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:r,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:d,...u}){return!!Object.keys(u).length}const Jo=(e,t,n,s={},r,i)=>o=>{const a=_o(s,e)||{},l=a.delay||s.delay||0;let{elapsed:d=0}=s;d=d-et(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-d,onUpdate:m=>{t.set(m),a.onUpdate&&a.onUpdate(m)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:i?void 0:r};_p(a)||Object.assign(u,Op(e,u)),u.duration&&(u.duration=et(u.duration)),u.repeatDelay&&(u.repeatDelay=et(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(zr(u),u.delay===0&&(h=!0)),(vt.instantAnimations||vt.skipAnimations)&&(h=!0,zr(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!i&&t.get()!==void 0){const m=Vp(u.keyframes,a);if(m!==void 0){ye.update(()=>{u.onUpdate(m),u.onComplete()});return}}return a.isSync?new Fo(u):new am(u)};function $p({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function Kc(e,t,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:i=e.getDefaultTransition(),transitionEnd:o,...a}=t;s&&(i=s);const l=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const u in a){const h=e.getValue(u,e.latestValues[u]??null),m=a[u];if(m===void 0||d&&$p(d,u))continue;const g={delay:n,..._o(i||{},u)},x=h.get();if(x!==void 0&&!h.isAnimating&&!Array.isArray(m)&&m===x&&!g.velocity)continue;let p=!1;if(window.MotionHandoffAnimation){const b=Wc(e);if(b){const y=window.MotionHandoffAnimation(b,u,ye);y!==null&&(g.startTime=y,p=!0)}}Xr(e,u),h.start(Jo(u,h,m,e.shouldReduceMotion&&hc.has(u)?{type:!1}:g,e,p));const v=h.animation;v&&l.push(v)}return o&&Promise.all(l).then(()=>{ye.update(()=>{o&&Mp(e,o)})}),l}function Yc(e,t,n,s=0,r=1){const i=Array.from(e).sort((d,u)=>d.sortNodePosition(u)).indexOf(t),o=e.size,a=(o-1)*s;return typeof n=="function"?n(i,o):r===1?i*s:a-i*s}function qr(e,t,n={}){var l;const s=un(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const i=s?()=>Promise.all(Kc(e,s,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:m}=r;return Bp(e,t,d,u,h,m,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[d,u]=a==="beforeChildren"?[i,o]:[o,i];return d().then(()=>u())}else return Promise.all([i(),o(n.delay)])}function Bp(e,t,n=0,s=0,r=0,i=1,o){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(qr(l,t,{...o,delay:n+(typeof s=="function"?0:s)+Yc(e.variantChildren,l,s,r,i)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function Hp(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const r=t.map(i=>qr(e,i,n));s=Promise.all(r)}else if(typeof t=="string")s=qr(e,t,n);else{const r=typeof t=="function"?un(e,t,n.custom):t;s=Promise.all(Kc(e,r,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function Gc(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const Up=Zo.length;function Xc(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Xc(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<Up;n++){const s=Zo[n],r=e.props[s];(Un(r)||r===!1)&&(t[s]=r)}return t}const zp=[...zo].reverse(),Zp=zo.length;function Wp(e){return t=>Promise.all(t.map(({animation:n,options:s})=>Hp(e,n,s)))}function Kp(e){let t=Wp(e),n=ca(),s=!0;const r=l=>(d,u)=>{var m;const h=un(e,u,l==="exit"?(m=e.presenceContext)==null?void 0:m.custom:void 0);if(h){const{transition:g,transitionEnd:x,...p}=h;d={...d,...p,...x}}return d};function i(l){t=l(e)}function o(l){const{props:d}=e,u=Xc(e.parent)||{},h=[],m=new Set;let g={},x=1/0;for(let v=0;v<Zp;v++){const b=zp[v],y=n[b],w=d[b]!==void 0?d[b]:u[b],S=Un(w),k=b===l?y.isActive:null;k===!1&&(x=v);let T=w===u[b]&&w!==d[b]&&S;if(T&&s&&e.manuallyAnimateOnMount&&(T=!1),y.protectedKeys={...g},!y.isActive&&k===null||!w&&!y.prevProp||_s(w)||typeof w=="boolean")continue;const A=Yp(y.prevProp,w);let j=A||b===l&&y.isActive&&!T&&S||v>x&&S,V=!1;const I=Array.isArray(w)?w:[w];let $=I.reduce(r(b),{});k===!1&&($={});const{prevResolvedValues:F={}}=y,se={...F,...$},Z=O=>{j=!0,m.has(O)&&(V=!0,m.delete(O)),y.needsAnimating[O]=!0;const P=e.getValue(O);P&&(P.liveStyle=!1)};for(const O in se){const P=$[O],B=F[O];if(g.hasOwnProperty(O))continue;let X=!1;Gr(P)&&Gr(B)?X=!Gc(P,B):X=P!==B,X?P!=null?Z(O):m.add(O):P!==void 0&&m.has(O)?Z(O):y.protectedKeys[O]=!0}y.prevProp=w,y.prevResolvedValues=$,y.isActive&&(g={...g,...$}),s&&e.blockInitialAnimation&&(j=!1);const ee=T&&A;j&&(!ee||V)&&h.push(...I.map(O=>{const P={type:b};if(typeof O=="string"&&s&&!ee&&e.manuallyAnimateOnMount&&e.parent){const{parent:B}=e,X=un(B,O);if(B.enteringChildren&&X){const{delayChildren:_}=X.transition||{};P.delay=Yc(B.enteringChildren,e,_)}}return{animation:O,options:P}}))}if(m.size){const v={};if(typeof d.initial!="boolean"){const b=un(e,Array.isArray(d.initial)?d.initial[0]:d.initial);b&&b.transition&&(v.transition=b.transition)}m.forEach(b=>{const y=e.getBaseTarget(b),w=e.getValue(b);w&&(w.liveStyle=!0),v[b]=y??null}),h.push({animation:v})}let p=!!h.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(p=!1),s=!1,p?t(h):Promise.resolve()}function a(l,d){var h;if(n[l].isActive===d)return Promise.resolve();(h=e.variantChildren)==null||h.forEach(m=>{var g;return(g=m.animationState)==null?void 0:g.setActive(l,d)}),n[l].isActive=d;const u=o(l);for(const m in n)n[m].protectedKeys={};return u}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=ca(),s=!0}}}function Yp(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Gc(t,e):!1}function Dt(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ca(){return{animate:Dt(!0),whileInView:Dt(),whileHover:Dt(),whileTap:Dt(),whileDrag:Dt(),whileFocus:Dt(),exit:Dt()}}class Pt{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Gp extends Pt{constructor(t){super(t),t.animationState||(t.animationState=Kp(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();_s(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Xp=0;class qp extends Pt{constructor(){super(...arguments),this.id=Xp++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Jp={animation:{Feature:Gp},exit:{Feature:qp}};function Zn(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function Jn(e){return{point:{x:e.pageX,y:e.pageY}}}const Qp=e=>t=>Ho(t)&&e(t,Jn(t));function Fn(e,t,n,s){return Zn(e,t,Qp(n),s)}const qc=1e-4,e0=1-qc,t0=1+qc,Jc=.01,n0=0-Jc,s0=0+Jc;function _e(e){return e.max-e.min}function r0(e,t,n){return Math.abs(e-t)<=n}function da(e,t,n,s=.5){e.origin=s,e.originPoint=be(t.min,t.max,e.origin),e.scale=_e(n)/_e(t),e.translate=be(n.min,n.max,e.origin)-e.originPoint,(e.scale>=e0&&e.scale<=t0||isNaN(e.scale))&&(e.scale=1),(e.translate>=n0&&e.translate<=s0||isNaN(e.translate))&&(e.translate=0)}function On(e,t,n,s){da(e.x,t.x,n.x,s?s.originX:void 0),da(e.y,t.y,n.y,s?s.originY:void 0)}function ua(e,t,n){e.min=n.min+t.min,e.max=e.min+_e(t)}function o0(e,t,n){ua(e.x,t.x,n.x),ua(e.y,t.y,n.y)}function fa(e,t,n){e.min=t.min-n.min,e.max=e.min+_e(t)}function _n(e,t,n){fa(e.x,t.x,n.x),fa(e.y,t.y,n.y)}function Ye(e){return[e("x"),e("y")]}const Qc=({current:e})=>e?e.ownerDocument.defaultView:null,ha=(e,t)=>Math.abs(e-t);function i0(e,t){const n=ha(e.x,t.x),s=ha(e.y,t.y);return Math.sqrt(n**2+s**2)}class ed{constructor(t,n,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=ur(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=i0(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:p}=m,{timestamp:v}=Ne;this.history.push({...p,timestamp:v});const{onStart:b,onMove:y}=this.handlers;g||(b&&b(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,m)},this.handlePointerMove=(m,g)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=dr(g,this.transformPagePoint),ye.update(this.updatePoint,!0)},this.handlePointerUp=(m,g)=>{this.end();const{onEnd:x,onSessionEnd:p,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=ur(m.type==="pointercancel"?this.lastMoveEventInfo:dr(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(m,b),p&&p(m,b)},!Ho(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=o,this.contextWindow=r||window;const a=Jn(t),l=dr(a,this.transformPagePoint),{point:d}=l,{timestamp:u}=Ne;this.history=[{...d,timestamp:u}];const{onSessionStart:h}=n;h&&h(t,ur(l,this.history)),this.removeListeners=Gn(Fn(this.contextWindow,"pointermove",this.handlePointerMove),Fn(this.contextWindow,"pointerup",this.handlePointerUp),Fn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),kt(this.updatePoint)}}function dr(e,t){return t?{point:t(e.point)}:e}function ma(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ur({point:e},t){return{point:e,delta:ma(e,td(t)),offset:ma(e,a0(t)),velocity:l0(t,.1)}}function a0(e){return e[0]}function td(e){return e[e.length-1]}function l0(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const r=td(e);for(;n>=0&&(s=e[n],!(r.timestamp-s.timestamp>et(t)));)n--;if(!s)return{x:0,y:0};const i=lt(r.timestamp-s.timestamp);if(i===0)return{x:0,y:0};const o={x:(r.x-s.x)/i,y:(r.y-s.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function c0(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?be(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?be(n,e,s.max):Math.min(e,n)),e}function pa(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function d0(e,{top:t,left:n,bottom:s,right:r}){return{x:pa(e.x,n,r),y:pa(e.y,t,s)}}function ga(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function u0(e,t){return{x:ga(e.x,t.x),y:ga(e.y,t.y)}}function f0(e,t){let n=.5;const s=_e(e),r=_e(t);return r>s?n=$n(t.min,t.max-s,e.min):s>r&&(n=$n(e.min,e.max-r,t.min)),xt(0,1,n)}function h0(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Jr=.35;function m0(e=Jr){return e===!1?e=0:e===!0&&(e=Jr),{x:xa(e,"left","right"),y:xa(e,"top","bottom")}}function xa(e,t,n){return{min:ya(e,t),max:ya(e,n)}}function ya(e,t){return typeof e=="number"?e:e[t]||0}const p0=new WeakMap;class g0{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ce(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Jn(h).point)},o=(h,m)=>{const{drag:g,dragPropagation:x,onDragStart:p}=this.getProps();if(g&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Em(g),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ye(b=>{let y=this.getAxisMotionValue(b).get()||0;if(ct.test(y)){const{projection:w}=this.visualElement;if(w&&w.layout){const S=w.layout.layoutBox[b];S&&(y=_e(S)*(parseFloat(y)/100))}}this.originPoint[b]=y}),p&&ye.postRender(()=>p(h,m)),Xr(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},a=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m;const{dragPropagation:g,dragDirectionLock:x,onDirectionLock:p,onDrag:v}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:b}=m;if(x&&this.currentDirection===null){this.currentDirection=x0(b),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),v&&v(h,m)},l=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m,this.stop(h,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>Ye(h=>{var m;return this.getAnimationState(h)==="paused"&&((m=this.getAxisMotionValue(h).animation)==null?void 0:m.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new ed(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:Qc(this.visualElement)})}stop(t,n){const s=t||this.latestPointerEvent,r=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!s)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&ye.postRender(()=>a(s,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:r}=this.getProps();if(!s||!is(t,r,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(o=c0(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,r=this.constraints;t&&on(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=d0(s.layoutBox,t):this.constraints=!1,this.elastic=m0(n),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ye(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=h0(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!on(t))return!1;const s=t.current;yt(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=yp(s,r.root,this.visualElement.getTransformPagePoint());let o=u0(r.layout.layoutBox,i);if(n){const a=n(pp(o));this.hasMutatedConstraints=!!a,a&&(o=Oc(a))}return o}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},d=Ye(u=>{if(!is(u,n,this.currentDirection))return;let h=l&&l[u]||{};o&&(h={min:0,max:0});const m=r?200:1e6,g=r?40:1e7,x={type:"inertia",velocity:s?t[u]:0,bounceStiffness:m,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(u,x)});return Promise.all(d).then(a)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return Xr(this.visualElement,t),s.start(Jo(t,s,0,n,this.visualElement,!1))}stopAnimation(){Ye(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ye(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),r=s[n];return r||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Ye(n=>{const{drag:s}=this.getProps();if(!is(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[n];i.set(t[n]-be(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!on(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Ye(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();r[o]=f0({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Ye(o=>{if(!is(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:d}=this.constraints[o];a.set(be(l,d,r[o]))})}addListeners(){if(!this.visualElement.current)return;p0.set(this.visualElement,this);const t=this.visualElement.current,n=Fn(t,"pointerdown",l=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(l)}),s=()=>{const{dragConstraints:l}=this.getProps();on(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener("measure",s);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),ye.read(s);const o=Zn(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:l,hasLayoutChanged:d})=>{this.isDragging&&d&&(Ye(u=>{const h=this.getAxisMotionValue(u);h&&(this.originPoint[u]+=l[u].translate,h.set(h.get()+l[u].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=Jr,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function is(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function x0(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class y0 extends Pt{constructor(t){super(t),this.removeGroupControls=Xe,this.removeListeners=Xe,this.controls=new g0(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Xe}unmount(){this.removeGroupControls(),this.removeListeners()}}const va=e=>(t,n)=>{e&&ye.postRender(()=>e(t,n))};class v0 extends Pt{constructor(){super(...arguments),this.removePointerDownListener=Xe}onPointerDown(t){this.session=new ed(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qc(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:va(t),onStart:va(n),onMove:s,onEnd:(i,o)=>{delete this.session,r&&ye.postRender(()=>r(i,o))}}}mount(){this.removePointerDownListener=Fn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const vs={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ba(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Rn={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(oe.test(e))e=parseFloat(e);else return e;const n=ba(e,t.target.x),s=ba(e,t.target.y);return`${n}% ${s}%`}},b0={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,r=At.parse(e);if(r.length>5)return s;const i=At.createTransformer(e),o=typeof r[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;r[0+o]/=a,r[1+o]/=l;const d=be(a,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=d),typeof r[3+o]=="number"&&(r[3+o]/=d),i(r)}};let fr=!1;class w0 extends E.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:i}=t;Um(S0),i&&(n.group&&n.group.add(i),s&&s.register&&r&&s.register(i),fr&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),vs.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:r,isPresent:i}=this.props,{projection:o}=s;return o&&(o.isPresent=i,fr=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==i?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||ye.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Bo.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=t;fr=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function nd(e){const[t,n]=Ec(),s=E.useContext(vo);return c.jsx(w0,{...e,layoutGroup:s,switchLayoutGroup:E.useContext(Lc),isPresent:t,safeToRemove:n})}const S0={borderRadius:{...Rn,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Rn,borderTopRightRadius:Rn,borderBottomLeftRadius:Rn,borderBottomRightRadius:Rn,boxShadow:b0};function C0(e,t,n){const s=Le(e)?e:mn(e);return s.start(Jo("",s,t,n)),s.animation}const E0=(e,t)=>e.depth-t.depth;class k0{constructor(){this.children=[],this.isDirty=!1}add(t){So(this.children,t),this.isDirty=!0}remove(t){Co(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(E0),this.isDirty=!1,this.children.forEach(t)}}function A0(e,t){const n=He.now(),s=({timestamp:r})=>{const i=r-n;i>=t&&(kt(s),e(i-t))};return ye.setup(s,!0),()=>kt(s)}const sd=["TopLeft","TopRight","BottomLeft","BottomRight"],T0=sd.length,wa=e=>typeof e=="string"?parseFloat(e):e,Sa=e=>typeof e=="number"||oe.test(e);function j0(e,t,n,s,r,i){r?(e.opacity=be(0,n.opacity??1,P0(s)),e.opacityExit=be(t.opacity??1,0,M0(s))):i&&(e.opacity=be(t.opacity??1,n.opacity??1,s));for(let o=0;o<T0;o++){const a=`border${sd[o]}Radius`;let l=Ca(t,a),d=Ca(n,a);if(l===void 0&&d===void 0)continue;l||(l=0),d||(d=0),l===0||d===0||Sa(l)===Sa(d)?(e[a]=Math.max(be(wa(l),wa(d),s),0),(ct.test(d)||ct.test(l))&&(e[a]+="%")):e[a]=d}(t.rotate||n.rotate)&&(e.rotate=be(t.rotate||0,n.rotate||0,s))}function Ca(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const P0=rd(0,.5,zl),M0=rd(.5,.95,Xe);function rd(e,t,n){return s=>s<e?0:s>t?1:n($n(e,t,s))}function Ea(e,t){e.min=t.min,e.max=t.max}function Ke(e,t){Ea(e.x,t.x),Ea(e.y,t.y)}function ka(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Aa(e,t,n,s,r){return e-=t,e=Ps(e,1/n,s),r!==void 0&&(e=Ps(e,1/r,s)),e}function N0(e,t=0,n=1,s=.5,r,i=e,o=e){if(ct.test(t)&&(t=parseFloat(t),t=be(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=be(i.min,i.max,s);e===i&&(a-=t),e.min=Aa(e.min,t,n,a,r),e.max=Aa(e.max,t,n,a,r)}function Ta(e,t,[n,s,r],i,o){N0(e,t[n],t[s],t[r],t.scale,i,o)}const R0=["x","scaleX","originX"],V0=["y","scaleY","originY"];function ja(e,t,n,s){Ta(e.x,t,R0,n?n.x:void 0,s?s.x:void 0),Ta(e.y,t,V0,n?n.y:void 0,s?s.y:void 0)}function Pa(e){return e.translate===0&&e.scale===1}function od(e){return Pa(e.x)&&Pa(e.y)}function Ma(e,t){return e.min===t.min&&e.max===t.max}function I0(e,t){return Ma(e.x,t.x)&&Ma(e.y,t.y)}function Na(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function id(e,t){return Na(e.x,t.x)&&Na(e.y,t.y)}function Ra(e){return _e(e.x)/_e(e.y)}function Va(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class D0{constructor(){this.members=[]}add(t){So(this.members,t),t.scheduleRender()}remove(t){if(Co(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let s;for(let r=n;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1){s=i;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function L0(e,t,n){let s="";const r=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((r||i||o)&&(s=`translate3d(${r}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:h,rotateY:m,skewX:g,skewY:x}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),h&&(s+=`rotateX(${h}deg) `),m&&(s+=`rotateY(${m}deg) `),g&&(s+=`skewX(${g}deg) `),x&&(s+=`skewY(${x}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(s+=`scale(${a}, ${l})`),s||"none"}const hr=["","X","Y","Z"],F0=1e3;let O0=0;function mr(e,t,n,s){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),s&&(s[e]=0))}function ad(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Wc(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ye,!(r||i))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&ad(s)}function ld({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(o={},a=t==null?void 0:t()){this.id=O0++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(B0),this.nodes.forEach(Z0),this.nodes.forEach(W0),this.nodes.forEach(H0)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new k0)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new ko),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Cc(o)&&!Mm(o),this.instance=o;const{layoutId:a,layout:l,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,h=0;const m=()=>this.root.updateBlockedByResize=!1;ye.read(()=>{h=window.innerWidth}),e(o,()=>{const g=window.innerWidth;g!==h&&(h=g,this.root.updateBlockedByResize=!0,u&&u(),u=A0(m,250),vs.hasAnimatedSinceResize&&(vs.hasAnimatedSinceResize=!1,this.nodes.forEach(La)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&d&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:m,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||q0,{onLayoutAnimationStart:p,onLayoutAnimationComplete:v}=d.getProps(),b=!this.targetLayout||!id(this.targetLayout,g),y=!h&&m;if(this.options.layoutRoot||this.resumeFrom||y||h&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={..._o(x,"layout"),onPlay:p,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,y)}else h||La(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),kt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(K0),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ad(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ia);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Da);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(z0),this.nodes.forEach(_0),this.nodes.forEach($0)):this.nodes.forEach(Da),this.clearAllSnapshots();const a=He.now();Ne.delta=xt(0,1e3/60,a-Ne.timestamp),Ne.timestamp=a,Ne.isProcessing=!0,nr.update.process(Ne),nr.preRender.process(Ne),nr.render.process(Ne),Ne.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Bo.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(U0),this.sharedNodes.forEach(Y0)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ye.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ye.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!_e(this.snapshot.measuredBox.x)&&!_e(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ce(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!od(this.projectionDelta),l=this.getTransformTemplate(),d=l?l(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;o&&this.instance&&(a||Ft(this.latestValues)||u)&&(r(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),J0(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:o}=this.options;if(!o)return Ce();const a=o.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(Q0))){const{scroll:u}=this.root;u&&(an(a.x,u.offset.x),an(a.y,u.offset.y))}return a}removeElementScroll(o){var l;const a=Ce();if(Ke(a,o),(l=this.scroll)!=null&&l.wasRoot)return a;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:h,options:m}=u;u!==this.root&&h&&m.layoutScroll&&(h.wasRoot&&Ke(a,o),an(a.x,h.offset.x),an(a.y,h.offset.y))}return a}applyTransform(o,a=!1){const l=Ce();Ke(l,o);for(let d=0;d<this.path.length;d++){const u=this.path[d];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&ln(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),Ft(u.latestValues)&&ln(l,u.latestValues)}return Ft(this.latestValues)&&ln(l,this.latestValues),l}removeTransform(o){const a=Ce();Ke(a,o);for(let l=0;l<this.path.length;l++){const d=this.path[l];if(!d.instance||!Ft(d.latestValues))continue;Wr(d.latestValues)&&d.updateSnapshot();const u=Ce(),h=d.measurePageBox();Ke(u,h),ja(a,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return Ft(this.latestValues)&&ja(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ne.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var m;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!(!this.layout||!(u||h))){if(this.resolvedRelativeTargetAt=Ne.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ce(),this.relativeTargetOrigin=Ce(),_n(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ce(),this.targetWithTransforms=Ce()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),o0(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ke(this.target,this.layout.layoutBox),$c(this.target,this.targetDelta)):Ke(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ce(),this.relativeTargetOrigin=Ce(),_n(this.relativeTargetOrigin,this.target,g.target),Ke(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Wr(this.parent.latestValues)||_c(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var x;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ne.timestamp&&(l=!1),l)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;Ke(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,m=this.treeScale.y;xp(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Ce());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ka(this.prevProjectionDelta.x,this.projectionDelta.x),ka(this.prevProjectionDelta.y,this.projectionDelta.y)),On(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==m||!Va(this.projectionDelta.x,this.prevProjectionDelta.x)||!Va(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=cn(),this.projectionDelta=cn(),this.projectionDeltaWithTransform=cn()}setAnimationOrigin(o,a=!1){const l=this.snapshot,d=l?l.latestValues:{},u={...this.latestValues},h=cn();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const m=Ce(),g=l?l.source:void 0,x=this.layout?this.layout.source:void 0,p=g!==x,v=this.getStack(),b=!v||v.members.length<=1,y=!!(p&&!b&&this.options.crossfade===!0&&!this.path.some(X0));this.animationProgress=0;let w;this.mixTargetDelta=S=>{const k=S/1e3;Fa(h.x,o.x,k),Fa(h.y,o.y,k),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_n(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),G0(this.relativeTarget,this.relativeTargetOrigin,m,k),w&&I0(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Ce()),Ke(w,this.relativeTarget)),p&&(this.animationValues=u,j0(u,d,this.latestValues,k,y,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,d;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(d=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||d.stop(),this.pendingAnimation&&(kt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ye.update(()=>{vs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mn(0)),this.currentAnimation=C0(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),o.onUpdate&&o.onUpdate(u)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(F0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:d,latestValues:u}=o;if(!(!a||!l||!d)){if(this!==o&&this.layout&&d&&cd(this.options.animationType,this.layout.layoutBox,d.layoutBox)){l=this.target||Ce();const h=_e(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const m=_e(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+m}Ke(a,l),ln(a,u),On(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new D0),this.sharedNodes.get(o).add(a);const d=a.options.initialPromotionConfig;a.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const d=this.getStack();d&&d.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const d={};l.z&&mr("z",o,d,this.animationValues);for(let u=0;u<hr.length;u++)mr(`rotate${hr[u]}`,o,d,this.animationValues),mr(`skew${hr[u]}`,o,d,this.animationValues);o.render();for(const u in d)o.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=ys(a==null?void 0:a.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=ys(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Ft(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=L0(this.projectionDeltaWithTransform,this.treeScale,u);l&&(h=l(u,h)),o.transform=h;const{x:m,y:g}=this.projectionDelta;o.transformOrigin=`${m.origin*100}% ${g.origin*100}% 0`,d.animationValues?o.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const x in zn){if(u[x]===void 0)continue;const{correct:p,applyTo:v,isCSSVariable:b}=zn[x],y=h==="none"?u[x]:p(u[x],d);if(v){const w=v.length;for(let S=0;S<w;S++)o[v[S]]=y}else b?this.options.visualElement.renderState.vars[x]=y:o[x]=y}this.options.layoutId&&(o.pointerEvents=d===this?ys(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(Ia),this.root.sharedNodes.clear()}}}function _0(e){e.updateLayout()}function $0(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;i==="size"?Ye(h=>{const m=o?t.measuredBox[h]:t.layoutBox[h],g=_e(m);m.min=s[h].min,m.max=m.min+g}):cd(i,t.layoutBox,s)&&Ye(h=>{const m=o?t.measuredBox[h]:t.layoutBox[h],g=_e(s[h]);m.max=m.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+g)});const a=cn();On(a,s,t.layoutBox);const l=cn();o?On(l,e.applyTransform(r,!0),t.measuredBox):On(l,s,t.layoutBox);const d=!od(a);let u=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:m,layout:g}=h;if(m&&g){const x=Ce();_n(x,t.layoutBox,m.layoutBox);const p=Ce();_n(p,s,g.layoutBox),id(x,p)||(u=!0),h.options.layoutRoot&&(e.relativeTarget=p,e.relativeTargetOrigin=x,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function B0(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function H0(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function U0(e){e.clearSnapshot()}function Ia(e){e.clearMeasurements()}function Da(e){e.isLayoutDirty=!1}function z0(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function La(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Z0(e){e.resolveTargetDelta()}function W0(e){e.calcProjection()}function K0(e){e.resetSkewAndRotation()}function Y0(e){e.removeLeadSnapshot()}function Fa(e,t,n){e.translate=be(t.translate,0,n),e.scale=be(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Oa(e,t,n,s){e.min=be(t.min,n.min,s),e.max=be(t.max,n.max,s)}function G0(e,t,n,s){Oa(e.x,t.x,n.x,s),Oa(e.y,t.y,n.y,s)}function X0(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const q0={duration:.45,ease:[.4,0,.1,1]},_a=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$a=_a("applewebkit/")&&!_a("chrome/")?Math.round:Xe;function Ba(e){e.min=$a(e.min),e.max=$a(e.max)}function J0(e){Ba(e.x),Ba(e.y)}function cd(e,t,n){return e==="position"||e==="preserve-aspect"&&!r0(Ra(t),Ra(n),.2)}function Q0(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const eg=ld({attachResizeListener:(e,t)=>Zn(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),pr={current:void 0},dd=ld({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!pr.current){const e=new eg({});e.mount(window),e.setOptions({layoutScroll:!0}),pr.current=e}return pr.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),tg={pan:{Feature:v0},drag:{Feature:y0,ProjectionNode:dd,MeasureLayout:nd}};function Ha(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=s[r];i&&ye.postRender(()=>i(t,Jn(t)))}class ng extends Pt{mount(){const{current:t}=this.node;t&&(this.unmount=km(t,(n,s)=>(Ha(this.node,s,"Start"),r=>Ha(this.node,r,"End"))))}unmount(){}}class sg extends Pt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Gn(Zn(this.node.current,"focus",()=>this.onFocus()),Zn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Ua(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=s[r];i&&ye.postRender(()=>i(t,Jn(t)))}class rg extends Pt{mount(){const{current:t}=this.node;t&&(this.unmount=Pm(t,(n,s)=>(Ua(this.node,s,"Start"),(r,{success:i})=>Ua(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Qr=new WeakMap,gr=new WeakMap,og=e=>{const t=Qr.get(e.target);t&&t(e)},ig=e=>{e.forEach(og)};function ag({root:e,...t}){const n=e||document;gr.has(n)||gr.set(n,{});const s=gr.get(n),r=JSON.stringify(t);return s[r]||(s[r]=new IntersectionObserver(ig,{root:e,...t})),s[r]}function lg(e,t,n){const s=ag(t);return Qr.set(e,n),s.observe(e),()=>{Qr.delete(e),s.unobserve(e)}}const cg={some:0,all:1};class dg extends Pt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:cg[r]},a=l=>{const{isIntersecting:d}=l;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),m=d?u:h;m&&m(l)};return lg(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(ug(t,n))&&this.startObserver()}unmount(){}}function ug({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const fg={inView:{Feature:dg},tap:{Feature:rg},focus:{Feature:sg},hover:{Feature:ng}},hg={layout:{ProjectionNode:dd,MeasureLayout:nd}},mg={...Jp,...fg,...tg,...hg},ce=mp(mg,Tp);function pg(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Array(12).fill(0);let eo=1;class gg{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:s,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:eo++,o=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:s}),{...l,...t,id:i,dismissible:a,title:s}):l):this.addToast({title:s,...r,dismissible:a,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(t instanceof Function?t():t);let i=s!==void 0,o;const a=r.then(async d=>{if(o=["resolve",d],E.isValidElement(d))i=!1,this.create({id:s,type:"default",message:d});else if(yg(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,m=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,x=typeof h=="object"&&!E.isValidElement(h)?h:{message:h};this.create({id:s,type:"error",description:m,...x})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,m=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!E.isValidElement(h)?h:{message:h};this.create({id:s,type:"error",description:m,...x})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,m=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!E.isValidElement(h)?h:{message:h};this.create({id:s,type:"success",description:m,...x})}}).catch(async d=>{if(o=["reject",d],n.error!==void 0){i=!1;const u=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,g=typeof u=="object"&&!E.isValidElement(u)?u:{message:u};this.create({id:s,type:"error",description:h,...g})}}).finally(()=>{i&&(this.dismiss(s),s=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((d,u)=>a.then(()=>o[0]==="reject"?u(o[1]):d(o[1])).catch(u));return typeof s!="string"&&typeof s!="number"?{unwrap:l}:Object.assign(s,{unwrap:l})},this.custom=(t,n)=>{const s=(n==null?void 0:n.id)||eo++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ge=new gg,xg=(e,t)=>{const n=(t==null?void 0:t.id)||eo++;return Ge.addToast({title:e,...t,id:n}),n},yg=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",vg=xg,bg=()=>Ge.toasts,wg=()=>Ge.getActiveToasts(),ud=Object.assign(vg,{success:Ge.success,info:Ge.info,warning:Ge.warning,error:Ge.error,custom:Ge.custom,message:Ge.message,promise:Ge.promise,dismiss:Ge.dismiss,loading:Ge.loading},{getHistory:bg,getToasts:wg});pg("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const st=f.forwardRef((e,t)=>{const{alt:n,color:s="currentColor",size:r="1em",weight:i="regular",mirrored:o=!1,children:a,weights:l,...d}=e;return f.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 256 256",transform:o?"scale(-1, 1)":void 0,...d},!!n&&f.createElement("title",null,n),a,l.get(i))});st.displayName="SSRBase";const Sg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),f.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),Qo=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Sg}));Qo.displayName="CaretDownIcon";const Cg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),f.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),fd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Cg}));fd.displayName="CaretUpIcon";const Eg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),f.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),hd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Eg}));hd.displayName="ChatTextIcon";const kg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),f.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),md=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:kg}));md.displayName="CheckIcon";const Ag=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),f.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),pd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Ag}));pd.displayName="MicrophoneIcon";const Tg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),f.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),gd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Tg}));gd.displayName="MicrophoneSlashIcon";const jg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),f.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),xd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:jg}));xd.displayName="MonitorArrowUpIcon";const Pg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),f.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),ei=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Pg}));ei.displayName="SpinnerIcon";const Mg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),yd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Mg}));yd.displayName="VideoCameraIcon";const Ng=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),vd=f.forwardRef((e,t)=>f.createElement(st,{ref:t,...e,weights:Ng}));vd.displayName="VideoCameraSlashIcon";const Rg=new Map([["bold",f.createElement(f.Fragment,null,f.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",f.createElement(f.Fragment,null,f.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),f.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",f.createElement(f.Fragment,null,f.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",f.createElement(f.Fragment,null,f.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",f.createElement(f.Fragment,null,f.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",f.createElement(f.Fragment,null,f.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),Vg=E.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),bd=f.forwardRef((e,t)=>{const{alt:n,color:s,size:r,weight:i,mirrored:o,children:a,weights:l,...d}=e,{color:u="currentColor",size:h,weight:m="regular",mirrored:g=!1,...x}=f.useContext(Vg);return f.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:r??h,height:r??h,fill:s??u,viewBox:"0 0 256 256",transform:o||g?"scale(-1, 1)":void 0,...x,...d},!!n&&f.createElement("title",null,n),a,l.get(i??m))});bd.displayName="IconBase";const wd=f.forwardRef((e,t)=>f.createElement(bd,{ref:t,...e,weights:Rg}));wd.displayName="WarningIcon";const ti="-",Ig=e=>{const t=Lg(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const a=o.split(ti);return a[0]===""&&a.length!==1&&a.shift(),Sd(a,t)||Dg(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&s[o]?[...l,...s[o]]:l}}},Sd=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),r=s?Sd(e.slice(1),s):void 0;if(r)return r;if(t.validators.length===0)return;const i=e.join(ti);return(o=t.validators.find(({validator:a})=>a(i)))==null?void 0:o.classGroupId},za=/^\[(.+)\]$/,Dg=e=>{if(za.test(e)){const t=za.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Lg=e=>{const{theme:t,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const r in n)to(n[r],s,r,t);return s},to=(e,t,n,s)=>{e.forEach(r=>{if(typeof r=="string"){const i=r===""?t:Za(t,r);i.classGroupId=n;return}if(typeof r=="function"){if(Fg(r)){to(r(s),t,n,s);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([i,o])=>{to(o,Za(t,i),n,s)})})},Za=(e,t)=>{let n=e;return t.split(ti).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Fg=e=>e.isThemeGetter,Og=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const r=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return r(i,o),o},set(i,o){n.has(i)?n.set(i,o):r(i,o)}}},no="!",so=":",_g=so.length,$g=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const i=[];let o=0,a=0,l=0,d;for(let x=0;x<r.length;x++){let p=r[x];if(o===0&&a===0){if(p===so){i.push(r.slice(l,x)),l=x+_g;continue}if(p==="/"){d=x;continue}}p==="["?o++:p==="]"?o--:p==="("?a++:p===")"&&a--}const u=i.length===0?r:r.substring(l),h=Bg(u),m=h!==u,g=d&&d>l?d-l:void 0;return{modifiers:i,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:g}};if(t){const r=t+so,i=s;s=o=>o.startsWith(r)?i(o.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},Bg=e=>e.endsWith(no)?e.substring(0,e.length-1):e.startsWith(no)?e.substring(1):e,Hg=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const r=[];let i=[];return s.forEach(o=>{o[0]==="["||t[o]?(r.push(...i.sort(),o),i=[]):i.push(o)}),r.push(...i.sort()),r}},Ug=e=>({cache:Og(e.cacheSize),parseClassName:$g(e),sortModifiers:Hg(e),...Ig(e)}),zg=/\s+/,Zg=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i}=t,o=[],a=e.trim().split(zg);let l="";for(let d=a.length-1;d>=0;d-=1){const u=a[d],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:p}=n(u);if(h){l=u+(l.length>0?" "+l:l);continue}let v=!!p,b=s(v?x.substring(0,p):x);if(!b){if(!v){l=u+(l.length>0?" "+l:l);continue}if(b=s(x),!b){l=u+(l.length>0?" "+l:l);continue}v=!1}const y=i(m).join(":"),w=g?y+no:y,S=w+b;if(o.includes(S))continue;o.push(S);const k=r(b,v);for(let T=0;T<k.length;++T){const A=k[T];o.push(w+A)}l=u+(l.length>0?" "+l:l)}return l};function Wg(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Cd(t))&&(s&&(s+=" "),s+=n);return s}const Cd=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Cd(e[s]))&&(n&&(n+=" "),n+=t);return n};function Kg(e,...t){let n,s,r,i=o;function o(l){const d=t.reduce((u,h)=>h(u),e());return n=Ug(d),s=n.cache.get,r=n.cache.set,i=a,a(l)}function a(l){const d=s(l);if(d)return d;const u=Zg(l,n);return r(l,u),u}return function(){return i(Wg.apply(null,arguments))}}const Me=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ed=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Yg=/^\d+\/\d+$/,Gg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Xg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qg=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qt=e=>Yg.test(e),le=e=>!!e&&!Number.isNaN(Number(e)),St=e=>!!e&&Number.isInteger(Number(e)),xr=e=>e.endsWith("%")&&le(e.slice(0,-1)),mt=e=>Gg.test(e),e1=()=>!0,t1=e=>Xg.test(e)&&!qg.test(e),Ad=()=>!1,n1=e=>Jg.test(e),s1=e=>Qg.test(e),r1=e=>!K(e)&&!Y(e),o1=e=>Sn(e,Pd,Ad),K=e=>Ed.test(e),Lt=e=>Sn(e,Md,t1),yr=e=>Sn(e,d1,le),Wa=e=>Sn(e,Td,Ad),i1=e=>Sn(e,jd,s1),as=e=>Sn(e,Nd,n1),Y=e=>kd.test(e),Vn=e=>Cn(e,Md),a1=e=>Cn(e,u1),Ka=e=>Cn(e,Td),l1=e=>Cn(e,Pd),c1=e=>Cn(e,jd),ls=e=>Cn(e,Nd,!0),Sn=(e,t,n)=>{const s=Ed.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Cn=(e,t,n=!1)=>{const s=kd.exec(e);return s?s[1]?t(s[1]):n:!1},Td=e=>e==="position"||e==="percentage",jd=e=>e==="image"||e==="url",Pd=e=>e==="length"||e==="size"||e==="bg-size",Md=e=>e==="length",d1=e=>e==="number",u1=e=>e==="family-name",Nd=e=>e==="shadow",f1=()=>{const e=Me("color"),t=Me("font"),n=Me("text"),s=Me("font-weight"),r=Me("tracking"),i=Me("leading"),o=Me("breakpoint"),a=Me("container"),l=Me("spacing"),d=Me("radius"),u=Me("shadow"),h=Me("inset-shadow"),m=Me("text-shadow"),g=Me("drop-shadow"),x=Me("blur"),p=Me("perspective"),v=Me("aspect"),b=Me("ease"),y=Me("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...S(),Y,K],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],j=()=>[Y,K,l],V=()=>[qt,"full","auto",...j()],I=()=>[St,"none","subgrid",Y,K],$=()=>["auto",{span:["full",St,Y,K]},St,Y,K],F=()=>[St,"auto",Y,K],se=()=>["auto","min","max","fr",Y,K],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...j()],O=()=>[qt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],P=()=>[e,Y,K],B=()=>[...S(),Ka,Wa,{position:[Y,K]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",l1,o1,{size:[Y,K]}],re=()=>[xr,Vn,Lt],M=()=>["","none","full",d,Y,K],H=()=>["",le,Vn,Lt],q=()=>["solid","dashed","dotted","double"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>[le,xr,Ka,Wa],L=()=>["","none",x,Y,K],W=()=>["none",le,Y,K],D=()=>["none",le,Y,K],ne=()=>[le,Y,K],te=()=>[qt,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[mt],breakpoint:[mt],color:[e1],container:[mt],"drop-shadow":[mt],ease:["in","out","in-out"],font:[r1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[mt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[mt],shadow:[mt],spacing:["px",le],text:[mt],"text-shadow":[mt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qt,K,Y,v]}],container:["container"],columns:[{columns:[le,K,Y,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[St,"auto",Y,K]}],basis:[{basis:[qt,"full","auto",a,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[le,qt,"auto","initial","none",K]}],grow:[{grow:["",le,Y,K]}],shrink:[{shrink:["",le,Y,K]}],order:[{order:[St,"first","last","none",Y,K]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":se()}],"auto-rows":[{"auto-rows":se()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],w:[{w:[a,"screen",...O()]}],"min-w":[{"min-w":[a,"screen","none",...O()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,Vn,Lt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Y,yr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xr,K]}],"font-family":[{font:[a1,K,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Y,K]}],"line-clamp":[{"line-clamp":[le,"none",Y,yr]}],leading:[{leading:[i,...j()]}],"list-image":[{"list-image":["none",Y,K]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Y,K]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[le,"from-font","auto",Y,Lt]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[le,"auto",Y,K]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Y,K]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Y,K]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},St,Y,K],radial:["",Y,K],conic:[St,Y,K]},c1,i1]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[le,Y,K]}],"outline-w":[{outline:["",le,Vn,Lt]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",u,ls,as]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",h,ls,as]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[le,Lt]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",m,ls,as]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[le,Y,K]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[le]}],"mask-image-linear-from-pos":[{"mask-linear-from":N()}],"mask-image-linear-to-pos":[{"mask-linear-to":N()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":N()}],"mask-image-t-to-pos":[{"mask-t-to":N()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":N()}],"mask-image-r-to-pos":[{"mask-r-to":N()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":N()}],"mask-image-b-to-pos":[{"mask-b-to":N()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":N()}],"mask-image-l-to-pos":[{"mask-l-to":N()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":N()}],"mask-image-x-to-pos":[{"mask-x-to":N()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":N()}],"mask-image-y-to-pos":[{"mask-y-to":N()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":N()}],"mask-image-radial-to-pos":[{"mask-radial-to":N()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[le]}],"mask-image-conic-from-pos":[{"mask-conic-from":N()}],"mask-image-conic-to-pos":[{"mask-conic-to":N()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Y,K]}],filter:[{filter:["","none",Y,K]}],blur:[{blur:L()}],brightness:[{brightness:[le,Y,K]}],contrast:[{contrast:[le,Y,K]}],"drop-shadow":[{"drop-shadow":["","none",g,ls,as]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",le,Y,K]}],"hue-rotate":[{"hue-rotate":[le,Y,K]}],invert:[{invert:["",le,Y,K]}],saturate:[{saturate:[le,Y,K]}],sepia:[{sepia:["",le,Y,K]}],"backdrop-filter":[{"backdrop-filter":["","none",Y,K]}],"backdrop-blur":[{"backdrop-blur":L()}],"backdrop-brightness":[{"backdrop-brightness":[le,Y,K]}],"backdrop-contrast":[{"backdrop-contrast":[le,Y,K]}],"backdrop-grayscale":[{"backdrop-grayscale":["",le,Y,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[le,Y,K]}],"backdrop-invert":[{"backdrop-invert":["",le,Y,K]}],"backdrop-opacity":[{"backdrop-opacity":[le,Y,K]}],"backdrop-saturate":[{"backdrop-saturate":[le,Y,K]}],"backdrop-sepia":[{"backdrop-sepia":["",le,Y,K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Y,K]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[le,"initial",Y,K]}],ease:[{ease:["linear","initial",b,Y,K]}],delay:[{delay:[le,Y,K]}],animate:[{animate:["none",y,Y,K]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,Y,K]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:D()}],"scale-x":[{"scale-x":D()}],"scale-y":[{"scale-y":D()}],"scale-z":[{"scale-z":D()}],"scale-3d":["scale-3d"],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[Y,K,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Y,K]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Y,K]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[le,Vn,Lt,yr]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},h1=Kg(f1);function Q(...e){return h1(Vf.clsx(e))}function m1(e,t){return{id:e.streamInfo.id,timestamp:e.streamInfo.timestamp,message:e.text,from:e.participantInfo.identity===t.localParticipant.identity?t.localParticipant:Array.from(t.remoteParticipants.values()).find(n=>n.identity===e.participantInfo.identity)}}const p1=Ds.cva(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function g1({className:e,variant:t,...n}){return c.jsx("div",{"data-slot":"alert",role:"alert",className:Q(p1({variant:t}),e),...n})}function x1({className:e,...t}){return c.jsx("div",{"data-slot":"alert-title",className:Q("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function y1({className:e,...t}){return c.jsx("div",{"data-slot":"alert-description",className:Q("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function cs(e){return ud.custom(t=>c.jsx(v1,{id:t,title:e.title,description:e.description}),{duration:1e4})}function v1(e){const{title:t,id:n,description:s}=e;return c.jsxs(g1,{onClick:()=>ud.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[c.jsx(wd,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx(x1,{className:"text-base font-semibold text-white mb-1",children:t}),c.jsx(y1,{className:"text-sm text-gray-300 leading-snug",children:s})]})]})}function Ya(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rd(...e){return t=>{let n=!1;const s=e.map(r=>{const i=Ya(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():Ya(e[r],null)}}}}function Re(...e){return f.useCallback(Rd(...e),e)}function Wn(e){const t=w1(e),n=f.forwardRef((s,r)=>{const{children:i,...o}=s,a=f.Children.toArray(i),l=a.find(C1);if(l){const d=l.props.children,u=a.map(h=>h===l?f.Children.count(d)>1?f.Children.only(null):f.isValidElement(d)?d.props.children:null:h);return c.jsx(t,{...o,ref:r,children:f.isValidElement(d)?f.cloneElement(d,void 0,u):null})}return c.jsx(t,{...o,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}var b1=Wn("Slot");function w1(e){const t=f.forwardRef((n,s)=>{const{children:r,...i}=n;if(f.isValidElement(r)){const o=k1(r),a=E1(i,r.props);return r.type!==f.Fragment&&(a.ref=s?Rd(s,o):o),f.cloneElement(r,a)}return f.Children.count(r)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S1=Symbol("radix.slottable");function C1(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S1}function E1(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function k1(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const A1=Ds.cva(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function T1({className:e,variant:t,size:n,asChild:s=!1,...r}){const i=s?b1:"button";return c.jsx(i,{"data-slot":"button",className:Q(A1({variant:t,size:n,className:e})),...r})}function j1({onSend:e,className:t,disabled:n,...s}){const r=E.useRef(null),[i,o]=E.useState(""),a=d=>{var u,h;d.preventDefault(),(u=s.onSubmit)==null||u.call(s,d),e==null||e(i),o(""),(h=r.current)==null||h.focus({preventScroll:!0})},l=n||i.trim().length===0;return c.jsxs("form",{...s,onSubmit:a,className:Q("flex items-center rounded-md pl-1 text-sm",t),children:[c.jsx("input",{ref:r,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:i,onChange:d=>o(d.target.value),disabled:n}),c.jsx(T1,{size:"sm",type:"submit",variant:l?"secondary":"primary",disabled:l,className:"font-mono",children:"SEND"})]})}function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}var Ue=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},P1=f[" useInsertionEffect ".trim().toString()]||Ue;function ro({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=M1({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:r;{const u=f.useRef(e!==void 0);f.useEffect(()=>{const h=u.current;h!==a&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,s])}const d=f.useCallback(u=>{var h;if(a){const m=N1(u)?u(e):u;m!==e&&((h=o.current)==null||h.call(o,m))}else i(u)},[a,e,i,o]);return[l,d]}function M1({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),r=f.useRef(n),i=f.useRef(t);return P1(()=>{i.current=t},[t]),f.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function N1(e){return typeof e=="function"}var R1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=R1.reduce((e,t)=>{const n=Wn(`Primitive.${t}`),s=f.forwardRef((r,i)=>{const{asChild:o,...a}=r,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function V1(e,t){e&&Ls.flushSync(()=>e.dispatchEvent(t))}var Vd="Toggle",Id=f.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:r,...i}=e,[o,a]=ro({prop:n,onChange:r,defaultProp:s??!1,caller:Vd});return c.jsx(we.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:Ee(e.onClick,()=>{e.disabled||a(!o)})})});Id.displayName=Vd;var I1=Id;const D1=Ds.cva(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function Dd({className:e,variant:t,size:n,...s}){return c.jsx(I1,{"data-slot":"toggle",className:Q(D1({variant:t,size:n,className:e})),...s})}function L1(e){const[t,n]=E.useState(()=>e.getPublishPermissions());return E.useEffect(()=>{const s=()=>{n(e.getPublishPermissions())},r=()=>{s()};return e.on("connection.connected",r),e.on("connection.disconnected",r),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r)}},[e]),t}function F1(e){const[t,n]=E.useState(()=>e.getLocalParticipant()),[s,r]=E.useState(()=>e.getMicrophoneTrack());return E.useEffect(()=>{const i=()=>{const a=e.getLocalParticipant(),l=e.getMicrophoneTrack();console.log("🎤 useVoxketLocalParticipant: Updating state:",{hasParticipant:!!a,hasMicTrack:!!l,isMicEnabled:e.isMicrophoneEnabled,trackPublications:a?a.trackPublications.size:0}),n(a),r(l)};i(),e.on("connection.connected",i),e.on("connection.disconnected",i),e.on("track.muted",i),e.on("track.unmuted",i);const o=e.getRoom();if(o){const a=()=>{console.log("🎤 Track published, updating participant state"),i()},l=()=>{console.log("🎤 Track unpublished, updating participant state"),i()};return o.on("localTrackPublished",a),o.on("localTrackUnpublished",l),()=>{e.off("connection.connected",i),e.off("connection.disconnected",i),e.off("track.muted",i),e.off("track.unmuted",i),o.off("localTrackPublished",a),o.off("localTrackUnpublished",l)}}else return()=>{e.off("connection.connected",i),e.off("connection.disconnected",i),e.off("track.muted",i),e.off("track.unmuted",i)}},[e]),{localParticipant:t,microphoneTrack:s}}function vr(e,t,n){const[s,r]=E.useState(!1),[i,o]=E.useState(!1);return E.useEffect(()=>{const l=()=>{let d=!1;switch(t){case"microphone":d=e.isMicrophoneEnabled;break;case"camera":d=e.isCameraEnabled;break;case"screenShare":d=e.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${t} enabled state updated to:`,d),r(d)};return l(),e.on("track.muted",l),e.on("track.unmuted",l),e.on("connection.connected",l),()=>{e.off("track.muted",l),e.off("track.unmuted",l),e.off("connection.connected",l)}},[e,t]),{enabled:s,pending:i,toggle:async l=>{var d;try{o(!0);const u=l!==void 0?l:!s;switch(t){case"microphone":await e.toggleMicrophone(u);break;case"camera":await e.toggleCamera(u);break;case"screenShare":u?await e.startScreenShare():await e.stopScreenShare();break}}catch(u){(d=n==null?void 0:n.onDeviceError)==null||d.call(n,u)}finally{o(!1)}}}}function O1(e){const[t,n]=E.useState(()=>e.getRoom()),[s,r]=E.useState(()=>e.getConnectionState());return E.useEffect(()=>{const i=()=>{n(e.getRoom()),r(e.getConnectionState())};return e.on("connection.connected",i),e.on("connection.disconnected",i),e.on("connection.connecting",i),()=>{e.off("connection.connected",i),e.off("connection.disconnected",i),e.off("connection.connecting",i)}},[e]),t}function _1(e,t){const[n,s]=E.useState([]),[r,i]=E.useState("");return E.useEffect(()=>{var d;const a=async()=>{try{const u=t==="audioinput"?await e.getAudioInputDevices():await e.getVideoInputDevices();s(u)}catch(u){console.error("Failed to load devices:",u)}};a();const l=()=>{a()};return(d=navigator.mediaDevices)==null||d.addEventListener("devicechange",l),()=>{var u;(u=navigator.mediaDevices)==null||u.removeEventListener("devicechange",l)}},[e,t]),{devices:n,activeDeviceId:r,setActiveMediaDevice:async a=>{try{t==="audioinput"?await e.setAudioInputDevice(a):await e.setVideoInputDevice(a),i(a)}catch(l){console.error("Failed to set device:",l)}}}}function $1(e){const{preventSave:t=!1}=e||{};return{saveAudioInputEnabled:o=>{t||localStorage.setItem("voxket-audio-input-enabled",o.toString())},saveAudioInputDeviceId:o=>{t||localStorage.setItem("voxket-audio-input-device-id",o)},saveVideoInputEnabled:o=>{t||localStorage.setItem("voxket-video-input-enabled",o.toString())},saveVideoInputDeviceId:o=>{t||localStorage.setItem("voxket-video-input-device-id",o)}}}function Ga(e,[t,n]){return Math.min(n,Math.max(t,e))}function ni(e,t=[]){let n=[];function s(i,o){const a=f.createContext(o),l=n.length;n=[...n,o];const d=h=>{var b;const{scope:m,children:g,...x}=h,p=((b=m==null?void 0:m[e])==null?void 0:b[l])||a,v=f.useMemo(()=>x,Object.values(x));return c.jsx(p.Provider,{value:v,children:g})};d.displayName=i+"Provider";function u(h,m){var p;const g=((p=m==null?void 0:m[e])==null?void 0:p[l])||a,x=f.useContext(g);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[d,u]}const r=()=>{const i=n.map(o=>f.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[s,B1(r,...t)]}function B1(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const o=s.reduce((a,{useScope:l,scopeName:d})=>{const h=l(i)[`__scope${d}`];return{...a,...h}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function H1(e){const t=e+"CollectionProvider",[n,s]=ni(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:v,children:b}=p,y=E.useRef(null),w=E.useRef(new Map).current;return c.jsx(r,{scope:v,itemMap:w,collectionRef:y,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=Wn(a),d=E.forwardRef((p,v)=>{const{scope:b,children:y}=p,w=i(a,b),S=Re(v,w.collectionRef);return c.jsx(l,{ref:S,children:y})});d.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",m=Wn(u),g=E.forwardRef((p,v)=>{const{scope:b,children:y,...w}=p,S=E.useRef(null),k=Re(v,S),T=i(u,b);return E.useEffect(()=>(T.itemMap.set(S,{ref:S,...w}),()=>void T.itemMap.delete(S))),c.jsx(m,{[h]:"",ref:k,children:y})});g.displayName=u;function x(p){const v=i(e+"CollectionConsumer",p);return E.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((T,A)=>w.indexOf(T.ref.current)-w.indexOf(A.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:d,ItemSlot:g},x,s]}var U1=f.createContext(void 0);function z1(e){const t=f.useContext(U1);return e||t||"ltr"}function Ut(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function Z1(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e);f.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var W1="DismissableLayer",oo="dismissableLayer.update",K1="dismissableLayer.pointerDownOutside",Y1="dismissableLayer.focusOutside",Xa,Ld=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Fd=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:o,onDismiss:a,...l}=e,d=f.useContext(Ld),[u,h]=f.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=f.useState({}),x=Re(t,A=>h(A)),p=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=p.indexOf(v),y=u?p.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,S=y>=b,k=q1(A=>{const j=A.target,V=[...d.branches].some(I=>I.contains(j));!S||V||(r==null||r(A),o==null||o(A),A.defaultPrevented||a==null||a())},m),T=J1(A=>{const j=A.target;[...d.branches].some(I=>I.contains(j))||(i==null||i(A),o==null||o(A),A.defaultPrevented||a==null||a())},m);return Z1(A=>{y===d.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&a&&(A.preventDefault(),a()))},m),f.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Xa=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),qa(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Xa)}},[u,m,n,d]),f.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),qa())},[u,d]),f.useEffect(()=>{const A=()=>g({});return document.addEventListener(oo,A),()=>document.removeEventListener(oo,A)},[]),c.jsx(we.div,{...l,ref:x,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,k.onPointerDownCapture)})});Fd.displayName=W1;var G1="DismissableLayerBranch",X1=f.forwardRef((e,t)=>{const n=f.useContext(Ld),s=f.useRef(null),r=Re(t,s);return f.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(we.div,{...e,ref:r})});X1.displayName=G1;function q1(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),s=f.useRef(!1),r=f.useRef(()=>{});return f.useEffect(()=>{const i=a=>{if(a.target&&!s.current){let l=function(){Od(K1,n,d,{discrete:!0})};const d={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function J1(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),s=f.useRef(!1);return f.useEffect(()=>{const r=i=>{i.target&&!s.current&&Od(Y1,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function qa(){const e=new CustomEvent(oo);document.dispatchEvent(e)}function Od(e,t,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?V1(r,i):r.dispatchEvent(i)}var br=0;function Q1(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ja()),document.body.insertAdjacentElement("beforeend",e[1]??Ja()),br++,()=>{br===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),br--}},[])}function Ja(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var wr="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",Qa={bubbles:!1,cancelable:!0},ex="FocusScope",_d=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,l]=f.useState(null),d=Ut(r),u=Ut(i),h=f.useRef(null),m=Re(t,p=>l(p)),g=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let p=function(w){if(g.paused||!a)return;const S=w.target;a.contains(S)?h.current=S:Et(h.current,{select:!0})},v=function(w){if(g.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||Et(h.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const k of w)k.removedNodes.length>0&&Et(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const y=new MutationObserver(b);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),y.disconnect()}}},[s,a,g.paused]),f.useEffect(()=>{if(a){tl.add(g);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(wr,Qa);a.addEventListener(wr,d),a.dispatchEvent(b),b.defaultPrevented||(tx(ix($d(a)),{select:!0}),document.activeElement===p&&Et(a))}return()=>{a.removeEventListener(wr,d),setTimeout(()=>{const b=new CustomEvent(Sr,Qa);a.addEventListener(Sr,u),a.dispatchEvent(b),b.defaultPrevented||Et(p??document.body,{select:!0}),a.removeEventListener(Sr,u),tl.remove(g)},0)}}},[a,d,u,g]);const x=f.useCallback(p=>{if(!n&&!s||g.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(v&&b){const y=p.currentTarget,[w,S]=nx(y);w&&S?!p.shiftKey&&b===S?(p.preventDefault(),n&&Et(w,{select:!0})):p.shiftKey&&b===w&&(p.preventDefault(),n&&Et(S,{select:!0})):b===y&&p.preventDefault()}},[n,s,g.paused]);return c.jsx(we.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});_d.displayName=ex;function tx(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Et(s,{select:t}),document.activeElement!==n)return}function nx(e){const t=$d(e),n=el(t,e),s=el(t.reverse(),e);return[n,s]}function $d(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function el(e,t){for(const n of e)if(!sx(n,{upTo:t}))return n}function sx(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rx(e){return e instanceof HTMLInputElement&&"select"in e}function Et(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rx(e)&&t&&e.select()}}var tl=ox();function ox(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=nl(e,t),e.unshift(t)},remove(t){var n;e=nl(e,t),(n=e[0])==null||n.resume()}}}function nl(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function ix(e){return e.filter(t=>t.tagName!=="A")}var ax=f[" useId ".trim().toString()]||(()=>{}),lx=0;function si(e){const[t,n]=f.useState(ax());return Ue(()=>{n(s=>s??String(lx++))},[e]),e||(t?`radix-${t}`:"")}const cx=["top","right","bottom","left"],Tt=Math.min,ze=Math.max,Ms=Math.round,ds=Math.floor,dt=e=>({x:e,y:e}),dx={left:"right",right:"left",bottom:"top",top:"bottom"},ux={start:"end",end:"start"};function io(e,t,n){return ze(e,Tt(t,n))}function bt(e,t){return typeof e=="function"?e(t):e}function wt(e){return e.split("-")[0]}function En(e){return e.split("-")[1]}function ri(e){return e==="x"?"y":"x"}function oi(e){return e==="y"?"height":"width"}const fx=new Set(["top","bottom"]);function at(e){return fx.has(wt(e))?"y":"x"}function ii(e){return ri(at(e))}function hx(e,t,n){n===void 0&&(n=!1);const s=En(e),r=ii(e),i=oi(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Ns(o)),[o,Ns(o)]}function mx(e){const t=Ns(e);return[ao(e),t,ao(t)]}function ao(e){return e.replace(/start|end/g,t=>ux[t])}const sl=["left","right"],rl=["right","left"],px=["top","bottom"],gx=["bottom","top"];function xx(e,t,n){switch(e){case"top":case"bottom":return n?t?rl:sl:t?sl:rl;case"left":case"right":return t?px:gx;default:return[]}}function yx(e,t,n,s){const r=En(e);let i=xx(wt(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(ao)))),i}function Ns(e){return e.replace(/left|right|bottom|top/g,t=>dx[t])}function vx(e){return{top:0,right:0,bottom:0,left:0,...e}}function Bd(e){return typeof e!="number"?vx(e):{top:e,right:e,bottom:e,left:e}}function Rs(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function ol(e,t,n){let{reference:s,floating:r}=e;const i=at(t),o=ii(t),a=oi(o),l=wt(t),d=i==="y",u=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,m=s[a]/2-r[a]/2;let g;switch(l){case"top":g={x:u,y:s.y-r.height};break;case"bottom":g={x:u,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:h};break;case"left":g={x:s.x-r.width,y:h};break;default:g={x:s.x,y:s.y}}switch(En(t)){case"start":g[o]-=m*(n&&d?-1:1);break;case"end":g[o]+=m*(n&&d?-1:1);break}return g}const bx=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:h}=ol(d,s,l),m=s,g={},x=0;for(let p=0;p<a.length;p++){const{name:v,fn:b}=a[p],{x:y,y:w,data:S,reset:k}=await b({x:u,y:h,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:d,platform:o,elements:{reference:e,floating:t}});u=y??u,h=w??h,g={...g,[v]:{...g[v],...S}},k&&x<=50&&(x++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(d=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:u,y:h}=ol(d,m,l)),p=-1)}return{x:u,y:h,placement:m,strategy:r,middlewareData:g}};async function Kn(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:g=0}=bt(t,e),x=Bd(g),v=a[m?h==="floating"?"reference":"floating":h],b=Rs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),y=h==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},k=Rs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(b.top-k.top+x.top)/S.y,bottom:(k.bottom-b.bottom+x.bottom)/S.y,left:(b.left-k.left+x.left)/S.x,right:(k.right-b.right+x.right)/S.x}}const wx=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:u=0}=bt(e,t)||{};if(d==null)return{};const h=Bd(u),m={x:n,y:s},g=ii(r),x=oi(g),p=await o.getDimensions(d),v=g==="y",b=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",S=i.reference[x]+i.reference[g]-m[g]-i.floating[x],k=m[g]-i.reference[g],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let A=T?T[w]:0;(!A||!await(o.isElement==null?void 0:o.isElement(T)))&&(A=a.floating[w]||i.floating[x]);const j=S/2-k/2,V=A/2-p[x]/2-1,I=Tt(h[b],V),$=Tt(h[y],V),F=I,se=A-p[x]-$,Z=A/2-p[x]/2+j,ee=io(F,Z,se),G=!l.arrow&&En(r)!=null&&Z!==ee&&i.reference[x]/2-(Z<F?I:$)-p[x]/2<0,O=G?Z<F?Z-F:Z-se:0;return{[g]:m[g]+O,data:{[g]:ee,centerOffset:Z-ee-O,...G&&{alignmentOffset:O}},reset:G}}}),Sx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:p=!0,...v}=bt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=wt(r),y=at(a),w=wt(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(d.floating)),k=m||(w||!p?[Ns(a)]:mx(a)),T=x!=="none";!m&&T&&k.push(...yx(a,p,x,S));const A=[a,...k],j=await Kn(t,v),V=[];let I=((s=i.flip)==null?void 0:s.overflows)||[];if(u&&V.push(j[b]),h){const Z=hx(r,o,S);V.push(j[Z[0]],j[Z[1]])}if(I=[...I,{placement:r,overflows:V}],!V.every(Z=>Z<=0)){var $,F;const Z=((($=i.flip)==null?void 0:$.index)||0)+1,ee=A[Z];if(ee&&(!(h==="alignment"?y!==at(ee):!1)||I.every(P=>P.overflows[0]>0&&at(P.placement)===y)))return{data:{index:Z,overflows:I},reset:{placement:ee}};let G=(F=I.filter(O=>O.overflows[0]<=0).sort((O,P)=>O.overflows[1]-P.overflows[1])[0])==null?void 0:F.placement;if(!G)switch(g){case"bestFit":{var se;const O=(se=I.filter(P=>{if(T){const B=at(P.placement);return B===y||B==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(B=>B>0).reduce((B,X)=>B+X,0)]).sort((P,B)=>P[1]-B[1])[0])==null?void 0:se[0];O&&(G=O);break}case"initialPlacement":G=a;break}if(r!==G)return{reset:{placement:G}}}return{}}}};function il(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function al(e){return cx.some(t=>e[t]>=0)}const Cx=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...r}=bt(e,t);switch(s){case"referenceHidden":{const i=await Kn(t,{...r,elementContext:"reference"}),o=il(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:al(o)}}}case"escaped":{const i=await Kn(t,{...r,altBoundary:!0}),o=il(i,n.floating);return{data:{escapedOffsets:o,escaped:al(o)}}}default:return{}}}}},Hd=new Set(["left","top"]);async function Ex(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=wt(n),a=En(n),l=at(n)==="y",d=Hd.has(o)?-1:1,u=i&&l?-1:1,h=bt(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof x=="number"&&(g=a==="end"?x*-1:x),l?{x:g*u,y:m*d}:{x:m*d,y:g*u}}const kx=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:i,placement:o,middlewareData:a}=t,l=await Ex(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:o}}}}},Ax=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:v=>{let{x:b,y}=v;return{x:b,y}}},...l}=bt(e,t),d={x:n,y:s},u=await Kn(t,l),h=at(wt(r)),m=ri(h);let g=d[m],x=d[h];if(i){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",y=g+u[v],w=g-u[b];g=io(y,g,w)}if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=x+u[v],w=x-u[b];x=io(y,x,w)}const p=a.fn({...t,[m]:g,[h]:x});return{...p,data:{x:p.x-n,y:p.y-s,enabled:{[m]:i,[h]:o}}}}}},Tx=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=bt(e,t),u={x:n,y:s},h=at(r),m=ri(h);let g=u[m],x=u[h];const p=bt(a,t),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const w=m==="y"?"height":"width",S=i.reference[m]-i.floating[w]+v.mainAxis,k=i.reference[m]+i.reference[w]-v.mainAxis;g<S?g=S:g>k&&(g=k)}if(d){var b,y;const w=m==="y"?"width":"height",S=Hd.has(wt(r)),k=i.reference[h]-i.floating[w]+(S&&((b=o.offset)==null?void 0:b[h])||0)+(S?0:v.crossAxis),T=i.reference[h]+i.reference[w]+(S?0:((y=o.offset)==null?void 0:y[h])||0)-(S?v.crossAxis:0);x<k?x=k:x>T&&(x=T)}return{[m]:g,[h]:x}}}},jx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:r,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=bt(e,t),u=await Kn(t,d),h=wt(r),m=En(r),g=at(r)==="y",{width:x,height:p}=i.floating;let v,b;h==="top"||h==="bottom"?(v=h,b=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=h,v=m==="end"?"top":"bottom");const y=p-u.top-u.bottom,w=x-u.left-u.right,S=Tt(p-u[v],y),k=Tt(x-u[b],w),T=!t.middlewareData.shift;let A=S,j=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(A=y),T&&!m){const I=ze(u.left,0),$=ze(u.right,0),F=ze(u.top,0),se=ze(u.bottom,0);g?j=x-2*(I!==0||$!==0?I+$:ze(u.left,u.right)):A=p-2*(F!==0||se!==0?F+se:ze(u.top,u.bottom))}await l({...t,availableWidth:j,availableHeight:A});const V=await o.getDimensions(a.floating);return x!==V.width||p!==V.height?{reset:{rects:!0}}:{}}}};function Bs(){return typeof window<"u"}function kn(e){return Ud(e)?(e.nodeName||"").toLowerCase():"#document"}function Ze(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ft(e){var t;return(t=(Ud(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ud(e){return Bs()?e instanceof Node||e instanceof Ze(e).Node:!1}function tt(e){return Bs()?e instanceof Element||e instanceof Ze(e).Element:!1}function ut(e){return Bs()?e instanceof HTMLElement||e instanceof Ze(e).HTMLElement:!1}function ll(e){return!Bs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ze(e).ShadowRoot}const Px=new Set(["inline","contents"]);function Qn(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=nt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!Px.has(r)}const Mx=new Set(["table","td","th"]);function Nx(e){return Mx.has(kn(e))}const Rx=[":popover-open",":modal"];function Hs(e){return Rx.some(t=>{try{return e.matches(t)}catch{return!1}})}const Vx=["transform","translate","scale","rotate","perspective"],Ix=["transform","translate","scale","rotate","perspective","filter"],Dx=["paint","layout","strict","content"];function ai(e){const t=li(),n=tt(e)?nt(e):e;return Vx.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Ix.some(s=>(n.willChange||"").includes(s))||Dx.some(s=>(n.contain||"").includes(s))}function Lx(e){let t=jt(e);for(;ut(t)&&!gn(t);){if(ai(t))return t;if(Hs(t))return null;t=jt(t)}return null}function li(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Fx=new Set(["html","body","#document"]);function gn(e){return Fx.has(kn(e))}function nt(e){return Ze(e).getComputedStyle(e)}function Us(e){return tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jt(e){if(kn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ll(e)&&e.host||ft(e);return ll(t)?t.host:t}function zd(e){const t=jt(e);return gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:ut(t)&&Qn(t)?t:zd(t)}function Yn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=zd(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=Ze(r);if(i){const a=lo(o);return t.concat(o,o.visualViewport||[],Qn(r)?r:[],a&&n?Yn(a):[])}return t.concat(r,Yn(r,[],n))}function lo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zd(e){const t=nt(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=ut(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=Ms(n)!==i||Ms(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function ci(e){return tt(e)?e:e.contextElement}function fn(e){const t=ci(e);if(!ut(t))return dt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=Zd(t);let o=(i?Ms(n.width):n.width)/s,a=(i?Ms(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ox=dt(0);function Wd(e){const t=Ze(e);return!li()||!t.visualViewport?Ox:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _x(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ze(e)?!1:t}function zt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=ci(e);let o=dt(1);t&&(s?tt(s)&&(o=fn(s)):o=fn(e));const a=_x(i,n,s)?Wd(i):dt(0);let l=(r.left+a.x)/o.x,d=(r.top+a.y)/o.y,u=r.width/o.x,h=r.height/o.y;if(i){const m=Ze(i),g=s&&tt(s)?Ze(s):s;let x=m,p=lo(x);for(;p&&s&&g!==x;){const v=fn(p),b=p.getBoundingClientRect(),y=nt(p),w=b.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,S=b.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;l*=v.x,d*=v.y,u*=v.x,h*=v.y,l+=w,d+=S,x=Ze(p),p=lo(x)}}return Rs({width:u,height:h,x:l,y:d})}function di(e,t){const n=Us(e).scrollLeft;return t?t.left+n:zt(ft(e)).left+n}function Kd(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:di(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function $x(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=ft(s),a=t?Hs(t.floating):!1;if(s===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=dt(1);const u=dt(0),h=ut(s);if((h||!h&&!i)&&((kn(s)!=="body"||Qn(o))&&(l=Us(s)),ut(s))){const g=zt(s);d=fn(s),u.x=g.x+s.clientLeft,u.y=g.y+s.clientTop}const m=o&&!h&&!i?Kd(o,l,!0):dt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-l.scrollTop*d.y+u.y+m.y}}function Bx(e){return Array.from(e.getClientRects())}function Hx(e){const t=ft(e),n=Us(e),s=e.ownerDocument.body,r=ze(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=ze(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+di(e);const a=-n.scrollTop;return nt(s).direction==="rtl"&&(o+=ze(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:o,y:a}}function Ux(e,t){const n=Ze(e),s=ft(e),r=n.visualViewport;let i=s.clientWidth,o=s.clientHeight,a=0,l=0;if(r){i=r.width,o=r.height;const d=li();(!d||d&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:i,height:o,x:a,y:l}}const zx=new Set(["absolute","fixed"]);function Zx(e,t){const n=zt(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=ut(e)?fn(e):dt(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=r*i.x,d=s*i.y;return{width:o,height:a,x:l,y:d}}function cl(e,t,n){let s;if(t==="viewport")s=Ux(e,n);else if(t==="document")s=Hx(ft(e));else if(tt(t))s=Zx(t,n);else{const r=Wd(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Rs(s)}function Yd(e,t){const n=jt(e);return n===t||!tt(n)||gn(n)?!1:nt(n).position==="fixed"||Yd(n,t)}function Wx(e,t){const n=t.get(e);if(n)return n;let s=Yn(e,[],!1).filter(a=>tt(a)&&kn(a)!=="body"),r=null;const i=nt(e).position==="fixed";let o=i?jt(e):e;for(;tt(o)&&!gn(o);){const a=nt(o),l=ai(o);!l&&a.position==="fixed"&&(r=null),(i?!l&&!r:!l&&a.position==="static"&&!!r&&zx.has(r.position)||Qn(o)&&!l&&Yd(e,o))?s=s.filter(u=>u!==o):r=a,o=jt(o)}return t.set(e,s),s}function Kx(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?Hs(t)?[]:Wx(t,this._c):[].concat(n),s],a=o[0],l=o.reduce((d,u)=>{const h=cl(t,u,r);return d.top=ze(h.top,d.top),d.right=Tt(h.right,d.right),d.bottom=Tt(h.bottom,d.bottom),d.left=ze(h.left,d.left),d},cl(t,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Yx(e){const{width:t,height:n}=Zd(e);return{width:t,height:n}}function Gx(e,t,n){const s=ut(t),r=ft(t),i=n==="fixed",o=zt(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=dt(0);function d(){l.x=di(r)}if(s||!s&&!i)if((kn(t)!=="body"||Qn(r))&&(a=Us(t)),s){const g=zt(t,!0,i,t);l.x=g.x+t.clientLeft,l.y=g.y+t.clientTop}else r&&d();i&&!s&&r&&d();const u=r&&!s&&!i?Kd(r,a):dt(0),h=o.left+a.scrollLeft-l.x-u.x,m=o.top+a.scrollTop-l.y-u.y;return{x:h,y:m,width:o.width,height:o.height}}function Cr(e){return nt(e).position==="static"}function dl(e,t){if(!ut(e)||nt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ft(e)===n&&(n=n.ownerDocument.body),n}function Gd(e,t){const n=Ze(e);if(Hs(e))return n;if(!ut(e)){let r=jt(e);for(;r&&!gn(r);){if(tt(r)&&!Cr(r))return r;r=jt(r)}return n}let s=dl(e,t);for(;s&&Nx(s)&&Cr(s);)s=dl(s,t);return s&&gn(s)&&Cr(s)&&!ai(s)?n:s||Lx(e)||n}const Xx=async function(e){const t=this.getOffsetParent||Gd,n=this.getDimensions,s=await n(e.floating);return{reference:Gx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function qx(e){return nt(e).direction==="rtl"}const Jx={convertOffsetParentRelativeRectToViewportRelativeRect:$x,getDocumentElement:ft,getClippingRect:Kx,getOffsetParent:Gd,getElementRects:Xx,getClientRects:Bx,getDimensions:Yx,getScale:fn,isElement:tt,isRTL:qx};function Xd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qx(e,t){let n=null,s;const r=ft(e);function i(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const d=e.getBoundingClientRect(),{left:u,top:h,width:m,height:g}=d;if(a||t(),!m||!g)return;const x=ds(h),p=ds(r.clientWidth-(u+m)),v=ds(r.clientHeight-(h+g)),b=ds(u),w={rootMargin:-x+"px "+-p+"px "+-v+"px "+-b+"px",threshold:ze(0,Tt(1,l))||1};let S=!0;function k(T){const A=T[0].intersectionRatio;if(A!==l){if(!S)return o();A?o(!1,A):s=setTimeout(()=>{o(!1,1e-7)},1e3)}A===1&&!Xd(d,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(k,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return o(!0),i}function ey(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,d=ci(e),u=r||i?[...d?Yn(d):[],...Yn(t)]:[];u.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const h=d&&a?Qx(d,n):null;let m=-1,g=null;o&&(g=new ResizeObserver(b=>{let[y]=b;y&&y.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=g)==null||w.observe(t)})),n()}),d&&!l&&g.observe(d),g.observe(t));let x,p=l?zt(e):null;l&&v();function v(){const b=zt(e);p&&!Xd(p,b)&&n(),p=b,x=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(y=>{r&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),h==null||h(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(x)}}const ty=kx,ny=Ax,sy=Sx,ry=jx,oy=Cx,ul=wx,iy=Tx,ay=(e,t,n)=>{const s=new Map,r={platform:Jx,...n},i={...r.platform,_c:s};return bx(e,t,{...r,platform:i})};var ly=typeof document<"u",cy=function(){},bs=ly?E.useLayoutEffect:cy;function Vs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Vs(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!Vs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function qd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fl(e,t){const n=qd(e);return Math.round(t*n)/n}function Er(e){const t=f.useRef(e);return bs(()=>{t.current=e}),t}function dy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[u,h]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=f.useState(s);Vs(m,s)||g(s);const[x,p]=f.useState(null),[v,b]=f.useState(null),y=f.useCallback(P=>{P!==T.current&&(T.current=P,p(P))},[]),w=f.useCallback(P=>{P!==A.current&&(A.current=P,b(P))},[]),S=i||x,k=o||v,T=f.useRef(null),A=f.useRef(null),j=f.useRef(u),V=l!=null,I=Er(l),$=Er(r),F=Er(d),se=f.useCallback(()=>{if(!T.current||!A.current)return;const P={placement:t,strategy:n,middleware:m};$.current&&(P.platform=$.current),ay(T.current,A.current,P).then(B=>{const X={...B,isPositioned:F.current!==!1};Z.current&&!Vs(j.current,X)&&(j.current=X,Ls.flushSync(()=>{h(X)}))})},[m,t,n,$,F]);bs(()=>{d===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,h(P=>({...P,isPositioned:!1})))},[d]);const Z=f.useRef(!1);bs(()=>(Z.current=!0,()=>{Z.current=!1}),[]),bs(()=>{if(S&&(T.current=S),k&&(A.current=k),S&&k){if(I.current)return I.current(S,k,se);se()}},[S,k,se,I,V]);const ee=f.useMemo(()=>({reference:T,floating:A,setReference:y,setFloating:w}),[y,w]),G=f.useMemo(()=>({reference:S,floating:k}),[S,k]),O=f.useMemo(()=>{const P={position:n,left:0,top:0};if(!G.floating)return P;const B=fl(G.floating,u.x),X=fl(G.floating,u.y);return a?{...P,transform:"translate("+B+"px, "+X+"px)",...qd(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:X}},[n,a,G.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:se,refs:ee,elements:G,floatingStyles:O}),[u,se,ee,G,O])}const uy=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:r}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ul({element:s.current,padding:r}).fn(n):{}:s?ul({element:s,padding:r}).fn(n):{}}}},fy=(e,t)=>({...ty(e),options:[e,t]}),hy=(e,t)=>({...ny(e),options:[e,t]}),my=(e,t)=>({...iy(e),options:[e,t]}),py=(e,t)=>({...sy(e),options:[e,t]}),gy=(e,t)=>({...ry(e),options:[e,t]}),xy=(e,t)=>({...oy(e),options:[e,t]}),yy=(e,t)=>({...uy(e),options:[e,t]});var vy="Arrow",Jd=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return c.jsx(we.svg,{...i,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Jd.displayName=vy;var by=Jd;function wy(e){const[t,n]=f.useState(void 0);return Ue(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,d=Array.isArray(l)?l[0]:l;o=d.inlineSize,a=d.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var ui="Popper",[Qd,eu]=ni(ui),[Sy,tu]=Qd(ui),nu=e=>{const{__scopePopper:t,children:n}=e,[s,r]=f.useState(null);return c.jsx(Sy,{scope:t,anchor:s,onAnchorChange:r,children:n})};nu.displayName=ui;var su="PopperAnchor",ru=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=tu(su,n),o=f.useRef(null),a=Re(t,o);return f.useEffect(()=>{i.onAnchorChange((s==null?void 0:s.current)||o.current)}),s?null:c.jsx(we.div,{...r,ref:a})});ru.displayName=su;var fi="PopperContent",[Cy,Ey]=Qd(fi),ou=f.forwardRef((e,t)=>{var N,L,W,D,ne,te;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:x,...p}=e,v=tu(fi,n),[b,y]=f.useState(null),w=Re(t,de=>y(de)),[S,k]=f.useState(null),T=wy(S),A=(T==null?void 0:T.width)??0,j=(T==null?void 0:T.height)??0,V=s+(i!=="center"?"-"+i:""),I=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},$=Array.isArray(d)?d:[d],F=$.length>0,se={padding:I,boundary:$.filter(Ay),altBoundary:F},{refs:Z,floatingStyles:ee,placement:G,isPositioned:O,middlewareData:P}=dy({strategy:"fixed",placement:V,whileElementsMounted:(...de)=>ey(...de,{animationFrame:g==="always"}),elements:{reference:v.anchor},middleware:[fy({mainAxis:r+j,alignmentAxis:o}),l&&hy({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?my():void 0,...se}),l&&py({...se}),gy({...se,apply:({elements:de,rects:me,availableWidth:Ae,availableHeight:De})=>{const{width:rt,height:ot}=me.reference,Fe=de.floating.style;Fe.setProperty("--radix-popper-available-width",`${Ae}px`),Fe.setProperty("--radix-popper-available-height",`${De}px`),Fe.setProperty("--radix-popper-anchor-width",`${rt}px`),Fe.setProperty("--radix-popper-anchor-height",`${ot}px`)}}),S&&yy({element:S,padding:a}),Ty({arrowWidth:A,arrowHeight:j}),m&&xy({strategy:"referenceHidden",...se})]}),[B,X]=lu(G),_=Ut(x);Ue(()=>{O&&(_==null||_())},[O,_]);const re=(N=P.arrow)==null?void 0:N.x,M=(L=P.arrow)==null?void 0:L.y,H=((W=P.arrow)==null?void 0:W.centerOffset)!==0,[q,U]=f.useState();return Ue(()=>{b&&U(window.getComputedStyle(b).zIndex)},[b]),c.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:O?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(D=P.transformOrigin)==null?void 0:D.x,(ne=P.transformOrigin)==null?void 0:ne.y].join(" "),...((te=P.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Cy,{scope:n,placedSide:B,onArrowChange:k,arrowX:re,arrowY:M,shouldHideArrow:H,children:c.jsx(we.div,{"data-side":B,"data-align":X,...p,ref:w,style:{...p.style,animation:O?void 0:"none"}})})})});ou.displayName=fi;var iu="PopperArrow",ky={top:"bottom",right:"left",bottom:"top",left:"right"},au=f.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=Ey(iu,s),o=ky[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(by,{...r,ref:n,style:{...r.style,display:"block"}})})});au.displayName=iu;function Ay(e){return e!==null}var Ty=e=>({name:"transformOrigin",options:e,fn(t){var v,b,y;const{placement:n,rects:s,middlewareData:r}=t,o=((v=r.arrow)==null?void 0:v.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,u]=lu(n),h={start:"0%",center:"50%",end:"100%"}[u],m=(((b=r.arrow)==null?void 0:b.x)??0)+a/2,g=(((y=r.arrow)==null?void 0:y.y)??0)+l/2;let x="",p="";return d==="bottom"?(x=o?h:`${m}px`,p=`${-l}px`):d==="top"?(x=o?h:`${m}px`,p=`${s.floating.height+l}px`):d==="right"?(x=`${-l}px`,p=o?h:`${g}px`):d==="left"&&(x=`${s.floating.width+l}px`,p=o?h:`${g}px`),{data:{x,y:p}}}});function lu(e){const[t,n="center"]=e.split("-");return[t,n]}var jy=nu,Py=ru,My=ou,Ny=au,Ry="Portal",cu=f.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=f.useState(!1);Ue(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?yo.createPortal(c.jsx(we.div,{...s,ref:t}),o):null});cu.displayName=Ry;function Vy(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var du=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Iy="VisuallyHidden",Dy=f.forwardRef((e,t)=>c.jsx(we.span,{...e,ref:t,style:{...du,...e.style}}));Dy.displayName=Iy;var Ly=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Jt=new WeakMap,us=new WeakMap,fs={},kr=0,uu=function(e){return e&&(e.host||uu(e.parentNode))},Fy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=uu(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Oy=function(e,t,n,s){var r=Fy(t,Array.isArray(e)?e:[e]);fs[n]||(fs[n]=new WeakMap);var i=fs[n],o=[],a=new Set,l=new Set(r),d=function(h){!h||a.has(h)||(a.add(h),d(h.parentNode))};r.forEach(d);var u=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(m){if(a.has(m))u(m);else try{var g=m.getAttribute(s),x=g!==null&&g!=="false",p=(Jt.get(m)||0)+1,v=(i.get(m)||0)+1;Jt.set(m,p),i.set(m,v),o.push(m),p===1&&x&&us.set(m,!0),v===1&&m.setAttribute(n,"true"),x||m.setAttribute(s,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),a.clear(),kr++,function(){o.forEach(function(h){var m=Jt.get(h)-1,g=i.get(h)-1;Jt.set(h,m),i.set(h,g),m||(us.has(h)||h.removeAttribute(s),us.delete(h)),g||h.removeAttribute(n)}),kr--,kr||(Jt=new WeakMap,Jt=new WeakMap,us=new WeakMap,fs={})}},_y=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=Ly(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),Oy(s,r,n,"aria-hidden")):function(){return null}},it=function(){return it=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},it.apply(this,arguments)};function fu(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function $y(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,i;s<r;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var ws="right-scroll-bar-position",Ss="width-before-scroll-bar",By="with-scroll-bars-hidden",Hy="--removed-body-scroll-bar-size";function Ar(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Uy(e,t){var n=E.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var zy=typeof window<"u"?f.useLayoutEffect:f.useEffect,hl=new WeakMap;function Zy(e,t){var n=Uy(null,function(s){return e.forEach(function(r){return Ar(r,s)})});return zy(function(){var s=hl.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||Ar(a,null)}),i.forEach(function(a){r.has(a)||Ar(a,o)})}hl.set(n,e)},[e]),n}function Wy(e){return e}function Ky(e,t){t===void 0&&(t=Wy);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,s);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return r}function Yy(e){e===void 0&&(e={});var t=Ky(null);return t.options=it({async:!0,ssr:!1},e),t}var hu=function(e){var t=e.sideCar,n=fu(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return f.createElement(s,it({},n))};hu.isSideCarExport=!0;function Gy(e,t){return e.useMedium(t),hu}var mu=Yy(),Tr=function(){},zs=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:Tr,onWheelCapture:Tr,onTouchMoveCapture:Tr}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,h=e.shards,m=e.sideCar,g=e.noRelative,x=e.noIsolation,p=e.inert,v=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,w=e.gapMode,S=fu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=m,T=Zy([n,t]),A=it(it({},S),r);return f.createElement(f.Fragment,null,u&&f.createElement(k,{sideCar:mu,removeScrollBar:d,shards:h,noRelative:g,noIsolation:x,inert:p,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),o?f.cloneElement(f.Children.only(a),it(it({},A),{ref:T})):f.createElement(y,it({},A,{className:l,ref:T}),a))});zs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};zs.classNames={fullWidth:Ss,zeroRight:ws};var Xy=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qy(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Xy();return t&&e.setAttribute("nonce",t),e}function Jy(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Qy(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ev=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qy())&&(Jy(t,n),Qy(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tv=function(){var e=ev();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pu=function(){var e=tv(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},nv={left:0,top:0,right:0,gap:0},jr=function(e){return parseInt(e||"",10)||0},sv=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[jr(n),jr(s),jr(r)]},rv=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return nv;var t=sv(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},ov=pu(),hn="data-scroll-locked",iv=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
39
|
+
.`.concat(By,` {
|
|
40
|
+
overflow: hidden `).concat(s,`;
|
|
41
|
+
padding-right: `).concat(a,"px ").concat(s,`;
|
|
52
42
|
}
|
|
53
|
-
body[`).concat(
|
|
54
|
-
overflow: hidden `).concat(
|
|
43
|
+
body[`).concat(hn,`] {
|
|
44
|
+
overflow: hidden `).concat(s,`;
|
|
55
45
|
overscroll-behavior: contain;
|
|
56
|
-
`).concat([
|
|
46
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
57
47
|
padding-left: `.concat(r,`px;
|
|
58
|
-
padding-top: `).concat(
|
|
48
|
+
padding-top: `).concat(i,`px;
|
|
59
49
|
padding-right: `).concat(o,`px;
|
|
60
50
|
margin-left:0;
|
|
61
51
|
margin-top:0;
|
|
62
|
-
margin-right: `).concat(a,"px ").concat(
|
|
63
|
-
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(
|
|
52
|
+
margin-right: `).concat(a,"px ").concat(s,`;
|
|
53
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
64
54
|
}
|
|
65
55
|
|
|
66
|
-
.`).concat(
|
|
67
|
-
right: `).concat(a,"px ").concat(
|
|
56
|
+
.`).concat(ws,` {
|
|
57
|
+
right: `).concat(a,"px ").concat(s,`;
|
|
68
58
|
}
|
|
69
59
|
|
|
70
|
-
.`).concat(
|
|
71
|
-
margin-right: `).concat(a,"px ").concat(
|
|
60
|
+
.`).concat(Ss,` {
|
|
61
|
+
margin-right: `).concat(a,"px ").concat(s,`;
|
|
72
62
|
}
|
|
73
63
|
|
|
74
|
-
.`).concat(
|
|
75
|
-
right: 0 `).concat(
|
|
64
|
+
.`).concat(ws," .").concat(ws,` {
|
|
65
|
+
right: 0 `).concat(s,`;
|
|
76
66
|
}
|
|
77
67
|
|
|
78
|
-
.`).concat(
|
|
79
|
-
margin-right: 0 `).concat(
|
|
68
|
+
.`).concat(Ss," .").concat(Ss,` {
|
|
69
|
+
margin-right: 0 `).concat(s,`;
|
|
80
70
|
}
|
|
81
71
|
|
|
82
|
-
body[`).concat(
|
|
83
|
-
`).concat(
|
|
72
|
+
body[`).concat(hn,`] {
|
|
73
|
+
`).concat(Hy,": ").concat(a,`px;
|
|
84
74
|
}
|
|
85
|
-
`)},
|
|
86
|
-
.block-interactivity-`.concat(
|
|
87
|
-
.allow-interactivity-`).concat(
|
|
88
|
-
`)},v6=0,Yi=[];function y6(t){var e=g.useRef([]),n=g.useRef([0,0]),i=g.useRef(),r=g.useState(v6++)[0],s=g.useState(lx)[0],o=g.useRef(t);g.useEffect(function(){o.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var f=F_([t.lockRef.current],(t.shards||[]).map(Yp),!0).filter(Boolean);return f.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),f.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var a=g.useCallback(function(f,y){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!o.current.allowPinchZoom;var b=mo(f),S=n.current,k="deltaX"in f?f.deltaX:S[0]-b[0],w="deltaY"in f?f.deltaY:S[1]-b[1],x,T=f.target,E=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in f&&E==="h"&&T.type==="range")return!1;var P=Kp(E,T);if(!P)return!0;if(P?x=E:(x=E==="v"?"h":"v",P=Kp(E,T)),!P)return!1;if(!i.current&&"changedTouches"in f&&(k||w)&&(i.current=x),!x)return!0;var I=i.current||x;return m6(I,y,f,I==="h"?k:w)},[]),c=g.useCallback(function(f){var y=f;if(!(!Yi.length||Yi[Yi.length-1]!==s)){var b="deltaY"in y?Zp(y):mo(y),S=e.current.filter(function(x){return x.name===y.type&&(x.target===y.target||y.target===x.shadowParent)&&p6(x.delta,b)})[0];if(S&&S.should){y.cancelable&&y.preventDefault();return}if(!S){var k=(o.current.shards||[]).map(Yp).filter(Boolean).filter(function(x){return x.contains(y.target)}),w=k.length>0?a(y,k[0]):!o.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),l=g.useCallback(function(f,y,b,S){var k={name:f,delta:y,target:b,should:S,shadowParent:b6(b)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(w){return w!==k})},1)},[]),d=g.useCallback(function(f){n.current=mo(f),i.current=void 0},[]),u=g.useCallback(function(f){l(f.type,Zp(f),f.target,a(f,t.lockRef.current))},[]),h=g.useCallback(function(f){l(f.type,mo(f),f.target,a(f,t.lockRef.current))},[]);g.useEffect(function(){return Yi.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Zi),document.addEventListener("touchmove",c,Zi),document.addEventListener("touchstart",d,Zi),function(){Yi=Yi.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Zi),document.removeEventListener("touchmove",c,Zi),document.removeEventListener("touchstart",d,Zi)}},[]);var p=t.removeScrollBar,v=t.inert;return g.createElement(g.Fragment,null,v?g.createElement(s,{styles:g6(r)}):null,p?g.createElement(a6,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function b6(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const x6=K_(cx,y6);var fx=g.forwardRef(function(t,e){return g.createElement(La,an({},t,{ref:e,sideCar:x6}))});fx.classNames=La.classNames;var w6=[" ","Enter","ArrowUp","ArrowDown"],S6=[" ","Enter"],Fi="Select",[Va,Fa,k6]=BM(Fi),[Wr,Bj]=ah(Fi,[k6,K1]),Ua=K1(),[C6,mi]=Wr(Fi),[T6,E6]=Wr(Fi),mx=t=>{const{__scopeSelect:e,children:n,open:i,defaultOpen:r,onOpenChange:s,value:o,defaultValue:a,onValueChange:c,dir:l,name:d,autoComplete:u,disabled:h,required:p,form:v}=t,f=Ua(e),[y,b]=g.useState(null),[S,k]=g.useState(null),[w,x]=g.useState(!1),T=HM(l),[E,P]=Rd({prop:i,defaultProp:r??!1,onChange:s,caller:Fi}),[I,C]=Rd({prop:o,defaultProp:a,onChange:c,caller:Fi}),A=g.useRef(null),N=y?v||!!y.closest("form"):!0,[Z,Q]=g.useState(new Set),se=Array.from(Z).map(te=>te.props.value).join(";");return m.jsx(P_,{...f,children:m.jsxs(C6,{required:p,scope:e,trigger:y,onTriggerChange:b,valueNode:S,onValueNodeChange:k,valueNodeHasChildren:w,onValueNodeHasChildrenChange:x,contentId:ch(),value:I,onValueChange:C,open:E,onOpenChange:P,dir:T,triggerPointerDownPosRef:A,disabled:h,children:[m.jsx(Va.Provider,{scope:e,children:m.jsx(T6,{scope:t.__scopeSelect,onNativeOptionAdd:g.useCallback(te=>{Q(Y=>new Set(Y).add(te))},[]),onNativeOptionRemove:g.useCallback(te=>{Q(Y=>{const _=new Set(Y);return _.delete(te),_})},[]),children:n})}),N?m.jsxs(jx,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:u,value:I,onChange:te=>C(te.target.value),disabled:h,form:v,children:[I===void 0?m.jsx("option",{value:""}):null,Array.from(Z)]},se):null]})})};mx.displayName=Fi;var px="SelectTrigger",gx=g.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...r}=t,s=Ua(n),o=mi(px,n),a=o.disabled||i,c=dt(e,o.onTriggerChange),l=Fa(n),d=g.useRef("touch"),[u,h,p]=Vx(f=>{const y=l().filter(k=>!k.disabled),b=y.find(k=>k.value===o.value),S=Fx(y,f,b);S!==void 0&&o.onValueChange(S.value)}),v=f=>{a||(o.onOpenChange(!0),p()),f&&(o.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return m.jsx(R_,{asChild:!0,...s,children:m.jsx(We.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Lx(o.value)?"":void 0,...r,ref:c,onClick:Ge(r.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&v(f)}),onPointerDown:Ge(r.onPointerDown,f=>{d.current=f.pointerType;const y=f.target;y.hasPointerCapture(f.pointerId)&&y.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(v(f),f.preventDefault())}),onKeyDown:Ge(r.onKeyDown,f=>{const y=u.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(y&&f.key===" ")&&w6.includes(f.key)&&(v(),f.preventDefault())})})})});gx.displayName=px;var vx="SelectValue",yx=g.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,children:s,placeholder:o="",...a}=t,c=mi(vx,n),{onValueNodeHasChildrenChange:l}=c,d=s!==void 0,u=dt(e,c.onValueNodeChange);return St(()=>{l(d)},[l,d]),m.jsx(We.span,{...a,ref:u,style:{pointerEvents:"none"},children:Lx(c.value)?m.jsx(m.Fragment,{children:o}):s})});yx.displayName=vx;var P6="SelectIcon",bx=g.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...r}=t;return m.jsx(We.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});bx.displayName=P6;var R6="SelectPortal",xx=t=>m.jsx(ix,{asChild:!0,...t});xx.displayName=R6;var Ui="SelectContent",wx=g.forwardRef((t,e)=>{const n=mi(Ui,t.__scopeSelect),[i,r]=g.useState();if(St(()=>{r(new DocumentFragment)},[]),!n.open){const s=i;return s?js.createPortal(m.jsx(Sx,{scope:t.__scopeSelect,children:m.jsx(Va.Slot,{scope:t.__scopeSelect,children:m.jsx("div",{children:t.children})})}),s):null}return m.jsx(kx,{...t,ref:e})});wx.displayName=Ui;var Ht=10,[Sx,pi]=Wr(Ui),A6="SelectContentImpl",I6=As("SelectContent.RemoveScroll"),kx=g.forwardRef((t,e)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:v,hideWhenDetached:f,avoidCollisions:y,...b}=t,S=mi(Ui,n),[k,w]=g.useState(null),[x,T]=g.useState(null),E=dt(e,O=>w(O)),[P,I]=g.useState(null),[C,A]=g.useState(null),N=Fa(n),[Z,Q]=g.useState(!1),se=g.useRef(!1);g.useEffect(()=>{if(k)return V_(k)},[k]),XM();const te=g.useCallback(O=>{const[$,...X]=N().map(H=>H.ref.current),[z]=X.slice(-1),oe=document.activeElement;for(const H of O)if(H===oe||(H==null||H.scrollIntoView({block:"nearest"}),H===$&&x&&(x.scrollTop=0),H===z&&x&&(x.scrollTop=x.scrollHeight),H==null||H.focus(),document.activeElement!==oe))return},[N,x]),Y=g.useCallback(()=>te([P,k]),[te,P,k]);g.useEffect(()=>{Z&&Y()},[Z,Y]);const{onOpenChange:_,triggerPointerDownPosRef:ie}=S;g.useEffect(()=>{if(k){let O={x:0,y:0};const $=z=>{var oe,H;O={x:Math.abs(Math.round(z.pageX)-(((oe=ie.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(z.pageY)-(((H=ie.current)==null?void 0:H.y)??0))}},X=z=>{O.x<=10&&O.y<=10?z.preventDefault():k.contains(z.target)||_(!1),document.removeEventListener("pointermove",$),ie.current=null};return ie.current!==null&&(document.addEventListener("pointermove",$),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",X,{capture:!0})}}},[k,_,ie]),g.useEffect(()=>{const O=()=>_(!1);return window.addEventListener("blur",O),window.addEventListener("resize",O),()=>{window.removeEventListener("blur",O),window.removeEventListener("resize",O)}},[_]);const[L,F]=Vx(O=>{const $=N().filter(oe=>!oe.disabled),X=$.find(oe=>oe.ref.current===document.activeElement),z=Fx($,O,X);z&&setTimeout(()=>z.ref.current.focus())}),ee=g.useCallback((O,$,X)=>{const z=!se.current&&!X;(S.value!==void 0&&S.value===$||z)&&(I(O),z&&(se.current=!0))},[S.value]),j=g.useCallback(()=>k==null?void 0:k.focus(),[k]),W=g.useCallback((O,$,X)=>{const z=!se.current&&!X;(S.value!==void 0&&S.value===$||z)&&A(O)},[S.value]),J=i==="popper"?Od:Cx,G=J===Od?{side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:v,hideWhenDetached:f,avoidCollisions:y}:{};return m.jsx(Sx,{scope:n,content:k,viewport:x,onViewportChange:T,itemRefCallback:ee,selectedItem:P,onItemLeave:j,itemTextRefCallback:W,focusSelectedItem:Y,selectedItemText:C,position:i,isPositioned:Z,searchRef:L,children:m.jsx(fx,{as:I6,allowPinchZoom:!0,children:m.jsx(_1,{asChild:!0,trapped:S.open,onMountAutoFocus:O=>{O.preventDefault()},onUnmountAutoFocus:Ge(r,O=>{var $;($=S.trigger)==null||$.focus({preventScroll:!0}),O.preventDefault()}),children:m.jsx(M1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:O=>O.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:m.jsx(J,{role:"listbox",id:S.contentId,"data-state":S.open?"open":"closed",dir:S.dir,onContextMenu:O=>O.preventDefault(),...b,...G,onPlaced:()=>Q(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ge(b.onKeyDown,O=>{const $=O.ctrlKey||O.altKey||O.metaKey;if(O.key==="Tab"&&O.preventDefault(),!$&&O.key.length===1&&F(O.key),["ArrowUp","ArrowDown","Home","End"].includes(O.key)){let z=N().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(O.key)&&(z=z.slice().reverse()),["ArrowUp","ArrowDown"].includes(O.key)){const oe=O.target,H=z.indexOf(oe);z=z.slice(H+1)}setTimeout(()=>te(z)),O.preventDefault()}})})})})})})});kx.displayName=A6;var M6="SelectItemAlignedPosition",Cx=g.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...r}=t,s=mi(Ui,n),o=pi(Ui,n),[a,c]=g.useState(null),[l,d]=g.useState(null),u=dt(e,E=>d(E)),h=Fa(n),p=g.useRef(!1),v=g.useRef(!0),{viewport:f,selectedItem:y,selectedItemText:b,focusSelectedItem:S}=o,k=g.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&l&&f&&y&&b){const E=s.trigger.getBoundingClientRect(),P=l.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),C=b.getBoundingClientRect();if(s.dir!=="rtl"){const oe=C.left-P.left,H=I.left-oe,ue=E.left-H,we=E.width+ue,rt=Math.max(we,P.width),Qt=window.innerWidth-Ht,vi=Rp(H,[Ht,Math.max(Ht,Qt-rt)]);a.style.minWidth=we+"px",a.style.left=vi+"px"}else{const oe=P.right-C.right,H=window.innerWidth-I.right-oe,ue=window.innerWidth-E.right-H,we=E.width+ue,rt=Math.max(we,P.width),Qt=window.innerWidth-Ht,vi=Rp(H,[Ht,Math.max(Ht,Qt-rt)]);a.style.minWidth=we+"px",a.style.right=vi+"px"}const A=h(),N=window.innerHeight-Ht*2,Z=f.scrollHeight,Q=window.getComputedStyle(l),se=parseInt(Q.borderTopWidth,10),te=parseInt(Q.paddingTop,10),Y=parseInt(Q.borderBottomWidth,10),_=parseInt(Q.paddingBottom,10),ie=se+te+Z+_+Y,L=Math.min(y.offsetHeight*5,ie),F=window.getComputedStyle(f),ee=parseInt(F.paddingTop,10),j=parseInt(F.paddingBottom,10),W=E.top+E.height/2-Ht,J=N-W,G=y.offsetHeight/2,O=y.offsetTop+G,$=se+te+O,X=ie-$;if($<=W){const oe=A.length>0&&y===A[A.length-1].ref.current;a.style.bottom="0px";const H=l.clientHeight-f.offsetTop-f.offsetHeight,ue=Math.max(J,G+(oe?j:0)+H+Y),we=$+ue;a.style.height=we+"px"}else{const oe=A.length>0&&y===A[0].ref.current;a.style.top="0px";const ue=Math.max(W,se+f.offsetTop+(oe?ee:0)+G)+X;a.style.height=ue+"px",f.scrollTop=$-W+f.offsetTop}a.style.margin=`${Ht}px 0`,a.style.minHeight=L+"px",a.style.maxHeight=N+"px",i==null||i(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,a,l,f,y,b,s.dir,i]);St(()=>k(),[k]);const[w,x]=g.useState();St(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]);const T=g.useCallback(E=>{E&&v.current===!0&&(k(),S==null||S(),v.current=!1)},[k,S]);return m.jsx(_6,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:m.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:m.jsx(We.div,{...r,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Cx.displayName=M6;var N6="SelectPopperPosition",Od=g.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:r=Ht,...s}=t,o=Ua(n);return m.jsx(A_,{...o,...s,ref:e,align:i,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Od.displayName=N6;var[_6,yh]=Wr(Ui,{}),Dd="SelectViewport",Tx=g.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...r}=t,s=pi(Dd,n),o=yh(Dd,n),a=dt(e,s.onViewportChange),c=g.useRef(0);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),m.jsx(Va.Slot,{scope:n,children:m.jsx(We.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:Ge(r.onScroll,l=>{const d=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&u){const p=Math.abs(c.current-d.scrollTop);if(p>0){const v=window.innerHeight-Ht*2,f=parseFloat(u.style.minHeight),y=parseFloat(u.style.height),b=Math.max(f,y);if(b<v){const S=b+p,k=Math.min(v,S),w=S-k;u.style.height=k+"px",u.style.bottom==="0px"&&(d.scrollTop=w>0?w:0,u.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Tx.displayName=Dd;var Ex="SelectGroup",[O6,D6]=Wr(Ex),j6=g.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=ch();return m.jsx(O6,{scope:n,id:r,children:m.jsx(We.div,{role:"group","aria-labelledby":r,...i,ref:e})})});j6.displayName=Ex;var Px="SelectLabel",L6=g.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=D6(Px,n);return m.jsx(We.div,{id:r.id,...i,ref:e})});L6.displayName=Px;var ga="SelectItem",[V6,Rx]=Wr(ga),Ax=g.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:r=!1,textValue:s,...o}=t,a=mi(ga,n),c=pi(ga,n),l=a.value===i,[d,u]=g.useState(s??""),[h,p]=g.useState(!1),v=dt(e,S=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,S,i,r)}),f=ch(),y=g.useRef("touch"),b=()=>{r||(a.onValueChange(i),a.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.jsx(V6,{scope:n,value:i,disabled:r,textId:f,isSelected:l,onItemTextChange:g.useCallback(S=>{u(k=>k||((S==null?void 0:S.textContent)??"").trim())},[]),children:m.jsx(Va.ItemSlot,{scope:n,value:i,disabled:r,textValue:d,children:m.jsx(We.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":l&&h,"data-state":l?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:v,onFocus:Ge(o.onFocus,()=>p(!0)),onBlur:Ge(o.onBlur,()=>p(!1)),onClick:Ge(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Ge(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Ge(o.onPointerDown,S=>{y.current=S.pointerType}),onPointerMove:Ge(o.onPointerMove,S=>{var k;y.current=S.pointerType,r?(k=c.onItemLeave)==null||k.call(c):y.current==="mouse"&&S.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ge(o.onPointerLeave,S=>{var k;S.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:Ge(o.onKeyDown,S=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&S.key===" "||(S6.includes(S.key)&&b(),S.key===" "&&S.preventDefault())})})})})});Ax.displayName=ga;var as="SelectItemText",Ix=g.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,...s}=t,o=mi(as,n),a=pi(as,n),c=Rx(as,n),l=E6(as,n),[d,u]=g.useState(null),h=dt(e,b=>u(b),c.onItemTextChange,b=>{var S;return(S=a.itemTextRefCallback)==null?void 0:S.call(a,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,v=g.useMemo(()=>m.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:y}=l;return St(()=>(f(v),()=>y(v)),[f,y,v]),m.jsxs(m.Fragment,{children:[m.jsx(We.span,{id:c.textId,...s,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?js.createPortal(s.children,o.valueNode):null]})});Ix.displayName=as;var Mx="SelectItemIndicator",Nx=g.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return Rx(Mx,n).isSelected?m.jsx(We.span,{"aria-hidden":!0,...i,ref:e}):null});Nx.displayName=Mx;var jd="SelectScrollUpButton",_x=g.forwardRef((t,e)=>{const n=pi(jd,t.__scopeSelect),i=yh(jd,t.__scopeSelect),[r,s]=g.useState(!1),o=dt(e,i.onScrollButtonChange);return St(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollTop>0;s(l)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?m.jsx(Dx,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});_x.displayName=jd;var Ld="SelectScrollDownButton",Ox=g.forwardRef((t,e)=>{const n=pi(Ld,t.__scopeSelect),i=yh(Ld,t.__scopeSelect),[r,s]=g.useState(!1),o=dt(e,i.onScrollButtonChange);return St(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<l;s(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?m.jsx(Dx,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});Ox.displayName=Ld;var Dx=g.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...r}=t,s=pi("SelectScrollButton",n),o=g.useRef(null),a=Fa(n),c=g.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),St(()=>{var d;const l=a().find(u=>u.ref.current===document.activeElement);(d=l==null?void 0:l.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),m.jsx(We.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:Ge(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:Ge(r.onPointerMove,()=>{var l;(l=s.onItemLeave)==null||l.call(s),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:Ge(r.onPointerLeave,()=>{c()})})}),F6="SelectSeparator",U6=g.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return m.jsx(We.div,{"aria-hidden":!0,...i,ref:e})});U6.displayName=F6;var Vd="SelectArrow",B6=g.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=Ua(n),s=mi(Vd,n),o=pi(Vd,n);return s.open&&o.position==="popper"?m.jsx(I_,{...r,...i,ref:e}):null});B6.displayName=Vd;var $6="SelectBubbleInput",jx=g.forwardRef(({__scopeSelect:t,value:e,...n},i)=>{const r=g.useRef(null),s=dt(i,r),o=N_(e);return g.useEffect(()=>{const a=r.current;if(!a)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const u=new Event("change",{bubbles:!0});d.call(a,e),a.dispatchEvent(u)}},[o,e]),m.jsx(We.select,{...n,style:{...rx,...n.style},ref:s,defaultValue:e})});jx.displayName=$6;function Lx(t){return t===""||t===void 0}function Vx(t){const e=Li(t),n=g.useRef(""),i=g.useRef(0),r=g.useCallback(o=>{const a=n.current+o;e(a),function c(l){n.current=l,window.clearTimeout(i.current),l!==""&&(i.current=window.setTimeout(()=>c(""),1e3))}(a)},[e]),s=g.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,r,s]}function Fx(t,e,n){const r=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=H6(t,Math.max(s,0));r.length===1&&(o=o.filter(l=>l!==n));const c=o.find(l=>l.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function H6(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var z6=mx,W6=gx,q6=yx,G6=bx,K6=xx,Z6=wx,Y6=Tx,J6=Ax,X6=Ix,Q6=Nx,e8=_x,t8=Ox;function Jp({...t}){return m.jsx(z6,{"data-slot":"select",...t})}function Xp({...t}){return m.jsx(q6,{"data-slot":"select-value",...t})}function Qp({className:t,size:e="default",children:n,...i}){return m.jsxs(W6,{"data-slot":"select-trigger","data-size":e,className:le(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...i,children:[n,m.jsx(G6,{asChild:!0,children:m.jsx(rh,{weight:"bold",className:"size-4 transition-colors"})})]})}function eg({className:t,children:e,position:n="popper",...i}){return m.jsx(K6,{children:m.jsxs(Z6,{"data-slot":"select-content",className:le(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[m.jsx(n8,{}),m.jsx(Y6,{className:le("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),m.jsx(i8,{})]})})}function tg({className:t,children:e,...n}){return m.jsxs(J6,{"data-slot":"select-item",className:le(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],t),...n,children:[m.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:m.jsx(Q6,{children:m.jsx(a1,{className:"size-4",weight:"bold"})})}),m.jsx(X6,{children:e})]})}function n8({className:t,...e}){return m.jsx(e8,{"data-slot":"select-scroll-up-button",className:le("flex cursor-default items-center justify-center py-1",t),...e,children:m.jsx(s1,{className:"size-4",weight:"bold"})})}function i8({className:t,...e}){return m.jsx(t8,{"data-slot":"select-scroll-down-button",className:le("flex cursor-default items-center justify-center py-1",t),...e,children:m.jsx(rh,{className:"size-4",weight:"bold"})})}const ng=_a(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function ig({kind:t,track:e,requestPermissions:n,onError:i,client:r,...s}){const o=s.size||"default";if(!r)return m.jsxs(Jp,{disabled:!0,children:[m.jsx(Qp,{className:le(ng({size:o}),s.className),children:m.jsx(Xp,{placeholder:`Select a ${t}`})}),m.jsx(eg,{children:m.jsx(tg,{value:"none",children:"No devices available"})})]});const{devices:a,activeDeviceId:c,setActiveMediaDevice:l}=VM(r,t==="audioinput"?"audioinput":"videoinput");return m.jsxs(Jp,{value:c,onValueChange:l,children:[m.jsx(Qp,{className:le(ng({size:o}),s.className,"hover:bg"),children:o!=="sm"&&m.jsx(Xp,{className:"font-mono text-sm",placeholder:`Select a ${t}`})}),m.jsx(eg,{children:a.map(d=>m.jsx(tg,{value:d.deviceId,className:"font-mono text-xs",children:d.label},d.deviceId))})]})}function r8(t,e,n=!1){if(n)return sh;switch(t){case D.Source.Microphone:return e?c1:l1;case D.Source.Camera:return e?u1:h1;case D.Source.ScreenShare:return d1;default:return g.Fragment}}function il({source:t,pressed:e,pending:n,className:i,...r}){const s=r8(t,e??!1,n),o=t===D.Source.Microphone&&!(e??!1)&&!n,a=t===D.Source.Camera&&!(e??!1)&&!n;return g.useEffect(()=>{console.log(`TrackToggle for ${t} changed: pressed=${e}, pending=${n}, actualState=${e?"enabled":"disabled"}`)},[t,e,n]),m.jsxs(A1,{pressed:e,"aria-label":`Toggle ${t}`,className:le(i),...r,children:[m.jsx(s,{weight:"bold",className:le(n&&"animate-spin",o||a?"text-red-500":void 0)}),r.children]})}function s8(t){return t?DM(t):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function o8(t={}){const{controls:e,saveUserChoices:n=!0,client:i}=t,r={leave:!0,...e};if(!i)return{micTrackRef:{participant:void 0,source:D.Source.Microphone,publication:void 0},visibleControls:r,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:s,localParticipant:o}=jM(i),a=s8(i);LM(i);const c=Gc(i,"microphone",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:D.Source.Microphone,error:T})}}),l=Gc(i,"camera",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:D.Source.Camera,error:T})}}),d=Gc(i,"screenShare",{onDeviceError:T=>{var E;return(E=t.onDeviceError)==null?void 0:E.call(t,{source:D.Source.ScreenShare,error:T})}}),u=g.useMemo(()=>{let T;if(o){for(const[,E]of o.trackPublications)if(E.source===D.Source.Microphone){T=E;break}}return console.log("🎤 Creating micTrackRef:",{hasParticipant:!!o,hasPublication:!!T,isTrackSubscribed:T==null?void 0:T.isSubscribed,isMuted:T==null?void 0:T.isMuted,trackSid:T==null?void 0:T.trackSid}),{participant:o??void 0,source:D.Source.Microphone,publication:T}},[o,s]);r.microphone??(r.microphone=a.microphone),r.screenShare??(r.screenShare=a.screenShare),r.camera??(r.camera=a.camera),r.chat??(r.chat=a.data);const{saveAudioInputEnabled:h,saveAudioInputDeviceId:p,saveVideoInputEnabled:v,saveVideoInputDeviceId:f}=FM({preventSave:!n}),y=g.useCallback(()=>{i&&i.disconnect()},[i]),b=g.useCallback(T=>{p(T??"default"),i&&i.setAudioInputDevice(T)},[p,i]),S=g.useCallback(T=>{f(T??"default"),i&&i.setVideoInputDevice(T)},[f,i]),k=g.useCallback(async T=>{d.enabled&&await d.toggle(!1),await l.toggle(T),v(!l.enabled)},[l,v,d]),w=g.useCallback(async T=>{await c.toggle(T),h(!c.enabled)},[c,h]),x=g.useCallback(async T=>{l.enabled&&await l.toggle(!1),await d.toggle(T)},[l,d]);return{micTrackRef:u,visibleControls:r,cameraToggle:{...l,toggle:k},microphoneToggle:{...c,toggle:w},screenShareToggle:{...d,toggle:x},handleDisconnect:y,handleAudioDeviceChange:b,handleVideoDeviceChange:S}}const a8={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},c8={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},l8={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},rg={dark:a8,light:c8,vox:l8};function ut(t){return rg[t]||rg.vox}function d8({controls:t,saveUserChoices:e=!0,capabilities:n,className:i,onSendMessage:r,onChatOpenChange:s,onDisconnect:o,onDeviceError:a,theme:c="vox",client:l,...d}){const[u,h]=g.useState(!1),[p,v]=g.useState(!1),f=ut(c),{micTrackRef:y,visibleControls:b,cameraToggle:S,microphoneToggle:k,screenShareToggle:w,handleAudioDeviceChange:x,handleVideoDeviceChange:T,handleDisconnect:E}=o8({controls:t,saveUserChoices:e,client:l}),P=async I=>{v(!0);try{await(r==null?void 0:r(I))}finally{v(!1)}};return g.useEffect(()=>{s==null||s(u)},[u,s]),g.useEffect(()=>{var I,C,A,N;console.log("🎤 AgentControlBar: micTrackRef changed:",{hasParticipant:!!y.participant,hasPublication:!!y.publication,source:y.source,isSubscribed:(I=y.publication)==null?void 0:I.isSubscribed,isMuted:(C=y.publication)==null?void 0:C.isMuted,trackSid:(A=y.publication)==null?void 0:A.trackSid,hasTrack:!!((N=y.publication)!=null&&N.track)})},[y]),m.jsxs("div",{"aria-label":"Voice assistant controls",className:le(f.controlBar,i),...d,children:[n.suportsChatInput&&m.jsxs("div",{inert:!u,className:le("overflow-hidden transition-[height] relative duration-300 ease-in-out",u?"h-[64px] mb-3":"h-0"),children:[m.jsx("div",{className:"flex h-9 px-4 w-full",children:m.jsx(PM,{onSend:P,disabled:p,className:le("w-full",f.chatInput)})}),m.jsx("hr",{className:"border-border my-2 mx-5"})]}),m.jsxs("div",{className:le("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",c==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[m.jsxs("div",{className:"flex gap-y-2 justify-start",children:[b.microphone&&m.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[m.jsx(il,{variant:"primary",source:D.Source.Microphone,pressed:k.enabled,disabled:k.pending,onPressedChange:k.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),m.jsx(i1,{barCount:3,trackRef:y,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:m.jsx("span",{className:le(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),m.jsx(ig,{size:"sm",kind:"audioinput",client:l,onError:a?I=>I instanceof Error?a({source:D.Source.Microphone,error:I}):void 0:void 0,onActiveDeviceChange:x,className:le(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&b.camera&&m.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[m.jsx(il,{variant:"primary",source:D.Source.Camera,pressed:S.enabled,pending:S.pending,disabled:S.pending,onPressedChange:S.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),m.jsx(ig,{size:"sm",kind:"videoinput",client:l,onError:a?I=>I instanceof Error?a({source:D.Source.Camera,error:I}):void 0:void 0,onActiveDeviceChange:T,className:le(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),n.suportsScreenShare&&b.screenShare&&m.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:m.jsx(il,{variant:"secondary",source:D.Source.ScreenShare,pressed:w.enabled,disabled:w.pending,onPressedChange:w.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),b.chat&&m.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:m.jsx(A1,{variant:"secondary","aria-label":"Toggle chat",pressed:u,onPressedChange:I=>{h(I)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:m.jsx(o1,{weight:"bold",className:"h-5 w-5"})})})]})]})}const u8=(t,e)=>{var a,c;const n=g.useMemo(()=>e?e(t.message):t.message,[t.message,e]),i=!!t.editTimestamp,r=new Date(t.timestamp),s=typeof navigator<"u"?navigator.language:"en-US",o=(a=t.from)!=null&&a.name&&t.from.name!==""?t.from.name:(c=t.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:i,time:r,locale:s,name:o}},h8=({entry:t,messageFormatter:e,className:n,participantName:i,...r})=>{var d,u;const{message:s,time:o,locale:a}=u8(t,e),c=((d=t.from)==null?void 0:d.isLocal)??!1;le("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",c?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const l=le("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",c?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return m.jsx("li",{title:o.toLocaleTimeString(a,{timeStyle:"full"}),className:le("group flex mb-2",c?"justify-end":"justify-start",n),...r,children:m.jsxs("div",{className:le("flex w-fit max-w-full rounded-2xl border",c?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[m.jsx("span",{className:l,children:c?((u=i==null?void 0:i[0])==null?void 0:u.toUpperCase())||"U":"A"}),m.jsx("span",{className:le("flex items-center text-xs break-words whitespace-pre-line",c?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:s})]})})};function f8(t){M.useEffect(()=>{function e(){const n=t.current;n&&(n.scrollTop=n.scrollHeight)}if(t.current){const n=new ResizeObserver(e);return n.observe(t.current),e(),()=>n.disconnect()}},[t])}const m8=({className:t,children:e,...n})=>{const i=M.useRef(null);return f8(i),m.jsx("div",{ref:i,className:le("flex flex-col justify-end",t),...n,children:e})},p8=({state:t,audioTrack:e,className:n,ref:i})=>m.jsx("div",{ref:i,className:le("",n),children:m.jsx(i1,{barCount:5,state:t,options:{minHeight:5},trackRef:e,className:le("flex aspect-video w-40 items-center justify-center gap-1"),children:m.jsx("span",{className:le(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})})}),g8=({videoTrack:t,className:e,ref:n})=>{var i,r;return m.jsx("div",{ref:n,className:le(e),children:m.jsx(ih,{trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},v8=ge.create(ih),y8=({trackRef:t,className:e,ref:n})=>{var i,r;return m.jsx("div",{className:le("bg-muted overflow-hidden rounded-md",e),children:m.jsx(v8,{ref:n,trackRef:t,width:((i=t==null?void 0:t.publication.dimensions)==null?void 0:i.width)??0,height:((r=t==null?void 0:t.publication.dimensions)==null?void 0:r.height)??0,className:le("h-full w-auto")})})},sg=ge.create(y8),b8=ge.create(p8),x8=ge.create(g8),Sn={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},Ji={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function w8(t){const{localParticipant:e}=HI(),n=e.getTrackPublication(t);return M.useMemo(()=>n?{source:t,participant:e,publication:n}:void 0,[t,n,e])}function S8({chatOpen:t}){const{state:e,audioTrack:n,videoTrack:i,agent:{isActive:r=!1}={}}=t1(),[s]=nh([D.Source.ScreenShare]),o=w8(D.Source.Camera),a=o&&!o.publication.isMuted,c=s&&!s.publication.isMuted,l=a||c,d={...Sn.transition,delay:t?0:.15},u={...Sn.animate,scale:t?1:3,transition:d},h={...Sn.animate,transition:d},p=d,v=d,f=i!==void 0;return m.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:m.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:m.jsxs("div",{className:le(Ji.grid),children:[r&&m.jsx("div",{className:le(["grid",!t&&Ji.agentChatClosed,t&&l&&Ji.agentChatOpenWithSecondTile,t&&!l&&Ji.agentChatOpenWithoutSecondTile]),children:m.jsxs("div",{className:"h-full flex items-center justify-center",children:[!f&&m.jsx(b8,{layoutId:"agent",...Sn,animate:u,transition:p,state:e,audioTrack:n,className:le(t?"h-[90px]":"h-auto w-full")},"agent"),f&&m.jsx(x8,{layoutId:"avatar",...Sn,animate:h,transition:v,videoTrack:i,className:le(t?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),m.jsx("div",{className:le(["grid",t&&Ji.secondTileChatOpen,!t&&Ji.secondTileChatClosed]),children:m.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[o&&a&&m.jsx(sg,{layout:"position",layoutId:"camera",...Sn,trackRef:o,transition:{...Sn.transition,delay:t?0:.15},className:"h-[60px] order-1"},"camera"),c&&m.jsx(sg,{layout:"position",layoutId:"screen",...Sn,trackRef:s,transition:{...Sn.transition,delay:t?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}/**
|
|
75
|
+
`)},ml=function(){var e=parseInt(document.body.getAttribute(hn)||"0",10);return isFinite(e)?e:0},av=function(){f.useEffect(function(){return document.body.setAttribute(hn,(ml()+1).toString()),function(){var e=ml()-1;e<=0?document.body.removeAttribute(hn):document.body.setAttribute(hn,e.toString())}},[])},lv=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;av();var i=f.useMemo(function(){return rv(r)},[r]);return f.createElement(ov,{styles:iv(i,!t,r,n?"":"!important")})},co=!1;if(typeof window<"u")try{var hs=Object.defineProperty({},"passive",{get:function(){return co=!0,!0}});window.addEventListener("test",hs,hs),window.removeEventListener("test",hs,hs)}catch{co=!1}var Qt=co?{passive:!1}:!1,cv=function(e){return e.tagName==="TEXTAREA"},gu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!cv(e)&&n[t]==="visible")},dv=function(e){return gu(e,"overflowY")},uv=function(e){return gu(e,"overflowX")},pl=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=xu(e,s);if(r){var i=yu(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},fv=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},hv=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},xu=function(e,t){return e==="v"?dv(t):uv(t)},yu=function(e,t){return e==="v"?fv(t):hv(t)},mv=function(e,t){return e==="h"&&t==="rtl"?-1:1},pv=function(e,t,n,s,r){var i=mv(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,l=t.contains(a),d=!1,u=o>0,h=0,m=0;do{if(!a)break;var g=yu(e,a),x=g[0],p=g[1],v=g[2],b=p-v-i*x;(x||b)&&xu(e,a)&&(h+=b,m+=x);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(h)<1||!u&&Math.abs(m)<1)&&(d=!0),d},ms=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gl=function(e){return[e.deltaX,e.deltaY]},xl=function(e){return e&&"current"in e?e.current:e},gv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},xv=function(e){return`
|
|
76
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
77
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
78
|
+
`)},yv=0,en=[];function vv(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),r=f.useState(yv++)[0],i=f.useState(pu)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var p=$y([e.lockRef.current],(e.shards||[]).map(xl),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var b=ms(p),y=n.current,w="deltaX"in p?p.deltaX:y[0]-b[0],S="deltaY"in p?p.deltaY:y[1]-b[1],k,T=p.target,A=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in p&&A==="h"&&T.type==="range")return!1;var j=pl(A,T);if(!j)return!0;if(j?k=A:(k=A==="v"?"h":"v",j=pl(A,T)),!j)return!1;if(!s.current&&"changedTouches"in p&&(w||S)&&(s.current=k),!k)return!0;var V=s.current||k;return pv(V,v,p,V==="h"?w:S)},[]),l=f.useCallback(function(p){var v=p;if(!(!en.length||en[en.length-1]!==i)){var b="deltaY"in v?gl(v):ms(v),y=t.current.filter(function(k){return k.name===v.type&&(k.target===v.target||v.target===k.shadowParent)&&gv(k.delta,b)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(xl).filter(Boolean).filter(function(k){return k.contains(v.target)}),S=w.length>0?a(v,w[0]):!o.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),d=f.useCallback(function(p,v,b,y){var w={name:p,delta:v,target:b,should:y,shadowParent:bv(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),u=f.useCallback(function(p){n.current=ms(p),s.current=void 0},[]),h=f.useCallback(function(p){d(p.type,gl(p),p.target,a(p,e.lockRef.current))},[]),m=f.useCallback(function(p){d(p.type,ms(p),p.target,a(p,e.lockRef.current))},[]);f.useEffect(function(){return en.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Qt),document.addEventListener("touchmove",l,Qt),document.addEventListener("touchstart",u,Qt),function(){en=en.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,Qt),document.removeEventListener("touchmove",l,Qt),document.removeEventListener("touchstart",u,Qt)}},[]);var g=e.removeScrollBar,x=e.inert;return f.createElement(f.Fragment,null,x?f.createElement(i,{styles:xv(r)}):null,g?f.createElement(lv,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const wv=Gy(mu,vv);var vu=f.forwardRef(function(e,t){return f.createElement(zs,it({},e,{ref:t,sideCar:wv}))});vu.classNames=zs.classNames;var Sv=[" ","Enter","ArrowUp","ArrowDown"],Cv=[" ","Enter"],Zt="Select",[Zs,Ws,Ev]=H1(Zt),[An,gw]=ni(Zt,[Ev,eu]),Ks=eu(),[kv,Mt]=An(Zt),[Av,Tv]=An(Zt),bu=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:u,autoComplete:h,disabled:m,required:g,form:x}=e,p=Ks(t),[v,b]=f.useState(null),[y,w]=f.useState(null),[S,k]=f.useState(!1),T=z1(d),[A,j]=ro({prop:s,defaultProp:r??!1,onChange:i,caller:Zt}),[V,I]=ro({prop:o,defaultProp:a,onChange:l,caller:Zt}),$=f.useRef(null),F=v?x||!!v.closest("form"):!0,[se,Z]=f.useState(new Set),ee=Array.from(se).map(G=>G.props.value).join(";");return c.jsx(jy,{...p,children:c.jsxs(kv,{required:g,scope:t,trigger:v,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:si(),value:V,onValueChange:I,open:A,onOpenChange:j,dir:T,triggerPointerDownPosRef:$,disabled:m,children:[c.jsx(Zs.Provider,{scope:t,children:c.jsx(Av,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(G=>{Z(O=>new Set(O).add(G))},[]),onNativeOptionRemove:f.useCallback(G=>{Z(O=>{const P=new Set(O);return P.delete(G),P})},[]),children:n})}),F?c.jsxs(Hu,{"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:h,value:V,onChange:G=>I(G.target.value),disabled:m,form:x,children:[V===void 0?c.jsx("option",{value:""}):null,Array.from(se)]},ee):null]})})};bu.displayName=Zt;var wu="SelectTrigger",Su=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=Ks(n),o=Mt(wu,n),a=o.disabled||s,l=Re(t,o.onTriggerChange),d=Ws(n),u=f.useRef("touch"),[h,m,g]=zu(p=>{const v=d().filter(w=>!w.disabled),b=v.find(w=>w.value===o.value),y=Zu(v,p,b);y!==void 0&&o.onValueChange(y.value)}),x=p=>{a||(o.onOpenChange(!0),g()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return c.jsx(Py,{asChild:!0,...i,children:c.jsx(we.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Uu(o.value)?"":void 0,...r,ref:l,onClick:Ee(r.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&x(p)}),onPointerDown:Ee(r.onPointerDown,p=>{u.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(x(p),p.preventDefault())}),onKeyDown:Ee(r.onKeyDown,p=>{const v=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(v&&p.key===" ")&&Sv.includes(p.key)&&(x(),p.preventDefault())})})})});Su.displayName=wu;var Cu="SelectValue",Eu=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...a}=e,l=Mt(Cu,n),{onValueNodeHasChildrenChange:d}=l,u=i!==void 0,h=Re(t,l.onValueNodeChange);return Ue(()=>{d(u)},[d,u]),c.jsx(we.span,{...a,ref:h,style:{pointerEvents:"none"},children:Uu(l.value)?c.jsx(c.Fragment,{children:o}):i})});Eu.displayName=Cu;var jv="SelectIcon",ku=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return c.jsx(we.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});ku.displayName=jv;var Pv="SelectPortal",Au=e=>c.jsx(cu,{asChild:!0,...e});Au.displayName=Pv;var Wt="SelectContent",Tu=f.forwardRef((e,t)=>{const n=Mt(Wt,e.__scopeSelect),[s,r]=f.useState();if(Ue(()=>{r(new DocumentFragment)},[]),!n.open){const i=s;return i?Ls.createPortal(c.jsx(ju,{scope:e.__scopeSelect,children:c.jsx(Zs.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),i):null}return c.jsx(Pu,{...e,ref:t})});Tu.displayName=Wt;var Qe=10,[ju,Nt]=An(Wt),Mv="SelectContentImpl",Nv=Wn("SelectContent.RemoveScroll"),Pu=f.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:p,avoidCollisions:v,...b}=e,y=Mt(Wt,n),[w,S]=f.useState(null),[k,T]=f.useState(null),A=Re(t,N=>S(N)),[j,V]=f.useState(null),[I,$]=f.useState(null),F=Ws(n),[se,Z]=f.useState(!1),ee=f.useRef(!1);f.useEffect(()=>{if(w)return _y(w)},[w]),Q1();const G=f.useCallback(N=>{const[L,...W]=F().map(te=>te.ref.current),[D]=W.slice(-1),ne=document.activeElement;for(const te of N)if(te===ne||(te==null||te.scrollIntoView({block:"nearest"}),te===L&&k&&(k.scrollTop=0),te===D&&k&&(k.scrollTop=k.scrollHeight),te==null||te.focus(),document.activeElement!==ne))return},[F,k]),O=f.useCallback(()=>G([j,w]),[G,j,w]);f.useEffect(()=>{se&&O()},[se,O]);const{onOpenChange:P,triggerPointerDownPosRef:B}=y;f.useEffect(()=>{if(w){let N={x:0,y:0};const L=D=>{var ne,te;N={x:Math.abs(Math.round(D.pageX)-(((ne=B.current)==null?void 0:ne.x)??0)),y:Math.abs(Math.round(D.pageY)-(((te=B.current)==null?void 0:te.y)??0))}},W=D=>{N.x<=10&&N.y<=10?D.preventDefault():w.contains(D.target)||P(!1),document.removeEventListener("pointermove",L),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",L),document.addEventListener("pointerup",W,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",W,{capture:!0})}}},[w,P,B]),f.useEffect(()=>{const N=()=>P(!1);return window.addEventListener("blur",N),window.addEventListener("resize",N),()=>{window.removeEventListener("blur",N),window.removeEventListener("resize",N)}},[P]);const[X,_]=zu(N=>{const L=F().filter(ne=>!ne.disabled),W=L.find(ne=>ne.ref.current===document.activeElement),D=Zu(L,N,W);D&&setTimeout(()=>D.ref.current.focus())}),re=f.useCallback((N,L,W)=>{const D=!ee.current&&!W;(y.value!==void 0&&y.value===L||D)&&(V(N),D&&(ee.current=!0))},[y.value]),M=f.useCallback(()=>w==null?void 0:w.focus(),[w]),H=f.useCallback((N,L,W)=>{const D=!ee.current&&!W;(y.value!==void 0&&y.value===L||D)&&$(N)},[y.value]),q=s==="popper"?uo:Mu,U=q===uo?{side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:p,avoidCollisions:v}:{};return c.jsx(ju,{scope:n,content:w,viewport:k,onViewportChange:T,itemRefCallback:re,selectedItem:j,onItemLeave:M,itemTextRefCallback:H,focusSelectedItem:O,selectedItemText:I,position:s,isPositioned:se,searchRef:X,children:c.jsx(vu,{as:Nv,allowPinchZoom:!0,children:c.jsx(_d,{asChild:!0,trapped:y.open,onMountAutoFocus:N=>{N.preventDefault()},onUnmountAutoFocus:Ee(r,N=>{var L;(L=y.trigger)==null||L.focus({preventScroll:!0}),N.preventDefault()}),children:c.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:N=>N.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:c.jsx(q,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:N=>N.preventDefault(),...b,...U,onPlaced:()=>Z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ee(b.onKeyDown,N=>{const L=N.ctrlKey||N.altKey||N.metaKey;if(N.key==="Tab"&&N.preventDefault(),!L&&N.key.length===1&&_(N.key),["ArrowUp","ArrowDown","Home","End"].includes(N.key)){let D=F().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(N.key)&&(D=D.slice().reverse()),["ArrowUp","ArrowDown"].includes(N.key)){const ne=N.target,te=D.indexOf(ne);D=D.slice(te+1)}setTimeout(()=>G(D)),N.preventDefault()}})})})})})})});Pu.displayName=Mv;var Rv="SelectItemAlignedPosition",Mu=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=Mt(Wt,n),o=Nt(Wt,n),[a,l]=f.useState(null),[d,u]=f.useState(null),h=Re(t,A=>u(A)),m=Ws(n),g=f.useRef(!1),x=f.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:b,focusSelectedItem:y}=o,w=f.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&p&&v&&b){const A=i.trigger.getBoundingClientRect(),j=d.getBoundingClientRect(),V=i.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(i.dir!=="rtl"){const ne=I.left-j.left,te=V.left-ne,de=A.left-te,me=A.width+de,Ae=Math.max(me,j.width),De=window.innerWidth-Qe,rt=Ga(te,[Qe,Math.max(Qe,De-Ae)]);a.style.minWidth=me+"px",a.style.left=rt+"px"}else{const ne=j.right-I.right,te=window.innerWidth-V.right-ne,de=window.innerWidth-A.right-te,me=A.width+de,Ae=Math.max(me,j.width),De=window.innerWidth-Qe,rt=Ga(te,[Qe,Math.max(Qe,De-Ae)]);a.style.minWidth=me+"px",a.style.right=rt+"px"}const $=m(),F=window.innerHeight-Qe*2,se=p.scrollHeight,Z=window.getComputedStyle(d),ee=parseInt(Z.borderTopWidth,10),G=parseInt(Z.paddingTop,10),O=parseInt(Z.borderBottomWidth,10),P=parseInt(Z.paddingBottom,10),B=ee+G+se+P+O,X=Math.min(v.offsetHeight*5,B),_=window.getComputedStyle(p),re=parseInt(_.paddingTop,10),M=parseInt(_.paddingBottom,10),H=A.top+A.height/2-Qe,q=F-H,U=v.offsetHeight/2,N=v.offsetTop+U,L=ee+G+N,W=B-L;if(L<=H){const ne=$.length>0&&v===$[$.length-1].ref.current;a.style.bottom="0px";const te=d.clientHeight-p.offsetTop-p.offsetHeight,de=Math.max(q,U+(ne?M:0)+te+O),me=L+de;a.style.height=me+"px"}else{const ne=$.length>0&&v===$[0].ref.current;a.style.top="0px";const de=Math.max(H,ee+p.offsetTop+(ne?re:0)+U)+W;a.style.height=de+"px",p.scrollTop=L-H+p.offsetTop}a.style.margin=`${Qe}px 0`,a.style.minHeight=X+"px",a.style.maxHeight=F+"px",s==null||s(),requestAnimationFrame(()=>g.current=!0)}},[m,i.trigger,i.valueNode,a,d,p,v,b,i.dir,s]);Ue(()=>w(),[w]);const[S,k]=f.useState();Ue(()=>{d&&k(window.getComputedStyle(d).zIndex)},[d]);const T=f.useCallback(A=>{A&&x.current===!0&&(w(),y==null||y(),x.current=!1)},[w,y]);return c.jsx(Iv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:c.jsx(we.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Mu.displayName=Rv;var Vv="SelectPopperPosition",uo=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=Qe,...i}=e,o=Ks(n);return c.jsx(My,{...o,...i,ref:t,align:s,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});uo.displayName=Vv;var[Iv,hi]=An(Wt,{}),fo="SelectViewport",Nu=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=Nt(fo,n),o=hi(fo,n),a=Re(t,i.onViewportChange),l=f.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),c.jsx(Zs.Slot,{scope:n,children:c.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:Ee(r.onScroll,d=>{const u=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const g=Math.abs(l.current-u.scrollTop);if(g>0){const x=window.innerHeight-Qe*2,p=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),b=Math.max(p,v);if(b<x){const y=b+g,w=Math.min(x,y),S=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Nu.displayName=fo;var Ru="SelectGroup",[Dv,Lv]=An(Ru),Fv=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=si();return c.jsx(Dv,{scope:n,id:r,children:c.jsx(we.div,{role:"group","aria-labelledby":r,...s,ref:t})})});Fv.displayName=Ru;var Vu="SelectLabel",Ov=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=Lv(Vu,n);return c.jsx(we.div,{id:r.id,...s,ref:t})});Ov.displayName=Vu;var Is="SelectItem",[_v,Iu]=An(Is),Du=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,a=Mt(Is,n),l=Nt(Is,n),d=a.value===s,[u,h]=f.useState(i??""),[m,g]=f.useState(!1),x=Re(t,y=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,y,s,r)}),p=si(),v=f.useRef("touch"),b=()=>{r||(a.onValueChange(s),a.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return c.jsx(_v,{scope:n,value:s,disabled:r,textId:p,isSelected:d,onItemTextChange:f.useCallback(y=>{h(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:c.jsx(Zs.ItemSlot,{scope:n,value:s,disabled:r,textValue:u,children:c.jsx(we.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:x,onFocus:Ee(o.onFocus,()=>g(!0)),onBlur:Ee(o.onBlur,()=>g(!1)),onClick:Ee(o.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Ee(o.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Ee(o.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:Ee(o.onPointerMove,y=>{var w;v.current=y.pointerType,r?(w=l.onItemLeave)==null||w.call(l):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ee(o.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Ee(o.onKeyDown,y=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&y.key===" "||(Cv.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});Du.displayName=Is;var Dn="SelectItemText",Lu=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=Mt(Dn,n),a=Nt(Dn,n),l=Iu(Dn,n),d=Tv(Dn,n),[u,h]=f.useState(null),m=Re(t,b=>h(b),l.onItemTextChange,b=>{var y;return(y=a.itemTextRefCallback)==null?void 0:y.call(a,b,l.value,l.disabled)}),g=u==null?void 0:u.textContent,x=f.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=d;return Ue(()=>(p(x),()=>v(x)),[p,v,x]),c.jsxs(c.Fragment,{children:[c.jsx(we.span,{id:l.textId,...i,ref:m}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ls.createPortal(i.children,o.valueNode):null]})});Lu.displayName=Dn;var Fu="SelectItemIndicator",Ou=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return Iu(Fu,n).isSelected?c.jsx(we.span,{"aria-hidden":!0,...s,ref:t}):null});Ou.displayName=Fu;var ho="SelectScrollUpButton",_u=f.forwardRef((e,t)=>{const n=Nt(ho,e.__scopeSelect),s=hi(ho,e.__scopeSelect),[r,i]=f.useState(!1),o=Re(t,s.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?c.jsx(Bu,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});_u.displayName=ho;var mo="SelectScrollDownButton",$u=f.forwardRef((e,t)=>{const n=Nt(mo,e.__scopeSelect),s=hi(mo,e.__scopeSelect),[r,i]=f.useState(!1),o=Re(t,s.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<d;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?c.jsx(Bu,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});$u.displayName=mo;var Bu=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=Nt("SelectScrollButton",n),o=f.useRef(null),a=Ws(n),l=f.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return f.useEffect(()=>()=>l(),[l]),Ue(()=>{var u;const d=a().find(h=>h.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),c.jsx(we.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:Ee(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:Ee(r.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:Ee(r.onPointerLeave,()=>{l()})})}),$v="SelectSeparator",Bv=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return c.jsx(we.div,{"aria-hidden":!0,...s,ref:t})});Bv.displayName=$v;var po="SelectArrow",Hv=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=Ks(n),i=Mt(po,n),o=Nt(po,n);return i.open&&o.position==="popper"?c.jsx(Ny,{...r,...s,ref:t}):null});Hv.displayName=po;var Uv="SelectBubbleInput",Hu=f.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const r=f.useRef(null),i=Re(s,r),o=Vy(t);return f.useEffect(()=>{const a=r.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&u){const h=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(h)}},[o,t]),c.jsx(we.select,{...n,style:{...du,...n.style},ref:i,defaultValue:t})});Hu.displayName=Uv;function Uu(e){return e===""||e===void 0}function zu(e){const t=Ut(e),n=f.useRef(""),s=f.useRef(0),r=f.useCallback(o=>{const a=n.current+o;t(a),function l(d){n.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function Zu(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=zv(e,Math.max(i,0));r.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function zv(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Zv=bu,Wv=Su,Kv=Eu,Yv=ku,Gv=Au,Xv=Tu,qv=Nu,Jv=Du,Qv=Lu,eb=Ou,tb=_u,nb=$u;function yl({...e}){return c.jsx(Zv,{"data-slot":"select",...e})}function vl({...e}){return c.jsx(Kv,{"data-slot":"select-value",...e})}function bl({className:e,size:t="default",children:n,...s}){return c.jsxs(Wv,{"data-slot":"select-trigger","data-size":t,className:Q(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...s,children:[n,c.jsx(Yv,{asChild:!0,children:c.jsx(Qo,{weight:"bold",className:"size-4 transition-colors"})})]})}function wl({className:e,children:t,position:n="popper",...s}){return c.jsx(Gv,{children:c.jsxs(Xv,{"data-slot":"select-content",className:Q(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[c.jsx(sb,{}),c.jsx(qv,{className:Q("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),c.jsx(rb,{})]})})}function Sl({className:e,children:t,...n}){return c.jsxs(Jv,{"data-slot":"select-item",className:Q(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...n,children:[c.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:c.jsx(eb,{children:c.jsx(md,{className:"size-4",weight:"bold"})})}),c.jsx(Qv,{children:t})]})}function sb({className:e,...t}){return c.jsx(tb,{"data-slot":"select-scroll-up-button",className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(fd,{className:"size-4",weight:"bold"})})}function rb({className:e,...t}){return c.jsx(nb,{"data-slot":"select-scroll-down-button",className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Qo,{className:"size-4",weight:"bold"})})}const Cl=Ds.cva(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function El({kind:e,track:t,requestPermissions:n,onError:s,client:r,...i}){const o=i.size||"default";if(!r)return c.jsxs(yl,{disabled:!0,children:[c.jsx(bl,{className:Q(Cl({size:o}),i.className),children:c.jsx(vl,{placeholder:`Select a ${e}`})}),c.jsx(wl,{children:c.jsx(Sl,{value:"none",children:"No devices available"})})]});const{devices:a,activeDeviceId:l,setActiveMediaDevice:d}=_1(r,e==="audioinput"?"audioinput":"videoinput");return c.jsxs(yl,{value:l,onValueChange:d,children:[c.jsx(bl,{className:Q(Cl({size:o}),i.className,"hover:bg"),children:o!=="sm"&&c.jsx(vl,{className:"font-mono text-sm",placeholder:`Select a ${e}`})}),c.jsx(wl,{children:a.map(u=>c.jsx(Sl,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function ob(e,t,n=!1){if(n)return ei;switch(e){case J.Track.Source.Microphone:return t?pd:gd;case J.Track.Source.Camera:return t?yd:vd;case J.Track.Source.ScreenShare:return xd;default:return f.Fragment}}function Pr({source:e,pressed:t,pending:n,className:s,...r}){const i=ob(e,t??!1,n),o=e===J.Track.Source.Microphone&&!(t??!1)&&!n,a=e===J.Track.Source.Camera&&!(t??!1)&&!n;return f.useEffect(()=>{console.log(`TrackToggle for ${e} changed: pressed=${t}, pending=${n}, actualState=${t?"enabled":"disabled"}`)},[e,t,n]),c.jsxs(Dd,{pressed:t,"aria-label":`Toggle ${e}`,className:Q(s),...r,children:[c.jsx(i,{weight:"bold",className:Q(n&&"animate-spin",o||a?"text-red-500":void 0)}),r.children]})}function ib(e){return e?L1(e):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function ab(e={}){const{controls:t,saveUserChoices:n=!0,client:s}=e,r={leave:!0,...t};if(!s)return{micTrackRef:{participant:void 0,source:J.Track.Source.Microphone,publication:void 0},visibleControls:r,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:i,localParticipant:o}=F1(s),a=ib(s);O1(s);const l=vr(s,"microphone",{onDeviceError:T=>{var A;return(A=e.onDeviceError)==null?void 0:A.call(e,{source:J.Track.Source.Microphone,error:T})}}),d=vr(s,"camera",{onDeviceError:T=>{var A;return(A=e.onDeviceError)==null?void 0:A.call(e,{source:J.Track.Source.Camera,error:T})}}),u=vr(s,"screenShare",{onDeviceError:T=>{var A;return(A=e.onDeviceError)==null?void 0:A.call(e,{source:J.Track.Source.ScreenShare,error:T})}}),h=f.useMemo(()=>{let T;if(o){for(const[,A]of o.trackPublications)if(A.source===J.Track.Source.Microphone){T=A;break}}return console.log("🎤 Creating micTrackRef:",{hasParticipant:!!o,hasPublication:!!T,isTrackSubscribed:T==null?void 0:T.isSubscribed,isMuted:T==null?void 0:T.isMuted,trackSid:T==null?void 0:T.trackSid}),{participant:o??void 0,source:J.Track.Source.Microphone,publication:T}},[o,i]);r.microphone??(r.microphone=a.microphone),r.screenShare??(r.screenShare=a.screenShare),r.camera??(r.camera=a.camera),r.chat??(r.chat=a.data);const{saveAudioInputEnabled:m,saveAudioInputDeviceId:g,saveVideoInputEnabled:x,saveVideoInputDeviceId:p}=$1({preventSave:!n}),v=f.useCallback(()=>{s&&s.disconnect()},[s]),b=f.useCallback(T=>{g(T??"default"),s&&s.setAudioInputDevice(T)},[g,s]),y=f.useCallback(T=>{p(T??"default"),s&&s.setVideoInputDevice(T)},[p,s]),w=f.useCallback(async T=>{u.enabled&&await u.toggle(!1),await d.toggle(T),x(!d.enabled)},[d,x,u]),S=f.useCallback(async T=>{await l.toggle(T),m(!l.enabled)},[l,m]),k=f.useCallback(async T=>{d.enabled&&await d.toggle(!1),await u.toggle(T)},[d,u]);return{micTrackRef:h,visibleControls:r,cameraToggle:{...d,toggle:w},microphoneToggle:{...l,toggle:S},screenShareToggle:{...u,toggle:k},handleDisconnect:v,handleAudioDeviceChange:b,handleVideoDeviceChange:y}}const lb={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},cb={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},db={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},kl={dark:lb,light:cb,vox:db};function Ve(e){return kl[e]||kl.vox}function ub({controls:e,saveUserChoices:t=!0,capabilities:n,className:s,onSendMessage:r,onChatOpenChange:i,onDisconnect:o,onDeviceError:a,theme:l="vox",client:d,...u}){const[h,m]=f.useState(!1),[g,x]=f.useState(!1),p=Ve(l),{micTrackRef:v,visibleControls:b,cameraToggle:y,microphoneToggle:w,screenShareToggle:S,handleAudioDeviceChange:k,handleVideoDeviceChange:T,handleDisconnect:A}=ab({controls:e,saveUserChoices:t,client:d}),j=async V=>{x(!0);try{await(r==null?void 0:r(V))}finally{x(!1)}};return f.useEffect(()=>{i==null||i(h)},[h,i]),f.useEffect(()=>{var V,I,$,F;console.log("🎤 AgentControlBar: micTrackRef changed:",{hasParticipant:!!v.participant,hasPublication:!!v.publication,source:v.source,isSubscribed:(V=v.publication)==null?void 0:V.isSubscribed,isMuted:(I=v.publication)==null?void 0:I.isMuted,trackSid:($=v.publication)==null?void 0:$.trackSid,hasTrack:!!((F=v.publication)!=null&&F.track)})},[v]),c.jsxs("div",{"aria-label":"Voice assistant controls",className:Q(p.controlBar,s),...u,children:[n.suportsChatInput&&c.jsxs("div",{inert:!h,className:Q("overflow-hidden transition-[height] relative duration-300 ease-in-out",h?"h-[64px] mb-3":"h-0"),children:[c.jsx("div",{className:"flex h-9 px-4 w-full",children:c.jsx(j1,{onSend:j,disabled:g,className:Q("w-full",p.chatInput)})}),c.jsx("hr",{className:"border-border my-2 mx-5"})]}),c.jsxs("div",{className:Q("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",l==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[c.jsxs("div",{className:"flex gap-y-2 justify-start",children:[b.microphone&&c.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[c.jsx(Pr,{variant:"primary",source:J.Track.Source.Microphone,pressed:w.enabled,disabled:w.pending,onPressedChange:w.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),c.jsx(ke.BarVisualizer,{barCount:3,trackRef:v,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:c.jsx("span",{className:Q(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),c.jsx(El,{size:"sm",kind:"audioinput",client:d,onError:a?V=>V instanceof Error?a({source:J.Track.Source.Microphone,error:V}):void 0:void 0,onActiveDeviceChange:k,className:Q(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&b.camera&&c.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[c.jsx(Pr,{variant:"primary",source:J.Track.Source.Camera,pressed:y.enabled,pending:y.pending,disabled:y.pending,onPressedChange:y.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),c.jsx(El,{size:"sm",kind:"videoinput",client:d,onError:a?V=>V instanceof Error?a({source:J.Track.Source.Camera,error:V}):void 0:void 0,onActiveDeviceChange:T,className:Q(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),n.suportsScreenShare&&b.screenShare&&c.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:c.jsx(Pr,{variant:"secondary",source:J.Track.Source.ScreenShare,pressed:S.enabled,disabled:S.pending,onPressedChange:S.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),b.chat&&c.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:c.jsx(Dd,{variant:"secondary","aria-label":"Toggle chat",pressed:h,onPressedChange:V=>{m(V)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:c.jsx(hd,{weight:"bold",className:"h-5 w-5"})})})]})]})}const fb=(e,t)=>{var a,l;const n=f.useMemo(()=>t?t(e.message):e.message,[e.message,t]),s=!!e.editTimestamp,r=new Date(e.timestamp),i=typeof navigator<"u"?navigator.language:"en-US",o=(a=e.from)!=null&&a.name&&e.from.name!==""?e.from.name:(l=e.from)==null?void 0:l.identity;return{message:n,hasBeenEdited:s,time:r,locale:i,name:o}},hb=({entry:e,messageFormatter:t,className:n,participantName:s,...r})=>{var u,h;const{message:i,time:o,locale:a}=fb(e,t),l=((u=e.from)==null?void 0:u.isLocal)??!1;Q("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",l?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const d=Q("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",l?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return c.jsx("li",{title:o.toLocaleTimeString(a,{timeStyle:"full"}),className:Q("group flex mb-2",l?"justify-end":"justify-start",n),...r,children:c.jsxs("div",{className:Q("flex w-fit max-w-full rounded-2xl border",l?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[c.jsx("span",{className:d,children:l?((h=s==null?void 0:s[0])==null?void 0:h.toUpperCase())||"U":"A"}),c.jsx("span",{className:Q("flex items-center text-xs break-words whitespace-pre-line",l?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:i})]})})};function mb(e){E.useEffect(()=>{function t(){const n=e.current;n&&(n.scrollTop=n.scrollHeight)}if(e.current){const n=new ResizeObserver(t);return n.observe(e.current),t(),()=>n.disconnect()}},[e])}const pb=({className:e,children:t,...n})=>{const s=E.useRef(null);return mb(s),c.jsx("div",{ref:s,className:Q("flex flex-col justify-end",e),...n,children:t})},gb=({state:e,audioTrack:t,className:n,ref:s})=>c.jsx("div",{ref:s,className:Q("",n),children:c.jsx(ke.BarVisualizer,{barCount:5,state:e,options:{minHeight:5},trackRef:t,className:Q("flex aspect-video w-40 items-center justify-center gap-1"),children:c.jsx("span",{className:Q(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})})}),xb=({videoTrack:e,className:t,ref:n})=>{var s,r;return c.jsx("div",{ref:n,className:Q(t),children:c.jsx(ke.VideoTrack,{trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e==null?void 0:e.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},yb=ce.create(ke.VideoTrack),vb=({trackRef:e,className:t,ref:n})=>{var s,r;return c.jsx("div",{className:Q("bg-muted overflow-hidden rounded-md",t),children:c.jsx(yb,{ref:n,trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e==null?void 0:e.publication.dimensions)==null?void 0:r.height)??0,className:Q("h-full w-auto")})})},Al=ce.create(vb),bb=ce.create(gb),wb=ce.create(xb),pt={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},tn={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function Sb(e){const{localParticipant:t}=ke.useLocalParticipant(),n=t.getTrackPublication(e);return E.useMemo(()=>n?{source:e,participant:t,publication:n}:void 0,[e,n,t])}function Cb({chatOpen:e}){const{state:t,audioTrack:n,videoTrack:s,agent:{isActive:r=!1}={}}=ke.useVoiceAssistant(),[i]=ke.useTracks([J.Track.Source.ScreenShare]),o=Sb(J.Track.Source.Camera),a=o&&!o.publication.isMuted,l=i&&!i.publication.isMuted,d=a||l,u={...pt.transition,delay:e?0:.15},h={...pt.animate,scale:e?1:3,transition:u},m={...pt.animate,transition:u},g=u,x=u,p=s!==void 0;return c.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:c.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:c.jsxs("div",{className:Q(tn.grid),children:[r&&c.jsx("div",{className:Q(["grid",!e&&tn.agentChatClosed,e&&d&&tn.agentChatOpenWithSecondTile,e&&!d&&tn.agentChatOpenWithoutSecondTile]),children:c.jsxs("div",{className:"h-full flex items-center justify-center",children:[!p&&c.jsx(bb,{layoutId:"agent",...pt,animate:h,transition:g,state:t,audioTrack:n,className:Q(e?"h-[90px]":"h-auto w-full")},"agent"),p&&c.jsx(wb,{layoutId:"avatar",...pt,animate:m,transition:x,videoTrack:s,className:Q(e?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),c.jsx("div",{className:Q(["grid",e&&tn.secondTileChatOpen,!e&&tn.secondTileChatClosed]),children:c.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[o&&a&&c.jsx(Al,{layout:"position",layoutId:"camera",...pt,trackRef:o,transition:{...pt.transition,delay:e?0:.15},className:"h-[60px] order-1"},"camera"),l&&c.jsx(Al,{layout:"position",layoutId:"screen",...pt,trackRef:i,transition:{...pt.transition,delay:e?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}/**
|
|
89
79
|
* @license lucide-react v0.522.0 - ISC
|
|
90
80
|
*
|
|
91
81
|
* This source code is licensed under the ISC license.
|
|
92
82
|
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
-
*/const
|
|
83
|
+
*/const Eb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),Tl=e=>{const t=kb(e);return t.charAt(0).toUpperCase()+t.slice(1)},Wu=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),Ab=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
94
84
|
* @license lucide-react v0.522.0 - ISC
|
|
95
85
|
*
|
|
96
86
|
* This source code is licensed under the ISC license.
|
|
97
87
|
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/var
|
|
88
|
+
*/var Tb={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
99
89
|
* @license lucide-react v0.522.0 - ISC
|
|
100
90
|
*
|
|
101
91
|
* This source code is licensed under the ISC license.
|
|
102
92
|
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
-
*/const
|
|
93
|
+
*/const jb=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},l)=>E.createElement("svg",{ref:l,...Tb,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Wu("lucide",r),...!i&&!Ab(a)&&{"aria-hidden":"true"},...a},[...o.map(([d,u])=>E.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
|
|
104
94
|
* @license lucide-react v0.522.0 - ISC
|
|
105
95
|
*
|
|
106
96
|
* This source code is licensed under the ISC license.
|
|
107
97
|
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
-
*/const
|
|
98
|
+
*/const Ie=(e,t)=>{const n=E.forwardRef(({className:s,...r},i)=>E.createElement(jb,{ref:i,iconNode:t,className:Wu(`lucide-${Eb(Tl(e))}`,`lucide-${e}`,s),...r}));return n.displayName=Tl(e),n};/**
|
|
109
99
|
* @license lucide-react v0.522.0 - ISC
|
|
110
100
|
*
|
|
111
101
|
* This source code is licensed under the ISC license.
|
|
112
102
|
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
-
*/const
|
|
103
|
+
*/const Pb=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Mb=Ie("archive",Pb);/**
|
|
114
104
|
* @license lucide-react v0.522.0 - ISC
|
|
115
105
|
*
|
|
116
106
|
* This source code is licensed under the ISC license.
|
|
117
107
|
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
-
*/const
|
|
108
|
+
*/const Nb=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]],Ku=Ie("camera-off",Nb);/**
|
|
119
109
|
* @license lucide-react v0.522.0 - ISC
|
|
120
110
|
*
|
|
121
111
|
* This source code is licensed under the ISC license.
|
|
122
112
|
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
-
*/const
|
|
113
|
+
*/const Rb=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Yu=Ie("camera",Rb);/**
|
|
124
114
|
* @license lucide-react v0.522.0 - ISC
|
|
125
115
|
*
|
|
126
116
|
* This source code is licensed under the ISC license.
|
|
127
117
|
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
-
*/const
|
|
118
|
+
*/const Vb=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ib=Ie("download",Vb);/**
|
|
129
119
|
* @license lucide-react v0.522.0 - ISC
|
|
130
120
|
*
|
|
131
121
|
* This source code is licensed under the ISC license.
|
|
132
122
|
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
-
*/const
|
|
123
|
+
*/const Db=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Lb=Ie("file-text",Db);/**
|
|
134
124
|
* @license lucide-react v0.522.0 - ISC
|
|
135
125
|
*
|
|
136
126
|
* This source code is licensed under the ISC license.
|
|
137
127
|
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
-
*/const
|
|
128
|
+
*/const Fb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ob=Ie("image",Fb);/**
|
|
139
129
|
* @license lucide-react v0.522.0 - ISC
|
|
140
130
|
*
|
|
141
131
|
* This source code is licensed under the ISC license.
|
|
142
132
|
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
-
*/const
|
|
133
|
+
*/const _b=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],$b=Ie("layout-grid",_b);/**
|
|
144
134
|
* @license lucide-react v0.522.0 - ISC
|
|
145
135
|
*
|
|
146
136
|
* This source code is licensed under the ISC license.
|
|
147
137
|
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
-
*/const
|
|
138
|
+
*/const Bb=[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Hb=Ie("monitor-off",Bb);/**
|
|
149
139
|
* @license lucide-react v0.522.0 - ISC
|
|
150
140
|
*
|
|
151
141
|
* This source code is licensed under the ISC license.
|
|
152
142
|
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
-
*/const
|
|
143
|
+
*/const Ub=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],zb=Ie("monitor",Ub);/**
|
|
154
144
|
* @license lucide-react v0.522.0 - ISC
|
|
155
145
|
*
|
|
156
146
|
* This source code is licensed under the ISC license.
|
|
157
147
|
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
-
*/const
|
|
148
|
+
*/const Zb=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Wb=Ie("music",Zb);/**
|
|
159
149
|
* @license lucide-react v0.522.0 - ISC
|
|
160
150
|
*
|
|
161
151
|
* This source code is licensed under the ISC license.
|
|
162
152
|
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
-
*/const
|
|
153
|
+
*/const Kb=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Yb=Ie("paperclip",Kb);/**
|
|
164
154
|
* @license lucide-react v0.522.0 - ISC
|
|
165
155
|
*
|
|
166
156
|
* This source code is licensed under the ISC license.
|
|
167
157
|
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
-
*/const
|
|
158
|
+
*/const Gb=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272",key:"1wngk7"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473",key:"10hv5p"}]],Gu=Ie("phone-off",Gb);/**
|
|
169
159
|
* @license lucide-react v0.522.0 - ISC
|
|
170
160
|
*
|
|
171
161
|
* This source code is licensed under the ISC license.
|
|
172
162
|
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
-
*/const
|
|
163
|
+
*/const Xb=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],qb=Ie("send-horizontal",Xb);/**
|
|
174
164
|
* @license lucide-react v0.522.0 - ISC
|
|
175
165
|
*
|
|
176
166
|
* This source code is licensed under the ISC license.
|
|
177
167
|
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
-
*/const
|
|
168
|
+
*/const Jb=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Qb=Ie("user",Jb);/**
|
|
179
169
|
* @license lucide-react v0.522.0 - ISC
|
|
180
170
|
*
|
|
181
171
|
* This source code is licensed under the ISC license.
|
|
182
172
|
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
-
*/const
|
|
173
|
+
*/const e2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],t2=Ie("users",e2);/**
|
|
184
174
|
* @license lucide-react v0.522.0 - ISC
|
|
185
175
|
*
|
|
186
176
|
* This source code is licensed under the ISC license.
|
|
187
177
|
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
-
*/const
|
|
178
|
+
*/const n2=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],s2=Ie("video",n2);/**
|
|
189
179
|
* @license lucide-react v0.522.0 - ISC
|
|
190
180
|
*
|
|
191
181
|
* This source code is licensed under the ISC license.
|
|
192
182
|
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
-
*/const iO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rO=ht("x",iO);function ag({timeout:t}){const[e,n]=M.useState(100),i=M.useRef(null),r=M.useRef(null);return M.useEffect(()=>{if(!t||t<=0)return;n(100),r.current=Date.now();const s=()=>{if(!t||r.current===null)return;const o=Date.now()-r.current,a=Math.max(0,100-o/t*100);n(a),a>0&&(i.current=requestAnimationFrame(s))};return i.current=requestAnimationFrame(s),()=>{i.current&&cancelAnimationFrame(i.current)}},[t]),!t||t<=0?null:m.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:m.jsx(ge.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(e,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function _r({interaction:t,theme:e,onDismiss:n,client:i,addLocalMessage:r}){var a;if(!t||!t.isVisible||!t.component)return null;const[s]=g.useState(()=>Date.now()),o=()=>t.component?g.createElement(t.component,{handler:t.handler||void 0,timeout:t.timeout,loadData:async l=>{console.log("InteractiveComponent: Loading data:",l)},presentationMode:t.presentationMode,data:t.data,client:i,addLocalMessage:r}):m.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(t.presentationMode){case"fullscreen":return m.jsx(yr,{children:m.jsxs(ge.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[m.jsxs("div",{className:"flex flex-col",children:[m.jsx(ag,{timeout:t.timeout}),m.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[m.jsx("h3",{className:"text-lg font-semibold",children:t.methodName.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}),m.jsx("button",{onClick:n||((a=t.handler)==null?void 0:a.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:m.jsx(rO,{className:"w-5 h-5"})})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o()})]})});case"embedded":default:return m.jsx(yr,{children:m.jsx(ge.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:m.jsxs("div",{children:[m.jsx(ag,{timeout:t.timeout}),o()]})})})}}function sO(){const t=n4(),e=GI(),n=$s();return{messages:M.useMemo(()=>[...t.map(s=>fM(s,n)),...e.chatMessages].sort((s,o)=>s.timestamp-o.timestamp),[t,e.chatMessages,n]),send:e.send}}const oO=({logLevel:t}={})=>{const e=$s();g.useEffect(()=>(Tk(t??"debug"),window.__lk_room=e,()=>{window.__lk_room=void 0}),[e,t])},cg=t=>t,aO=()=>{let t=cg;return{configure(e){t=e},generate(e){return t(e)},reset(){t=cg}}},cO=aO();function ai(t,...e){const n=new URL(`https://mui.com/production-error/?code=${t}`);return e.forEach(i=>n.searchParams.append("args[]",i)),`Minified MUI error #${t}; visit ${n} for the full message.`}function Bi(t){if(typeof t!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":ai(7));return t.charAt(0).toUpperCase()+t.slice(1)}function lO(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var po={exports:{}},go={exports:{}},Ce={};/** @license React v16.13.1
|
|
194
|
-
* react-is.production.min.js
|
|
195
|
-
*
|
|
196
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the MIT license found in the
|
|
199
|
-
* LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/var lg;function dO(){if(lg)return Ce;lg=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,r=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,a=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,l=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,u=t?Symbol.for("react.suspense"):60113,h=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,v=t?Symbol.for("react.lazy"):60116,f=t?Symbol.for("react.block"):60121,y=t?Symbol.for("react.fundamental"):60117,b=t?Symbol.for("react.responder"):60118,S=t?Symbol.for("react.scope"):60119;function k(x){if(typeof x=="object"&&x!==null){var T=x.$$typeof;switch(T){case e:switch(x=x.type,x){case c:case l:case i:case s:case r:case u:return x;default:switch(x=x&&x.$$typeof,x){case a:case d:case v:case p:case o:return x;default:return T}}case n:return T}}}function w(x){return k(x)===l}return Ce.AsyncMode=c,Ce.ConcurrentMode=l,Ce.ContextConsumer=a,Ce.ContextProvider=o,Ce.Element=e,Ce.ForwardRef=d,Ce.Fragment=i,Ce.Lazy=v,Ce.Memo=p,Ce.Portal=n,Ce.Profiler=s,Ce.StrictMode=r,Ce.Suspense=u,Ce.isAsyncMode=function(x){return w(x)||k(x)===c},Ce.isConcurrentMode=w,Ce.isContextConsumer=function(x){return k(x)===a},Ce.isContextProvider=function(x){return k(x)===o},Ce.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===e},Ce.isForwardRef=function(x){return k(x)===d},Ce.isFragment=function(x){return k(x)===i},Ce.isLazy=function(x){return k(x)===v},Ce.isMemo=function(x){return k(x)===p},Ce.isPortal=function(x){return k(x)===n},Ce.isProfiler=function(x){return k(x)===s},Ce.isStrictMode=function(x){return k(x)===r},Ce.isSuspense=function(x){return k(x)===u},Ce.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===i||x===l||x===s||x===r||x===u||x===h||typeof x=="object"&&x!==null&&(x.$$typeof===v||x.$$typeof===p||x.$$typeof===o||x.$$typeof===a||x.$$typeof===d||x.$$typeof===y||x.$$typeof===b||x.$$typeof===S||x.$$typeof===f)},Ce.typeOf=k,Ce}var Te={};/** @license React v16.13.1
|
|
201
|
-
* react-is.development.js
|
|
202
|
-
*
|
|
203
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
204
|
-
*
|
|
205
|
-
* This source code is licensed under the MIT license found in the
|
|
206
|
-
* LICENSE file in the root directory of this source tree.
|
|
207
|
-
*/var dg;function uO(){return dg||(dg=1,process.env.NODE_ENV!=="production"&&function(){var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,r=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,a=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,l=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,u=t?Symbol.for("react.suspense"):60113,h=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,v=t?Symbol.for("react.lazy"):60116,f=t?Symbol.for("react.block"):60121,y=t?Symbol.for("react.fundamental"):60117,b=t?Symbol.for("react.responder"):60118,S=t?Symbol.for("react.scope"):60119;function k(H){return typeof H=="string"||typeof H=="function"||H===i||H===l||H===s||H===r||H===u||H===h||typeof H=="object"&&H!==null&&(H.$$typeof===v||H.$$typeof===p||H.$$typeof===o||H.$$typeof===a||H.$$typeof===d||H.$$typeof===y||H.$$typeof===b||H.$$typeof===S||H.$$typeof===f)}function w(H){if(typeof H=="object"&&H!==null){var ue=H.$$typeof;switch(ue){case e:var we=H.type;switch(we){case c:case l:case i:case s:case r:case u:return we;default:var rt=we&&we.$$typeof;switch(rt){case a:case d:case v:case p:case o:return rt;default:return ue}}case n:return ue}}}var x=c,T=l,E=a,P=o,I=e,C=d,A=i,N=v,Z=p,Q=n,se=s,te=r,Y=u,_=!1;function ie(H){return _||(_=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),L(H)||w(H)===c}function L(H){return w(H)===l}function F(H){return w(H)===a}function ee(H){return w(H)===o}function j(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function W(H){return w(H)===d}function J(H){return w(H)===i}function G(H){return w(H)===v}function O(H){return w(H)===p}function $(H){return w(H)===n}function X(H){return w(H)===s}function z(H){return w(H)===r}function oe(H){return w(H)===u}Te.AsyncMode=x,Te.ConcurrentMode=T,Te.ContextConsumer=E,Te.ContextProvider=P,Te.Element=I,Te.ForwardRef=C,Te.Fragment=A,Te.Lazy=N,Te.Memo=Z,Te.Portal=Q,Te.Profiler=se,Te.StrictMode=te,Te.Suspense=Y,Te.isAsyncMode=ie,Te.isConcurrentMode=L,Te.isContextConsumer=F,Te.isContextProvider=ee,Te.isElement=j,Te.isForwardRef=W,Te.isFragment=J,Te.isLazy=G,Te.isMemo=O,Te.isPortal=$,Te.isProfiler=X,Te.isStrictMode=z,Te.isSuspense=oe,Te.isValidElementType=k,Te.typeOf=w}()),Te}var ug;function zx(){return ug||(ug=1,process.env.NODE_ENV==="production"?go.exports=dO():go.exports=uO()),go.exports}/*
|
|
208
|
-
object-assign
|
|
209
|
-
(c) Sindre Sorhus
|
|
210
|
-
@license MIT
|
|
211
|
-
*/var rl,hg;function hO(){if(hg)return rl;hg=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function r(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(o).map(function(d){return o[d]});if(c.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(d){l[d]=d}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return rl=r()?Object.assign:function(s,o){for(var a,c=i(s),l,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var u in a)e.call(a,u)&&(c[u]=a[u]);if(t){l=t(a);for(var h=0;h<l.length;h++)n.call(a,l[h])&&(c[l[h]]=a[l[h]])}}return c},rl}var sl,fg;function bh(){if(fg)return sl;fg=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return sl=t,sl}var ol,mg;function Wx(){return mg||(mg=1,ol=Function.call.bind(Object.prototype.hasOwnProperty)),ol}var al,pg;function fO(){if(pg)return al;pg=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var e=bh(),n={},i=Wx();t=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function r(s,o,a,c,l){if(process.env.NODE_ENV!=="production"){for(var d in s)if(i(s,d)){var u;try{if(typeof s[d]!="function"){var h=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}u=s[d](o,d,c,a,null,e)}catch(v){u=v}if(u&&!(u instanceof Error)&&t((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in n)){n[u.message]=!0;var p=l?l():"";t("Failed "+a+" type: "+u.message+(p??""))}}}}return r.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},al=r,al}var cl,gg;function mO(){if(gg)return cl;gg=1;var t=zx(),e=hO(),n=bh(),i=Wx(),r=fO(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function o(){return null}return cl=function(a,c){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function u(L){var F=L&&(l&&L[l]||L[d]);if(typeof F=="function")return F}var h="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:S(),arrayOf:k,element:w(),elementType:x(),instanceOf:T,node:C(),objectOf:P,oneOf:E,oneOfType:I,shape:N,exact:Z};function v(L,F){return L===F?L!==0||1/L===1/F:L!==L&&F!==F}function f(L,F){this.message=L,this.data=F&&typeof F=="object"?F:{},this.stack=""}f.prototype=Error.prototype;function y(L){if(process.env.NODE_ENV!=="production")var F={},ee=0;function j(J,G,O,$,X,z,oe){if($=$||h,z=z||O,oe!==n){if(c){var H=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw H.name="Invariant Violation",H}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ue=$+":"+O;!F[ue]&&ee<3&&(s("You are manually calling a React.PropTypes validation function for the `"+z+"` prop on `"+$+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),F[ue]=!0,ee++)}}return G[O]==null?J?G[O]===null?new f("The "+X+" `"+z+"` is marked as required "+("in `"+$+"`, but its value is `null`.")):new f("The "+X+" `"+z+"` is marked as required in "+("`"+$+"`, but its value is `undefined`.")):null:L(G,O,$,X,z)}var W=j.bind(null,!1);return W.isRequired=j.bind(null,!0),W}function b(L){function F(ee,j,W,J,G,O){var $=ee[j],X=te($);if(X!==L){var z=Y($);return new f("Invalid "+J+" `"+G+"` of type "+("`"+z+"` supplied to `"+W+"`, expected ")+("`"+L+"`."),{expectedType:L})}return null}return y(F)}function S(){return y(o)}function k(L){function F(ee,j,W,J,G){if(typeof L!="function")return new f("Property `"+G+"` of component `"+W+"` has invalid PropType notation inside arrayOf.");var O=ee[j];if(!Array.isArray(O)){var $=te(O);return new f("Invalid "+J+" `"+G+"` of type "+("`"+$+"` supplied to `"+W+"`, expected an array."))}for(var X=0;X<O.length;X++){var z=L(O,X,W,J,G+"["+X+"]",n);if(z instanceof Error)return z}return null}return y(F)}function w(){function L(F,ee,j,W,J){var G=F[ee];if(!a(G)){var O=te(G);return new f("Invalid "+W+" `"+J+"` of type "+("`"+O+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return y(L)}function x(){function L(F,ee,j,W,J){var G=F[ee];if(!t.isValidElementType(G)){var O=te(G);return new f("Invalid "+W+" `"+J+"` of type "+("`"+O+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return y(L)}function T(L){function F(ee,j,W,J,G){if(!(ee[j]instanceof L)){var O=L.name||h,$=ie(ee[j]);return new f("Invalid "+J+" `"+G+"` of type "+("`"+$+"` supplied to `"+W+"`, expected ")+("instance of `"+O+"`."))}return null}return y(F)}function E(L){if(!Array.isArray(L))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function F(ee,j,W,J,G){for(var O=ee[j],$=0;$<L.length;$++)if(v(O,L[$]))return null;var X=JSON.stringify(L,function(oe,H){var ue=Y(H);return ue==="symbol"?String(H):H});return new f("Invalid "+J+" `"+G+"` of value `"+String(O)+"` "+("supplied to `"+W+"`, expected one of "+X+"."))}return y(F)}function P(L){function F(ee,j,W,J,G){if(typeof L!="function")return new f("Property `"+G+"` of component `"+W+"` has invalid PropType notation inside objectOf.");var O=ee[j],$=te(O);if($!=="object")return new f("Invalid "+J+" `"+G+"` of type "+("`"+$+"` supplied to `"+W+"`, expected an object."));for(var X in O)if(i(O,X)){var z=L(O,X,W,J,G+"."+X,n);if(z instanceof Error)return z}return null}return y(F)}function I(L){if(!Array.isArray(L))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var F=0;F<L.length;F++){var ee=L[F];if(typeof ee!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+_(ee)+" at index "+F+"."),o}function j(W,J,G,O,$){for(var X=[],z=0;z<L.length;z++){var oe=L[z],H=oe(W,J,G,O,$,n);if(H==null)return null;H.data&&i(H.data,"expectedType")&&X.push(H.data.expectedType)}var ue=X.length>0?", expected one of type ["+X.join(", ")+"]":"";return new f("Invalid "+O+" `"+$+"` supplied to "+("`"+G+"`"+ue+"."))}return y(j)}function C(){function L(F,ee,j,W,J){return Q(F[ee])?null:new f("Invalid "+W+" `"+J+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return y(L)}function A(L,F,ee,j,W){return new f((L||"React class")+": "+F+" type `"+ee+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+W+"`.")}function N(L){function F(ee,j,W,J,G){var O=ee[j],$=te(O);if($!=="object")return new f("Invalid "+J+" `"+G+"` of type `"+$+"` "+("supplied to `"+W+"`, expected `object`."));for(var X in L){var z=L[X];if(typeof z!="function")return A(W,J,G,X,Y(z));var oe=z(O,X,W,J,G+"."+X,n);if(oe)return oe}return null}return y(F)}function Z(L){function F(ee,j,W,J,G){var O=ee[j],$=te(O);if($!=="object")return new f("Invalid "+J+" `"+G+"` of type `"+$+"` "+("supplied to `"+W+"`, expected `object`."));var X=e({},ee[j],L);for(var z in X){var oe=L[z];if(i(L,z)&&typeof oe!="function")return A(W,J,G,z,Y(oe));if(!oe)return new f("Invalid "+J+" `"+G+"` key `"+z+"` supplied to `"+W+"`.\nBad object: "+JSON.stringify(ee[j],null," ")+`
|
|
212
|
-
Valid keys: `+JSON.stringify(Object.keys(L),null," "));var H=oe(O,z,W,J,G+"."+z,n);if(H)return H}return null}return y(F)}function Q(L){switch(typeof L){case"number":case"string":case"undefined":return!0;case"boolean":return!L;case"object":if(Array.isArray(L))return L.every(Q);if(L===null||a(L))return!0;var F=u(L);if(F){var ee=F.call(L),j;if(F!==L.entries){for(;!(j=ee.next()).done;)if(!Q(j.value))return!1}else for(;!(j=ee.next()).done;){var W=j.value;if(W&&!Q(W[1]))return!1}}else return!1;return!0;default:return!1}}function se(L,F){return L==="symbol"?!0:F?F["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&F instanceof Symbol:!1}function te(L){var F=typeof L;return Array.isArray(L)?"array":L instanceof RegExp?"object":se(F,L)?"symbol":F}function Y(L){if(typeof L>"u"||L===null)return""+L;var F=te(L);if(F==="object"){if(L instanceof Date)return"date";if(L instanceof RegExp)return"regexp"}return F}function _(L){var F=Y(L);switch(F){case"array":case"object":return"an "+F;case"boolean":case"date":case"regexp":return"a "+F;default:return F}}function ie(L){return!L.constructor||!L.constructor.name?h:L.constructor.name}return p.checkPropTypes=r,p.resetWarningCache=r.resetWarningCache,p.PropTypes=p,p},cl}var ll,vg;function pO(){if(vg)return ll;vg=1;var t=bh();function e(){}function n(){}return n.resetWarningCache=e,ll=function(){function i(o,a,c,l,d,u){if(u!==t){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}i.isRequired=i;function r(){return i}var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:r,element:i,elementType:i,instanceOf:r,node:i,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:e};return s.PropTypes=s,s},ll}var yg;function gO(){if(yg)return po.exports;if(yg=1,process.env.NODE_ENV!=="production"){var t=zx(),e=!0;po.exports=mO()(t.isElement,e)}else po.exports=pO()();return po.exports}var vO=gO();const xe=lO(vO);function yO(t,e,n=void 0){const i={};for(const r in t){const s=t[r];let o="",a=!0;for(let c=0;c<s.length;c+=1){const l=s[c];l&&(o+=(a===!0?"":" ")+e(l),a=!1,n&&n[l]&&(o+=" "+n[l]))}i[r]=o}return i}var vo={exports:{}},Ee={};/**
|
|
213
|
-
* @license React
|
|
214
|
-
* react-is.production.js
|
|
215
|
-
*
|
|
216
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the MIT license found in the
|
|
219
|
-
* LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/var bg;function bO(){if(bg)return Ee;bg=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),h=Symbol.for("react.view_transition"),p=Symbol.for("react.client.reference");function v(f){if(typeof f=="object"&&f!==null){var y=f.$$typeof;switch(y){case t:switch(f=f.type,f){case n:case r:case i:case c:case l:case h:return f;default:switch(f=f&&f.$$typeof,f){case o:case a:case u:case d:return f;case s:return f;default:return y}}case e:return y}}}return Ee.ContextConsumer=s,Ee.ContextProvider=o,Ee.Element=t,Ee.ForwardRef=a,Ee.Fragment=n,Ee.Lazy=u,Ee.Memo=d,Ee.Portal=e,Ee.Profiler=r,Ee.StrictMode=i,Ee.Suspense=c,Ee.SuspenseList=l,Ee.isContextConsumer=function(f){return v(f)===s},Ee.isContextProvider=function(f){return v(f)===o},Ee.isElement=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===t},Ee.isForwardRef=function(f){return v(f)===a},Ee.isFragment=function(f){return v(f)===n},Ee.isLazy=function(f){return v(f)===u},Ee.isMemo=function(f){return v(f)===d},Ee.isPortal=function(f){return v(f)===e},Ee.isProfiler=function(f){return v(f)===r},Ee.isStrictMode=function(f){return v(f)===i},Ee.isSuspense=function(f){return v(f)===c},Ee.isSuspenseList=function(f){return v(f)===l},Ee.isValidElementType=function(f){return typeof f=="string"||typeof f=="function"||f===n||f===r||f===i||f===c||f===l||typeof f=="object"&&f!==null&&(f.$$typeof===u||f.$$typeof===d||f.$$typeof===o||f.$$typeof===s||f.$$typeof===a||f.$$typeof===p||f.getModuleId!==void 0)},Ee.typeOf=v,Ee}var Pe={};/**
|
|
221
|
-
* @license React
|
|
222
|
-
* react-is.development.js
|
|
223
|
-
*
|
|
224
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
225
|
-
*
|
|
226
|
-
* This source code is licensed under the MIT license found in the
|
|
227
|
-
* LICENSE file in the root directory of this source tree.
|
|
228
|
-
*/var xg;function xO(){return xg||(xg=1,process.env.NODE_ENV!=="production"&&function(){function t(f){if(typeof f=="object"&&f!==null){var y=f.$$typeof;switch(y){case e:switch(f=f.type,f){case i:case s:case r:case l:case d:case p:return f;default:switch(f=f&&f.$$typeof,f){case a:case c:case h:case u:return f;case o:return f;default:return y}}case n:return y}}}var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.view_transition"),v=Symbol.for("react.client.reference");Pe.ContextConsumer=o,Pe.ContextProvider=a,Pe.Element=e,Pe.ForwardRef=c,Pe.Fragment=i,Pe.Lazy=h,Pe.Memo=u,Pe.Portal=n,Pe.Profiler=s,Pe.StrictMode=r,Pe.Suspense=l,Pe.SuspenseList=d,Pe.isContextConsumer=function(f){return t(f)===o},Pe.isContextProvider=function(f){return t(f)===a},Pe.isElement=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===e},Pe.isForwardRef=function(f){return t(f)===c},Pe.isFragment=function(f){return t(f)===i},Pe.isLazy=function(f){return t(f)===h},Pe.isMemo=function(f){return t(f)===u},Pe.isPortal=function(f){return t(f)===n},Pe.isProfiler=function(f){return t(f)===s},Pe.isStrictMode=function(f){return t(f)===r},Pe.isSuspense=function(f){return t(f)===l},Pe.isSuspenseList=function(f){return t(f)===d},Pe.isValidElementType=function(f){return typeof f=="string"||typeof f=="function"||f===i||f===s||f===r||f===l||f===d||typeof f=="object"&&f!==null&&(f.$$typeof===h||f.$$typeof===u||f.$$typeof===a||f.$$typeof===o||f.$$typeof===c||f.$$typeof===v||f.getModuleId!==void 0)},Pe.typeOf=t}()),Pe}var wg;function wO(){return wg||(wg=1,process.env.NODE_ENV==="production"?vo.exports=bO():vo.exports=xO()),vo.exports}var va=wO();function In(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function qx(t){if(g.isValidElement(t)||va.isValidElementType(t)||!In(t))return t;const e={};return Object.keys(t).forEach(n=>{e[n]=qx(t[n])}),e}function At(t,e,n={clone:!0}){const i=n.clone?{...t}:t;return In(t)&&In(e)&&Object.keys(e).forEach(r=>{g.isValidElement(e[r])||va.isValidElementType(e[r])?i[r]=e[r]:In(e[r])&&Object.prototype.hasOwnProperty.call(t,r)&&In(t[r])?i[r]=At(t[r],e[r],n):n.clone?i[r]=In(e[r])?qx(e[r]):e[r]:i[r]=e[r]}),i}function vs(t,e){return e?At(t,e,{clone:!1}):t}const gi=process.env.NODE_ENV!=="production"?xe.oneOfType([xe.number,xe.string,xe.object,xe.array]):{};function Sg(t,e){if(!t.containerQueries)return e;const n=Object.keys(e).filter(i=>i.startsWith("@container")).sort((i,r)=>{var o,a;const s=/min-width:\s*([0-9.]+)/;return+(((o=i.match(s))==null?void 0:o[1])||0)-+(((a=r.match(s))==null?void 0:a[1])||0)});return n.length?n.reduce((i,r)=>{const s=e[r];return delete i[r],i[r]=s,i},{...e}):e}function SO(t,e){return e==="@"||e.startsWith("@")&&(t.some(n=>e.startsWith(`@${n}`))||!!e.match(/^@\d/))}function kO(t,e){const n=e.match(/^@([^/]+)?\/?(.+)?$/);if(!n){if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The provided shorthand ${`(${e})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
229
|
-
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:ai(18,`(${e})`));return null}const[,i,r]=n,s=Number.isNaN(+i)?i||0:+i;return t.containerQueries(r).up(s)}function CO(t){const e=(s,o)=>s.replace("@media",o?`@container ${o}`:"@container");function n(s,o){s.up=(...a)=>e(t.breakpoints.up(...a),o),s.down=(...a)=>e(t.breakpoints.down(...a),o),s.between=(...a)=>e(t.breakpoints.between(...a),o),s.only=(...a)=>e(t.breakpoints.only(...a),o),s.not=(...a)=>{const c=e(t.breakpoints.not(...a),o);return c.includes("not all and")?c.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):c}}const i={},r=s=>(n(i,s),i);return n(r),{...t,containerQueries:r}}const Ba={xs:0,sm:600,md:900,lg:1200,xl:1536},kg={keys:["xs","sm","md","lg","xl"],up:t=>`@media (min-width:${Ba[t]}px)`},TO={containerQueries:t=>({up:e=>{let n=typeof e=="number"?e:Ba[e]||e;return typeof n=="number"&&(n=`${n}px`),t?`@container ${t} (min-width:${n})`:`@container (min-width:${n})`}})};function Vn(t,e,n){const i=t.theme||{};if(Array.isArray(e)){const s=i.breakpoints||kg;return e.reduce((o,a,c)=>(o[s.up(s.keys[c])]=n(e[c]),o),{})}if(typeof e=="object"){const s=i.breakpoints||kg;return Object.keys(e).reduce((o,a)=>{if(SO(s.keys,a)){const c=kO(i.containerQueries?i:TO,a);c&&(o[c]=n(e[a],a))}else if(Object.keys(s.values||Ba).includes(a)){const c=s.up(a);o[c]=n(e[a],a)}else{const c=a;o[c]=e[c]}return o},{})}return n(e)}function EO(t={}){var n;return((n=t.keys)==null?void 0:n.reduce((i,r)=>{const s=t.up(r);return i[s]={},i},{}))||{}}function Cg(t,e){return t.reduce((n,i)=>{const r=n[i];return(!r||Object.keys(r).length===0)&&delete n[i],n},e)}function $a(t,e,n=!0){if(!e||typeof e!="string")return null;if(t&&t.vars&&n){const i=`vars.${e}`.split(".").reduce((r,s)=>r&&r[s]?r[s]:null,t);if(i!=null)return i}return e.split(".").reduce((i,r)=>i&&i[r]!=null?i[r]:null,t)}function ya(t,e,n,i=n){let r;return typeof t=="function"?r=t(n):Array.isArray(t)?r=t[n]||i:r=$a(t,n)||i,e&&(r=e(r,i,t)),r}function Ze(t){const{prop:e,cssProperty:n=t.prop,themeKey:i,transform:r}=t,s=o=>{if(o[e]==null)return null;const a=o[e],c=o.theme,l=$a(c,i)||{};return Vn(o,a,u=>{let h=ya(l,r,u);return u===h&&typeof u=="string"&&(h=ya(l,r,`${e}${u==="default"?"":Bi(u)}`,u)),n===!1?h:{[n]:h}})};return s.propTypes=process.env.NODE_ENV!=="production"?{[e]:gi}:{},s.filterProps=[e],s}function PO(t){const e={};return n=>(e[n]===void 0&&(e[n]=t(n)),e[n])}const RO={m:"margin",p:"padding"},AO={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},Tg={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},IO=PO(t=>{if(t.length>2)if(Tg[t])t=Tg[t];else return[t];const[e,n]=t.split(""),i=RO[e],r=AO[n]||"";return Array.isArray(r)?r.map(s=>i+s):[i+r]}),Ha=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],za=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],MO=[...Ha,...za];function Ws(t,e,n,i){const r=$a(t,e,!0)??n;return typeof r=="number"||typeof r=="string"?s=>typeof s=="string"?s:(process.env.NODE_ENV!=="production"&&typeof s!="number"&&console.error(`MUI: Expected ${i} argument to be a number or a string, got ${s}.`),typeof r=="string"?r.startsWith("var(")&&s===0?0:r.startsWith("var(")&&s===1?r:`calc(${s} * ${r})`:r*s):Array.isArray(r)?s=>{if(typeof s=="string")return s;const o=Math.abs(s);process.env.NODE_ENV!=="production"&&(Number.isInteger(o)?o>r.length-1&&console.error([`MUI: The value provided (${o}) overflows.`,`The supported values are: ${JSON.stringify(r)}.`,`${o} > ${r.length-1}, you need to add the missing values.`].join(`
|
|
230
|
-
`)):console.error([`MUI: The \`theme.${e}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${e}\` as a number.`].join(`
|
|
231
|
-
`)));const a=r[o];return s>=0?a:typeof a=="number"?-a:typeof a=="string"&&a.startsWith("var(")?`calc(-1 * ${a})`:`-${a}`}:typeof r=="function"?r:(process.env.NODE_ENV!=="production"&&console.error([`MUI: The \`theme.${e}\` value (${r}) is invalid.`,"It should be a number, an array or a function."].join(`
|
|
232
|
-
`)),()=>{})}function xh(t){return Ws(t,"spacing",8,"spacing")}function qs(t,e){return typeof e=="string"||e==null?e:t(e)}function NO(t,e){return n=>t.reduce((i,r)=>(i[r]=qs(e,n),i),{})}function _O(t,e,n,i){if(!e.includes(n))return null;const r=IO(n),s=NO(r,i),o=t[n];return Vn(t,o,s)}function Gx(t,e){const n=xh(t.theme);return Object.keys(t).map(i=>_O(t,e,i,n)).reduce(vs,{})}function Ue(t){return Gx(t,Ha)}Ue.propTypes=process.env.NODE_ENV!=="production"?Ha.reduce((t,e)=>(t[e]=gi,t),{}):{};Ue.filterProps=Ha;function Be(t){return Gx(t,za)}Be.propTypes=process.env.NODE_ENV!=="production"?za.reduce((t,e)=>(t[e]=gi,t),{}):{};Be.filterProps=za;process.env.NODE_ENV!=="production"&&MO.reduce((t,e)=>(t[e]=gi,t),{});function Wa(...t){const e=t.reduce((i,r)=>(r.filterProps.forEach(s=>{i[s]=r}),i),{}),n=i=>Object.keys(i).reduce((r,s)=>e[s]?vs(r,e[s](i)):r,{});return n.propTypes=process.env.NODE_ENV!=="production"?t.reduce((i,r)=>Object.assign(i,r.propTypes),{}):{},n.filterProps=t.reduce((i,r)=>i.concat(r.filterProps),[]),n}function Ot(t){return typeof t!="number"?t:`${t}px solid`}function Vt(t,e){return Ze({prop:t,themeKey:"borders",transform:e})}const OO=Vt("border",Ot),DO=Vt("borderTop",Ot),jO=Vt("borderRight",Ot),LO=Vt("borderBottom",Ot),VO=Vt("borderLeft",Ot),FO=Vt("borderColor"),UO=Vt("borderTopColor"),BO=Vt("borderRightColor"),$O=Vt("borderBottomColor"),HO=Vt("borderLeftColor"),zO=Vt("outline",Ot),WO=Vt("outlineColor"),qa=t=>{if(t.borderRadius!==void 0&&t.borderRadius!==null){const e=Ws(t.theme,"shape.borderRadius",4,"borderRadius"),n=i=>({borderRadius:qs(e,i)});return Vn(t,t.borderRadius,n)}return null};qa.propTypes=process.env.NODE_ENV!=="production"?{borderRadius:gi}:{};qa.filterProps=["borderRadius"];Wa(OO,DO,jO,LO,VO,FO,UO,BO,$O,HO,qa,zO,WO);const Ga=t=>{if(t.gap!==void 0&&t.gap!==null){const e=Ws(t.theme,"spacing",8,"gap"),n=i=>({gap:qs(e,i)});return Vn(t,t.gap,n)}return null};Ga.propTypes=process.env.NODE_ENV!=="production"?{gap:gi}:{};Ga.filterProps=["gap"];const Ka=t=>{if(t.columnGap!==void 0&&t.columnGap!==null){const e=Ws(t.theme,"spacing",8,"columnGap"),n=i=>({columnGap:qs(e,i)});return Vn(t,t.columnGap,n)}return null};Ka.propTypes=process.env.NODE_ENV!=="production"?{columnGap:gi}:{};Ka.filterProps=["columnGap"];const Za=t=>{if(t.rowGap!==void 0&&t.rowGap!==null){const e=Ws(t.theme,"spacing",8,"rowGap"),n=i=>({rowGap:qs(e,i)});return Vn(t,t.rowGap,n)}return null};Za.propTypes=process.env.NODE_ENV!=="production"?{rowGap:gi}:{};Za.filterProps=["rowGap"];const qO=Ze({prop:"gridColumn"}),GO=Ze({prop:"gridRow"}),KO=Ze({prop:"gridAutoFlow"}),ZO=Ze({prop:"gridAutoColumns"}),YO=Ze({prop:"gridAutoRows"}),JO=Ze({prop:"gridTemplateColumns"}),XO=Ze({prop:"gridTemplateRows"}),QO=Ze({prop:"gridTemplateAreas"}),eD=Ze({prop:"gridArea"});Wa(Ga,Ka,Za,qO,GO,KO,ZO,YO,JO,XO,QO,eD);function kr(t,e){return e==="grey"?e:t}const tD=Ze({prop:"color",themeKey:"palette",transform:kr}),nD=Ze({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:kr}),iD=Ze({prop:"backgroundColor",themeKey:"palette",transform:kr});Wa(tD,nD,iD);function Et(t){return t<=1&&t!==0?`${t*100}%`:t}const rD=Ze({prop:"width",transform:Et}),wh=t=>{if(t.maxWidth!==void 0&&t.maxWidth!==null){const e=n=>{var r,s,o,a,c;const i=((o=(s=(r=t.theme)==null?void 0:r.breakpoints)==null?void 0:s.values)==null?void 0:o[n])||Ba[n];return i?((c=(a=t.theme)==null?void 0:a.breakpoints)==null?void 0:c.unit)!=="px"?{maxWidth:`${i}${t.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:Et(n)}};return Vn(t,t.maxWidth,e)}return null};wh.filterProps=["maxWidth"];const sD=Ze({prop:"minWidth",transform:Et}),oD=Ze({prop:"height",transform:Et}),aD=Ze({prop:"maxHeight",transform:Et}),cD=Ze({prop:"minHeight",transform:Et});Ze({prop:"size",cssProperty:"width",transform:Et});Ze({prop:"size",cssProperty:"height",transform:Et});const lD=Ze({prop:"boxSizing"});Wa(rD,wh,sD,oD,aD,cD,lD);const Ya={border:{themeKey:"borders",transform:Ot},borderTop:{themeKey:"borders",transform:Ot},borderRight:{themeKey:"borders",transform:Ot},borderBottom:{themeKey:"borders",transform:Ot},borderLeft:{themeKey:"borders",transform:Ot},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Ot},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:qa},color:{themeKey:"palette",transform:kr},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:kr},backgroundColor:{themeKey:"palette",transform:kr},p:{style:Be},pt:{style:Be},pr:{style:Be},pb:{style:Be},pl:{style:Be},px:{style:Be},py:{style:Be},padding:{style:Be},paddingTop:{style:Be},paddingRight:{style:Be},paddingBottom:{style:Be},paddingLeft:{style:Be},paddingX:{style:Be},paddingY:{style:Be},paddingInline:{style:Be},paddingInlineStart:{style:Be},paddingInlineEnd:{style:Be},paddingBlock:{style:Be},paddingBlockStart:{style:Be},paddingBlockEnd:{style:Be},m:{style:Ue},mt:{style:Ue},mr:{style:Ue},mb:{style:Ue},ml:{style:Ue},mx:{style:Ue},my:{style:Ue},margin:{style:Ue},marginTop:{style:Ue},marginRight:{style:Ue},marginBottom:{style:Ue},marginLeft:{style:Ue},marginX:{style:Ue},marginY:{style:Ue},marginInline:{style:Ue},marginInlineStart:{style:Ue},marginInlineEnd:{style:Ue},marginBlock:{style:Ue},marginBlockStart:{style:Ue},marginBlockEnd:{style:Ue},displayPrint:{cssProperty:!1,transform:t=>({"@media print":{display:t}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Ga},rowGap:{style:Za},columnGap:{style:Ka},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Et},maxWidth:{style:wh},minWidth:{transform:Et},height:{transform:Et},maxHeight:{transform:Et},minHeight:{transform:Et},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function dD(...t){const e=t.reduce((i,r)=>i.concat(Object.keys(r)),[]),n=new Set(e);return t.every(i=>n.size===Object.keys(i).length)}function uD(t,e){return typeof t=="function"?t(e):t}function hD(){function t(n,i,r,s){const o={[n]:i,theme:r},a=s[n];if(!a)return{[n]:i};const{cssProperty:c=n,themeKey:l,transform:d,style:u}=a;if(i==null)return null;if(l==="typography"&&i==="inherit")return{[n]:i};const h=$a(r,l)||{};return u?u(o):Vn(o,i,v=>{let f=ya(h,d,v);return v===f&&typeof v=="string"&&(f=ya(h,d,`${n}${v==="default"?"":Bi(v)}`,v)),c===!1?f:{[c]:f}})}function e(n){const{sx:i,theme:r={},nested:s}=n||{};if(!i)return null;const o=r.unstable_sxConfig??Ya;function a(c){let l=c;if(typeof c=="function")l=c(r);else if(typeof c!="object")return c;if(!l)return null;const d=EO(r.breakpoints),u=Object.keys(d);let h=d;return Object.keys(l).forEach(p=>{const v=uD(l[p],r);if(v!=null)if(typeof v=="object")if(o[p])h=vs(h,t(p,v,r,o));else{const f=Vn({theme:r},v,y=>({[p]:y}));dD(f,v)?h[p]=e({sx:v,theme:r,nested:!0}):h=vs(h,f)}else h=vs(h,t(p,v,r,o))}),!s&&r.modularCssLayers?{"@layer sx":Sg(r,Cg(u,h))}:Sg(r,Cg(u,h))}return Array.isArray(i)?i.map(a):a(i)}return e}const Or=hD();Or.filterProps=["sx"];function Fd(){return Fd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Fd.apply(null,arguments)}function fD(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function mD(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var pD=function(){function t(n){var i=this;this._insertTag=function(r){var s;i.tags.length===0?i.insertionPoint?s=i.insertionPoint.nextSibling:i.prepend?s=i.container.firstChild:s=i.before:s=i.tags[i.tags.length-1].nextSibling,i.container.insertBefore(r,s),i.tags.push(r)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(i){i.forEach(this._insertTag)},e.insert=function(i){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(mD(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var s=fD(r);try{s.insertRule(i,s.cssRules.length)}catch{}}else r.appendChild(document.createTextNode(i));this.ctr++},e.flush=function(){this.tags.forEach(function(i){var r;return(r=i.parentNode)==null?void 0:r.removeChild(i)}),this.tags=[],this.ctr=0},t}(),ft="-ms-",ba="-moz-",Se="-webkit-",Kx="comm",Sh="rule",kh="decl",gD="@import",Zx="@keyframes",vD="@layer",yD=Math.abs,Ja=String.fromCharCode,bD=Object.assign;function xD(t,e){return ct(t,0)^45?(((e<<2^ct(t,0))<<2^ct(t,1))<<2^ct(t,2))<<2^ct(t,3):0}function Yx(t){return t.trim()}function wD(t,e){return(t=e.exec(t))?t[0]:t}function ke(t,e,n){return t.replace(e,n)}function Ud(t,e){return t.indexOf(e)}function ct(t,e){return t.charCodeAt(e)|0}function Ns(t,e,n){return t.slice(e,n)}function sn(t){return t.length}function Ch(t){return t.length}function yo(t,e){return e.push(t),t}function SD(t,e){return t.map(e).join("")}var Xa=1,Dr=1,Jx=0,kt=0,Qe=0,qr="";function Qa(t,e,n,i,r,s,o){return{value:t,root:e,parent:n,type:i,props:r,children:s,line:Xa,column:Dr,length:o,return:""}}function ns(t,e){return bD(Qa("",null,null,"",null,null,0),t,{length:-t.length},e)}function kD(){return Qe}function CD(){return Qe=kt>0?ct(qr,--kt):0,Dr--,Qe===10&&(Dr=1,Xa--),Qe}function It(){return Qe=kt<Jx?ct(qr,kt++):0,Dr++,Qe===10&&(Dr=1,Xa++),Qe}function fn(){return ct(qr,kt)}function zo(){return kt}function Gs(t,e){return Ns(qr,t,e)}function _s(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Xx(t){return Xa=Dr=1,Jx=sn(qr=t),kt=0,[]}function Qx(t){return qr="",t}function Wo(t){return Yx(Gs(kt-1,Bd(t===91?t+2:t===40?t+1:t)))}function TD(t){for(;(Qe=fn())&&Qe<33;)It();return _s(t)>2||_s(Qe)>3?"":" "}function ED(t,e){for(;--e&&It()&&!(Qe<48||Qe>102||Qe>57&&Qe<65||Qe>70&&Qe<97););return Gs(t,zo()+(e<6&&fn()==32&&It()==32))}function Bd(t){for(;It();)switch(Qe){case t:return kt;case 34:case 39:t!==34&&t!==39&&Bd(Qe);break;case 40:t===41&&Bd(t);break;case 92:It();break}return kt}function PD(t,e){for(;It()&&t+Qe!==57;)if(t+Qe===84&&fn()===47)break;return"/*"+Gs(e,kt-1)+"*"+Ja(t===47?t:It())}function RD(t){for(;!_s(fn());)It();return Gs(t,kt)}function AD(t){return Qx(qo("",null,null,null,[""],t=Xx(t),0,[0],t))}function qo(t,e,n,i,r,s,o,a,c){for(var l=0,d=0,u=o,h=0,p=0,v=0,f=1,y=1,b=1,S=0,k="",w=r,x=s,T=i,E=k;y;)switch(v=S,S=It()){case 40:if(v!=108&&ct(E,u-1)==58){Ud(E+=ke(Wo(S),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:E+=Wo(S);break;case 9:case 10:case 13:case 32:E+=TD(v);break;case 92:E+=ED(zo()-1,7);continue;case 47:switch(fn()){case 42:case 47:yo(ID(PD(It(),zo()),e,n),c);break;default:E+="/"}break;case 123*f:a[l++]=sn(E)*b;case 125*f:case 59:case 0:switch(S){case 0:case 125:y=0;case 59+d:b==-1&&(E=ke(E,/\f/g,"")),p>0&&sn(E)-u&&yo(p>32?Pg(E+";",i,n,u-1):Pg(ke(E," ","")+";",i,n,u-2),c);break;case 59:E+=";";default:if(yo(T=Eg(E,e,n,l,d,r,a,k,w=[],x=[],u),s),S===123)if(d===0)qo(E,e,T,T,w,s,u,a,x);else switch(h===99&&ct(E,3)===110?100:h){case 100:case 108:case 109:case 115:qo(t,T,T,i&&yo(Eg(t,T,T,0,0,r,a,k,r,w=[],u),x),r,x,u,a,i?w:x);break;default:qo(E,T,T,T,[""],x,0,a,x)}}l=d=p=0,f=b=1,k=E="",u=o;break;case 58:u=1+sn(E),p=v;default:if(f<1){if(S==123)--f;else if(S==125&&f++==0&&CD()==125)continue}switch(E+=Ja(S),S*f){case 38:b=d>0?1:(E+="\f",-1);break;case 44:a[l++]=(sn(E)-1)*b,b=1;break;case 64:fn()===45&&(E+=Wo(It())),h=fn(),d=u=sn(k=E+=RD(zo())),S++;break;case 45:v===45&&sn(E)==2&&(f=0)}}return s}function Eg(t,e,n,i,r,s,o,a,c,l,d){for(var u=r-1,h=r===0?s:[""],p=Ch(h),v=0,f=0,y=0;v<i;++v)for(var b=0,S=Ns(t,u+1,u=yD(f=o[v])),k=t;b<p;++b)(k=Yx(f>0?h[b]+" "+S:ke(S,/&\f/g,h[b])))&&(c[y++]=k);return Qa(t,e,n,r===0?Sh:a,c,l,d)}function ID(t,e,n){return Qa(t,e,n,Kx,Ja(kD()),Ns(t,2,-2),0)}function Pg(t,e,n,i){return Qa(t,e,n,kh,Ns(t,0,i),Ns(t,i+1,-1),i)}function Cr(t,e){for(var n="",i=Ch(t),r=0;r<i;r++)n+=e(t[r],r,t,e)||"";return n}function MD(t,e,n,i){switch(t.type){case vD:if(t.children.length)break;case gD:case kh:return t.return=t.return||t.value;case Kx:return"";case Zx:return t.return=t.value+"{"+Cr(t.children,i)+"}";case Sh:t.value=t.props.join(",")}return sn(n=Cr(t.children,i))?t.return=t.value+"{"+n+"}":""}function ND(t){var e=Ch(t);return function(n,i,r,s){for(var o="",a=0;a<e;a++)o+=t[a](n,i,r,s)||"";return o}}function _D(t){return function(e){e.root||(e=e.return)&&t(e)}}function ew(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var OD=function(e,n,i){for(var r=0,s=0;r=s,s=fn(),r===38&&s===12&&(n[i]=1),!_s(s);)It();return Gs(e,kt)},DD=function(e,n){var i=-1,r=44;do switch(_s(r)){case 0:r===38&&fn()===12&&(n[i]=1),e[i]+=OD(kt-1,n,i);break;case 2:e[i]+=Wo(r);break;case 4:if(r===44){e[++i]=fn()===58?"&\f":"",n[i]=e[i].length;break}default:e[i]+=Ja(r)}while(r=It());return e},jD=function(e,n){return Qx(DD(Xx(e),n))},Rg=new WeakMap,LD=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var n=e.value,i=e.parent,r=e.column===i.column&&e.line===i.line;i.type!=="rule";)if(i=i.parent,!i)return;if(!(e.props.length===1&&n.charCodeAt(0)!==58&&!Rg.get(i))&&!r){Rg.set(e,!0);for(var s=[],o=jD(n,s),a=i.props,c=0,l=0;c<o.length;c++)for(var d=0;d<a.length;d++,l++)e.props[l]=s[c]?o[c].replace(/&\f/g,a[d]):a[d]+" "+o[c]}}},VD=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function tw(t,e){switch(xD(t,e)){case 5103:return Se+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Se+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Se+t+ba+t+ft+t+t;case 6828:case 4268:return Se+t+ft+t+t;case 6165:return Se+t+ft+"flex-"+t+t;case 5187:return Se+t+ke(t,/(\w+).+(:[^]+)/,Se+"box-$1$2"+ft+"flex-$1$2")+t;case 5443:return Se+t+ft+"flex-item-"+ke(t,/flex-|-self/,"")+t;case 4675:return Se+t+ft+"flex-line-pack"+ke(t,/align-content|flex-|-self/,"")+t;case 5548:return Se+t+ft+ke(t,"shrink","negative")+t;case 5292:return Se+t+ft+ke(t,"basis","preferred-size")+t;case 6060:return Se+"box-"+ke(t,"-grow","")+Se+t+ft+ke(t,"grow","positive")+t;case 4554:return Se+ke(t,/([^-])(transform)/g,"$1"+Se+"$2")+t;case 6187:return ke(ke(ke(t,/(zoom-|grab)/,Se+"$1"),/(image-set)/,Se+"$1"),t,"")+t;case 5495:case 3959:return ke(t,/(image-set\([^]*)/,Se+"$1$`$1");case 4968:return ke(ke(t,/(.+:)(flex-)?(.*)/,Se+"box-pack:$3"+ft+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Se+t+t;case 4095:case 3583:case 4068:case 2532:return ke(t,/(.+)-inline(.+)/,Se+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(sn(t)-1-e>6)switch(ct(t,e+1)){case 109:if(ct(t,e+4)!==45)break;case 102:return ke(t,/(.+:)(.+)-([^]+)/,"$1"+Se+"$2-$3$1"+ba+(ct(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~Ud(t,"stretch")?tw(ke(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(ct(t,e+1)!==115)break;case 6444:switch(ct(t,sn(t)-3-(~Ud(t,"!important")&&10))){case 107:return ke(t,":",":"+Se)+t;case 101:return ke(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Se+(ct(t,14)===45?"inline-":"")+"box$3$1"+Se+"$2$3$1"+ft+"$2box$3")+t}break;case 5936:switch(ct(t,e+11)){case 114:return Se+t+ft+ke(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Se+t+ft+ke(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Se+t+ft+ke(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Se+t+ft+t+t}return t}var FD=function(e,n,i,r){if(e.length>-1&&!e.return)switch(e.type){case kh:e.return=tw(e.value,e.length);break;case Zx:return Cr([ns(e,{value:ke(e.value,"@","@"+Se)})],r);case Sh:if(e.length)return SD(e.props,function(s){switch(wD(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Cr([ns(e,{props:[ke(s,/:(read-\w+)/,":"+ba+"$1")]})],r);case"::placeholder":return Cr([ns(e,{props:[ke(s,/:(plac\w+)/,":"+Se+"input-$1")]}),ns(e,{props:[ke(s,/:(plac\w+)/,":"+ba+"$1")]}),ns(e,{props:[ke(s,/:(plac\w+)/,ft+"input-$1")]})],r)}return""})}},UD=[FD],BD=function(e){var n=e.key;if(n==="css"){var i=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(i,function(f){var y=f.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(f),f.setAttribute("data-s",""))})}var r=e.stylisPlugins||UD,s={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(f){for(var y=f.getAttribute("data-emotion").split(" "),b=1;b<y.length;b++)s[y[b]]=!0;a.push(f)});var c,l=[LD,VD];{var d,u=[MD,_D(function(f){d.insert(f)})],h=ND(l.concat(r,u)),p=function(y){return Cr(AD(y),h)};c=function(y,b,S,k){d=S,p(y?y+"{"+b.styles+"}":b.styles),k&&(v.inserted[b.name]=!0)}}var v={key:n,sheet:new pD({key:n,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:c};return v.sheet.hydrate(a),v},$D=!0;function HD(t,e,n){var i="";return n.split(" ").forEach(function(r){t[r]!==void 0?e.push(t[r]+";"):r&&(i+=r+" ")}),i}var nw=function(e,n,i){var r=e.key+"-"+n.name;(i===!1||$D===!1)&&e.registered[r]===void 0&&(e.registered[r]=n.styles)},zD=function(e,n,i){nw(e,n,i);var r=e.key+"-"+n.name;if(e.inserted[n.name]===void 0){var s=n;do e.insert(n===s?"."+r:"",s,e.sheet,!0),s=s.next;while(s!==void 0)}};function WD(t){for(var e=0,n,i=0,r=t.length;r>=4;++i,r-=4)n=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(r){case 3:e^=(t.charCodeAt(i+2)&255)<<16;case 2:e^=(t.charCodeAt(i+1)&255)<<8;case 1:e^=t.charCodeAt(i)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var qD={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},GD=/[A-Z]|^ms/g,KD=/_EMO_([^_]+?)_([^]*?)_EMO_/g,iw=function(e){return e.charCodeAt(1)===45},Ag=function(e){return e!=null&&typeof e!="boolean"},dl=ew(function(t){return iw(t)?t:t.replace(GD,"-$&").toLowerCase()}),Ig=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(KD,function(i,r,s){return on={name:r,styles:s,next:on},r})}return qD[e]!==1&&!iw(e)&&typeof n=="number"&&n!==0?n+"px":n};function Os(t,e,n){if(n==null)return"";var i=n;if(i.__emotion_styles!==void 0)return i;switch(typeof n){case"boolean":return"";case"object":{var r=n;if(r.anim===1)return on={name:r.name,styles:r.styles,next:on},r.name;var s=n;if(s.styles!==void 0){var o=s.next;if(o!==void 0)for(;o!==void 0;)on={name:o.name,styles:o.styles,next:on},o=o.next;var a=s.styles+";";return a}return ZD(t,e,n)}case"function":{if(t!==void 0){var c=on,l=n(t);return on=c,Os(t,e,l)}break}}var d=n;if(e==null)return d;var u=e[d];return u!==void 0?u:d}function ZD(t,e,n){var i="";if(Array.isArray(n))for(var r=0;r<n.length;r++)i+=Os(t,e,n[r])+";";else for(var s in n){var o=n[s];if(typeof o!="object"){var a=o;e!=null&&e[a]!==void 0?i+=s+"{"+e[a]+"}":Ag(a)&&(i+=dl(s)+":"+Ig(s,a)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(e==null||e[o[0]]===void 0))for(var c=0;c<o.length;c++)Ag(o[c])&&(i+=dl(s)+":"+Ig(s,o[c])+";");else{var l=Os(t,e,o);switch(s){case"animation":case"animationName":{i+=dl(s)+":"+l+";";break}default:i+=s+"{"+l+"}"}}}return i}var Mg=/label:\s*([^\s;{]+)\s*(;|$)/g,on;function rw(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var i=!0,r="";on=void 0;var s=t[0];if(s==null||s.raw===void 0)i=!1,r+=Os(n,e,s);else{var o=s;r+=o[0]}for(var a=1;a<t.length;a++)if(r+=Os(n,e,t[a]),i){var c=s;r+=c[a]}Mg.lastIndex=0;for(var l="",d;(d=Mg.exec(r))!==null;)l+="-"+d[1];var u=WD(r)+l;return{name:u,styles:r,next:on}}var YD=function(e){return e()},JD=g.useInsertionEffect?g.useInsertionEffect:!1,XD=JD||YD,sw=g.createContext(typeof HTMLElement<"u"?BD({key:"css"}):null);sw.Provider;var QD=function(e){return M.forwardRef(function(n,i){var r=M.useContext(sw);return e(n,r,i)})},e3=g.createContext({}),t3=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,n3=ew(function(t){return t3.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),i3=n3,r3=function(e){return e!=="theme"},Ng=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?i3:r3},_g=function(e,n,i){var r;if(n){var s=n.shouldForwardProp;r=e.__emotion_forwardProp&&s?function(o){return e.__emotion_forwardProp(o)&&s(o)}:s}return typeof r!="function"&&i&&(r=e.__emotion_forwardProp),r},s3=function(e){var n=e.cache,i=e.serialized,r=e.isStringTag;return nw(n,i,r),XD(function(){return zD(n,i,r)}),null},o3=function t(e,n){var i=e.__emotion_real===e,r=i&&e.__emotion_base||e,s,o;n!==void 0&&(s=n.label,o=n.target);var a=_g(e,n,i),c=a||Ng(r),l=!c("as");return function(){var d=arguments,u=i&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(s!==void 0&&u.push("label:"+s+";"),d[0]==null||d[0].raw===void 0)u.push.apply(u,d);else{var h=d[0];u.push(h[0]);for(var p=d.length,v=1;v<p;v++)u.push(d[v],h[v])}var f=QD(function(y,b,S){var k=l&&y.as||r,w="",x=[],T=y;if(y.theme==null){T={};for(var E in y)T[E]=y[E];T.theme=g.useContext(e3)}typeof y.className=="string"?w=HD(b.registered,x,y.className):y.className!=null&&(w=y.className+" ");var P=rw(u.concat(x),b.registered,T);w+=b.key+"-"+P.name,o!==void 0&&(w+=" "+o);var I=l&&a===void 0?Ng(k):c,C={};for(var A in y)l&&A==="as"||I(A)&&(C[A]=y[A]);return C.className=w,S&&(C.ref=S),g.createElement(g.Fragment,null,g.createElement(s3,{cache:b,serialized:P,isStringTag:typeof k=="string"}),g.createElement(k,C))});return f.displayName=s!==void 0?s:"Styled("+(typeof r=="string"?r:r.displayName||r.name||"Component")+")",f.defaultProps=e.defaultProps,f.__emotion_real=f,f.__emotion_base=r,f.__emotion_styles=u,f.__emotion_forwardProp=a,Object.defineProperty(f,"toString",{value:function(){return"."+o}}),f.withComponent=function(y,b){var S=t(y,Fd({},n,b,{shouldForwardProp:_g(f,b,!0)}));return S.apply(void 0,u)},f}},a3=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],$d=o3.bind(null);a3.forEach(function(t){$d[t]=$d(t)});/**
|
|
233
|
-
* @mui/styled-engine v7.2.0
|
|
234
|
-
*
|
|
235
|
-
* @license MIT
|
|
236
|
-
* This source code is licensed under the MIT license found in the
|
|
237
|
-
* LICENSE file in the root directory of this source tree.
|
|
238
|
-
*/function c3(t,e){const n=$d(t,e);return process.env.NODE_ENV!=="production"?(...i)=>{const r=typeof t=="string"?`"${t}"`:"component";return i.length===0?console.error([`MUI: Seems like you called \`styled(${r})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
239
|
-
`)):i.some(s=>s===void 0)&&console.error(`MUI: the styled(${r})(...args) API requires all its args to be defined.`),n(...i)}:n}function l3(t,e){Array.isArray(t.__emotion_styles)&&(t.__emotion_styles=e(t.__emotion_styles))}const Og=[];function Mi(t){return Og[0]=t,rw(Og)}const d3=t=>{const e=Object.keys(t).map(n=>({key:n,val:t[n]}))||[];return e.sort((n,i)=>n.val-i.val),e.reduce((n,i)=>({...n,[i.key]:i.val}),{})};function u3(t){const{values:e={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:i=5,...r}=t,s=d3(e),o=Object.keys(s);function a(h){return`@media (min-width:${typeof e[h]=="number"?e[h]:h}${n})`}function c(h){return`@media (max-width:${(typeof e[h]=="number"?e[h]:h)-i/100}${n})`}function l(h,p){const v=o.indexOf(p);return`@media (min-width:${typeof e[h]=="number"?e[h]:h}${n}) and (max-width:${(v!==-1&&typeof e[o[v]]=="number"?e[o[v]]:p)-i/100}${n})`}function d(h){return o.indexOf(h)+1<o.length?l(h,o[o.indexOf(h)+1]):a(h)}function u(h){const p=o.indexOf(h);return p===0?a(o[1]):p===o.length-1?c(o[p]):l(h,o[o.indexOf(h)+1]).replace("@media","@media not all and")}return{keys:o,values:s,up:a,down:c,between:l,only:d,not:u,unit:n,...r}}const h3={borderRadius:4};function ow(t=8,e=xh({spacing:t})){if(t.mui)return t;const n=(...i)=>(process.env.NODE_ENV!=="production"&&(i.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${i.length}`)),(i.length===0?[1]:i).map(s=>{const o=e(s);return typeof o=="number"?`${o}px`:o}).join(" "));return n.mui=!0,n}function f3(t,e){var i;const n=this;if(n.vars){if(!((i=n.colorSchemes)!=null&&i[t])||typeof n.getColorSchemeSelector!="function")return{};let r=n.getColorSchemeSelector(t);return r==="&"?e:((r.includes("data-")||r.includes("."))&&(r=`*:where(${r.replace(/\s*&$/,"")}) &`),{[r]:e})}return n.palette.mode===t?e:{}}function aw(t={},...e){const{breakpoints:n={},palette:i={},spacing:r,shape:s={},...o}=t,a=u3(n),c=ow(r);let l=At({breakpoints:a,direction:"ltr",components:{},palette:{mode:"light",...i},spacing:c,shape:{...h3,...s}},o);return l=CO(l),l.applyStyles=f3,l=e.reduce((d,u)=>At(d,u),l),l.unstable_sxConfig={...Ya,...o==null?void 0:o.unstable_sxConfig},l.unstable_sx=function(u){return Or({sx:u,theme:this})},l}const m3={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Th(t,e,n="Mui"){const i=m3[e];return i?`${n}-${i}`:`${cO.generate(t)}-${e}`}function p3(t,e,n="Mui"){const i={};return e.forEach(r=>{i[r]=Th(t,r,n)}),i}function cw(t,e=""){return t.displayName||t.name||e}function Dg(t,e,n){const i=cw(e);return t.displayName||(i!==""?`${n}(${i})`:n)}function g3(t){if(t!=null){if(typeof t=="string")return t;if(typeof t=="function")return cw(t,"Component");if(typeof t=="object")switch(t.$$typeof){case va.ForwardRef:return Dg(t,t.render,"ForwardRef");case va.Memo:return Dg(t,t.type,"memo");default:return}}}function lw(t){const{variants:e,...n}=t,i={variants:e,style:Mi(n),isProcessed:!0};return i.style===n||e&&e.forEach(r=>{typeof r.style!="function"&&(r.style=Mi(r.style))}),i}const v3=aw();function ul(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}function Ei(t,e){return e&&t&&typeof t=="object"&&t.styles&&!t.styles.startsWith("@layer")&&(t.styles=`@layer ${e}{${String(t.styles)}}`),t}function y3(t){return t?(e,n)=>n[t]:null}function b3(t,e,n){t.theme=k3(t.theme)?n:t.theme[e]||t.theme}function Go(t,e,n){const i=typeof e=="function"?e(t):e;if(Array.isArray(i))return i.flatMap(r=>Go(t,r,n));if(Array.isArray(i==null?void 0:i.variants)){let r;if(i.isProcessed)r=n?Ei(i.style,n):i.style;else{const{variants:s,...o}=i;r=n?Ei(Mi(o),n):o}return dw(t,i.variants,[r],n)}return i!=null&&i.isProcessed?n?Ei(Mi(i.style),n):i.style:n?Ei(Mi(i),n):i}function dw(t,e,n=[],i=void 0){var s;let r;e:for(let o=0;o<e.length;o+=1){const a=e[o];if(typeof a.props=="function"){if(r??(r={...t,...t.ownerState,ownerState:t.ownerState}),!a.props(r))continue}else for(const c in a.props)if(t[c]!==a.props[c]&&((s=t.ownerState)==null?void 0:s[c])!==a.props[c])continue e;typeof a.style=="function"?(r??(r={...t,...t.ownerState,ownerState:t.ownerState}),n.push(i?Ei(Mi(a.style(r)),i):a.style(r))):n.push(i?Ei(Mi(a.style),i):a.style)}return n}function x3(t={}){const{themeId:e,defaultTheme:n=v3,rootShouldForwardProp:i=ul,slotShouldForwardProp:r=ul}=t;function s(a){b3(a,e,n)}return(a,c={})=>{l3(a,T=>T.filter(E=>E!==Or));const{name:l,slot:d,skipVariantsResolver:u,skipSx:h,overridesResolver:p=y3(uw(d)),...v}=c,f=l&&l.startsWith("Mui")||d?"components":"custom",y=u!==void 0?u:d&&d!=="Root"&&d!=="root"||!1,b=h||!1;let S=ul;d==="Root"||d==="root"?S=i:d?S=r:C3(a)&&(S=void 0);const k=c3(a,{shouldForwardProp:S,label:S3(l,d),...v}),w=T=>{if(T.__emotion_real===T)return T;if(typeof T=="function")return function(P){return Go(P,T,P.theme.modularCssLayers?f:void 0)};if(In(T)){const E=lw(T);return function(I){return E.variants?Go(I,E,I.theme.modularCssLayers?f:void 0):I.theme.modularCssLayers?Ei(E.style,f):E.style}}return T},x=(...T)=>{const E=[],P=T.map(w),I=[];if(E.push(s),l&&p&&I.push(function(Z){var Y,_;const se=(_=(Y=Z.theme.components)==null?void 0:Y[l])==null?void 0:_.styleOverrides;if(!se)return null;const te={};for(const ie in se)te[ie]=Go(Z,se[ie],Z.theme.modularCssLayers?"theme":void 0);return p(Z,te)}),l&&!y&&I.push(function(Z){var te,Y;const Q=Z.theme,se=(Y=(te=Q==null?void 0:Q.components)==null?void 0:te[l])==null?void 0:Y.variants;return se?dw(Z,se,[],Z.theme.modularCssLayers?"theme":void 0):null}),b||I.push(Or),Array.isArray(P[0])){const N=P.shift(),Z=new Array(E.length).fill(""),Q=new Array(I.length).fill("");let se;se=[...Z,...N,...Q],se.raw=[...Z,...N.raw,...Q],E.unshift(se)}const C=[...E,...P,...I],A=k(...C);return a.muiName&&(A.muiName=a.muiName),process.env.NODE_ENV!=="production"&&(A.displayName=w3(l,d,a)),A};return k.withConfig&&(x.withConfig=k.withConfig),x}}function w3(t,e,n){return t?`${t}${Bi(e||"")}`:`Styled(${g3(n)})`}function S3(t,e){let n;return process.env.NODE_ENV!=="production"&&t&&(n=`${t}-${uw(e||"Root")}`),n}function k3(t){for(const e in t)return!1;return!0}function C3(t){return typeof t=="string"&&t.charCodeAt(0)>96}function uw(t){return t&&t.charAt(0).toLowerCase()+t.slice(1)}function Hd(t,e,n=!1){const i={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const s=r;if(s==="components"||s==="slots")i[s]={...t[s],...i[s]};else if(s==="componentsProps"||s==="slotProps"){const o=t[s],a=e[s];if(!a)i[s]=o||{};else if(!o)i[s]=a;else{i[s]={...a};for(const c in o)if(Object.prototype.hasOwnProperty.call(o,c)){const l=c;i[s][l]=Hd(o[l],a[l],n)}}}else s==="className"&&n&&e.className?i.className=Na(t==null?void 0:t.className,e==null?void 0:e.className):s==="style"&&n&&e.style?i.style={...t==null?void 0:t.style,...e==null?void 0:e.style}:i[s]===void 0&&(i[s]=t[s])}return i}function T3(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}function Eh(t,e=0,n=1){return process.env.NODE_ENV!=="production"&&(t<e||t>n)&&console.error(`MUI: The value provided ${t} is out of range [${e}, ${n}].`),T3(t,e,n)}function E3(t){t=t.slice(1);const e=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let n=t.match(e);return n&&n[0].length===1&&(n=n.map(i=>i+i)),process.env.NODE_ENV!=="production"&&t.length!==t.trim().length&&console.error(`MUI: The color: "${t}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),n?`rgb${n.length===4?"a":""}(${n.map((i,r)=>r<3?parseInt(i,16):Math.round(parseInt(i,16)/255*1e3)/1e3).join(", ")})`:""}function ci(t){if(t.type)return t;if(t.charAt(0)==="#")return ci(E3(t));const e=t.indexOf("("),n=t.substring(0,e);if(!["rgb","rgba","hsl","hsla","color"].includes(n))throw new Error(process.env.NODE_ENV!=="production"?`MUI: Unsupported \`${t}\` color.
|
|
240
|
-
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:ai(9,t));let i=t.substring(e+1,t.length-1),r;if(n==="color"){if(i=i.split(" "),r=i.shift(),i.length===4&&i[3].charAt(0)==="/"&&(i[3]=i[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(r))throw new Error(process.env.NODE_ENV!=="production"?`MUI: unsupported \`${r}\` color space.
|
|
241
|
-
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:ai(10,r))}else i=i.split(",");return i=i.map(s=>parseFloat(s)),{type:n,values:i,colorSpace:r}}const P3=t=>{const e=ci(t);return e.values.slice(0,3).map((n,i)=>e.type.includes("hsl")&&i!==0?`${n}%`:n).join(" ")},cs=(t,e)=>{try{return P3(t)}catch{return e&&process.env.NODE_ENV!=="production"&&console.warn(e),t}};function ec(t){const{type:e,colorSpace:n}=t;let{values:i}=t;return e.includes("rgb")?i=i.map((r,s)=>s<3?parseInt(r,10):r):e.includes("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),e.includes("color")?i=`${n} ${i.join(" ")}`:i=`${i.join(", ")}`,`${e}(${i})`}function hw(t){t=ci(t);const{values:e}=t,n=e[0],i=e[1]/100,r=e[2]/100,s=i*Math.min(r,1-r),o=(l,d=(l+n/30)%12)=>r-s*Math.max(Math.min(d-3,9-d,1),-1);let a="rgb";const c=[Math.round(o(0)*255),Math.round(o(8)*255),Math.round(o(4)*255)];return t.type==="hsla"&&(a+="a",c.push(e[3])),ec({type:a,values:c})}function zd(t){t=ci(t);let e=t.type==="hsl"||t.type==="hsla"?ci(hw(t)).values:t.values;return e=e.map(n=>(t.type!=="color"&&(n/=255),n<=.03928?n/12.92:((n+.055)/1.055)**2.4)),Number((.2126*e[0]+.7152*e[1]+.0722*e[2]).toFixed(3))}function jg(t,e){const n=zd(t),i=zd(e);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}function R3(t,e){return t=ci(t),e=Eh(e),(t.type==="rgb"||t.type==="hsl")&&(t.type+="a"),t.type==="color"?t.values[3]=`/${e}`:t.values[3]=e,ec(t)}function bo(t,e,n){try{return R3(t,e)}catch{return t}}function Ph(t,e){if(t=ci(t),e=Eh(e),t.type.includes("hsl"))t.values[2]*=1-e;else if(t.type.includes("rgb")||t.type.includes("color"))for(let n=0;n<3;n+=1)t.values[n]*=1-e;return ec(t)}function Ie(t,e,n){try{return Ph(t,e)}catch{return t}}function Rh(t,e){if(t=ci(t),e=Eh(e),t.type.includes("hsl"))t.values[2]+=(100-t.values[2])*e;else if(t.type.includes("rgb"))for(let n=0;n<3;n+=1)t.values[n]+=(255-t.values[n])*e;else if(t.type.includes("color"))for(let n=0;n<3;n+=1)t.values[n]+=(1-t.values[n])*e;return ec(t)}function Me(t,e,n){try{return Rh(t,e)}catch{return t}}function A3(t,e=.15){return zd(t)>.5?Ph(t,e):Rh(t,e)}function xo(t,e,n){try{return A3(t,e)}catch{return t}}const I3=g.createContext(void 0);process.env.NODE_ENV!=="production"&&(xe.node,xe.object);function M3(t){const{theme:e,name:n,props:i}=t;if(!e||!e.components||!e.components[n])return i;const r=e.components[n];return r.defaultProps?Hd(r.defaultProps,i,e.components.mergeClassNameAndStyle):!r.styleOverrides&&!r.variants?Hd(r,i,e.components.mergeClassNameAndStyle):i}function N3({props:t,name:e}){const n=g.useContext(I3);return M3({props:t,name:e,theme:{components:n}})}const Lg={theme:void 0};function _3(t){let e,n;return function(r){let s=e;return(s===void 0||r.theme!==n)&&(Lg.theme=r.theme,s=lw(t(Lg)),e=s,n=r.theme),s}}function O3(t=""){function e(...i){if(!i.length)return"";const r=i[0];return typeof r=="string"&&!r.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${t?`${t}-`:""}${r}${e(...i.slice(1))})`:`, ${r}`}return(i,...r)=>`var(--${t?`${t}-`:""}${i}${e(...r)})`}const Vg=(t,e,n,i=[])=>{let r=t;e.forEach((s,o)=>{o===e.length-1?Array.isArray(r)?r[Number(s)]=n:r&&typeof r=="object"&&(r[s]=n):r&&typeof r=="object"&&(r[s]||(r[s]=i.includes(s)?[]:{}),r=r[s])})},D3=(t,e,n)=>{function i(r,s=[],o=[]){Object.entries(r).forEach(([a,c])=>{(!n||n&&!n([...s,a]))&&c!=null&&(typeof c=="object"&&Object.keys(c).length>0?i(c,[...s,a],Array.isArray(c)?[...o,a]:o):e([...s,a],c,o))})}i(t)},j3=(t,e)=>typeof e=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(i=>t.includes(i))||t[t.length-1].toLowerCase().includes("opacity")?e:`${e}px`:e;function hl(t,e){const{prefix:n,shouldSkipGeneratingVar:i}=e||{},r={},s={},o={};return D3(t,(a,c,l)=>{if((typeof c=="string"||typeof c=="number")&&(!i||!i(a,c))){const d=`--${n?`${n}-`:""}${a.join("-")}`,u=j3(a,c);Object.assign(r,{[d]:u}),Vg(s,a,`var(${d})`,l),Vg(o,a,`var(${d}, ${u})`,l)}},a=>a[0]==="vars"),{css:r,vars:s,varsWithDefaults:o}}function L3(t,e={}){const{getSelector:n=y,disableCssColorScheme:i,colorSchemeSelector:r}=e,{colorSchemes:s={},components:o,defaultColorScheme:a="light",...c}=t,{vars:l,css:d,varsWithDefaults:u}=hl(c,e);let h=u;const p={},{[a]:v,...f}=s;if(Object.entries(f||{}).forEach(([k,w])=>{const{vars:x,css:T,varsWithDefaults:E}=hl(w,e);h=At(h,E),p[k]={css:T,vars:x}}),v){const{css:k,vars:w,varsWithDefaults:x}=hl(v,e);h=At(h,x),p[a]={css:k,vars:w}}function y(k,w){var T,E;let x=r;if(r==="class"&&(x=".%s"),r==="data"&&(x="[data-%s]"),r!=null&&r.startsWith("data-")&&!r.includes("%s")&&(x=`[${r}="%s"]`),k){if(x==="media")return t.defaultColorScheme===k?":root":{[`@media (prefers-color-scheme: ${((E=(T=s[k])==null?void 0:T.palette)==null?void 0:E.mode)||k})`]:{":root":w}};if(x)return t.defaultColorScheme===k?`:root, ${x.replace("%s",String(k))}`:x.replace("%s",String(k))}return":root"}return{vars:h,generateThemeVars:()=>{let k={...l};return Object.entries(p).forEach(([,{vars:w}])=>{k=At(k,w)}),k},generateStyleSheets:()=>{var P,I;const k=[],w=t.defaultColorScheme||"light";function x(C,A){Object.keys(A).length&&k.push(typeof C=="string"?{[C]:{...A}}:C)}x(n(void 0,{...d}),d);const{[w]:T,...E}=p;if(T){const{css:C}=T,A=(I=(P=s[w])==null?void 0:P.palette)==null?void 0:I.mode,N=!i&&A?{colorScheme:A,...C}:{...C};x(n(w,{...N}),N)}return Object.entries(E).forEach(([C,{css:A}])=>{var Q,se;const N=(se=(Q=s[C])==null?void 0:Q.palette)==null?void 0:se.mode,Z=!i&&N?{colorScheme:N,...A}:{...A};x(n(C,{...Z}),Z)}),k}}}function V3(t){return function(n){return t==="media"?(process.env.NODE_ENV!=="production"&&n!=="light"&&n!=="dark"&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${n}'.`),`@media (prefers-color-scheme: ${n})`):t?t.startsWith("data-")&&!t.includes("%s")?`[${t}="${n}"] &`:t==="class"?`.${n} &`:t==="data"?`[data-${n}] &`:`${t.replace("%s",n)} &`:"&"}}const Ds={black:"#000",white:"#fff"},F3={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Xi={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Qi={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},is={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},er={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},tr={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},nr={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function fw(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Ds.white,default:Ds.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const U3=fw();function mw(){return{text:{primary:Ds.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Ds.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const Fg=mw();function Ug(t,e,n,i){const r=i.light||i,s=i.dark||i*1.5;t[e]||(t.hasOwnProperty(n)?t[e]=t[n]:e==="light"?t.light=Rh(t.main,r):e==="dark"&&(t.dark=Ph(t.main,s)))}function B3(t="light"){return t==="dark"?{main:er[200],light:er[50],dark:er[400]}:{main:er[700],light:er[400],dark:er[800]}}function $3(t="light"){return t==="dark"?{main:Xi[200],light:Xi[50],dark:Xi[400]}:{main:Xi[500],light:Xi[300],dark:Xi[700]}}function H3(t="light"){return t==="dark"?{main:Qi[500],light:Qi[300],dark:Qi[700]}:{main:Qi[700],light:Qi[400],dark:Qi[800]}}function z3(t="light"){return t==="dark"?{main:tr[400],light:tr[300],dark:tr[700]}:{main:tr[700],light:tr[500],dark:tr[900]}}function W3(t="light"){return t==="dark"?{main:nr[400],light:nr[300],dark:nr[700]}:{main:nr[800],light:nr[500],dark:nr[900]}}function q3(t="light"){return t==="dark"?{main:is[400],light:is[300],dark:is[700]}:{main:"#ed6c02",light:is[500],dark:is[900]}}function Ah(t){const{mode:e="light",contrastThreshold:n=3,tonalOffset:i=.2,...r}=t,s=t.primary||B3(e),o=t.secondary||$3(e),a=t.error||H3(e),c=t.info||z3(e),l=t.success||W3(e),d=t.warning||q3(e);function u(f){const y=jg(f,Fg.text.primary)>=n?Fg.text.primary:U3.text.primary;if(process.env.NODE_ENV!=="production"){const b=jg(f,y);b<3&&console.error([`MUI: The contrast ratio of ${b}:1 for ${y} on ${f}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join(`
|
|
242
|
-
`))}return y}const h=({color:f,name:y,mainShade:b=500,lightShade:S=300,darkShade:k=700})=>{if(f={...f},!f.main&&f[b]&&(f.main=f[b]),!f.hasOwnProperty("main"))throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${y?` (${y})`:""} provided to augmentColor(color) is invalid.
|
|
243
|
-
The color object needs to have a \`main\` property or a \`${b}\` property.`:ai(11,y?` (${y})`:"",b));if(typeof f.main!="string")throw new Error(process.env.NODE_ENV!=="production"?`MUI: The color${y?` (${y})`:""} provided to augmentColor(color) is invalid.
|
|
244
|
-
\`color.main\` should be a string, but \`${JSON.stringify(f.main)}\` was provided instead.
|
|
245
|
-
|
|
246
|
-
Did you intend to use one of the following approaches?
|
|
247
|
-
|
|
248
|
-
import { green } from "@mui/material/colors";
|
|
249
|
-
|
|
250
|
-
const theme1 = createTheme({ palette: {
|
|
251
|
-
primary: green,
|
|
252
|
-
} });
|
|
253
|
-
|
|
254
|
-
const theme2 = createTheme({ palette: {
|
|
255
|
-
primary: { main: green[500] },
|
|
256
|
-
} });`:ai(12,y?` (${y})`:"",JSON.stringify(f.main)));return Ug(f,"light",S,i),Ug(f,"dark",k,i),f.contrastText||(f.contrastText=u(f.main)),f};let p;return e==="light"?p=fw():e==="dark"&&(p=mw()),process.env.NODE_ENV!=="production"&&(p||console.error(`MUI: The palette mode \`${e}\` is not supported.`)),At({common:{...Ds},mode:e,primary:h({color:s,name:"primary"}),secondary:h({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:a,name:"error"}),warning:h({color:d,name:"warning"}),info:h({color:c,name:"info"}),success:h({color:l,name:"success"}),grey:F3,contrastThreshold:n,getContrastText:u,augmentColor:h,tonalOffset:i,...p},r)}function G3(t){const e={};return Object.entries(t).forEach(i=>{const[r,s]=i;typeof s=="object"&&(e[r]=`${s.fontStyle?`${s.fontStyle} `:""}${s.fontVariant?`${s.fontVariant} `:""}${s.fontWeight?`${s.fontWeight} `:""}${s.fontStretch?`${s.fontStretch} `:""}${s.fontSize||""}${s.lineHeight?`/${s.lineHeight} `:""}${s.fontFamily||""}`)}),e}function K3(t,e){return{toolbar:{minHeight:56,[t.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[t.up("sm")]:{minHeight:64}},...e}}function Z3(t){return Math.round(t*1e5)/1e5}const Bg={textTransform:"uppercase"},$g='"Roboto", "Helvetica", "Arial", sans-serif';function Y3(t,e){const{fontFamily:n=$g,fontSize:i=14,fontWeightLight:r=300,fontWeightRegular:s=400,fontWeightMedium:o=500,fontWeightBold:a=700,htmlFontSize:c=16,allVariants:l,pxToRem:d,...u}=typeof e=="function"?e(t):e;process.env.NODE_ENV!=="production"&&(typeof i!="number"&&console.error("MUI: `fontSize` is required to be a number."),typeof c!="number"&&console.error("MUI: `htmlFontSize` is required to be a number."));const h=i/14,p=d||(y=>`${y/c*h}rem`),v=(y,b,S,k,w)=>({fontFamily:n,fontWeight:y,fontSize:p(b),lineHeight:S,...n===$g?{letterSpacing:`${Z3(k/b)}em`}:{},...w,...l}),f={h1:v(r,96,1.167,-1.5),h2:v(r,60,1.2,-.5),h3:v(s,48,1.167,0),h4:v(s,34,1.235,.25),h5:v(s,24,1.334,0),h6:v(o,20,1.6,.15),subtitle1:v(s,16,1.75,.15),subtitle2:v(o,14,1.57,.1),body1:v(s,16,1.5,.15),body2:v(s,14,1.43,.15),button:v(o,14,1.75,.4,Bg),caption:v(s,12,1.66,.4),overline:v(s,12,2.66,1,Bg),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return At({htmlFontSize:c,pxToRem:p,fontFamily:n,fontSize:i,fontWeightLight:r,fontWeightRegular:s,fontWeightMedium:o,fontWeightBold:a,...f},u,{clone:!1})}const J3=.2,X3=.14,Q3=.12;function Oe(...t){return[`${t[0]}px ${t[1]}px ${t[2]}px ${t[3]}px rgba(0,0,0,${J3})`,`${t[4]}px ${t[5]}px ${t[6]}px ${t[7]}px rgba(0,0,0,${X3})`,`${t[8]}px ${t[9]}px ${t[10]}px ${t[11]}px rgba(0,0,0,${Q3})`].join(",")}const e5=["none",Oe(0,2,1,-1,0,1,1,0,0,1,3,0),Oe(0,3,1,-2,0,2,2,0,0,1,5,0),Oe(0,3,3,-2,0,3,4,0,0,1,8,0),Oe(0,2,4,-1,0,4,5,0,0,1,10,0),Oe(0,3,5,-1,0,5,8,0,0,1,14,0),Oe(0,3,5,-1,0,6,10,0,0,1,18,0),Oe(0,4,5,-2,0,7,10,1,0,2,16,1),Oe(0,5,5,-3,0,8,10,1,0,3,14,2),Oe(0,5,6,-3,0,9,12,1,0,3,16,2),Oe(0,6,6,-3,0,10,14,1,0,4,18,3),Oe(0,6,7,-4,0,11,15,1,0,4,20,3),Oe(0,7,8,-4,0,12,17,2,0,5,22,4),Oe(0,7,8,-4,0,13,19,2,0,5,24,4),Oe(0,7,9,-4,0,14,21,2,0,5,26,4),Oe(0,8,9,-5,0,15,22,2,0,6,28,5),Oe(0,8,10,-5,0,16,24,2,0,6,30,5),Oe(0,8,11,-5,0,17,26,2,0,6,32,5),Oe(0,9,11,-5,0,18,28,2,0,7,34,6),Oe(0,9,12,-6,0,19,29,2,0,7,36,6),Oe(0,10,13,-6,0,20,31,3,0,8,38,7),Oe(0,10,13,-6,0,21,33,3,0,8,40,7),Oe(0,10,14,-6,0,22,35,3,0,8,42,7),Oe(0,11,14,-7,0,23,36,3,0,9,44,8),Oe(0,11,15,-7,0,24,38,3,0,9,46,8)],t5={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},n5={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Hg(t){return`${Math.round(t)}ms`}function i5(t){if(!t)return 0;const e=t/36;return Math.min(Math.round((4+15*e**.25+e/5)*10),3e3)}function r5(t){const e={...t5,...t.easing},n={...n5,...t.duration};return{getAutoHeightDuration:i5,create:(r=["all"],s={})=>{const{duration:o=n.standard,easing:a=e.easeInOut,delay:c=0,...l}=s;if(process.env.NODE_ENV!=="production"){const d=h=>typeof h=="string",u=h=>!Number.isNaN(parseFloat(h));!d(r)&&!Array.isArray(r)&&console.error('MUI: Argument "props" must be a string or Array.'),!u(o)&&!d(o)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${o}.`),d(a)||console.error('MUI: Argument "easing" must be a string.'),!u(c)&&!d(c)&&console.error('MUI: Argument "delay" must be a number or a string.'),typeof s!="object"&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
|
|
257
|
-
`)),Object.keys(l).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(l).join(",")}].`)}return(Array.isArray(r)?r:[r]).map(d=>`${d} ${typeof o=="string"?o:Hg(o)} ${a} ${typeof c=="string"?c:Hg(c)}`).join(",")},...t,easing:e,duration:n}}const s5={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function o5(t){return In(t)||typeof t>"u"||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||Array.isArray(t)}function pw(t={}){const e={...t};function n(i){const r=Object.entries(i);for(let s=0;s<r.length;s++){const[o,a]=r[s];!o5(a)||o.startsWith("unstable_")?delete i[o]:In(a)&&(i[o]={...a},n(i[o]))}}return n(e),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
|
|
258
|
-
|
|
259
|
-
const theme = ${JSON.stringify(e,null,2)};
|
|
260
|
-
|
|
261
|
-
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
262
|
-
theme.transitions = createTransitions(theme.transitions || {});
|
|
263
|
-
|
|
264
|
-
export default theme;`}function Wd(t={},...e){const{breakpoints:n,mixins:i={},spacing:r,palette:s={},transitions:o={},typography:a={},shape:c,...l}=t;if(t.vars&&t.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":ai(20));const d=Ah(s),u=aw(t);let h=At(u,{mixins:K3(u.breakpoints,i),palette:d,shadows:e5.slice(),typography:Y3(d,a),transitions:r5(o),zIndex:{...s5}});if(h=At(h,l),h=e.reduce((p,v)=>At(p,v),h),process.env.NODE_ENV!=="production"){const p=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],v=(f,y)=>{let b;for(b in f){const S=f[b];if(p.includes(b)&&Object.keys(S).length>0){if(process.env.NODE_ENV!=="production"){const k=Th("",b);console.error([`MUI: The \`${y}\` component increases the CSS specificity of the \`${b}\` internal state.`,"You can not override it like this: ",JSON.stringify(f,null,2),"",`Instead, you need to use the '&.${k}' syntax:`,JSON.stringify({root:{[`&.${k}`]:S}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
265
|
-
`))}f[b]={}}}};Object.keys(h.components).forEach(f=>{const y=h.components[f].styleOverrides;y&&f.startsWith("Mui")&&v(y,f)})}return h.unstable_sxConfig={...Ya,...l==null?void 0:l.unstable_sxConfig},h.unstable_sx=function(v){return Or({sx:v,theme:this})},h.toRuntimeSource=pw,h}function a5(t){let e;return t<1?e=5.11916*t**2:e=4.5*Math.log(t+1)+2,Math.round(e*10)/1e3}const c5=[...Array(25)].map((t,e)=>{if(e===0)return"none";const n=a5(e);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function gw(t){return{inputPlaceholder:t==="dark"?.5:.42,inputUnderline:t==="dark"?.7:.42,switchTrackDisabled:t==="dark"?.2:.12,switchTrack:t==="dark"?.3:.38}}function vw(t){return t==="dark"?c5:[]}function l5(t){const{palette:e={mode:"light"},opacity:n,overlays:i,...r}=t,s=Ah(e);return{palette:s,opacity:{...gw(s.mode),...n},overlays:i||vw(s.mode),...r}}function d5(t){var e;return!!t[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!t[0].match(/sxConfig$/)||t[0]==="palette"&&!!((e=t[1])!=null&&e.match(/(mode|contrastThreshold|tonalOffset)/))}const u5=t=>[...[...Array(25)].map((e,n)=>`--${t?`${t}-`:""}overlays-${n}`),`--${t?`${t}-`:""}palette-AppBar-darkBg`,`--${t?`${t}-`:""}palette-AppBar-darkColor`],h5=t=>(e,n)=>{const i=t.rootSelector||":root",r=t.colorSchemeSelector;let s=r;if(r==="class"&&(s=".%s"),r==="data"&&(s="[data-%s]"),r!=null&&r.startsWith("data-")&&!r.includes("%s")&&(s=`[${r}="%s"]`),t.defaultColorScheme===e){if(e==="dark"){const o={};return u5(t.cssVarPrefix).forEach(a=>{o[a]=n[a],delete n[a]}),s==="media"?{[i]:n,"@media (prefers-color-scheme: dark)":{[i]:o}}:s?{[s.replace("%s",e)]:o,[`${i}, ${s.replace("%s",e)}`]:n}:{[i]:{...n,...o}}}if(s&&s!=="media")return`${i}, ${s.replace("%s",String(e))}`}else if(e){if(s==="media")return{[`@media (prefers-color-scheme: ${String(e)})`]:{[i]:n}};if(s)return s.replace("%s",String(e))}return i};function f5(t,e){e.forEach(n=>{t[n]||(t[n]={})})}function B(t,e,n){!t[e]&&n&&(t[e]=n)}function ls(t){return typeof t!="string"||!t.startsWith("hsl")?t:hw(t)}function kn(t,e){`${e}Channel`in t||(t[`${e}Channel`]=cs(ls(t[e]),`MUI: Can't create \`palette.${e}Channel\` because \`palette.${e}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
266
|
-
To suppress this warning, you need to explicitly provide the \`palette.${e}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function m5(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const tn=t=>{try{return t()}catch{}},p5=(t="mui")=>O3(t);function fl(t,e,n,i){if(!e)return;e=e===!0?{}:e;const r=i==="dark"?"dark":"light";if(!n){t[i]=l5({...e,palette:{mode:r,...e==null?void 0:e.palette}});return}const{palette:s,...o}=Wd({...n,palette:{mode:r,...e==null?void 0:e.palette}});return t[i]={...e,palette:s,opacity:{...gw(r),...e==null?void 0:e.opacity},overlays:(e==null?void 0:e.overlays)||vw(r)},o}function g5(t={},...e){const{colorSchemes:n={light:!0},defaultColorScheme:i,disableCssColorScheme:r=!1,cssVarPrefix:s="mui",shouldSkipGeneratingVar:o=d5,colorSchemeSelector:a=n.light&&n.dark?"media":void 0,rootSelector:c=":root",...l}=t,d=Object.keys(n)[0],u=i||(n.light&&d!=="light"?"light":d),h=p5(s),{[u]:p,light:v,dark:f,...y}=n,b={...y};let S=p;if((u==="dark"&&!("dark"in n)||u==="light"&&!("light"in n))&&(S=!0),!S)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${u}\` option is either missing or invalid.`:ai(21,u));const k=fl(b,S,l,u);v&&!b.light&&fl(b,v,void 0,"light"),f&&!b.dark&&fl(b,f,void 0,"dark");let w={defaultColorScheme:u,...k,cssVarPrefix:s,colorSchemeSelector:a,rootSelector:c,getCssVar:h,colorSchemes:b,font:{...G3(k.typography),...k.font},spacing:m5(l.spacing)};Object.keys(w.colorSchemes).forEach(I=>{const C=w.colorSchemes[I].palette,A=N=>{const Z=N.split("-"),Q=Z[1],se=Z[2];return h(N,C[Q][se])};if(C.mode==="light"&&(B(C.common,"background","#fff"),B(C.common,"onBackground","#000")),C.mode==="dark"&&(B(C.common,"background","#000"),B(C.common,"onBackground","#fff")),f5(C,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),C.mode==="light"){B(C.Alert,"errorColor",Ie(C.error.light,.6)),B(C.Alert,"infoColor",Ie(C.info.light,.6)),B(C.Alert,"successColor",Ie(C.success.light,.6)),B(C.Alert,"warningColor",Ie(C.warning.light,.6)),B(C.Alert,"errorFilledBg",A("palette-error-main")),B(C.Alert,"infoFilledBg",A("palette-info-main")),B(C.Alert,"successFilledBg",A("palette-success-main")),B(C.Alert,"warningFilledBg",A("palette-warning-main")),B(C.Alert,"errorFilledColor",tn(()=>C.getContrastText(C.error.main))),B(C.Alert,"infoFilledColor",tn(()=>C.getContrastText(C.info.main))),B(C.Alert,"successFilledColor",tn(()=>C.getContrastText(C.success.main))),B(C.Alert,"warningFilledColor",tn(()=>C.getContrastText(C.warning.main))),B(C.Alert,"errorStandardBg",Me(C.error.light,.9)),B(C.Alert,"infoStandardBg",Me(C.info.light,.9)),B(C.Alert,"successStandardBg",Me(C.success.light,.9)),B(C.Alert,"warningStandardBg",Me(C.warning.light,.9)),B(C.Alert,"errorIconColor",A("palette-error-main")),B(C.Alert,"infoIconColor",A("palette-info-main")),B(C.Alert,"successIconColor",A("palette-success-main")),B(C.Alert,"warningIconColor",A("palette-warning-main")),B(C.AppBar,"defaultBg",A("palette-grey-100")),B(C.Avatar,"defaultBg",A("palette-grey-400")),B(C.Button,"inheritContainedBg",A("palette-grey-300")),B(C.Button,"inheritContainedHoverBg",A("palette-grey-A100")),B(C.Chip,"defaultBorder",A("palette-grey-400")),B(C.Chip,"defaultAvatarColor",A("palette-grey-700")),B(C.Chip,"defaultIconColor",A("palette-grey-700")),B(C.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),B(C.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),B(C.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),B(C.LinearProgress,"primaryBg",Me(C.primary.main,.62)),B(C.LinearProgress,"secondaryBg",Me(C.secondary.main,.62)),B(C.LinearProgress,"errorBg",Me(C.error.main,.62)),B(C.LinearProgress,"infoBg",Me(C.info.main,.62)),B(C.LinearProgress,"successBg",Me(C.success.main,.62)),B(C.LinearProgress,"warningBg",Me(C.warning.main,.62)),B(C.Skeleton,"bg",`rgba(${A("palette-text-primaryChannel")} / 0.11)`),B(C.Slider,"primaryTrack",Me(C.primary.main,.62)),B(C.Slider,"secondaryTrack",Me(C.secondary.main,.62)),B(C.Slider,"errorTrack",Me(C.error.main,.62)),B(C.Slider,"infoTrack",Me(C.info.main,.62)),B(C.Slider,"successTrack",Me(C.success.main,.62)),B(C.Slider,"warningTrack",Me(C.warning.main,.62));const N=xo(C.background.default,.8);B(C.SnackbarContent,"bg",N),B(C.SnackbarContent,"color",tn(()=>C.getContrastText(N))),B(C.SpeedDialAction,"fabHoverBg",xo(C.background.paper,.15)),B(C.StepConnector,"border",A("palette-grey-400")),B(C.StepContent,"border",A("palette-grey-400")),B(C.Switch,"defaultColor",A("palette-common-white")),B(C.Switch,"defaultDisabledColor",A("palette-grey-100")),B(C.Switch,"primaryDisabledColor",Me(C.primary.main,.62)),B(C.Switch,"secondaryDisabledColor",Me(C.secondary.main,.62)),B(C.Switch,"errorDisabledColor",Me(C.error.main,.62)),B(C.Switch,"infoDisabledColor",Me(C.info.main,.62)),B(C.Switch,"successDisabledColor",Me(C.success.main,.62)),B(C.Switch,"warningDisabledColor",Me(C.warning.main,.62)),B(C.TableCell,"border",Me(bo(C.divider,1),.88)),B(C.Tooltip,"bg",bo(C.grey[700],.92))}if(C.mode==="dark"){B(C.Alert,"errorColor",Me(C.error.light,.6)),B(C.Alert,"infoColor",Me(C.info.light,.6)),B(C.Alert,"successColor",Me(C.success.light,.6)),B(C.Alert,"warningColor",Me(C.warning.light,.6)),B(C.Alert,"errorFilledBg",A("palette-error-dark")),B(C.Alert,"infoFilledBg",A("palette-info-dark")),B(C.Alert,"successFilledBg",A("palette-success-dark")),B(C.Alert,"warningFilledBg",A("palette-warning-dark")),B(C.Alert,"errorFilledColor",tn(()=>C.getContrastText(C.error.dark))),B(C.Alert,"infoFilledColor",tn(()=>C.getContrastText(C.info.dark))),B(C.Alert,"successFilledColor",tn(()=>C.getContrastText(C.success.dark))),B(C.Alert,"warningFilledColor",tn(()=>C.getContrastText(C.warning.dark))),B(C.Alert,"errorStandardBg",Ie(C.error.light,.9)),B(C.Alert,"infoStandardBg",Ie(C.info.light,.9)),B(C.Alert,"successStandardBg",Ie(C.success.light,.9)),B(C.Alert,"warningStandardBg",Ie(C.warning.light,.9)),B(C.Alert,"errorIconColor",A("palette-error-main")),B(C.Alert,"infoIconColor",A("palette-info-main")),B(C.Alert,"successIconColor",A("palette-success-main")),B(C.Alert,"warningIconColor",A("palette-warning-main")),B(C.AppBar,"defaultBg",A("palette-grey-900")),B(C.AppBar,"darkBg",A("palette-background-paper")),B(C.AppBar,"darkColor",A("palette-text-primary")),B(C.Avatar,"defaultBg",A("palette-grey-600")),B(C.Button,"inheritContainedBg",A("palette-grey-800")),B(C.Button,"inheritContainedHoverBg",A("palette-grey-700")),B(C.Chip,"defaultBorder",A("palette-grey-700")),B(C.Chip,"defaultAvatarColor",A("palette-grey-300")),B(C.Chip,"defaultIconColor",A("palette-grey-300")),B(C.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),B(C.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),B(C.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),B(C.LinearProgress,"primaryBg",Ie(C.primary.main,.5)),B(C.LinearProgress,"secondaryBg",Ie(C.secondary.main,.5)),B(C.LinearProgress,"errorBg",Ie(C.error.main,.5)),B(C.LinearProgress,"infoBg",Ie(C.info.main,.5)),B(C.LinearProgress,"successBg",Ie(C.success.main,.5)),B(C.LinearProgress,"warningBg",Ie(C.warning.main,.5)),B(C.Skeleton,"bg",`rgba(${A("palette-text-primaryChannel")} / 0.13)`),B(C.Slider,"primaryTrack",Ie(C.primary.main,.5)),B(C.Slider,"secondaryTrack",Ie(C.secondary.main,.5)),B(C.Slider,"errorTrack",Ie(C.error.main,.5)),B(C.Slider,"infoTrack",Ie(C.info.main,.5)),B(C.Slider,"successTrack",Ie(C.success.main,.5)),B(C.Slider,"warningTrack",Ie(C.warning.main,.5));const N=xo(C.background.default,.98);B(C.SnackbarContent,"bg",N),B(C.SnackbarContent,"color",tn(()=>C.getContrastText(N))),B(C.SpeedDialAction,"fabHoverBg",xo(C.background.paper,.15)),B(C.StepConnector,"border",A("palette-grey-600")),B(C.StepContent,"border",A("palette-grey-600")),B(C.Switch,"defaultColor",A("palette-grey-300")),B(C.Switch,"defaultDisabledColor",A("palette-grey-600")),B(C.Switch,"primaryDisabledColor",Ie(C.primary.main,.55)),B(C.Switch,"secondaryDisabledColor",Ie(C.secondary.main,.55)),B(C.Switch,"errorDisabledColor",Ie(C.error.main,.55)),B(C.Switch,"infoDisabledColor",Ie(C.info.main,.55)),B(C.Switch,"successDisabledColor",Ie(C.success.main,.55)),B(C.Switch,"warningDisabledColor",Ie(C.warning.main,.55)),B(C.TableCell,"border",Ie(bo(C.divider,1),.68)),B(C.Tooltip,"bg",bo(C.grey[700],.92))}kn(C.background,"default"),kn(C.background,"paper"),kn(C.common,"background"),kn(C.common,"onBackground"),kn(C,"divider"),Object.keys(C).forEach(N=>{const Z=C[N];N!=="tonalOffset"&&Z&&typeof Z=="object"&&(Z.main&&B(C[N],"mainChannel",cs(ls(Z.main))),Z.light&&B(C[N],"lightChannel",cs(ls(Z.light))),Z.dark&&B(C[N],"darkChannel",cs(ls(Z.dark))),Z.contrastText&&B(C[N],"contrastTextChannel",cs(ls(Z.contrastText))),N==="text"&&(kn(C[N],"primary"),kn(C[N],"secondary")),N==="action"&&(Z.active&&kn(C[N],"active"),Z.selected&&kn(C[N],"selected")))})}),w=e.reduce((I,C)=>At(I,C),w);const x={prefix:s,disableCssColorScheme:r,shouldSkipGeneratingVar:o,getSelector:h5(w)},{vars:T,generateThemeVars:E,generateStyleSheets:P}=L3(w,x);return w.vars=T,Object.entries(w.colorSchemes[w.defaultColorScheme]).forEach(([I,C])=>{w[I]=C}),w.generateThemeVars=E,w.generateStyleSheets=P,w.generateSpacing=function(){return ow(l.spacing,xh(this))},w.getColorSchemeSelector=V3(a),w.spacing=w.generateSpacing(),w.shouldSkipGeneratingVar=o,w.unstable_sxConfig={...Ya,...l==null?void 0:l.unstable_sxConfig},w.unstable_sx=function(C){return Or({sx:C,theme:this})},w.toRuntimeSource=pw,w}function zg(t,e,n){t.colorSchemes&&n&&(t.colorSchemes[e]={...n!==!0&&n,palette:Ah({...n===!0?{}:n.palette,mode:e})})}function v5(t={},...e){const{palette:n,cssVariables:i=!1,colorSchemes:r=n?void 0:{light:!0},defaultColorScheme:s=n==null?void 0:n.mode,...o}=t,a=s||"light",c=r==null?void 0:r[a],l={...r,...n?{[a]:{...typeof c!="boolean"&&c,palette:n}}:void 0};if(i===!1){if(!("colorSchemes"in t))return Wd(t,...e);let d=n;"palette"in t||l[a]&&(l[a]!==!0?d=l[a].palette:a==="dark"&&(d={mode:"dark"}));const u=Wd({...t,palette:d},...e);return u.defaultColorScheme=a,u.colorSchemes=l,u.palette.mode==="light"&&(u.colorSchemes.light={...l.light!==!0&&l.light,palette:u.palette},zg(u,"dark",l.dark)),u.palette.mode==="dark"&&(u.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:u.palette},zg(u,"light",l.light)),u}return!n&&!("light"in l)&&a==="light"&&(l.light=!0),g5({...o,colorSchemes:l,defaultColorScheme:a,...typeof i!="boolean"&&i},...e)}const y5=v5(),b5="$$material";function x5(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const w5=t=>x5(t)&&t!=="classes",S5=x3({themeId:b5,defaultTheme:y5,rootShouldForwardProp:w5}),k5=_3;process.env.NODE_ENV!=="production"&&(xe.node,xe.object.isRequired);function C5(t){return N3(t)}function T5(t){return Th("MuiSvgIcon",t)}p3("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const E5=t=>{const{color:e,fontSize:n,classes:i}=t,r={root:["root",e!=="inherit"&&`color${Bi(e)}`,`fontSize${Bi(n)}`]};return yO(r,T5,i)},P5=S5("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color!=="inherit"&&e[`color${Bi(n.color)}`],e[`fontSize${Bi(n.fontSize)}`]]}})(k5(({theme:t})=>{var e,n,i,r,s,o,a,c,l,d,u,h,p,v;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(r=(e=t.transitions)==null?void 0:e.create)==null?void 0:r.call(e,"fill",{duration:(i=(n=(t.vars??t).transitions)==null?void 0:n.duration)==null?void 0:i.shorter}),variants:[{props:f=>!f.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((o=(s=t.typography)==null?void 0:s.pxToRem)==null?void 0:o.call(s,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((c=(a=t.typography)==null?void 0:a.pxToRem)==null?void 0:c.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((d=(l=t.typography)==null?void 0:l.pxToRem)==null?void 0:d.call(l,35))||"2.1875rem"}},...Object.entries((t.vars??t).palette).filter(([,f])=>f&&f.main).map(([f])=>{var y,b;return{props:{color:f},style:{color:(b=(y=(t.vars??t).palette)==null?void 0:y[f])==null?void 0:b.main}}}),{props:{color:"action"},style:{color:(h=(u=(t.vars??t).palette)==null?void 0:u.action)==null?void 0:h.active}},{props:{color:"disabled"},style:{color:(v=(p=(t.vars??t).palette)==null?void 0:p.action)==null?void 0:v.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),xa=g.forwardRef(function(e,n){const i=C5({props:e,name:"MuiSvgIcon"}),{children:r,className:s,color:o="inherit",component:a="svg",fontSize:c="medium",htmlColor:l,inheritViewBox:d=!1,titleAccess:u,viewBox:h="0 0 24 24",...p}=i,v=g.isValidElement(r)&&r.type==="svg",f={...i,color:o,component:a,fontSize:c,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:h,hasSvgAsChild:v},y={};d||(y.viewBox=h);const b=E5(f);return m.jsxs(P5,{as:a,className:Na(b.root,s),focusable:"false",color:l,"aria-hidden":u?void 0:!0,role:u?"img":void 0,ref:n,...y,...p,...v&&r.props,ownerState:f,children:[v?r.props.children:r,u?m.jsx("title",{children:u}):null]})});process.env.NODE_ENV!=="production"&&(xa.propTypes={children:xe.node,classes:xe.object,className:xe.string,color:xe.oneOfType([xe.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),xe.string]),component:xe.elementType,fontSize:xe.oneOfType([xe.oneOf(["inherit","large","medium","small"]),xe.string]),htmlColor:xe.string,inheritViewBox:xe.bool,shapeRendering:xe.string,sx:xe.oneOfType([xe.arrayOf(xe.oneOfType([xe.func,xe.object,xe.bool])),xe.func,xe.object]),titleAccess:xe.string,viewBox:xe.string});xa.muiName="SvgIcon";function Gr(t,e){function n(i,r){return m.jsx(xa,{"data-testid":process.env.NODE_ENV!=="production"?`${e}Icon`:void 0,ref:r,...i,children:t})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${e}Icon`),n.muiName=xa.muiName,g.memo(g.forwardRef(n))}const R5=Gr(m.jsx("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z"}),"AttachFile"),A5=Gr(m.jsx("path",{d:"M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08c-.18-.17-.29-.42-.29-.7s.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71s-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28-.79-.74-1.69-1.36-2.67-1.85-.33-.16-.56-.5-.56-.9v-3.1C15.15 9.25 13.6 9 12 9"}),"CallEnd"),I5=Gr([m.jsx("circle",{cx:"12",cy:"12",r:"3.2"},"0"),m.jsx("path",{d:"M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5"},"1")],"CameraAlt"),yw=Gr(m.jsx("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M6 9h12v2H6zm8 5H6v-2h8zm4-6H6V6h12z"}),"Chat"),bw=Gr(m.jsx("path",{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3m5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72z"}),"Mic"),xw=Gr(m.jsx("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11z"}),"Videocam"),M5=({disabled:t,capabilities:e,sessionStarted:n,ref:i,participantName:r="User",loadingText:s="Waiting for agent to connect...",theme:o="vox",client:a,displayType:c="widget",onBack:l})=>{var Q,se,te,Y,_,ie,L;const[d,u]=M.useState(!1),[h,p]=M.useState(!1),[v,f]=M.useState(()=>{var ee;const F=(ee=a==null?void 0:a.getCurrentInteraction)==null?void 0:ee.call(a);return console.log("SessionView: Initializing with existing interaction:",(F==null?void 0:F.methodName)||"none"),F||null}),{messages:y,send:b}=sO(),S=M.useRef(null),k=M.useRef(null),{agent:{isActive:w=!1}={}}=t1(),x=ut(o),T=g.default.useMemo(()=>a&&typeof a.getCurrentSession=="function"?!!a.getCurrentSession():!1,[a]),E=w||T;g.default.useEffect(()=>{var F,ee;console.log("🤖 SessionView agent state:",{isAgentActive:w,hasActiveSession:T,effectiveAgentActive:E,sessionStarted:n,clientSession:(ee=(F=a==null?void 0:a.getCurrentSession)==null?void 0:F.call(a))==null?void 0:ee.id})},[w,T,E,n,a]),g.default.useEffect(()=>{console.log("🤖 Agent active state changed:",w)},[w]),g.default.useEffect(()=>{console.log("📋 Session state changed:",{sessionStarted:n,disabled:t,participantName:r,effectiveAgentActive:E,chatOpen:d,currentInteraction:(v==null?void 0:v.methodName)||"none"})},[n,t,r,E,d,v]),g.default.useEffect(()=>{if(n&&!w){console.log("⏰ Starting agent timeout detection...");const F=setTimeout(()=>{console.log("⚠️ Agent timeout: Agent did not become active within 30 seconds"),p(!0)},3e4);return()=>{clearTimeout(F)}}else w&&(console.log("✅ Agent is active, clearing timeout"),p(!1))},[n,w]),g.default.useEffect(()=>{if(!a)return;const F=()=>{console.log("🔄 Client connection state changed:",a.connected)},ee=j=>{console.log("🔴 Client disconnected:",j),f(null),u(!1),p(!1)};return a.on("connection.connected",F),a.on("connection.disconnected",ee),()=>{a.off("connection.connected",F),a.off("connection.disconnected",ee)}},[a]),g.default.useEffect(()=>{if(!a)return;const F=J=>{console.log("🎯 SessionView: RPC Interaction started:",J);const G=a.getCurrentInteraction();G&&(console.log("📱 SessionView: Setting current interaction:",G.methodName,"mode:",G.presentationMode),f(G))},ee=J=>{console.log("✅ SessionView: RPC Interaction completed:",J),f(null)},j=async J=>{console.log("⏰ SessionView: RPC Interaction timeout:",J),f(null)},W=async J=>{console.log("❌ SessionView: RPC Interaction dismissed:",J),f(null)};return a.on("rpc.interaction.started",F),a.on("rpc.interaction.completed",ee),a.on("rpc.interaction.timeout",j),a.on("rpc.interaction.dismissed",W),()=>{a.off("rpc.interaction.started",F),a.off("rpc.interaction.completed",ee),a.off("rpc.interaction.timeout",j),a.off("rpc.interaction.dismissed",W)}},[a]),g.default.useEffect(()=>{if(!a)return;const F=a.getCurrentInteraction();F?(console.log("🔄 SessionView: Syncing with existing interaction:",F.methodName),f(F)):f(null)},[a]),g.default.useEffect(()=>{console.log("🎭 SessionView: Current interaction changed:",(v==null?void 0:v.methodName)||"none","mode:",(v==null?void 0:v.presentationMode)||"none")},[v]),g.default.useEffect(()=>{var F,ee,j;console.log("📱 SessionView: Display type changed to:",c),console.log("📱 SessionView: Current session state during display change:",{sessionStarted:n,effectiveAgentActive:E,hasSession:!!((F=a==null?void 0:a.getCurrentSession)!=null&&F.call(a)),sessionId:(j=(ee=a==null?void 0:a.getCurrentSession)==null?void 0:ee.call(a))==null?void 0:j.id})},[c,n,E,a]),g.default.useEffect(()=>{console.log("💬 SessionView: Chat open state changed:",d)},[d]),g.default.useEffect(()=>{v&&d&&(console.log("🎭 SessionView: Interactive UI appeared, closing chat"),u(!1))},[v,d]),oO(),M.useEffect(()=>{S.current&&d&&y.length>0&&(console.log("📜 SessionView: Auto-scrolling to latest message, count:",y.length),setTimeout(()=>{if(S.current){let F=S.current.parentElement;for(;F&&F.scrollHeight<=F.clientHeight;)F=F.parentElement;F?(console.log("📜 SessionView: Scrolling container found, scrolling to bottom"),F.scrollTo({top:F.scrollHeight,behavior:"smooth"})):(console.log("📜 SessionView: Using fallback scroll method"),S.current.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}))}},100))},[y.length,d]),M.useEffect(()=>{var j,W;console.log("📝 SessionView: Messages updated, count:",y.length),y.length>0&&console.log("📝 SessionView: Latest messages:",y.slice(-3).map(J=>{var G,O,$,X,z,oe,H;return{id:J.id,message:J.message,timestamp:J.timestamp,from:((G=J.from)==null?void 0:G.name)||((O=J.from)==null?void 0:O.identity),fromType:J.from===void 0?"unknown":"participant",isLocal:(($=J.from)==null?void 0:$.identity)===((oe=(z=(X=a==null?void 0:a.getCurrentSession)==null?void 0:X.call(a))==null?void 0:z.localParticipant)==null?void 0:oe.identity),messageLength:((H=J.message)==null?void 0:H.length)||0}}));const F=((j=a==null?void 0:a.getTranscriptions)==null?void 0:j.call(a))||[],ee=((W=a==null?void 0:a.getChatMessages)==null?void 0:W.call(a))||[];console.log("📝 SessionView: Raw transcriptions count:",F.length),console.log("📝 SessionView: Raw chat messages count:",ee.length)},[y.length,y,a]),M.useEffect(()=>{console.log("💬 SessionView: Chat state changed:",{chatOpen:d,messagesCount:y.length,displayType:c,hasMessages:y.length>0})},[d,y.length,c]);async function P(F){await b(F)}const I=g.default.useCallback(F=>{console.log("📝 SessionView: Adding local message for voice session context:",F)},[]),C=g.default.useCallback(async F=>{try{a&&typeof a.sendAttachments=="function"&&(await a.sendAttachments(F),console.log("📎 SessionView: Attachments sent successfully:",F.map(ee=>ee.name)))}catch(ee){console.error("❌ SessionView: Failed to send attachments:",ee)}},[a]),A=g.default.useCallback(()=>{try{console.log("📞 SessionView: Ending call..."),console.log("📞 SessionView: Current state before ending:",{sessionStarted:n,effectiveAgentActive:E,chatOpen:d,currentInteraction:v==null?void 0:v.methodName,hasOnBack:!!l}),v&&(console.log("🎭 SessionView: Dismissing current interaction:",v.methodName),f(null),a&&typeof a.dismissCurrentInteraction=="function"&&a.dismissCurrentInteraction()),u(!1),p(!1),console.log("✅ SessionView: Local state reset"),a&&typeof a.endSession=="function"&&(a.endSession(),console.log("✅ SessionView: Session ended via client.endSession()")),a&&typeof a.disconnect=="function"&&(a.disconnect(),console.log("✅ SessionView: Client disconnected")),l?(console.log("🔄 SessionView: Calling onBack to return to welcome..."),setTimeout(()=>{l(),console.log("✅ SessionView: onBack called")},150)):console.warn("⚠️ SessionView: No onBack function provided - cannot return to welcome"),console.log("🏁 SessionView: Call ended and cleanup completed")}catch(F){console.error("❌ SessionView: Failed to end call:",F),f(null),u(!1),p(!1),l&&(console.log("🔄 SessionView: Error occurred, still calling onBack..."),l())}},[a,l,v,n,E,d]);g.default.useEffect(()=>(console.log("🔄 SessionView: Component mounted/props changed:",{sessionStarted:n,disabled:t,participantName:r,displayType:c,hasOnBack:!!l,hasClient:!!a}),()=>{console.log("🧹 SessionView: Component unmounting or props changing")}),[n,t,r,c,l,a]),g.default.useEffect(()=>{console.log("🔗 SessionView: onBack prop:",{hasOnBack:!!l,onBackType:typeof l})},[l]),g.default.useEffect(()=>{var ee,j;const F=((j=(ee=a==null?void 0:a.getCurrentSession)==null?void 0:ee.call(a))==null?void 0:j.id)||null;k.current&&!F&&console.warn("⚠️ SessionView: Session was lost unexpectedly!",{previousSession:k.current,currentSession:F,displayType:c,sessionStarted:n,effectiveAgentActive:E}),k.current=F},[a,c,n,E]);const N=le("w-full flex flex-col items-center justify-center",c==="fullscreen"?"w-full max-w-none mx-0 h-full":"w-full mx-auto",x.main,c==="fullscreen"?"max-w-none":"","overflow-hidden","h-full"),Z=l&&(c==="popup"||c==="fullscreen");return m.jsxs("main",{ref:i,inert:t,className:le(N,"relative"),style:{minHeight:0},children:[Z&&m.jsx("div",{className:`flex items-center justify-between w-full p-4 border-b ${((Q=x.chatHeader)==null?void 0:Q.container)||"border-gray-200"}`,children:m.jsx("div",{className:"flex items-center",children:m.jsxs("div",{children:[m.jsx("h3",{className:`font-semibold ${x.text.primary}`,children:"Voice Session"}),m.jsx("p",{className:`text-sm ${x.text.muted}`,children:r})]})})}),m.jsxs("div",{className:"w-full flex-1 flex flex-col items-center px-0 min-h-0 overflow-hidden",children:[!E&&m.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[m.jsx(ge.div,{animate:{rotate:360,scale:[1,1.1,1]},transition:{rotate:{duration:2,repeat:1/0,ease:"linear"},scale:{duration:1,repeat:1/0,ease:"easeInOut"}},className:"w-12 h-12 mb-4",children:m.jsx(sh,{className:x.spinner,weight:"bold"})}),m.jsx(ge.span,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`text-sm opacity-80 ${x.text.muted} text-center max-w-xs`,children:h?"Agent is taking longer than expected...":s}),m.jsx(ge.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:2},className:`text-xs ${x.text.muted} mt-2 text-center opacity-60`,children:h?"Please check your connection or try again.":"Agent is connecting... This may take a moment."}),h&&l&&m.jsx(ge.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.5},onClick:l,className:`mt-4 px-4 py-2 rounded-lg ${((se=x.chatHeader)==null?void 0:se.backButton)||"bg-gray-100 hover:bg-gray-200"} transition-colors`,children:"Go Back"})]}),E&&m.jsxs(m.Fragment,{children:[d&&m.jsxs("div",{className:le("absolute inset-0 w-full h-full flex flex-col transition-[opacity,translate] duration-300 ease-out z-10",o==="light"?"bg-white":"bg-gray-900/95 backdrop-blur-sm",d?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:[m.jsxs("div",{className:le("flex-shrink-0 px-4 py-3 border-b",c==="fullscreen"?"px-8":"px-5",((te=x.chatHeader)==null?void 0:te.container)||"border-gray-200 dark:border-gray-700"),children:[m.jsx("h3",{className:le("font-semibold text-lg",((Y=x.text)==null?void 0:Y.primary)||"text-gray-900 dark:text-white"),children:"Transcription & Chat"}),m.jsxs("p",{className:le("text-sm",((_=x.text)==null?void 0:_.muted)||"text-gray-600 dark:text-gray-400"),children:[y.length," messages"]})]}),m.jsx("div",{className:le("flex-1 flex flex-col min-h-0",c==="fullscreen"?"px-8":"px-5"),children:m.jsx(m8,{className:"flex-1 flex flex-col min-h-0 h-full",children:m.jsxs("div",{className:`flex-1 flex flex-col h-full ${le("overflow-y-auto scrollbar-hide py-4")}`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",paddingBottom:"120px"},children:[y.length===0&&m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsxs("div",{className:"text-center",children:[m.jsx("p",{className:le("text-lg font-medium mb-2",((ie=x.text)==null?void 0:ie.primary)||"text-gray-900 dark:text-white"),children:"Start Speaking"}),m.jsx("p",{className:le("text-sm",((L=x.text)==null?void 0:L.muted)||"text-gray-600 dark:text-gray-400"),children:"Your conversation will appear here"})]})}),y.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"flex-1 min-h-4"}),m.jsx("div",{ref:S,className:"space-y-4 relative whitespace-pre-wrap z-0",children:m.jsx(yr,{mode:"popLayout",children:y.map((F,ee)=>m.jsx(ge.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:"easeOut",delay:ee*.02},layout:!0,children:m.jsx(h8,{participantName:r,entry:F})},F.id||`message-${ee}`))})})]})]})})})]}),!d&&m.jsxs("div",{className:le("flex-1 flex flex-col items-center w-full h-full min-h-0",(v==null?void 0:v.presentationMode)==="embedded"?"justify-end":"justify-center"),children:[m.jsx(ge.div,{className:"w-full flex justify-center",animate:{y:(v==null?void 0:v.presentationMode)==="embedded"?-8:0},transition:{duration:.3,ease:"easeOut"},children:m.jsx(S8,{chatOpen:d})}),m.jsx(yr,{mode:"wait",children:v&&v.presentationMode==="embedded"&&m.jsx(ge.div,{initial:{opacity:0,y:20,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:20,height:0},transition:{duration:.3,ease:"easeOut"},className:le("w-full relative mt-4 flex justify-center",c==="fullscreen"?"max-w-4xl":"max-w-md"),children:m.jsx("div",{className:"bg-white/10 backdrop-blur-sm rounded-xl border border-white/20 shadow-lg overflow-hidden",children:m.jsx(_r,{interaction:v,theme:o,onDismiss:()=>{var F;return(F=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:F.call(a)},client:a,addLocalMessage:I})})},`embedded-${v.methodName}`)})]})]})]}),m.jsx(yr,{mode:"wait",children:v&&v.presentationMode!=="embedded"&&!d&&m.jsx("div",{className:le("absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm",c==="fullscreen"?"bg-black/70":"bg-black/50"),children:m.jsx(ge.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},className:le("relative w-full overflow-hidden",c==="fullscreen"?"max-w-2xl mx-8 max-h-[85vh]":"max-w-lg mx-4 max-h-[80vh]","bg-white dark:bg-gray-900 rounded-2xl shadow-2xl","border border-gray-200 dark:border-gray-700"),children:m.jsx(_r,{interaction:v,theme:o,onDismiss:()=>{var F;return(F=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:F.call(a)},client:a,addLocalMessage:I})},`modal-${v.methodName}`)})}),m.jsx(ge.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"absolute bottom-0 left-0 right-0 flex-shrink-0 w-full z-20",children:m.jsx(N5,{capabilities:e,onSendMessage:P,onSendAttachments:C,onEndCall:A,onChatOpenChange:u,disabled:t,theme:o,client:a,sessionStarted:n})})]})};function N5({capabilities:t,onSendMessage:e,onSendAttachments:n,onEndCall:i,onChatOpenChange:r,disabled:s=!1,theme:o,client:a,sessionStarted:c=!1}){const[l,d]=g.default.useState(!1),u=g.default.useRef(null),h=g.default.useRef(null);g.default.useEffect(()=>{const S=()=>{const k=navigator.userAgent.toLowerCase(),x=["android","iphone","ipad","mobile","tablet"].some(P=>k.includes(P)),T="ontouchstart"in window||navigator.maxTouchPoints>0,E=window.innerWidth<=768;d(x||T&&E)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const p=S=>{const k=S.target.files;if(k&&k.length>0){const x=Array.from(k).filter(T=>T.type.startsWith("image/"));if(x.length===0){console.warn("No valid image files selected");return}n&&n(x),u.current&&(u.current.value="")}},v=S=>{const k=S.target.files;if(k&&k.length>0){const w=k[0];w.type.startsWith("image/")&&n&&n([w]),h.current&&(h.current.value="")}},f=()=>{!s&&u.current&&u.current.click()},y=()=>{!s&&l&&h.current&&h.current.click()},b=()=>{console.log("🔴 VoiceControlPanel: End call button clicked"),console.log("🔴 VoiceControlPanel: Current state:",{disabled:s,sessionStarted:c,hasOnEndCall:!!i}),i?i():console.warn("⚠️ VoiceControlPanel: No onEndCall function provided")};return m.jsx("div",{className:le("px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg",o==="light"?"bg-white/95 border-t border-gray-200":"bg-gray-900/95 border-t border-gray-700"),children:m.jsxs("div",{className:"flex items-center justify-between !w-full mx-auto max-w-4xl",children:[m.jsx("input",{ref:u,type:"file",multiple:!0,onChange:p,className:"hidden",accept:"image/*"}),m.jsx("input",{ref:h,type:"file",onChange:v,className:"hidden",accept:"image/*",capture:"environment"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:f,disabled:s,className:le("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",s?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Attach files",children:m.jsx(R5,{className:"w-5 h-5"})}),l&&m.jsx("button",{onClick:y,disabled:s,className:le("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",s?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Take photo",children:m.jsx(I5,{className:"w-5 h-5"})})]}),m.jsx("div",{className:"flex-1 flex justify-center px-4",children:m.jsx(d8,{capabilities:t,onChatOpenChange:r,onSendMessage:e,theme:o,client:a,className:"border-none py-1 rounded-xl max-w-md w-full"})}),m.jsx("div",{className:"flex items-center",children:m.jsx("button",{onClick:b,disabled:s||!c,className:le("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",s||!c?"opacity-50 cursor-not-allowed":"hover:shadow-md","bg-red-500 hover:bg-red-600 text-white"),title:"End call",children:m.jsx(A5,{className:"w-5 h-5"})})})]})})}function _5({onSendMessage:t,onSendAttachments:e,disabled:n,theme:i,onEndChat:r}){const[s,o]=g.useState(""),[a,c]=g.useState(!1),l=g.useRef(null),d=g.useRef(null),[u,h]=g.useState(!1),p=ut(i);g.useEffect(()=>{const w=()=>{const x=navigator.userAgent.toLowerCase(),E=["android","iphone","ipad","mobile","tablet"].some(C=>x.includes(C)),P="ontouchstart"in window||navigator.maxTouchPoints>0,I=window.innerWidth<=768;h(E||P&&I)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]);const v=w=>{w.preventDefault(),s.trim()&&!n&&(t(s.trim()),o(""))},f=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),v(w))},y=w=>{const x=w.target.files;if(x&&x.length>0){const T=Array.from(x),E=T.filter(P=>P.type.startsWith("image/"));if(E.length===0){console.warn("No valid image files selected");return}E.length!==T.length&&console.warn("Some non-image files were filtered out"),console.log("Selected image files:",E),e(E),l.current&&(l.current.value="")}},b=()=>{!n&&l.current&&l.current.click()},S=()=>{!n&&u&&d.current&&d.current.click()},k=w=>{const x=w.target.files;if(x&&x.length>0){const T=x[0];T.type.startsWith("image/")?e([T]):console.warn("Selected file is not an image"),d.current&&(d.current.value="")}};return m.jsx("div",{className:"px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg ",children:m.jsx("form",{onSubmit:v,className:"flex items-center !w-full mx-auto max-w-4xl",children:m.jsxs("div",{className:`flex items-center gap-2 !w-full backdrop-blur-md rounded-full px-3 py-2 shadow-sm hover:shadow-md focus-within:shadow-lg focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-500/50 transition-all duration-200 border ${i==="light"?"bg-white/90 border-gray-200":p.chatInput.container}`,children:[m.jsx(ge.button,{type:"button",onClick:b,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${p.chatInput.attachButton}`,disabled:n,"aria-label":"Attach file",children:m.jsx(G8,{className:"w-4 h-4"})}),u&&m.jsx(ge.button,{type:"button",onClick:S,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${p.chatInput.attachButton}`,disabled:n,"aria-label":"Take photo",children:m.jsx($x,{className:"w-4 h-4"})}),m.jsx("input",{ref:l,type:"file",multiple:!0,onChange:y,className:"hidden",accept:"image/*"}),m.jsx("input",{ref:d,type:"file",onChange:k,className:"hidden",accept:"image/*",capture:"environment"}),m.jsx("textarea",{value:s,onChange:w=>o(w.target.value),onKeyDown:f,onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:"Type your message...",disabled:n,className:`flex-1 px-2 py-1 bg-transparent resize-none min-h-[32px] max-h-20 focus:outline-none text-sm border-0 ${p.chatInput.textarea}`,rows:1,style:{height:"auto",minHeight:"32px"},onInput:w=>{const x=w.target;x.style.height="auto",x.style.height=`${Math.min(x.scrollHeight,80)}px`}}),m.jsx(ge.button,{type:"submit",disabled:n||!s.trim(),whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${s.trim()&&!n?p.chatInput.sendButton:i==="light"?"bg-gray-200 text-gray-400 cursor-not-allowed opacity-70":"bg-gray-600/50 text-gray-500 cursor-not-allowed opacity-50"}`,"aria-label":"Send message",children:m.jsx(Y8,{className:"w-4 h-4"})}),r&&m.jsx(ge.button,{type:"button",onClick:r,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${p.chatInput.endButton}`,"aria-label":"End chat",children:m.jsx(Hx,{className:"w-4 h-4"})})]})})})}function O5({text:t,isComplete:e,isRealTimeStream:n=!1,speed:i=50}){const[r,s]=g.useState(""),[o,a]=g.useState(0);return g.useEffect(()=>{if(n){s(t);return}if(e){s(t);return}if(o<t.length){const c=setTimeout(()=>{s(t.slice(0,o+1)),a(o+1)},i);return()=>clearTimeout(c)}},[t,o,e,i,n]),g.useEffect(()=>{n||(a(0),s(""))},[t,n]),m.jsxs("span",{className:"relative",children:[m.jsx("span",{className:"inline-block",children:r}),!e&&m.jsx("span",{className:"inline-flex items-center ml-1",children:[0,1,2].map(c=>m.jsx(ge.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:c*.2,ease:"easeInOut"}},c))})]})}function D5({message:t,theme:e,isOwn:n,isStreaming:i=!1}){var o,a;const r=ut(e),s=t.sender.name?t.sender.name.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2):"U";return m.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"} mb-4 px-1`,children:m.jsxs("div",{className:`relative group ${n?"flex-row-reverse":"flex-row"} flex items-end gap-3 max-w-[85%]`,children:[m.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${n?e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700":e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:s}),m.jsxs("div",{className:`
|
|
183
|
+
*/const r2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],o2=Ie("x",r2);function jl({timeout:e}){const[t,n]=E.useState(100),s=E.useRef(null),r=E.useRef(null);return E.useEffect(()=>{if(!e||e<=0)return;n(100),r.current=Date.now();const i=()=>{if(!e||r.current===null)return;const o=Date.now()-r.current,a=Math.max(0,100-o/e*100);n(a),a>0&&(s.current=requestAnimationFrame(i))};return s.current=requestAnimationFrame(i),()=>{s.current&&cancelAnimationFrame(s.current)}},[e]),!e||e<=0?null:c.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:c.jsx(ce.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(t,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function xn({interaction:e,theme:t,onDismiss:n,client:s,addLocalMessage:r}){var a;if(!e||!e.isVisible||!e.component)return null;const[i]=f.useState(()=>Date.now()),o=()=>e.component?f.createElement(e.component,{handler:e.handler||void 0,timeout:e.timeout,loadData:async d=>{console.log("InteractiveComponent: Loading data:",d)},presentationMode:e.presentationMode,data:e.data,client:s,addLocalMessage:r}):c.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(e.presentationMode){case"fullscreen":return c.jsx(dn,{children:c.jsxs(ce.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[c.jsxs("div",{className:"flex flex-col",children:[c.jsx(jl,{timeout:e.timeout}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[c.jsx("h3",{className:"text-lg font-semibold",children:e.methodName.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase())}),c.jsx("button",{onClick:n||((a=e.handler)==null?void 0:a.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:c.jsx(o2,{className:"w-5 h-5"})})]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o()})]})});case"embedded":default:return c.jsx(dn,{children:c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:c.jsxs("div",{children:[c.jsx(jl,{timeout:e.timeout}),o()]})})})}}function i2(){const e=ke.useTranscriptions(),t=ke.useChat(),n=ke.useRoomContext();return{messages:E.useMemo(()=>[...e.map(i=>m1(i,n)),...t.chatMessages].sort((i,o)=>i.timestamp-o.timestamp),[e,t.chatMessages,n]),send:t.send}}const a2=({logLevel:e}={})=>{const t=ke.useRoomContext();f.useEffect(()=>(J.setLogLevel(e??"debug"),window.__lk_room=t,()=>{window.__lk_room=void 0}),[t,e])},l2=({disabled:e,capabilities:t,sessionStarted:n,ref:s,participantName:r="User",loadingText:i="Waiting for agent to connect...",theme:o="vox",client:a,displayType:l="widget",onBack:d})=>{var Z,ee,G,O,P,B,X;const[u,h]=E.useState(!1),[m,g]=E.useState(!1),[x,p]=E.useState(()=>{var re;const _=(re=a==null?void 0:a.getCurrentInteraction)==null?void 0:re.call(a);return console.log("SessionView: Initializing with existing interaction:",(_==null?void 0:_.methodName)||"none"),_||null}),{messages:v,send:b}=i2(),y=E.useRef(null),w=E.useRef(null),{agent:{isActive:S=!1}={}}=ke.useVoiceAssistant(),k=Ve(o),T=E.useMemo(()=>a&&typeof a.getCurrentSession=="function"?!!a.getCurrentSession():!1,[a]),A=S||T;E.useEffect(()=>{var _,re;console.log("🤖 SessionView agent state:",{isAgentActive:S,hasActiveSession:T,effectiveAgentActive:A,sessionStarted:n,clientSession:(re=(_=a==null?void 0:a.getCurrentSession)==null?void 0:_.call(a))==null?void 0:re.id})},[S,T,A,n,a]),E.useEffect(()=>{console.log("🤖 Agent active state changed:",S)},[S]),E.useEffect(()=>{console.log("📋 Session state changed:",{sessionStarted:n,disabled:e,participantName:r,effectiveAgentActive:A,chatOpen:u,currentInteraction:(x==null?void 0:x.methodName)||"none"})},[n,e,r,A,u,x]),E.useEffect(()=>{if(n&&!S){console.log("⏰ Starting agent timeout detection...");const _=setTimeout(()=>{console.log("⚠️ Agent timeout: Agent did not become active within 30 seconds"),g(!0)},3e4);return()=>{clearTimeout(_)}}else S&&(console.log("✅ Agent is active, clearing timeout"),g(!1))},[n,S]),E.useEffect(()=>{if(!a)return;const _=()=>{console.log("🔄 Client connection state changed:",a.connected)},re=M=>{console.log("🔴 Client disconnected:",M),p(null),h(!1),g(!1)};return a.on("connection.connected",_),a.on("connection.disconnected",re),()=>{a.off("connection.connected",_),a.off("connection.disconnected",re)}},[a]),E.useEffect(()=>{if(!a)return;const _=q=>{console.log("🎯 SessionView: RPC Interaction started:",q);const U=a.getCurrentInteraction();U&&(console.log("📱 SessionView: Setting current interaction:",U.methodName,"mode:",U.presentationMode),p(U))},re=q=>{console.log("✅ SessionView: RPC Interaction completed:",q),p(null)},M=async q=>{console.log("⏰ SessionView: RPC Interaction timeout:",q),p(null)},H=async q=>{console.log("❌ SessionView: RPC Interaction dismissed:",q),p(null)};return a.on("rpc.interaction.started",_),a.on("rpc.interaction.completed",re),a.on("rpc.interaction.timeout",M),a.on("rpc.interaction.dismissed",H),()=>{a.off("rpc.interaction.started",_),a.off("rpc.interaction.completed",re),a.off("rpc.interaction.timeout",M),a.off("rpc.interaction.dismissed",H)}},[a]),E.useEffect(()=>{if(!a)return;const _=a.getCurrentInteraction();_?(console.log("🔄 SessionView: Syncing with existing interaction:",_.methodName),p(_)):p(null)},[a]),E.useEffect(()=>{console.log("🎭 SessionView: Current interaction changed:",(x==null?void 0:x.methodName)||"none","mode:",(x==null?void 0:x.presentationMode)||"none")},[x]),E.useEffect(()=>{var _,re,M;console.log("📱 SessionView: Display type changed to:",l),console.log("📱 SessionView: Current session state during display change:",{sessionStarted:n,effectiveAgentActive:A,hasSession:!!((_=a==null?void 0:a.getCurrentSession)!=null&&_.call(a)),sessionId:(M=(re=a==null?void 0:a.getCurrentSession)==null?void 0:re.call(a))==null?void 0:M.id})},[l,n,A,a]),E.useEffect(()=>{console.log("💬 SessionView: Chat open state changed:",u)},[u]),E.useEffect(()=>{x&&u&&(console.log("🎭 SessionView: Interactive UI appeared, closing chat"),h(!1))},[x,u]),a2(),E.useEffect(()=>{y.current&&u&&v.length>0&&(console.log("📜 SessionView: Auto-scrolling to latest message, count:",v.length),setTimeout(()=>{if(y.current){let _=y.current.parentElement;for(;_&&_.scrollHeight<=_.clientHeight;)_=_.parentElement;_?(console.log("📜 SessionView: Scrolling container found, scrolling to bottom"),_.scrollTo({top:_.scrollHeight,behavior:"smooth"})):(console.log("📜 SessionView: Using fallback scroll method"),y.current.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}))}},100))},[v.length,u]),E.useEffect(()=>{var M,H;console.log("📝 SessionView: Messages updated, count:",v.length),v.length>0&&console.log("📝 SessionView: Latest messages:",v.slice(-3).map(q=>{var U,N,L,W,D,ne,te;return{id:q.id,message:q.message,timestamp:q.timestamp,from:((U=q.from)==null?void 0:U.name)||((N=q.from)==null?void 0:N.identity),fromType:q.from===void 0?"unknown":"participant",isLocal:((L=q.from)==null?void 0:L.identity)===((ne=(D=(W=a==null?void 0:a.getCurrentSession)==null?void 0:W.call(a))==null?void 0:D.localParticipant)==null?void 0:ne.identity),messageLength:((te=q.message)==null?void 0:te.length)||0}}));const _=((M=a==null?void 0:a.getTranscriptions)==null?void 0:M.call(a))||[],re=((H=a==null?void 0:a.getChatMessages)==null?void 0:H.call(a))||[];console.log("📝 SessionView: Raw transcriptions count:",_.length),console.log("📝 SessionView: Raw chat messages count:",re.length)},[v.length,v,a]),E.useEffect(()=>{console.log("💬 SessionView: Chat state changed:",{chatOpen:u,messagesCount:v.length,displayType:l,hasMessages:v.length>0})},[u,v.length,l]);async function j(_){await b(_)}const V=E.useCallback(_=>{console.log("📝 SessionView: Adding local message for voice session context:",_)},[]),I=E.useCallback(async _=>{try{a&&typeof a.sendAttachments=="function"&&(await a.sendAttachments(_),console.log("📎 SessionView: Attachments sent successfully:",_.map(re=>re.name)))}catch(re){console.error("❌ SessionView: Failed to send attachments:",re)}},[a]),$=E.useCallback(()=>{try{console.log("📞 SessionView: Ending call..."),console.log("📞 SessionView: Current state before ending:",{sessionStarted:n,effectiveAgentActive:A,chatOpen:u,currentInteraction:x==null?void 0:x.methodName,hasOnBack:!!d}),x&&(console.log("🎭 SessionView: Dismissing current interaction:",x.methodName),p(null),a&&typeof a.dismissCurrentInteraction=="function"&&a.dismissCurrentInteraction()),h(!1),g(!1),console.log("✅ SessionView: Local state reset"),a&&typeof a.endSession=="function"&&(a.endSession(),console.log("✅ SessionView: Session ended via client.endSession()")),a&&typeof a.disconnect=="function"&&(a.disconnect(),console.log("✅ SessionView: Client disconnected")),d?(console.log("🔄 SessionView: Calling onBack to return to welcome..."),setTimeout(()=>{d(),console.log("✅ SessionView: onBack called")},150)):console.warn("⚠️ SessionView: No onBack function provided - cannot return to welcome"),console.log("🏁 SessionView: Call ended and cleanup completed")}catch(_){console.error("❌ SessionView: Failed to end call:",_),p(null),h(!1),g(!1),d&&(console.log("🔄 SessionView: Error occurred, still calling onBack..."),d())}},[a,d,x,n,A,u]);E.useEffect(()=>(console.log("🔄 SessionView: Component mounted/props changed:",{sessionStarted:n,disabled:e,participantName:r,displayType:l,hasOnBack:!!d,hasClient:!!a}),()=>{console.log("🧹 SessionView: Component unmounting or props changing")}),[n,e,r,l,d,a]),E.useEffect(()=>{console.log("🔗 SessionView: onBack prop:",{hasOnBack:!!d,onBackType:typeof d})},[d]),E.useEffect(()=>{var re,M;const _=((M=(re=a==null?void 0:a.getCurrentSession)==null?void 0:re.call(a))==null?void 0:M.id)||null;w.current&&!_&&console.warn("⚠️ SessionView: Session was lost unexpectedly!",{previousSession:w.current,currentSession:_,displayType:l,sessionStarted:n,effectiveAgentActive:A}),w.current=_},[a,l,n,A]);const F=Q("w-full flex flex-col items-center justify-center",l==="fullscreen"?"w-full max-w-none mx-0 h-full":"w-full mx-auto",k.main,l==="fullscreen"?"max-w-none":"","overflow-hidden","h-full"),se=d&&(l==="popup"||l==="fullscreen");return c.jsxs("main",{ref:s,inert:e,className:Q(F,"relative"),style:{minHeight:0},children:[se&&c.jsx("div",{className:`flex items-center justify-between w-full p-4 border-b ${((Z=k.chatHeader)==null?void 0:Z.container)||"border-gray-200"}`,children:c.jsx("div",{className:"flex items-center",children:c.jsxs("div",{children:[c.jsx("h3",{className:`font-semibold ${k.text.primary}`,children:"Voice Session"}),c.jsx("p",{className:`text-sm ${k.text.muted}`,children:r})]})})}),c.jsxs("div",{className:"w-full flex-1 flex flex-col items-center px-0 min-h-0 overflow-hidden",children:[!A&&c.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[180px]",children:[c.jsx(ce.div,{animate:{rotate:360,scale:[1,1.1,1]},transition:{rotate:{duration:2,repeat:1/0,ease:"linear"},scale:{duration:1,repeat:1/0,ease:"easeInOut"}},className:"w-12 h-12 mb-4",children:c.jsx(ei,{className:k.spinner,weight:"bold"})}),c.jsx(ce.span,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`text-sm opacity-80 ${k.text.muted} text-center max-w-xs`,children:m?"Agent is taking longer than expected...":i}),c.jsx(ce.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:2},className:`text-xs ${k.text.muted} mt-2 text-center opacity-60`,children:m?"Please check your connection or try again.":"Agent is connecting... This may take a moment."}),m&&d&&c.jsx(ce.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.5},onClick:d,className:`mt-4 px-4 py-2 rounded-lg ${((ee=k.chatHeader)==null?void 0:ee.backButton)||"bg-gray-100 hover:bg-gray-200"} transition-colors`,children:"Go Back"})]}),A&&c.jsxs(c.Fragment,{children:[u&&c.jsxs("div",{className:Q("absolute inset-0 w-full h-full flex flex-col transition-[opacity,translate] duration-300 ease-out z-10",o==="light"?"bg-white":"bg-gray-900/95 backdrop-blur-sm",u?"translate-y-0 opacity-100 delay-200":"translate-y-10 opacity-0"),children:[c.jsxs("div",{className:Q("flex-shrink-0 px-4 py-3 border-b",l==="fullscreen"?"px-8":"px-5",((G=k.chatHeader)==null?void 0:G.container)||"border-gray-200 dark:border-gray-700"),children:[c.jsx("h3",{className:Q("font-semibold text-lg",((O=k.text)==null?void 0:O.primary)||"text-gray-900 dark:text-white"),children:"Transcription & Chat"}),c.jsxs("p",{className:Q("text-sm",((P=k.text)==null?void 0:P.muted)||"text-gray-600 dark:text-gray-400"),children:[v.length," messages"]})]}),c.jsx("div",{className:Q("flex-1 flex flex-col min-h-0",l==="fullscreen"?"px-8":"px-5"),children:c.jsx(pb,{className:"flex-1 flex flex-col min-h-0 h-full",children:c.jsxs("div",{className:`flex-1 flex flex-col h-full ${Q("overflow-y-auto scrollbar-hide py-4")}`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",paddingBottom:"120px"},children:[v.length===0&&c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx("p",{className:Q("text-lg font-medium mb-2",((B=k.text)==null?void 0:B.primary)||"text-gray-900 dark:text-white"),children:"Start Speaking"}),c.jsx("p",{className:Q("text-sm",((X=k.text)==null?void 0:X.muted)||"text-gray-600 dark:text-gray-400"),children:"Your conversation will appear here"})]})}),v.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex-1 min-h-4"}),c.jsx("div",{ref:y,className:"space-y-4 relative whitespace-pre-wrap z-0",children:c.jsx(dn,{mode:"popLayout",children:v.map((_,re)=>c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:"easeOut",delay:re*.02},layout:!0,children:c.jsx(hb,{participantName:r,entry:_})},_.id||`message-${re}`))})})]})]})})})]}),!u&&c.jsxs("div",{className:Q("flex-1 flex flex-col items-center w-full h-full min-h-0",(x==null?void 0:x.presentationMode)==="embedded"?"justify-end":"justify-center"),children:[c.jsx(ce.div,{className:"w-full flex justify-center",animate:{y:(x==null?void 0:x.presentationMode)==="embedded"?-8:0},transition:{duration:.3,ease:"easeOut"},children:c.jsx(Cb,{chatOpen:u})}),c.jsx(dn,{mode:"wait",children:x&&x.presentationMode==="embedded"&&c.jsx(ce.div,{initial:{opacity:0,y:20,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:20,height:0},transition:{duration:.3,ease:"easeOut"},className:Q("w-full relative mt-4 flex justify-center",l==="fullscreen"?"max-w-4xl":"max-w-md"),children:c.jsx("div",{className:"bg-white/10 backdrop-blur-sm rounded-xl border border-white/20 shadow-lg overflow-hidden",children:c.jsx(xn,{interaction:x,theme:o,onDismiss:()=>{var _;return(_=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:_.call(a)},client:a,addLocalMessage:V})})},`embedded-${x.methodName}`)})]})]})]}),c.jsx(dn,{mode:"wait",children:x&&x.presentationMode!=="embedded"&&!u&&c.jsx("div",{className:Q("absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm",l==="fullscreen"?"bg-black/70":"bg-black/50"),children:c.jsx(ce.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},className:Q("relative w-full overflow-hidden",l==="fullscreen"?"max-w-2xl mx-8 max-h-[85vh]":"max-w-lg mx-4 max-h-[80vh]","bg-white dark:bg-gray-900 rounded-2xl shadow-2xl","border border-gray-200 dark:border-gray-700"),children:c.jsx(xn,{interaction:x,theme:o,onDismiss:()=>{var _;return(_=a==null?void 0:a.dismissCurrentInteraction)==null?void 0:_.call(a)},client:a,addLocalMessage:V})},`modal-${x.methodName}`)})}),c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"absolute bottom-0 left-0 right-0 flex-shrink-0 w-full z-20",children:c.jsx(c2,{capabilities:t,onSendMessage:j,onSendAttachments:I,onEndCall:$,onChatOpenChange:h,disabled:e,theme:o,client:a,sessionStarted:n})})]})};function c2({capabilities:e,onSendMessage:t,onSendAttachments:n,onEndCall:s,onChatOpenChange:r,disabled:i=!1,theme:o,client:a,sessionStarted:l=!1}){const[d,u]=E.useState(!1),h=E.useRef(null),m=E.useRef(null);E.useEffect(()=>{const y=()=>{const w=navigator.userAgent.toLowerCase(),k=["android","iphone","ipad","mobile","tablet"].some(j=>w.includes(j)),T="ontouchstart"in window||navigator.maxTouchPoints>0,A=window.innerWidth<=768;u(k||T&&A)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]);const g=y=>{const w=y.target.files;if(w&&w.length>0){const k=Array.from(w).filter(T=>T.type.startsWith("image/"));if(k.length===0){console.warn("No valid image files selected");return}n&&n(k),h.current&&(h.current.value="")}},x=y=>{const w=y.target.files;if(w&&w.length>0){const S=w[0];S.type.startsWith("image/")&&n&&n([S]),m.current&&(m.current.value="")}},p=()=>{!i&&h.current&&h.current.click()},v=()=>{!i&&d&&m.current&&m.current.click()},b=()=>{console.log("🔴 VoiceControlPanel: End call button clicked"),console.log("🔴 VoiceControlPanel: Current state:",{disabled:i,sessionStarted:l,hasOnEndCall:!!s}),s?s():console.warn("⚠️ VoiceControlPanel: No onEndCall function provided")};return c.jsx("div",{className:Q("px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg",o==="light"?"bg-white/95 border-t border-gray-200":"bg-gray-900/95 border-t border-gray-700"),children:c.jsxs("div",{className:"flex items-center justify-between !w-full mx-auto max-w-4xl",children:[c.jsx("input",{ref:h,type:"file",multiple:!0,onChange:g,className:"hidden",accept:"image/*"}),c.jsx("input",{ref:m,type:"file",onChange:x,className:"hidden",accept:"image/*",capture:"environment"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:p,disabled:i,className:Q("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",i?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Attach files",children:c.jsx(gt.AttachFile,{className:"w-5 h-5"})}),d&&c.jsx("button",{onClick:v,disabled:i,className:Q("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",i?"opacity-50 cursor-not-allowed":"hover:shadow-md",o==="light"?"bg-gray-100 hover:bg-gray-200 text-gray-600":"bg-gray-700/50 hover:bg-gray-600/50 text-gray-300"),title:"Take photo",children:c.jsx(gt.CameraAlt,{className:"w-5 h-5"})})]}),c.jsx("div",{className:"flex-1 flex justify-center px-4",children:c.jsx(ub,{capabilities:e,onChatOpenChange:r,onSendMessage:t,theme:o,client:a,className:"border-none py-1 rounded-xl max-w-md w-full"})}),c.jsx("div",{className:"flex items-center",children:c.jsx("button",{onClick:b,disabled:i||!l,className:Q("p-3 rounded-full transition-all duration-200 hover:scale-105 active:scale-95",i||!l?"opacity-50 cursor-not-allowed":"hover:shadow-md","bg-red-500 hover:bg-red-600 text-white"),title:"End call",children:c.jsx(gt.CallEnd,{className:"w-5 h-5"})})})]})})}function d2({onSendMessage:e,onSendAttachments:t,disabled:n,theme:s,onEndChat:r}){const[i,o]=f.useState(""),[a,l]=f.useState(!1),d=f.useRef(null),u=f.useRef(null),[h,m]=f.useState(!1),g=Ve(s);f.useEffect(()=>{const S=()=>{const k=navigator.userAgent.toLowerCase(),A=["android","iphone","ipad","mobile","tablet"].some(I=>k.includes(I)),j="ontouchstart"in window||navigator.maxTouchPoints>0,V=window.innerWidth<=768;m(A||j&&V)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=S=>{S.preventDefault(),i.trim()&&!n&&(e(i.trim()),o(""))},p=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),x(S))},v=S=>{const k=S.target.files;if(k&&k.length>0){const T=Array.from(k),A=T.filter(j=>j.type.startsWith("image/"));if(A.length===0){console.warn("No valid image files selected");return}A.length!==T.length&&console.warn("Some non-image files were filtered out"),console.log("Selected image files:",A),t(A),d.current&&(d.current.value="")}},b=()=>{!n&&d.current&&d.current.click()},y=()=>{!n&&h&&u.current&&u.current.click()},w=S=>{const k=S.target.files;if(k&&k.length>0){const T=k[0];T.type.startsWith("image/")?t([T]):console.warn("Selected file is not an image"),u.current&&(u.current.value="")}};return c.jsx("div",{className:"px-4 py-3 !w-full backdrop-blur-xl border-0 shadow-lg ",children:c.jsx("form",{onSubmit:x,className:"flex items-center !w-full mx-auto max-w-4xl",children:c.jsxs("div",{className:`flex items-center gap-2 !w-full backdrop-blur-md rounded-full px-3 py-2 shadow-sm hover:shadow-md focus-within:shadow-lg focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-500/50 transition-all duration-200 border ${s==="light"?"bg-white/90 border-gray-200":g.chatInput.container}`,children:[c.jsx(ce.button,{type:"button",onClick:b,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${g.chatInput.attachButton}`,disabled:n,"aria-label":"Attach file",children:c.jsx(Yb,{className:"w-4 h-4"})}),h&&c.jsx(ce.button,{type:"button",onClick:y,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 ${g.chatInput.attachButton}`,disabled:n,"aria-label":"Take photo",children:c.jsx(Yu,{className:"w-4 h-4"})}),c.jsx("input",{ref:d,type:"file",multiple:!0,onChange:v,className:"hidden",accept:"image/*"}),c.jsx("input",{ref:u,type:"file",onChange:w,className:"hidden",accept:"image/*",capture:"environment"}),c.jsx("textarea",{value:i,onChange:S=>o(S.target.value),onKeyDown:p,onFocus:()=>l(!0),onBlur:()=>l(!1),placeholder:"Type your message...",disabled:n,className:`flex-1 px-2 py-1 bg-transparent resize-none min-h-[32px] max-h-20 focus:outline-none text-sm border-0 ${g.chatInput.textarea}`,rows:1,style:{height:"auto",minHeight:"32px"},onInput:S=>{const k=S.target;k.style.height="auto",k.style.height=`${Math.min(k.scrollHeight,80)}px`}}),c.jsx(ce.button,{type:"submit",disabled:n||!i.trim(),whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${i.trim()&&!n?g.chatInput.sendButton:s==="light"?"bg-gray-200 text-gray-400 cursor-not-allowed opacity-70":"bg-gray-600/50 text-gray-500 cursor-not-allowed opacity-50"}`,"aria-label":"Send message",children:c.jsx(qb,{className:"w-4 h-4"})}),r&&c.jsx(ce.button,{type:"button",onClick:r,whileHover:{scale:1.05},whileTap:{scale:.95},className:`p-1 rounded-full transition-all duration-200 border-0 flex-shrink-0 ${g.chatInput.endButton}`,"aria-label":"End chat",children:c.jsx(Gu,{className:"w-4 h-4"})})]})})})}function u2({text:e,isComplete:t,isRealTimeStream:n=!1,speed:s=50}){const[r,i]=f.useState(""),[o,a]=f.useState(0);return f.useEffect(()=>{if(n){i(e);return}if(t){i(e);return}if(o<e.length){const l=setTimeout(()=>{i(e.slice(0,o+1)),a(o+1)},s);return()=>clearTimeout(l)}},[e,o,t,s,n]),f.useEffect(()=>{n||(a(0),i(""))},[e,n]),c.jsxs("span",{className:"relative",children:[c.jsx("span",{className:"inline-block",children:r}),!t&&c.jsx("span",{className:"inline-flex items-center ml-1",children:[0,1,2].map(l=>c.jsx(ce.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:l*.2,ease:"easeInOut"}},l))})]})}function f2({message:e,theme:t,isOwn:n,isStreaming:s=!1}){var o,a;const r=Ve(t),i=e.sender.name?e.sender.name.split(" ").map(l=>l[0]).join("").toUpperCase().slice(0,2):"U";return c.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"} mb-4 px-1`,children:c.jsxs("div",{className:`relative group ${n?"flex-row-reverse":"flex-row"} flex items-end gap-3 max-w-[85%]`,children:[c.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${n?t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700":t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:i}),c.jsxs("div",{className:`
|
|
267
184
|
relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover
|
|
268
185
|
${n?`${r.chatMessage.own} rounded-br-md`:`${r.chatMessage.other} rounded-bl-md`}
|
|
269
|
-
${
|
|
186
|
+
${s?"shimmer":""}
|
|
270
187
|
transition-all duration-200 group-hover:scale-[1.02]
|
|
271
|
-
`,style:{wordWrap:"break-word",overflowWrap:"break-word"},children:[
|
|
188
|
+
`,style:{wordWrap:"break-word",overflowWrap:"break-word"},children:[c.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-sm",children:((o=e.metadata)==null?void 0:o.type)==="attachment"?c.jsx(p2,{message:e,theme:t,isOwn:n}):s&&!n?c.jsx(u2,{text:e.content,isComplete:!s,isRealTimeStream:((a=e.metadata)==null?void 0:a.streaming)===!0,speed:35}):e.content}),c.jsx("div",{className:"text-xs",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})})}function h2(e,t){return e.startsWith("image/")?Ob:e.startsWith("video/")?s2:e.startsWith("audio/")?Wb:e.includes("zip")||e.includes("rar")||e.includes("archive")?Mb:Lb}function m2(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+n[s]}function p2({message:e,theme:t,isOwn:n}){const s=Ve(t),r=e.metadata,i=(r==null?void 0:r.fileName)||"Unknown file",o=(r==null?void 0:r.fileSize)||0,a=(r==null?void 0:r.mimeType)||"application/octet-stream",l=r==null?void 0:r.downloading,d=r==null?void 0:r.uploading,u=(r==null?void 0:r.downloadProgress)||0,h=(r==null?void 0:r.uploadProgress)||0,m=r==null?void 0:r.downloadUrl,g=r==null?void 0:r.file,x=h2(a),p=l||d,v=l?u:h,b=l?"Downloading...":d?"Uploading...":"Complete",[y,w]=f.useState(null);f.useEffect(()=>{if(m)w(m);else if(g&&a.startsWith("image/")){const A=URL.createObjectURL(g);return w(A),()=>URL.revokeObjectURL(A)}else w(null)},[m,g,a]);const S=()=>{if(m){const A=document.createElement("a");A.href=m,A.download=i,A.click()}},T=a.startsWith("image/")&&y;return c.jsxs("div",{className:"flex flex-col gap-2 max-w-sm",children:[T&&c.jsxs("div",{className:"relative rounded-lg overflow-hidden",children:[c.jsx("img",{src:y,alt:i,className:"max-w-full h-auto max-h-48 object-cover rounded-lg cursor-pointer",onClick:S}),c.jsx("div",{className:"absolute inset-0 bg-black/0 hover:bg-black/10 transition-colors duration-200 cursor-pointer"})]}),c.jsxs("div",{className:`
|
|
272
189
|
flex items-center gap-3 p-3 rounded-lg border transition-all duration-200
|
|
273
|
-
${
|
|
274
|
-
`,children:[
|
|
190
|
+
${t==="light"?"bg-gray-50 border-gray-200 hover:bg-gray-100":"bg-gray-800/50 border-gray-700 hover:bg-gray-700/50"}
|
|
191
|
+
`,children:[c.jsx("div",{className:`
|
|
275
192
|
p-2 rounded-lg flex-shrink-0
|
|
276
|
-
${
|
|
277
|
-
`,children:
|
|
193
|
+
${t==="light"?"bg-blue-100 text-blue-600":"bg-blue-900/50 text-blue-400"}
|
|
194
|
+
`,children:c.jsx(x,{className:"w-5 h-5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:`font-medium text-sm truncate ${s.text.primary}`,children:i}),c.jsxs("div",{className:`text-xs ${s.text.muted}`,children:[o>0&&m2(o),p&&c.jsxs(c.Fragment,{children:[o>0&&" • ",b," ",Math.round(v*100),"%"]})]}),p&&c.jsx("div",{className:`
|
|
278
195
|
w-full h-1 rounded-full mt-1 overflow-hidden
|
|
279
|
-
${
|
|
280
|
-
`,children:
|
|
196
|
+
${t==="light"?"bg-gray-200":"bg-gray-700"}
|
|
197
|
+
`,children:c.jsx(ce.div,{className:`h-full ${t==="light"?"bg-blue-500":"bg-blue-400"}`,initial:{width:0},animate:{width:`${v*100}%`},transition:{duration:.3}})})]}),m&&!p&&c.jsx(ce.button,{onClick:S,whileHover:{scale:1.05},whileTap:{scale:.95},className:`
|
|
281
198
|
p-2 rounded-lg transition-colors duration-200
|
|
282
|
-
${
|
|
283
|
-
`,"aria-label":"Download file",children:m.jsx(_8,{className:"w-4 h-4"})})]})]})}function F5(){return m.jsxs("div",{className:"max-w-xs mx-auto bg-green-50 border border-green-200 rounded-lg shadow p-3 flex flex-col items-center",children:[m.jsx("div",{className:"text-2xl mb-2",children:"✅"}),m.jsx("div",{className:"text-green-700 font-semibold text-sm mb-1",children:"Success!"}),m.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"Your action was completed successfully."})]})}function U5(){return m.jsxs("div",{className:"max-w-xs mx-auto bg-yellow-50 border border-yellow-200 rounded-lg shadow p-3 flex flex-col items-center",children:[m.jsx("div",{className:"text-2xl mb-2",children:"⏰"}),m.jsx("div",{className:"text-yellow-700 font-semibold text-sm mb-1",children:"Interaction timed out"}),m.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"No response was provided in time."})]})}function B5({client:t,theme:e="vox",onBack:n,disabled:i=!1,displayType:r="widget",onEndChat:s}){const[o,a]=g.useState(()=>{if(t&&typeof t.getChatMessages=="function"){const j=t.getChatMessages();return console.log("🔄 ChatView: Initializing with existing messages:",j.length),j}return[]}),[c,l]=g.useState(!0),[d,u]=g.useState(()=>{const j=t&&typeof t.getCurrentSession=="function"&&!!t.getCurrentSession(),W=t&&typeof t.getChatMessages=="function"&&t.getChatMessages().length>0;return!j&&!W}),[h,p]=g.useState(new Set),[v,f]=g.useState([]),[y,b]=g.useState(!1),[S,k]=g.useState(!1),[w,x]=g.useState(()=>{const j=t.getCurrentInteraction();return console.log("ChatView: Initializing with existing interaction:",(j==null?void 0:j.methodName)||"none"),j}),T=g.useRef(null),E=ut(e);g.useEffect(()=>{const j=()=>{const W=navigator.userAgent.toLowerCase(),G=["android","iphone","ipad","mobile","tablet"].some(z=>W.includes(z)),O="ontouchstart"in window||navigator.maxTouchPoints>0,$=window.innerWidth<=768,X=G||O&&$;b(X),X&&r==="widget"&&k(!0)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[r]),g.useEffect(()=>(S&&y&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.height="100%",document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(console.log)),()=>{S&&y&&(document.body.style.overflow="unset",document.body.style.position="unset",document.body.style.width="unset",document.body.style.height="unset",document.fullscreenElement&&document.exitFullscreen().catch(console.log))}),[S,y]);const P=t.getCurrentAgentInfo(),I=(P==null?void 0:P.name)||"AI Assistant",C=I.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2),A=g.useCallback(j=>{const W={id:`local_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:j,timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{isLocal:!0}};a(J=>(console.log("ChatView: Adding local message:",W.id),[...J,W]))},[]);g.useEffect(()=>{var j,W,J,G,O;console.log("💬 ChatView loading state:",{isLoading:d,hasActiveSession:!!((j=t==null?void 0:t.getCurrentSession)!=null&&j.call(t)),messagesCount:o.length,sessionId:(J=(W=t==null?void 0:t.getCurrentSession)==null?void 0:W.call(t))==null?void 0:J.id,hasStoredMessages:!!((O=(G=t==null?void 0:t.getChatMessages)==null?void 0:G.call(t))!=null&&O.length),isMobile:y,isFullscreen:S})},[d,o.length,t,y,S]);const N=g.useCallback((j=!1)=>{T.current&&(j?T.current.scrollIntoView({behavior:"auto"}):T.current.scrollIntoView({behavior:"smooth"}))},[]);g.useEffect(()=>{N(!0);const j=setTimeout(()=>{N(!1)},10);return()=>clearTimeout(j)},[o.length,N]),g.useEffect(()=>{if(w){N(!0);const j=setTimeout(()=>{N(!1)},50);return()=>clearTimeout(j)}},[w,N]),g.useEffect(()=>{const j=G=>{if(console.log("ChatView: Received message:",G),u(!1),w&&G.sender.type==="agent"){console.log("ChatView: Queuing agent message due to active interaction:",w.methodName),f(O=>[...O,G]);return}G.sender.type==="agent"&&l(!1),a(O=>{var X;if(O.some(z=>z.id===G.id))return console.log("ChatView: Message already exists, skipping:",G.id),O;if(console.log("ChatView: Adding new message:",G.id),G.sender.type==="agent"&&(p(z=>new Set(z).add(G.id)),!((X=G.metadata)!=null&&X.streaming))){const z=G.content.length*35+1e3;setTimeout(()=>{p(oe=>{const H=new Set(oe);return H.delete(G.id),H})},z)}return[...O,G]}),setTimeout(()=>N(!0),0)},W=G=>{var O;if(console.log("ChatView: Updated message:",G),w&&G.sender.type==="agent"){console.log("ChatView: Queuing agent message update due to active interaction:",w.methodName),f($=>{const X=$.findIndex(z=>z.id===G.id);if(X>=0){const z=[...$];return z[X]=G,z}else return[...$,G]});return}a($=>$.map(X=>X.id===G.id?{...G}:X)),setTimeout(()=>N(!0),0),(O=G.metadata)!=null&&O.streaming||p($=>{const X=new Set($);return X.delete(G.id),X})},J=G=>{console.log("ChatView: Sent message:",G),u(!1),a(O=>O.some(X=>X.id===G.id)?(console.log("ChatView: Sent message already exists, skipping:",G.id),O):(console.log("ChatView: Adding sent message:",G.id),[...O,G])),setTimeout(()=>N(!0),0)};return t.on("chat.message.received",j),t.on("chat.message.updated",W),t.on("chat.message.sent",J),()=>{t.off("chat.message.received",j),t.off("chat.message.updated",W),t.off("chat.message.sent",J)}},[t,w]),g.useEffect(()=>{const j=O=>{console.log("ChatView: RPC interaction started:",O);const $=t.getCurrentInteraction();console.log("ChatView: Got interaction from client:",$==null?void 0:$.methodName),x($),l(!1),N(!0),setTimeout(()=>{N(!1)},100)},W=O=>{if(console.log("ChatView: RPC interaction completed:",O),x(null),v.length>0&&(console.log("ChatView: Processing",v.length,"queued messages"),a($=>{const X=[...$];return v.forEach(z=>{var H;if(!X.some(ue=>ue.id===z.id)&&(console.log("ChatView: Adding queued message:",z.id),X.push(z),z.sender.type==="agent"&&(p(ue=>new Set(ue).add(z.id)),!((H=z.metadata)!=null&&H.streaming)))){const ue=z.content.length*35+1e3;setTimeout(()=>{p(we=>{const rt=new Set(we);return rt.delete(z.id),rt})},ue)}}),X}),f([]),setTimeout(()=>N(!0),0)),O&&O.response&&O.response.success){let $=null;O.response.successView?$=O.response.successView:O.successView&&($=O.successView),a(X=>{const z=[...X].reverse().findIndex(we=>we.sender.type==="participant");let oe=X.length;z!==-1&&(oe=X.length-z);const H={id:`success_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{type:"successView",view:$||m.jsx(F5,{})}};t&&typeof t.addChatMessage=="function"&&t.addChatMessage(H);const ue=[...X];return ue.splice(oe,0,H),ue})}},J=async O=>{w&&(console.log("ChatView: Dismissing active interaction due to timeout"),t.dismissCurrentInteraction()),x(null),v.length>0&&(console.log("ChatView: Processing",v.length,"queued messages after timeout"),a(X=>{const z=[...X];return v.forEach(oe=>{var ue;if(!z.some(we=>we.id===oe.id)&&(z.push(oe),oe.sender.type==="agent"&&(p(we=>new Set(we).add(oe.id)),!((ue=oe.metadata)!=null&&ue.streaming)))){const we=oe.content.length*35+1e3;setTimeout(()=>{p(rt=>{const Qt=new Set(rt);return Qt.delete(oe.id),Qt})},we)}}),z}),f([]),setTimeout(()=>N(!0),0));let $=null;O&&O.response&&O.response.timeoutView?$=O.response.timeoutView:O&&O.timeoutView&&($=O.timeoutView),a(X=>{const z={id:`timeout_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"agent",name:I,type:"agent"},metadata:{type:"timeoutView",view:$||m.jsx(U5,{})}};return t&&typeof t.addChatMessage=="function"&&t.addChatMessage(z),[...X,z]}),setTimeout(()=>{t.getCurrentInteraction()||x(null)},100)},G=async O=>{console.log("ChatView: RPC interaction dismissed:",O),console.log("ChatView: Current interaction before dismiss:",w==null?void 0:w.methodName),x(null),v.length>0&&(console.log("ChatView: Processing",v.length,"queued messages after dismissal"),a($=>{const X=[...$];return v.forEach(z=>{var H;if(!X.some(ue=>ue.id===z.id)&&(X.push(z),z.sender.type==="agent"&&(p(ue=>new Set(ue).add(z.id)),!((H=z.metadata)!=null&&H.streaming)))){const ue=z.content.length*35+1e3;setTimeout(()=>{p(we=>{const rt=new Set(we);return rt.delete(z.id),rt})},ue)}}),X}),f([]),setTimeout(()=>N(!0),0)),setTimeout(()=>{const $=t.getCurrentInteraction();console.log("ChatView: Latest interaction from client after dismiss:",($==null?void 0:$.methodName)||"null"),$===null&&x(null)},50),console.log("ChatView: Set currentInteraction to null after dismiss")};return t.on("rpc.interaction.started",j),t.on("rpc.interaction.completed",W),t.on("rpc.interaction.timeout",J),t.on("rpc.interaction.dismissed",G),()=>{t.off("rpc.interaction.started",j),t.off("rpc.interaction.completed",W),t.off("rpc.interaction.timeout",J),t.off("rpc.interaction.dismissed",G)}},[t]),g.useEffect(()=>{const j=()=>{if(console.log("ChatView: Agent is thinking"),w){console.log("ChatView: Suppressing thinking indicator due to active interaction:",w.methodName);return}l(!0)},W=()=>{console.log("ChatView: Agent is speaking"),l(!1)};return t.on("agent.thinking",j),t.on("agent.speaking",W),()=>{t.off("agent.thinking",j),t.off("agent.speaking",W)}},[t,w]),g.useEffect(()=>{const j=t.getCurrentInteraction();j?(console.log("ChatView: Restoring interaction state on mount/client change:",j.methodName),x(j)):x(null)},[t]),g.useEffect(()=>{console.log("ChatView: Display type changed to:",r,"Current interaction:",(w==null?void 0:w.methodName)||"none")},[r,w]);const Z=async j=>{try{w&&(console.log("ChatView: Dismissing active interaction due to user message send"),t.dismissCurrentInteraction(),x(null)),await t.sendChatMessage(j)}catch(W){console.error("Failed to send message:",W)}},Q=async j=>{try{w&&(console.log("ChatView: Dismissing active interaction due to user attachment send"),t.dismissCurrentInteraction(),x(null)),await t.sendAttachments(j),console.log("Attachments sent successfully:",j.map(W=>W.name))}catch(W){console.error("Failed to send attachments:",W)}},[se,te]=g.useState([]);if(g.useEffect(()=>{const j=W=>{te(Array.isArray(W)?W:["tes","hello how are you","algebra make me learn that ","what is the meaning of life"])};return t.on("suggested.response",j),()=>{t.off("suggested.response",j)}},[t]),d){const j=S&&y?"fixed inset-0 z-[9999] flex flex-col items-center justify-center h-screen w-screen bg-black":"flex w-full flex-col items-center justify-center h-full p-8";return m.jsxs("div",{className:j,children:[m.jsx("div",{className:`${E.spinner} w-12 h-12 mb-6`}),m.jsxs("p",{className:`text-sm text-center ${S&&y?"text-white":""}`,children:["Connecting to ",I,"..."]})]})}const Y=S&&y?"fullscreen":r,_=Y==="fullscreen"?S&&y?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"flex flex-col h-full w-full max-w-none":"flex flex-col h-full w-full backdrop-blur-sm",ie=Y==="fullscreen"?S&&y?"flex items-center w-full justify-between px-4 pt-3 pb-3 bg-black/80 text-white border-b border-gray-700":`flex items-center w-full justify-between px-6 pt-5 pb-4 border-b ${E.chatHeader.container}`:`flex items-center w-full justify-between px-4 pt-5 pb-4 border-b ${E.chatHeader.container}`,L=Y==="fullscreen"?S&&y?"flex-1 overflow-y-auto scrollbar-hide p-4 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide p-6 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide w-full p-4 chat-scrollable min-h-0",F="flex-shrink-0 !w-full",ee=()=>{k(!1),n&&n()};return m.jsxs("div",{className:_,children:[m.jsx("div",{className:ie,children:m.jsxs("div",{className:"flex items-center gap-2",children:[S&&y&&m.jsx(ge.button,{onClick:ee,whileHover:{scale:1.05},whileTap:{scale:.95},className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors mr-2","aria-label":"Exit fullscreen",children:"✕"}),m.jsxs("div",{children:[m.jsx("h3",{className:`font-semibold text-base leading-tight ${S&&y?"text-white":E.text.primary}`,children:I}),m.jsxs("p",{className:`text-xs flex items-center gap-1.5 mt-0.5 ${S&&y?"text-gray-300":E.text.muted}`,children:[m.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"}),"Online"]})]})]})}),m.jsxs("div",{className:`${L} flex flex-col`,style:{scrollBehavior:"smooth",scrollbarWidth:"none"},children:[" ",o.length===0?m.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center py-12",children:[m.jsx(ge.div,{transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-16 h-16 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl mb-6 shadow-xl",children:C}),m.jsxs("p",{className:`text-base mb-2 ${S&&y?"text-white":E.text.secondary}`,children:[I," is joining..."]}),m.jsx("p",{className:`text-xs ${S&&y?"text-gray-300":E.text.muted}`,children:"Your conversation will begin shortly"})]}):m.jsx("div",{className:"w-full max-w-5xl mx-auto space-y-3 py-4 flex-1 flex flex-col justify-end",children:m.jsxs("div",{className:"space-y-3",children:[o.map((j,W)=>{var J,G;return m.jsx("div",{children:((J=j.metadata)==null?void 0:J.type)==="successView"?m.jsx("div",{className:"flex w-full justify-end mb-4 px-1",children:m.jsxs("div",{className:"relative group flex-row-reverse flex items-end gap-3 max-w-[85%]",children:[m.jsx(ge.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:"Y"}),m.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-br-md message-hover border-gray-200 dark:border-gray-700 ${E.chatMessage.own}`,children:[j.metadata.view,m.jsx("div",{className:`text-xs ${E.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:j.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):((G=j.metadata)==null?void 0:G.type)==="timeoutView"?m.jsx("div",{className:"flex w-full justify-start mb-4 px-1",children:m.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[m.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:C}),m.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${E.chatMessage.other}`,children:[j.metadata.view,m.jsx("div",{className:`text-xs ${E.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:j.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):m.jsx(D5,{message:j,theme:e,isOwn:j.sender.type==="participant",isStreaming:h.has(j.id)})},j.id)}),c&&!w&&m.jsx(ge.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:o.length*.1},className:"flex w-full justify-start mb-4 px-1",children:m.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[m.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:C}),m.jsx("div",{className:`relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover ${E.chatMessage.other} rounded-bl-md transition-all duration-200 group-hover:scale-[1.02]`,style:{wordWrap:"break-word",overflowWrap:"break-word",minWidth:48},children:m.jsx("span",{className:"inline-flex items-center",children:[0,1,2].map(j=>m.jsx(ge.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:j*.2,ease:"easeInOut"}},j))})})]})}),w&&w.presentationMode==="embedded"&&m.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[m.jsx(ge.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${e==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:C}),m.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${E.chatMessage.other}`,children:[m.jsx(_r,{interaction:w,theme:e,onDismiss:()=>t.dismissCurrentInteraction(),client:t,addLocalMessage:A},w.methodName),m.jsx(ge.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:`text-xs ${E.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),m.jsx("div",{ref:T})]})})]}),se.length>0&&m.jsx("div",{className:"w-full flex overflow-x-auto gap-2 px-4 py-2 mb-1 scrollbar-hide",children:se.map((j,W)=>{var J;return m.jsx("button",{className:`whitespace-nowrap px-3 py-1 rounded-full border shadow-sm flex-shrink-0 transition-all duration-150 font-medium text-sm focus:outline-none focus:ring-2 focus:ring-blue-400/40
|
|
284
|
-
${
|
|
285
|
-
`,style:{boxShadow:
|
|
199
|
+
${t==="light"?"hover:bg-gray-200 text-gray-600 hover:text-gray-800":"hover:bg-gray-600 text-gray-400 hover:text-gray-200"}
|
|
200
|
+
`,"aria-label":"Download file",children:c.jsx(Ib,{className:"w-4 h-4"})})]})]})}function g2(){return c.jsxs("div",{className:"max-w-xs mx-auto bg-green-50 border border-green-200 rounded-lg shadow p-3 flex flex-col items-center",children:[c.jsx("div",{className:"text-2xl mb-2",children:"✅"}),c.jsx("div",{className:"text-green-700 font-semibold text-sm mb-1",children:"Success!"}),c.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"Your action was completed successfully."})]})}function x2(){return c.jsxs("div",{className:"max-w-xs mx-auto bg-yellow-50 border border-yellow-200 rounded-lg shadow p-3 flex flex-col items-center",children:[c.jsx("div",{className:"text-2xl mb-2",children:"⏰"}),c.jsx("div",{className:"text-yellow-700 font-semibold text-sm mb-1",children:"Interaction timed out"}),c.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:"No response was provided in time."})]})}function y2({client:e,theme:t="vox",onBack:n,disabled:s=!1,displayType:r="widget",onEndChat:i}){const[o,a]=f.useState(()=>{if(e&&typeof e.getChatMessages=="function"){const M=e.getChatMessages();return console.log("🔄 ChatView: Initializing with existing messages:",M.length),M}return[]}),[l,d]=f.useState(!0),[u,h]=f.useState(()=>{const M=e&&typeof e.getCurrentSession=="function"&&!!e.getCurrentSession(),H=e&&typeof e.getChatMessages=="function"&&e.getChatMessages().length>0;return!M&&!H}),[m,g]=f.useState(new Set),[x,p]=f.useState([]),[v,b]=f.useState(!1),[y,w]=f.useState(!1),[S,k]=f.useState(()=>{const M=e.getCurrentInteraction();return console.log("ChatView: Initializing with existing interaction:",(M==null?void 0:M.methodName)||"none"),M}),T=f.useRef(null),A=Ve(t);f.useEffect(()=>{const M=()=>{const H=navigator.userAgent.toLowerCase(),U=["android","iphone","ipad","mobile","tablet"].some(D=>H.includes(D)),N="ontouchstart"in window||navigator.maxTouchPoints>0,L=window.innerWidth<=768,W=U||N&&L;b(W),W&&r==="widget"&&w(!0)};return M(),window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[r]),f.useEffect(()=>(y&&v&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.height="100%",document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(console.log)),()=>{y&&v&&(document.body.style.overflow="unset",document.body.style.position="unset",document.body.style.width="unset",document.body.style.height="unset",document.fullscreenElement&&document.exitFullscreen().catch(console.log))}),[y,v]);const j=e.getCurrentAgentInfo(),V=(j==null?void 0:j.name)||"AI Assistant",I=V.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2),$=f.useCallback(M=>{const H={id:`local_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:M,timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{isLocal:!0}};a(q=>(console.log("ChatView: Adding local message:",H.id),[...q,H]))},[]);f.useEffect(()=>{var M,H,q,U,N;console.log("💬 ChatView loading state:",{isLoading:u,hasActiveSession:!!((M=e==null?void 0:e.getCurrentSession)!=null&&M.call(e)),messagesCount:o.length,sessionId:(q=(H=e==null?void 0:e.getCurrentSession)==null?void 0:H.call(e))==null?void 0:q.id,hasStoredMessages:!!((N=(U=e==null?void 0:e.getChatMessages)==null?void 0:U.call(e))!=null&&N.length),isMobile:v,isFullscreen:y})},[u,o.length,e,v,y]);const F=f.useCallback((M=!1)=>{T.current&&(M?T.current.scrollIntoView({behavior:"auto"}):T.current.scrollIntoView({behavior:"smooth"}))},[]);f.useEffect(()=>{F(!0);const M=setTimeout(()=>{F(!1)},10);return()=>clearTimeout(M)},[o.length,F]),f.useEffect(()=>{if(S){F(!0);const M=setTimeout(()=>{F(!1)},50);return()=>clearTimeout(M)}},[S,F]),f.useEffect(()=>{const M=U=>{if(console.log("ChatView: Received message:",U),h(!1),S&&U.sender.type==="agent"){console.log("ChatView: Queuing agent message due to active interaction:",S.methodName),p(N=>[...N,U]);return}U.sender.type==="agent"&&d(!1),a(N=>{var W;if(N.some(D=>D.id===U.id))return console.log("ChatView: Message already exists, skipping:",U.id),N;if(console.log("ChatView: Adding new message:",U.id),U.sender.type==="agent"&&(g(D=>new Set(D).add(U.id)),!((W=U.metadata)!=null&&W.streaming))){const D=U.content.length*35+1e3;setTimeout(()=>{g(ne=>{const te=new Set(ne);return te.delete(U.id),te})},D)}return[...N,U]}),setTimeout(()=>F(!0),0)},H=U=>{var N;if(console.log("ChatView: Updated message:",U),S&&U.sender.type==="agent"){console.log("ChatView: Queuing agent message update due to active interaction:",S.methodName),p(L=>{const W=L.findIndex(D=>D.id===U.id);if(W>=0){const D=[...L];return D[W]=U,D}else return[...L,U]});return}a(L=>L.map(W=>W.id===U.id?{...U}:W)),setTimeout(()=>F(!0),0),(N=U.metadata)!=null&&N.streaming||g(L=>{const W=new Set(L);return W.delete(U.id),W})},q=U=>{console.log("ChatView: Sent message:",U),h(!1),a(N=>N.some(W=>W.id===U.id)?(console.log("ChatView: Sent message already exists, skipping:",U.id),N):(console.log("ChatView: Adding sent message:",U.id),[...N,U])),setTimeout(()=>F(!0),0)};return e.on("chat.message.received",M),e.on("chat.message.updated",H),e.on("chat.message.sent",q),()=>{e.off("chat.message.received",M),e.off("chat.message.updated",H),e.off("chat.message.sent",q)}},[e,S]),f.useEffect(()=>{const M=N=>{console.log("ChatView: RPC interaction started:",N);const L=e.getCurrentInteraction();console.log("ChatView: Got interaction from client:",L==null?void 0:L.methodName),k(L),d(!1),F(!0),setTimeout(()=>{F(!1)},100)},H=N=>{if(console.log("ChatView: RPC interaction completed:",N),k(null),x.length>0&&(console.log("ChatView: Processing",x.length,"queued messages"),a(L=>{const W=[...L];return x.forEach(D=>{var te;if(!W.some(de=>de.id===D.id)&&(console.log("ChatView: Adding queued message:",D.id),W.push(D),D.sender.type==="agent"&&(g(de=>new Set(de).add(D.id)),!((te=D.metadata)!=null&&te.streaming)))){const de=D.content.length*35+1e3;setTimeout(()=>{g(me=>{const Ae=new Set(me);return Ae.delete(D.id),Ae})},de)}}),W}),p([]),setTimeout(()=>F(!0),0)),N&&N.response&&N.response.success){let L=null;N.response.successView?L=N.response.successView:N.successView&&(L=N.successView),a(W=>{const D=[...W].reverse().findIndex(me=>me.sender.type==="participant");let ne=W.length;D!==-1&&(ne=W.length-D);const te={id:`success_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"participant",name:"You",type:"participant"},metadata:{type:"successView",view:L||c.jsx(g2,{})}};e&&typeof e.addChatMessage=="function"&&e.addChatMessage(te);const de=[...W];return de.splice(ne,0,te),de})}},q=async N=>{S&&(console.log("ChatView: Dismissing active interaction due to timeout"),e.dismissCurrentInteraction()),k(null),x.length>0&&(console.log("ChatView: Processing",x.length,"queued messages after timeout"),a(W=>{const D=[...W];return x.forEach(ne=>{var de;if(!D.some(me=>me.id===ne.id)&&(D.push(ne),ne.sender.type==="agent"&&(g(me=>new Set(me).add(ne.id)),!((de=ne.metadata)!=null&&de.streaming)))){const me=ne.content.length*35+1e3;setTimeout(()=>{g(Ae=>{const De=new Set(Ae);return De.delete(ne.id),De})},me)}}),D}),p([]),setTimeout(()=>F(!0),0));let L=null;N&&N.response&&N.response.timeoutView?L=N.response.timeoutView:N&&N.timeoutView&&(L=N.timeoutView),a(W=>{const D={id:`timeout_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,content:"",timestamp:new Date,sender:{id:"agent",name:V,type:"agent"},metadata:{type:"timeoutView",view:L||c.jsx(x2,{})}};return e&&typeof e.addChatMessage=="function"&&e.addChatMessage(D),[...W,D]}),setTimeout(()=>{e.getCurrentInteraction()||k(null)},100)},U=async N=>{console.log("ChatView: RPC interaction dismissed:",N),console.log("ChatView: Current interaction before dismiss:",S==null?void 0:S.methodName),k(null),x.length>0&&(console.log("ChatView: Processing",x.length,"queued messages after dismissal"),a(L=>{const W=[...L];return x.forEach(D=>{var te;if(!W.some(de=>de.id===D.id)&&(W.push(D),D.sender.type==="agent"&&(g(de=>new Set(de).add(D.id)),!((te=D.metadata)!=null&&te.streaming)))){const de=D.content.length*35+1e3;setTimeout(()=>{g(me=>{const Ae=new Set(me);return Ae.delete(D.id),Ae})},de)}}),W}),p([]),setTimeout(()=>F(!0),0)),setTimeout(()=>{const L=e.getCurrentInteraction();console.log("ChatView: Latest interaction from client after dismiss:",(L==null?void 0:L.methodName)||"null"),L===null&&k(null)},50),console.log("ChatView: Set currentInteraction to null after dismiss")};return e.on("rpc.interaction.started",M),e.on("rpc.interaction.completed",H),e.on("rpc.interaction.timeout",q),e.on("rpc.interaction.dismissed",U),()=>{e.off("rpc.interaction.started",M),e.off("rpc.interaction.completed",H),e.off("rpc.interaction.timeout",q),e.off("rpc.interaction.dismissed",U)}},[e]),f.useEffect(()=>{const M=()=>{if(console.log("ChatView: Agent is thinking"),S){console.log("ChatView: Suppressing thinking indicator due to active interaction:",S.methodName);return}d(!0)},H=()=>{console.log("ChatView: Agent is speaking"),d(!1)};return e.on("agent.thinking",M),e.on("agent.speaking",H),()=>{e.off("agent.thinking",M),e.off("agent.speaking",H)}},[e,S]),f.useEffect(()=>{const M=e.getCurrentInteraction();M?(console.log("ChatView: Restoring interaction state on mount/client change:",M.methodName),k(M)):k(null)},[e]),f.useEffect(()=>{console.log("ChatView: Display type changed to:",r,"Current interaction:",(S==null?void 0:S.methodName)||"none")},[r,S]);const se=async M=>{try{S&&(console.log("ChatView: Dismissing active interaction due to user message send"),e.dismissCurrentInteraction(),k(null)),await e.sendChatMessage(M)}catch(H){console.error("Failed to send message:",H)}},Z=async M=>{try{S&&(console.log("ChatView: Dismissing active interaction due to user attachment send"),e.dismissCurrentInteraction(),k(null)),await e.sendAttachments(M),console.log("Attachments sent successfully:",M.map(H=>H.name))}catch(H){console.error("Failed to send attachments:",H)}},[ee,G]=f.useState([]);if(f.useEffect(()=>{const M=H=>{G(Array.isArray(H)?H:["tes","hello how are you","algebra make me learn that ","what is the meaning of life"])};return e.on("suggested.response",M),()=>{e.off("suggested.response",M)}},[e]),u){const M=y&&v?"fixed inset-0 z-[9999] flex flex-col items-center justify-center h-screen w-screen bg-black":"flex w-full flex-col items-center justify-center h-full p-8";return c.jsxs("div",{className:M,children:[c.jsx("div",{className:`${A.spinner} w-12 h-12 mb-6`}),c.jsxs("p",{className:`text-sm text-center ${y&&v?"text-white":""}`,children:["Connecting to ",V,"..."]})]})}const O=y&&v?"fullscreen":r,P=O==="fullscreen"?y&&v?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"flex flex-col h-full w-full max-w-none":"flex flex-col h-full w-full backdrop-blur-sm",B=O==="fullscreen"?y&&v?"flex items-center w-full justify-between px-4 pt-3 pb-3 bg-black/80 text-white border-b border-gray-700":`flex items-center w-full justify-between px-6 pt-5 pb-4 border-b ${A.chatHeader.container}`:`flex items-center w-full justify-between px-4 pt-5 pb-4 border-b ${A.chatHeader.container}`,X=O==="fullscreen"?y&&v?"flex-1 overflow-y-auto scrollbar-hide p-4 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide p-6 w-full max-w-none chat-scrollable min-h-0":"flex-1 overflow-y-auto scrollbar-hide w-full p-4 chat-scrollable min-h-0",_="flex-shrink-0 !w-full",re=()=>{w(!1),n&&n()};return c.jsxs("div",{className:P,children:[c.jsx("div",{className:B,children:c.jsxs("div",{className:"flex items-center gap-2",children:[y&&v&&c.jsx(ce.button,{onClick:re,whileHover:{scale:1.05},whileTap:{scale:.95},className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors mr-2","aria-label":"Exit fullscreen",children:"✕"}),c.jsxs("div",{children:[c.jsx("h3",{className:`font-semibold text-base leading-tight ${y&&v?"text-white":A.text.primary}`,children:V}),c.jsxs("p",{className:`text-xs flex items-center gap-1.5 mt-0.5 ${y&&v?"text-gray-300":A.text.muted}`,children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"}),"Online"]})]})]})}),c.jsxs("div",{className:`${X} flex flex-col`,style:{scrollBehavior:"smooth",scrollbarWidth:"none"},children:[" ",o.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center py-12",children:[c.jsx(ce.div,{transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-16 h-16 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl mb-6 shadow-xl",children:I}),c.jsxs("p",{className:`text-base mb-2 ${y&&v?"text-white":A.text.secondary}`,children:[V," is joining..."]}),c.jsx("p",{className:`text-xs ${y&&v?"text-gray-300":A.text.muted}`,children:"Your conversation will begin shortly"})]}):c.jsx("div",{className:"w-full max-w-5xl mx-auto space-y-3 py-4 flex-1 flex flex-col justify-end",children:c.jsxs("div",{className:"space-y-3",children:[o.map((M,H)=>{var q,U;return c.jsx("div",{children:((q=M.metadata)==null?void 0:q.type)==="successView"?c.jsx("div",{className:"flex w-full justify-end mb-4 px-1",children:c.jsxs("div",{className:"relative group flex-row-reverse flex items-end gap-3 max-w-[85%]",children:[c.jsx(ce.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:"Y"}),c.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-br-md message-hover border-gray-200 dark:border-gray-700 ${A.chatMessage.own}`,children:[M.metadata.view,c.jsx("div",{className:`text-xs ${A.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:M.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):((U=M.metadata)==null?void 0:U.type)==="timeoutView"?c.jsx("div",{className:"flex w-full justify-start mb-4 px-1",children:c.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[c.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:I}),c.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${A.chatMessage.other}`,children:[M.metadata.view,c.jsx("div",{className:`text-xs ${A.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:M.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}):c.jsx(f2,{message:M,theme:t,isOwn:M.sender.type==="participant",isStreaming:m.has(M.id)})},M.id)}),l&&!S&&c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:o.length*.1},className:"flex w-full justify-start mb-4 px-1",children:c.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[c.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to-gray-700"}`,children:I}),c.jsx("div",{className:`relative px-3 py-2 rounded-2xl break-words shadow-lg backdrop-blur-sm message-bubble message-hover ${A.chatMessage.other} rounded-bl-md transition-all duration-200 group-hover:scale-[1.02]`,style:{wordWrap:"break-word",overflowWrap:"break-word",minWidth:48},children:c.jsx("span",{className:"inline-flex items-center",children:[0,1,2].map(M=>c.jsx(ce.span,{className:"w-1.5 h-1.5 bg-current rounded-full mx-0.5",animate:{y:[0,-4,0],opacity:[.4,1,.4],scale:[.8,1,.8]},transition:{duration:.8,repeat:1/0,repeatType:"mirror",delay:M*.2,ease:"easeInOut"}},M))})})]})}),S&&S.presentationMode==="embedded"&&c.jsxs("div",{className:"relative group flex-row flex items-end gap-3 max-w-[85%]",children:[c.jsx(ce.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1},className:`w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-semibold flex-shrink-0 shadow-lg ${t==="light"?"bg-gradient-to-br from-blue-500 to-purple-600":"bg-gradient-to-br from-gray-600 to_gray-700"}`,children:I}),c.jsxs("div",{className:`flex h-full flex-col justify-between border px-3 py-2 rounded-2xl shadow-lg backdrop-bl-sm message-bubble rounded-bl-md message-hover border-gray-200 dark:border-gray-700 ${A.chatMessage.other}`,children:[c.jsx(xn,{interaction:S,theme:t,onDismiss:()=>e.dismissCurrentInteraction(),client:e,addLocalMessage:$},S.methodName),c.jsx(ce.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:`text-xs ${A.text.muted} mt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 `,children:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),c.jsx("div",{ref:T})]})})]}),ee.length>0&&c.jsx("div",{className:"w-full flex overflow-x-auto gap-2 px-4 py-2 mb-1 scrollbar-hide",children:ee.map((M,H)=>{var q;return c.jsx("button",{className:`whitespace-nowrap px-3 py-1 rounded-full border shadow-sm flex-shrink-0 transition-all duration-150 font-medium text-sm focus:outline-none focus:ring-2 focus:ring-blue-400/40
|
|
201
|
+
${t==="light"?"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900":t==="dark"?"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white":((q=A.suggestedResponse)==null?void 0:q.container)||"bg-gradient-to-br from-blue-500 to-purple-600 text-white border-blue-400 hover:from-blue-600 hover:to-purple-700"}
|
|
202
|
+
`,style:{boxShadow:t==="vox"?"0 2px 8px 0 rgba(80,60,200,0.10)":void 0,borderWidth:1},onClick:()=>{se(M),G([])},children:M},M+H)})}),S&&S.presentationMode!=="embedded"&&c.jsx(xn,{interaction:S,theme:t,onDismiss:()=>e.dismissCurrentInteraction(),client:e,addLocalMessage:$},S.methodName),c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:_,children:c.jsx(d2,{onSendMessage:se,onSendAttachments:Z,disabled:s,theme:t,onEndChat:i})})]})}function v2({onToggleCamera:e,onToggleScreenShare:t,onEndCall:n,onBack:s,theme:r,cameraEnabled:i,screenShareEnabled:o,isCameraLoading:a,isScreenShareLoading:l,disabled:d}){const u=Ve(r);return c.jsxs("div",{className:`flex items-center justify-center gap-3 p-4 ${u.video.controlsBackground}`,children:[c.jsx("button",{onClick:e,disabled:d||a,className:`p-3 rounded-full transition-all duration-200 ${i?u.video.controlEnabled:u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:i?"Turn off camera":"Turn on camera",children:a?c.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):i?c.jsx(Yu,{className:"w-5 h-5"}):c.jsx(Ku,{className:"w-5 h-5"})}),c.jsx("button",{onClick:t,disabled:d||l,className:`p-3 rounded-full transition-all duration-200 ${o?u.video.controlEnabled:u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:o?"Stop screen share":"Share screen",children:l?c.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-current border-t-transparent"}):o?c.jsx(Hb,{className:"w-5 h-5"}):c.jsx(zb,{className:"w-5 h-5"})}),n&&c.jsx("button",{onClick:n,disabled:d,className:`p-3 rounded-full transition-all duration-200 ${u.video.endCall} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"End call",children:c.jsx(Gu,{className:"w-5 h-5"})}),s&&c.jsx("button",{onClick:s,disabled:d,className:`p-3 rounded-full transition-all duration-200 ${u.video.controlDisabled} ${d?"opacity-50 cursor-not-allowed":"hover:scale-105"}`,title:"Back",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})})]})}function Pl({trackRef:e,participant:t,isLocal:n=!1,className:s="",theme:r}){var l;const i=Ve(r),o=(t==null?void 0:t.name)||(t==null?void 0:t.identity)||(n?"You":"Participant"),a=(e==null?void 0:e.publication)&&!e.publication.isMuted;return c.jsxs("div",{className:`relative rounded-lg overflow-hidden ${i.video.tile} ${s}`,children:[a?c.jsx(ke.VideoTrack,{trackRef:e,className:"w-full h-full object-cover"}):c.jsx("div",{className:`w-full h-full flex items-center justify-center ${i.video.placeholder}`,children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:`w-16 h-16 mx-auto mb-2 rounded-full flex items-center justify-center ${i.video.avatar}`,children:c.jsx(Qb,{className:"w-8 h-8"})}),c.jsx("p",{className:"text-sm opacity-80",children:o}),c.jsx("p",{className:"text-xs opacity-60",children:"Camera off"})]})}),c.jsx("div",{className:`absolute bottom-2 left-2 px-2 py-1 rounded text-xs ${i.video.nameOverlay}`,children:o}),((l=e==null?void 0:e.publication)==null?void 0:l.isMuted)&&c.jsx("div",{className:`absolute top-2 right-2 p-1 rounded ${i.video.mutedIndicator}`,children:c.jsx(Ku,{className:"w-4 h-4"})})]})}function b2({trackRefs:e,participants:t,theme:n,localParticipant:s}){const r=e.find(u=>u.source===J.Track.Source.Camera&&u.participant===s),i=e.filter(u=>u.participant!==s),o=e.length,a=o<=1?1:o<=4?2:3,l="grid gap-2 h-full",d={gridTemplateColumns:`repeat(${a}, 1fr)`,gridAutoRows:"minmax(0, 1fr)"};return c.jsxs("div",{className:l,style:d,children:[r&&s&&c.jsx(Pl,{trackRef:r,participant:s,isLocal:!0,theme:n,className:"min-h-0"}),i.map((u,h)=>{var m;return c.jsx(Pl,{trackRef:u,participant:u.participant,isLocal:!1,theme:n,className:"min-h-0"},((m=u.publication)==null?void 0:m.trackSid)||h)}),o===0&&c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center",children:[c.jsx(t2,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),c.jsx("p",{className:"text-lg opacity-70",children:"Waiting for participants..."}),c.jsx("p",{className:"text-sm opacity-50",children:"Turn on your camera to start the video call"})]})})]})}function w2({client:e,theme:t="vox",onBack:n,disabled:s=!1,displayType:r,onEndCall:i}){const o=Ve(t),a=ke.useMaybeRoomContext(),[l,d]=f.useState(!1),[u,h]=f.useState(!1),[m,g]=f.useState(!1),[x,p]=f.useState(!1),[v,b]=f.useState(null),y=ke.useTracks([J.Track.Source.Camera,J.Track.Source.ScreenShare],{onlySubscribed:!1});y.filter(A=>A.source===J.Track.Source.Camera),y.filter(A=>A.source===J.Track.Source.ScreenShare);const w=f.useMemo(()=>a?Array.from(a.remoteParticipants.values()):[],[a]),S=f.useCallback(async()=>{if(!(!a||m)){g(!0);try{const A=a.localParticipant;l?(await A.setCameraEnabled(!1),d(!1)):(await A.setCameraEnabled(!0),d(!0))}catch(A){console.error("Failed to toggle camera:",A)}finally{g(!1)}}},[a,l,m]),k=f.useCallback(async()=>{if(!(!a||x)){p(!0);try{const A=a.localParticipant;u?(await A.setScreenShareEnabled(!1),h(!1)):(await A.setScreenShareEnabled(!0),h(!0))}catch(A){console.error("Failed to toggle screen share:",A)}finally{p(!1)}}},[a,u,x]),T=f.useCallback(()=>{i?i():n&&n()},[i,n]);return f.useEffect(()=>{if(!e)return;const A=j=>{console.log("📺 Video: Interactive UI state updated:",j),b(j)};return e.on("interactive.ui.update",A),e.on("interactive.ui.show",A),()=>{e.off("interactive.ui.update",A),e.off("interactive.ui.show",A)}},[e]),c.jsxs("div",{className:`flex flex-col h-full ${o.video.container}`,children:[c.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${o.video.header}`,children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:`w-3 h-3 rounded-full ${o.video.statusDot}`}),c.jsx("span",{className:"font-medium",children:"Video Call"}),c.jsxs("span",{className:"text-sm opacity-70",children:[w.length+1," participant",w.length!==0?"s":""]})]}),c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("button",{className:`p-2 rounded-lg transition-colors ${o.video.headerButton}`,title:"Layout options",children:c.jsx($b,{className:"w-4 h-4"})})})]}),c.jsx("div",{className:"flex-1 p-4 min-h-0",children:c.jsx(b2,{trackRefs:y,participants:w,localParticipant:a==null?void 0:a.localParticipant,theme:t})}),v&&c.jsx(ce.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},className:"absolute inset-4 z-10",children:c.jsx(xn,{interaction:v,onDismiss:()=>b(null),theme:t})}),c.jsx(v2,{onToggleCamera:S,onToggleScreenShare:k,onEndCall:T,onBack:n,theme:t,cameraEnabled:l,screenShareEnabled:u,isCameraLoading:m,isScreenShareLoading:x,disabled:s})]})}function ps({onClick:e,disabled:t,theme:n}){const s=Ve(n);return c.jsx("button",{className:s.micButton,onClick:e,disabled:t,"aria-label":"Start Voice Session",type:"button",children:c.jsx(gt.Mic,{})})}function Mr({onClick:e,disabled:t,theme:n}){const s=Ve(n);return c.jsx("button",{className:s.chatButton,onClick:e,disabled:t,"aria-label":"Start Chat Session",type:"button",children:c.jsx(gt.Chat,{})})}function Nr({onClick:e,disabled:t,theme:n}){const s=Ve(n);return c.jsx("button",{className:s.videoButton,onClick:e,disabled:t,"aria-label":"Start Video Session",type:"button",children:c.jsx(gt.Videocam,{})})}function S2({prompts:e,theme:t}){const n=Ve(t),[s,r]=E.useState(0);return E.useEffect(()=>{const i=setInterval(()=>{r(o=>(o+1)%e.length)},3e3);return()=>clearInterval(i)},[e.length]),c.jsx("div",{className:"w-96 min-h-[3rem] h-12 relative overflow-hidden flex items-center justify-center",children:e.map((i,o)=>c.jsx("div",{className:`
|
|
286
203
|
${n.promptSlider}
|
|
287
|
-
${o===
|
|
204
|
+
${o===s?"opacity-100":"opacity-0"}
|
|
288
205
|
whitespace-pre-line break-words
|
|
289
|
-
`,style:{minHeight:"2.5rem",display:o===i?"block":"none"},children:s},o))})}function q5({statusMessage:t,theme:e}){const n=ut(e);return m.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[m.jsx("div",{className:n.statusIndicator}),m.jsx("span",{className:`text-xs ${n.text.muted}`,children:t})]})}const G5=({disabled:t,onStartCall:e,onStartChat:n,onStartVideo:i,prompts:r=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:s="Agent is ready",title:o="Choose how to interact",subTitle:a="Ask me anything or give me a task to complete",theme:c="vox",modalities:l=["voice","chat","video"]})=>{const d=ut(c),u=l.includes("voice"),h=l.includes("chat"),p=l.includes("video"),v=[u,h,p].filter(Boolean).length;return console.log("🎯 Welcome component debug:",{modalities:l,hasVoice:u,hasChat:h,hasVideo:p,totalButtons:v,onStartVideo:!!i}),m.jsxs("div",{inert:t,className:"flex p-8 flex-col items-center h-full justify-center w-full",children:[m.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[m.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[m.jsx("div",{className:d.pulseRings.ring1}),m.jsx("div",{className:d.pulseRings.ring2,style:{animationDelay:"0.5s"}}),m.jsx("div",{className:d.pulseRings.ring3,style:{animationDelay:"1s"}})]}),m.jsx("div",{className:"relative z-10 flex items-center justify-center",children:u&&h&&p?m.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[m.jsx(wo,{onClick:e,disabled:t,theme:c}),m.jsx(ml,{onClick:n,disabled:t,theme:c}),m.jsx(pl,{onClick:i||e,disabled:t,theme:c})]}):v>1?m.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[u&&m.jsx(wo,{onClick:e,disabled:t,theme:c}),h&&m.jsx(ml,{onClick:n,disabled:t,theme:c}),p&&i&&m.jsx(pl,{onClick:i,disabled:t,theme:c})]}):m.jsx("div",{className:"flex items-center justify-center",children:u?m.jsx(wo,{onClick:e,disabled:t,theme:c}):h?m.jsx(ml,{onClick:n,disabled:t,theme:c}):p&&i?m.jsx(pl,{onClick:i,disabled:t,theme:c}):m.jsx(wo,{onClick:e,disabled:t,theme:c})})})]}),m.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[m.jsx("h3",{className:`text-xl font-semibold mb-2 ${d.text.accent}`,children:o}),m.jsx("p",{className:`text-sm leading-relaxed px-4 ${d.text.secondary}`,children:a}),v>1&&m.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[u&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx(bw,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Voice"})]}),h&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx(yw,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Chat"})]}),p&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx(xw,{className:"w-4 h-4"}),m.jsx("span",{className:d.text.muted,children:"Video"})]})]})]}),m.jsx(W5,{prompts:r,theme:c}),m.jsx(q5,{statusMessage:s,theme:c})]})};function ww({room:t,onSessionEnd:e,onSessionStart:n,enableConsoleLogging:i=!0,enableLocalStorage:r=!0,voxketSessionId:s}={}){const[o,a]=g.useState(null),[c,l]=g.useState([]),[d,u]=g.useState(null),[h,p]=g.useState([]),v=g.useCallback((S,k)=>{const w={timestamp:new Date,event:S,data:k,sessionId:o==null?void 0:o.sessionId,participantId:d==null?void 0:d.identity};if(l(x=>[...x,w]),r){const x=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");x.push(w),localStorage.setItem("voxket-session-logs",JSON.stringify(x))}return w},[o==null?void 0:o.sessionId,d==null?void 0:d.identity,i,r]);g.useEffect(()=>{if(!t)return;const S=()=>{const C=s||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,A=new Date,N={sessionId:C,startTime:A,totalMessages:0,connectionIssues:0,participantCount:h.length,events:[]};a(N),v("SESSION_STARTED",{sessionId:C,startTime:A}),n==null||n(C)},k=()=>{if(o){const C=new Date,A=C.getTime()-o.startTime.getTime(),N={...o,endTime:C,duration:A,events:c};v("SESSION_ENDED",{sessionId:o.sessionId,duration:`${Math.round(A/1e3)}s`,totalMessages:o.totalMessages,connectionIssues:o.connectionIssues}),e==null||e(N),a(null),l([])}},w=C=>{v("CONNECTION_STATE_CHANGED",{state:C}),C===he.Reconnecting&&o&&(a(A=>A?{...A,connectionIssues:A.connectionIssues+1}:null),v("CONNECTION_ISSUE",{type:"reconnecting"}))},x=C=>{v("TRACK_PUBLISHED",{trackKind:C.kind,trackSource:C.source})},T=C=>{v("TRACK_UNPUBLISHED",{trackKind:C.kind,trackSource:C.source})},E=(C,A)=>{o&&a(N=>N?{...N,totalMessages:N.totalMessages+1}:null),v("DATA_RECEIVED",{participantId:A==null?void 0:A.identity,dataSize:C.length})},P=C=>{v("PARTICIPANT_CONNECTED",{participantId:C.identity,participantName:C.name}),p(A=>[...A,C]),o&&a(A=>A?{...A,participantCount:A.participantCount+1}:null)},I=C=>{v("PARTICIPANT_DISCONNECTED",{participantId:C.identity,participantName:C.name}),p(A=>A.filter(N=>N.identity!==C.identity))};return t.localParticipant&&u(t.localParticipant),t.on(V.Connected,S),t.on(V.Disconnected,k),t.on(V.ConnectionStateChanged,w),t.on(V.TrackPublished,x),t.on(V.TrackUnpublished,T),t.on(V.DataReceived,E),t.on(V.ParticipantConnected,P),t.on(V.ParticipantDisconnected,I),()=>{t.off(V.Connected,S),t.off(V.Disconnected,k),t.off(V.ConnectionStateChanged,w),t.off(V.TrackPublished,x),t.off(V.TrackUnpublished,T),t.off(V.DataReceived,E),t.off(V.ParticipantConnected,P),t.off(V.ParticipantDisconnected,I)}},[t,o,c,h.length,v,e,n]);const f=g.useCallback(()=>r?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):c,[c,r]),y=g.useCallback(()=>{r&&localStorage.removeItem("voxket-session-logs"),l([])},[r]),b=g.useCallback(()=>{const S=f(),k=JSON.stringify(S,null,2),w="data:application/json;charset=utf-8,"+encodeURIComponent(k),x=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,T=document.createElement("a");T.setAttribute("href",w),T.setAttribute("download",x),T.click()},[f]);return{sessionMetrics:o,sessionLogs:c,logEvent:v,getSessionLogs:f,clearSessionLogs:y,exportSessionLogs:b}}class Ih{constructor(){Ye(this,"listeners",{})}on(e,n){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n),()=>this.off(e,n)}once(e,n){const i=(...r)=>{this.off(e,i),n(...r)};return this.on(e,i)}off(e,n){const i=this.listeners[e];if(!i)return;const r=i.indexOf(n);r>-1&&i.splice(r,1)}removeAllListeners(e){e?delete this.listeners[e]:this.listeners={}}emit(e,...n){const i=this.listeners[e];if(!i)return;const r=[...i];for(const s of r)try{s(...n)}catch(o){console.error(`Error in event listener for ${String(e)}:`,o)}}listenerCount(e){var n;return((n=this.listeners[e])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class Sw{constructor(e){Ye(this,"plugins",new Map);Ye(this,"installedPlugins",new Set);Ye(this,"context");this.context={client:e,emit:e.emit.bind(e),on:e.on.bind(e),config:{}}}register(e){if(this.plugins.has(e.name))throw new Error(`Plugin '${e.name}' is already registered`);if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${e.name}' depends on '${n}' which is not registered`)}this.plugins.set(e.name,e)}async install(e,n){const i=this.plugins.get(e);if(!i)throw new Error(`Plugin '${e}' is not registered`);if(this.installedPlugins.has(e))throw new Error(`Plugin '${e}' is already installed`);if(i.dependencies)for(const s of i.dependencies)this.installedPlugins.has(s)||await this.install(s);const r={...this.context,config:{...i.config,...n}};i.install&&await i.install(r),this.installedPlugins.add(e),this.setupPluginEvents(i,r)}async uninstall(e){var i;const n=this.plugins.get(e);if(!n)throw new Error(`Plugin '${e}' is not registered`);if(this.installedPlugins.has(e)){for(const[r,s]of this.plugins)if(this.installedPlugins.has(r)&&((i=s.dependencies)!=null&&i.includes(e)))throw new Error(`Cannot uninstall '${e}' because '${r}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(e)}}isInstalled(e){return this.installedPlugins.has(e)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(e){return this.plugins.get(e)}setupPluginEvents(e,n){e.onSessionStart&&n.on("session.started",i=>{e.onSessionStart(n,i.id)}),e.onSessionEnd&&n.on("session.ended",i=>{e.onSessionEnd(n,i.id)}),e.onAgentResponse&&n.on("agent.response",i=>{e.onAgentResponse(n,i)})}}function K5(t){return t}function Mh(t,e,n){return{name:t,version:"1.0.0",description:`${e} modality plugin`,install:async i=>{n.onActivate&&await n.onActivate(i)},uninstall:async i=>{n.onDeactivate&&await n.onDeactivate(i)},onAgentResponse:n.onMessage}}const Z5={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async t=>{console.log("Analytics plugin installed"),t.on("session.started",e=>{console.log("Analytics: Session started",e.id)}),t.on("session.ended",(e,n)=>{console.log("Analytics: Session ended",e.id,n)}),t.on("chat.message.sent",e=>{console.log("Analytics: User message sent",e.content.length)})}},Y5={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async t=>{console.log("Debug plugin installed");const e=t.emit;t.emit=(n,...i)=>(console.log(`[Debug] Event: ${String(n)}`,i),e(n,...i))}},J5={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async t=>{console.log("Metrics plugin installed");const e=new Map;t.on("session.started",n=>{e.set(n.id,{startTime:Date.now(),events:[]})}),t.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},kw=M.createContext(null);function Cw({config:t,children:e,autoConnect:n=!1}){const[i,r]=M.useState(null),[s,o]=M.useState(!1),[a,c]=M.useState(!1),[l,d]=M.useState(null),[u,h]=M.useState(null),[p,v]=M.useState("idle"),[f,y]=M.useState(null),[b,S]=M.useState([]),[k,w]=M.useState([]),[x,T]=M.useState([]);M.useEffect(()=>{const _=new Ks(t);return r(_),E(_),n&&P(_),()=>{_.disconnect().catch(console.error)}},[t,n]);const E=_=>{_.on("connection.connecting",()=>{c(!0),d(null)}),_.on("connection.connected",()=>{o(!0),c(!1),d(null)}),_.on("connection.disconnected",()=>{o(!1),c(!1),h(null),v("idle"),S([]),w([]),T([])}),_.on("connection.error",ie=>{d(ie),c(!1)}),_.on("session.created",ie=>{h(ie),v(ie.state)}),_.on("session.state.changed",ie=>{v(ie),u&&h({...u,state:ie})}),_.on("session.ended",(ie,L)=>{h(null),v("idle"),y(L),S([]),w([]),T([])}),_.on("participant.joined",ie=>{S(L=>[...L,ie])}),_.on("participant.left",ie=>{S(L=>L.filter(F=>F.id!==ie.id))}),_.on("chat.message.received",ie=>{w(L=>[...L,ie])}),_.on("chat.message.sent",ie=>{w(L=>[...L,ie])}),_.on("transcription.received",ie=>{T(L=>[...L,ie])})},P=async _=>{const ie=_||i;if(ie)try{await ie.connect()}catch(L){console.error("Failed to connect:",L)}},Y={client:i,isConnected:s,isConnecting:a,connectionError:l,currentSession:u,sessionState:p,sessionMetrics:f,participants:b,chatMessages:k,transcriptions:x,connect:()=>P(),disconnect:async()=>{if(i)try{await i.disconnect()}catch(_){console.error("Failed to disconnect:",_)}},createSession:async(_,ie={})=>{if(!i)throw new Error("Client not initialized");const L={agentId:_,participantName:ie.participantName||"User",metadata:ie.metadata,modalities:ie.modalities||["voice"]};return await i.createSession(L)},endSession:async()=>i?await i.endSession():null,sendChatMessage:async _=>{if(!i)throw new Error("Client not initialized");await i.sendChatMessage(_)},setMicrophoneEnabled:async _=>{if(!i)throw new Error("Client not initialized");await i.setMicrophoneEnabled(_)},setCameraEnabled:async _=>{if(!i)throw new Error("Client not initialized");await i.setCameraEnabled(_)},startScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.startScreenShare()},stopScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.stopScreenShare()}};return m.jsx(kw.Provider,{value:Y,children:e})}function xn(){const t=M.useContext(kw);if(!t)throw new Error("useVoxket must be used within a VoxketProvider");return t}class X5 extends Ih{constructor(n){super();Ye(this,"room",null);Ye(this,"registeredMethods",new Map);Ye(this,"activeInteractions",new Map);Ye(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,i,r="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const s={methodName:n,component:i,presentationMode:r};this.registeredMethods.set(n,s);try{this.room.registerRpcMethod(n,async o=>{console.log(`RpcManager: RPC method '${n}' called by ${o.callerIdentity}`),console.log("RpcManager: Payload:",o.payload),this.emit("rpc.method.called",{methodName:n,data:o});let a;console.log(`RpcManager: Current registration for '${n}':`,s);let c=o.responseTimeout||30;try{a=JSON.parse(o.payload)}catch{a=o.payload}try{const l=await this.awaitUserInteraction(n,i,r,a,c);return JSON.stringify(l)}catch(l){throw console.error(`RpcManager: Error in RPC method '${n}':`,l),l}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(o){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,o),o}}async awaitUserInteraction(n,i,r,s,o){return new Promise((a,c)=>{const l=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${o} seconds`);const d={didSuccess:(h,p)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,h),this.clearInteraction(l),this.currentInteraction=null;const v={success:!0,message:"User interaction completed successfully",data:h,timestamp:new Date,...p?{successView:p}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:v}),a(v)},didFail:h=>{console.log(`RpcManager: User interaction failed for method: ${n}`,h),this.clearInteraction(l);const p={success:!1,message:"User interaction failed",error:h,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:p}),a(p)},dismissView:()=>{var p;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(p=this.currentInteraction)==null?void 0:p.methodName),this.clearInteraction(l),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const h={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:h}),this.emit("rpc.interaction.completed",{methodName:n,response:h}),setTimeout(()=>{var v;((v=this.currentInteraction)==null?void 0:v.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(h)},didTimeout:h=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(l),this.currentInteraction=null;const p={success:!0,message:`User interaction timed out after ${o} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...h?{timeoutView:h}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:p}),setTimeout(()=>{var v;((v=this.currentInteraction)==null?void 0:v.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(p)}},u=setTimeout(()=>{d.didTimeout&&d.didTimeout()},o);this.activeInteractions.set(l,{resolve:h=>a(JSON.parse(h)),reject:c,timeoutId:u}),this.currentInteraction={isVisible:!0,methodName:n,component:i,presentationMode:r,timeout:o,data:s,handler:d},this.emit("rpc.interaction.started",{methodName:n,presentationMode:r}),setTimeout(async()=>{var h;if((h=this.currentInteraction)!=null&&h.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,s)}catch(p){console.error("RpcManager: Error loading data into component:",p),d.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const i=this.activeInteractions.get(n);i&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(i.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,i]of this.activeInteractions)clearTimeout(i.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}const Q5=`
|
|
290
|
-
/* Scoped to voxket-widget containers only */
|
|
291
|
-
.voxket-widget-root, .voxket-widget-root * {
|
|
292
|
-
box-sizing: border-box;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/* Widget root styling with proper background colors */
|
|
296
|
-
.voxket-widget-root {
|
|
297
|
-
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
298
|
-
line-height: 1.5;
|
|
299
|
-
font-weight: 400;
|
|
300
|
-
font-synthesis: none;
|
|
301
|
-
text-rendering: optimizeLegibility;
|
|
302
|
-
-webkit-font-smoothing: antialiased;
|
|
303
|
-
-moz-osx-font-smoothing: grayscale;
|
|
304
|
-
border-radius: 1rem;
|
|
305
|
-
position: relative;
|
|
306
|
-
isolation: isolate;
|
|
307
|
-
--voxket-bg-primary: #ffffff;
|
|
308
|
-
--voxket-bg-secondary: #f8fafc;
|
|
309
|
-
--voxket-text-primary: #0f172a;
|
|
310
|
-
--voxket-text-secondary: #64748b;
|
|
311
|
-
--voxket-border: #e2e8f0;
|
|
312
|
-
--voxket-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/* Theme-specific colors */
|
|
316
|
-
.voxket-widget-root.theme-light {
|
|
317
|
-
--voxket-bg-primary: #ffffff;
|
|
318
|
-
--voxket-bg-secondary: #f8fafc;
|
|
319
|
-
--voxket-text-primary: #0f172a;
|
|
320
|
-
--voxket-text-secondary: #64748b;
|
|
321
|
-
--voxket-border: #e2e8f0;
|
|
322
|
-
background-color: var(--voxket-bg-primary);
|
|
323
|
-
color: var(--voxket-text-primary);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.voxket-widget-root.theme-dark {
|
|
327
|
-
--voxket-bg-primary: #0f172a;
|
|
328
|
-
--voxket-bg-secondary: #1e293b;
|
|
329
|
-
--voxket-text-primary: #f1f5f9;
|
|
330
|
-
--voxket-text-secondary: #94a3b8;
|
|
331
|
-
--voxket-border: #334155;
|
|
332
|
-
background-color: var(--voxket-bg-primary);
|
|
333
|
-
color: var(--voxket-text-primary);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.voxket-widget-root.theme-vox {
|
|
337
|
-
--voxket-bg-primary: #1a1a2e;
|
|
338
|
-
--voxket-bg-secondary: #16213e;
|
|
339
|
-
--voxket-text-primary: #eee6ff;
|
|
340
|
-
--voxket-text-secondary: #a78bfa;
|
|
341
|
-
--voxket-border: #4c1d95;
|
|
342
|
-
background-color: var(--voxket-bg-primary);
|
|
343
|
-
color: var(--voxket-text-primary);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/* Scrollbar utilities - scoped to widget */
|
|
347
|
-
.voxket-widget-root ::-webkit-scrollbar {
|
|
348
|
-
display: none;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.voxket-widget-root .scrollbar-hide {
|
|
352
|
-
scrollbar-width: none;
|
|
353
|
-
-ms-overflow-style: none;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.voxket-widget-root .scrollbar-hide::-webkit-scrollbar {
|
|
357
|
-
display: none;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/* Custom scrollbar for chat - scoped */
|
|
361
|
-
.voxket-widget-root .chat-scrollable {
|
|
362
|
-
scrollbar-width: thin;
|
|
363
|
-
scrollbar-color: rgba(155, 155, 155, 0.3) transparent;
|
|
364
|
-
display: flex;
|
|
365
|
-
flex-direction: column;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.voxket-widget-root .chat-scrollable::-webkit-scrollbar {
|
|
369
|
-
width: 6px;
|
|
370
|
-
display: block;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
.voxket-widget-root .chat-scrollable::-webkit-scrollbar-track {
|
|
374
|
-
background: transparent;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.voxket-widget-root .chat-scrollable::-webkit-scrollbar-thumb {
|
|
378
|
-
background-color: rgba(155, 155, 155, 0.3);
|
|
379
|
-
border-radius: 3px;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
.voxket-widget-root .chat-scrollable::-webkit-scrollbar-thumb:hover {
|
|
383
|
-
background-color: rgba(155, 155, 155, 0.5);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/* Chat container styling - scoped */
|
|
387
|
-
.voxket-widget-root .chat-messages-container {
|
|
388
|
-
display: flex;
|
|
389
|
-
flex-direction: column;
|
|
390
|
-
justify-content: flex-end;
|
|
391
|
-
min-height: 100%;
|
|
392
|
-
width: 100%;
|
|
393
|
-
max-width: none;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/* Animations - scoped */
|
|
397
|
-
@keyframes voxket-pulse-ring {
|
|
398
|
-
0% { transform: scale(1); opacity: 1; }
|
|
399
|
-
50% { transform: scale(1.2); opacity: 0.6; }
|
|
400
|
-
100% { transform: scale(1.4); opacity: 0; }
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
@keyframes voxket-glow {
|
|
404
|
-
0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }
|
|
405
|
-
50% { box-shadow: 0 0 30px rgba(59, 130, 246, 0.8); }
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
@keyframes voxket-spin {
|
|
409
|
-
to { transform: rotate(360deg); }
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.voxket-widget-root .pulse-ring {
|
|
413
|
-
animation: voxket-pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.voxket-widget-root .mic-glow {
|
|
417
|
-
animation: voxket-glow 2s ease-in-out infinite;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.voxket-widget-root .animate-spin {
|
|
421
|
-
animation: voxket-spin 1s linear infinite;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/* Utility classes - scoped to widget */
|
|
425
|
-
.voxket-widget-root .fixed { position: fixed !important; }
|
|
426
|
-
.voxket-widget-root .absolute { position: absolute !important; }
|
|
427
|
-
.voxket-widget-root .relative { position: relative !important; }
|
|
428
|
-
.voxket-widget-root .static { position: static !important; }
|
|
429
|
-
|
|
430
|
-
.voxket-widget-root .inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
|
|
431
|
-
.voxket-widget-root .top-0 { top: 0; }
|
|
432
|
-
.voxket-widget-root .right-0 { right: 0; }
|
|
433
|
-
.voxket-widget-root .bottom-0 { bottom: 0; }
|
|
434
|
-
.voxket-widget-root .left-0 { left: 0; }
|
|
435
|
-
|
|
436
|
-
.voxket-widget-root .z-50 { z-index: 50; }
|
|
437
|
-
.voxket-widget-root .z-40 { z-index: 40; }
|
|
438
|
-
.voxket-widget-root .z-30 { z-index: 30; }
|
|
439
|
-
.voxket-widget-root .z-20 { z-index: 20; }
|
|
440
|
-
.voxket-widget-root .z-10 { z-index: 10; }
|
|
441
|
-
|
|
442
|
-
.voxket-widget-root .flex { display: flex; }
|
|
443
|
-
.voxket-widget-root .inline-flex { display: inline-flex; }
|
|
444
|
-
.voxket-widget-root .block { display: block; }
|
|
445
|
-
.voxket-widget-root .inline-block { display: inline-block; }
|
|
446
|
-
.voxket-widget-root .inline { display: inline; }
|
|
447
|
-
.voxket-widget-root .hidden { display: none; }
|
|
448
|
-
|
|
449
|
-
.voxket-widget-root .flex-col { flex-direction: column; }
|
|
450
|
-
.voxket-widget-root .flex-row { flex-direction: row; }
|
|
451
|
-
.voxket-widget-root .flex-wrap { flex-wrap: wrap; }
|
|
452
|
-
.voxket-widget-root .flex-nowrap { flex-wrap: nowrap; }
|
|
453
|
-
|
|
454
|
-
.voxket-widget-root .items-start { align-items: flex-start; }
|
|
455
|
-
.voxket-widget-root .items-end { align-items: flex-end; }
|
|
456
|
-
.voxket-widget-root .items-center { align-items: center; }
|
|
457
|
-
.voxket-widget-root .items-stretch { align-items: stretch; }
|
|
458
|
-
|
|
459
|
-
.voxket-widget-root .justify-start { justify-content: flex-start; }
|
|
460
|
-
.voxket-widget-root .justify-end { justify-content: flex-end; }
|
|
461
|
-
.voxket-widget-root .justify-center { justify-content: center; }
|
|
462
|
-
.voxket-widget-root .justify-between { justify-content: space-between; }
|
|
463
|
-
.voxket-widget-root .justify-around { justify-content: space-around; }
|
|
464
|
-
|
|
465
|
-
.voxket-widget-root .w-full { width: 100%; }
|
|
466
|
-
.voxket-widget-root .w-auto { width: auto; }
|
|
467
|
-
.voxket-widget-root .w-fit { width: fit-content; }
|
|
468
|
-
.voxket-widget-root .w-screen { width: 100vw; }
|
|
469
|
-
.voxket-widget-root .w-0 { width: 0; }
|
|
470
|
-
.voxket-widget-root .w-1 { width: 0.25rem; }
|
|
471
|
-
.voxket-widget-root .w-2 { width: 0.5rem; }
|
|
472
|
-
.voxket-widget-root .w-3 { width: 0.75rem; }
|
|
473
|
-
.voxket-widget-root .w-4 { width: 1rem; }
|
|
474
|
-
.voxket-widget-root .w-5 { width: 1.25rem; }
|
|
475
|
-
.voxket-widget-root .w-6 { width: 1.5rem; }
|
|
476
|
-
.voxket-widget-root .w-8 { width: 2rem; }
|
|
477
|
-
.voxket-widget-root .w-10 { width: 2.5rem; }
|
|
478
|
-
.voxket-widget-root .w-12 { width: 3rem; }
|
|
479
|
-
.voxket-widget-root .w-16 { width: 4rem; }
|
|
480
|
-
.voxket-widget-root .w-20 { width: 5rem; }
|
|
481
|
-
.voxket-widget-root .w-24 { width: 6rem; }
|
|
482
|
-
.voxket-widget-root .w-32 { width: 8rem; }
|
|
483
|
-
.voxket-widget-root .w-48 { width: 12rem; }
|
|
484
|
-
.voxket-widget-root .w-64 { width: 16rem; }
|
|
485
|
-
.voxket-widget-root .w-96 { width: 24rem; }
|
|
486
|
-
|
|
487
|
-
.voxket-widget-root .h-full { height: 100%; }
|
|
488
|
-
.voxket-widget-root .h-auto { height: auto; }
|
|
489
|
-
.voxket-widget-root .h-fit { height: fit-content; }
|
|
490
|
-
.voxket-widget-root .h-screen { height: 100vh; }
|
|
491
|
-
.voxket-widget-root .h-0 { height: 0; }
|
|
492
|
-
.voxket-widget-root .h-1 { height: 0.25rem; }
|
|
493
|
-
.voxket-widget-root .h-2 { height: 0.5rem; }
|
|
494
|
-
.voxket-widget-root .h-3 { height: 0.75rem; }
|
|
495
|
-
.voxket-widget-root .h-4 { height: 1rem; }
|
|
496
|
-
.voxket-widget-root .h-5 { height: 1.25rem; }
|
|
497
|
-
.voxket-widget-root .h-6 { height: 1.5rem; }
|
|
498
|
-
.voxket-widget-root .h-8 { height: 2rem; }
|
|
499
|
-
.voxket-widget-root .h-10 { height: 2.5rem; }
|
|
500
|
-
.voxket-widget-root .h-12 { height: 3rem; }
|
|
501
|
-
.voxket-widget-root .h-16 { height: 4rem; }
|
|
502
|
-
.voxket-widget-root .h-20 { height: 5rem; }
|
|
503
|
-
.voxket-widget-root .h-24 { height: 6rem; }
|
|
504
|
-
.voxket-widget-root .h-32 { height: 8rem; }
|
|
505
|
-
.voxket-widget-root .h-48 { height: 12rem; }
|
|
506
|
-
.voxket-widget-root .h-64 { height: 16rem; }
|
|
507
|
-
.voxket-widget-root .h-96 { height: 24rem; }
|
|
508
|
-
|
|
509
|
-
.voxket-widget-root .min-h-0 { min-height: 0; }
|
|
510
|
-
.voxket-widget-root .min-h-full { min-height: 100%; }
|
|
511
|
-
.voxket-widget-root .min-h-screen { min-height: 100vh; }
|
|
512
|
-
|
|
513
|
-
.voxket-widget-root .max-w-none { max-width: none; }
|
|
514
|
-
.voxket-widget-root .max-w-sm { max-width: 24rem; }
|
|
515
|
-
.voxket-widget-root .max-w-md { max-width: 28rem; }
|
|
516
|
-
.voxket-widget-root .max-w-lg { max-width: 32rem; }
|
|
517
|
-
.voxket-widget-root .max-w-xl { max-width: 36rem; }
|
|
518
|
-
.voxket-widget-root .max-w-2xl { max-width: 42rem; }
|
|
519
|
-
.voxket-widget-root .max-w-4xl { max-width: 56rem; }
|
|
520
|
-
|
|
521
|
-
.voxket-widget-root .p-0 { padding: 0; }
|
|
522
|
-
.voxket-widget-root .p-1 { padding: 0.25rem; }
|
|
523
|
-
.voxket-widget-root .p-2 { padding: 0.5rem; }
|
|
524
|
-
.voxket-widget-root .p-3 { padding: 0.75rem; }
|
|
525
|
-
.voxket-widget-root .p-4 { padding: 1rem; }
|
|
526
|
-
.voxket-widget-root .p-5 { padding: 1.25rem; }
|
|
527
|
-
.voxket-widget-root .p-6 { padding: 1.5rem; }
|
|
528
|
-
.voxket-widget-root .p-8 { padding: 2rem; }
|
|
529
|
-
|
|
530
|
-
.voxket-widget-root .px-0 { padding-left: 0; padding-right: 0; }
|
|
531
|
-
.voxket-widget-root .px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
|
|
532
|
-
.voxket-widget-root .px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
|
|
533
|
-
.voxket-widget-root .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
|
|
534
|
-
.voxket-widget-root .px-4 { padding-left: 1rem; padding-right: 1rem; }
|
|
535
|
-
.voxket-widget-root .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
|
|
536
|
-
|
|
537
|
-
.voxket-widget-root .py-0 { padding-top: 0; padding-bottom: 0; }
|
|
538
|
-
.voxket-widget-root .py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
|
|
539
|
-
.voxket-widget-root .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
|
|
540
|
-
.voxket-widget-root .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
|
|
541
|
-
.voxket-widget-root .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
|
|
542
|
-
|
|
543
|
-
.voxket-widget-root .m-0 { margin: 0; }
|
|
544
|
-
.voxket-widget-root .m-1 { margin: 0.25rem; }
|
|
545
|
-
.voxket-widget-root .m-2 { margin: 0.5rem; }
|
|
546
|
-
.voxket-widget-root .m-4 { margin: 1rem; }
|
|
547
|
-
.voxket-widget-root .m-auto { margin: auto; }
|
|
548
|
-
|
|
549
|
-
.voxket-widget-root .mx-auto { margin-left: auto; margin-right: auto; }
|
|
550
|
-
.voxket-widget-root .my-auto { margin-top: auto; margin-bottom: auto; }
|
|
551
|
-
|
|
552
|
-
.voxket-widget-root .mt-0 { margin-top: 0; }
|
|
553
|
-
.voxket-widget-root .mt-1 { margin-top: 0.25rem; }
|
|
554
|
-
.voxket-widget-root .mt-2 { margin-top: 0.5rem; }
|
|
555
|
-
.voxket-widget-root .mt-4 { margin-top: 1rem; }
|
|
556
|
-
.voxket-widget-root .mb-0 { margin-bottom: 0; }
|
|
557
|
-
.voxket-widget-root .mb-1 { margin-bottom: 0.25rem; }
|
|
558
|
-
.voxket-widget-root .mb-2 { margin-bottom: 0.5rem; }
|
|
559
|
-
.voxket-widget-root .mb-4 { margin-bottom: 1rem; }
|
|
560
|
-
|
|
561
|
-
.voxket-widget-root .rounded { border-radius: 0.25rem; }
|
|
562
|
-
.voxket-widget-root .rounded-sm { border-radius: 0.125rem; }
|
|
563
|
-
.voxket-widget-root .rounded-md { border-radius: 0.375rem; }
|
|
564
|
-
.voxket-widget-root .rounded-lg { border-radius: 0.5rem; }
|
|
565
|
-
.voxket-widget-root .rounded-xl { border-radius: 0.75rem; }
|
|
566
|
-
.voxket-widget-root .rounded-2xl { border-radius: 1rem; }
|
|
567
|
-
.voxket-widget-root .rounded-full { border-radius: 9999px; }
|
|
568
|
-
|
|
569
|
-
.voxket-widget-root .border { border-width: 1px; }
|
|
570
|
-
.voxket-widget-root .border-0 { border-width: 0; }
|
|
571
|
-
.voxket-widget-root .border-2 { border-width: 2px; }
|
|
572
|
-
|
|
573
|
-
/* Use CSS variables for colors */
|
|
574
|
-
.voxket-widget-root .bg-transparent { background-color: transparent; }
|
|
575
|
-
.voxket-widget-root .bg-white { background-color: var(--voxket-bg-primary); }
|
|
576
|
-
.voxket-widget-root .bg-black { background-color: var(--voxket-text-primary); }
|
|
577
|
-
.voxket-widget-root .bg-gray-50 { background-color: var(--voxket-bg-secondary); }
|
|
578
|
-
.voxket-widget-root .bg-gray-100 { background-color: var(--voxket-bg-secondary); }
|
|
579
|
-
.voxket-widget-root .bg-gray-200 { background-color: var(--voxket-border); }
|
|
580
|
-
.voxket-widget-root .bg-gray-800 { background-color: #1f2937; }
|
|
581
|
-
.voxket-widget-root .bg-gray-900 { background-color: #111827; }
|
|
582
|
-
.voxket-widget-root .bg-blue-500 { background-color: #3b82f6; }
|
|
583
|
-
.voxket-widget-root .bg-blue-600 { background-color: #2563eb; }
|
|
584
|
-
.voxket-widget-root .bg-red-500 { background-color: #ef4444; }
|
|
585
|
-
.voxket-widget-root .bg-green-500 { background-color: #22c55e; }
|
|
586
|
-
|
|
587
|
-
.voxket-widget-root .text-white { color: var(--voxket-bg-primary); }
|
|
588
|
-
.voxket-widget-root .text-black { color: var(--voxket-text-primary); }
|
|
589
|
-
.voxket-widget-root .text-gray-600 { color: var(--voxket-text-secondary); }
|
|
590
|
-
.voxket-widget-root .text-gray-700 { color: var(--voxket-text-secondary); }
|
|
591
|
-
.voxket-widget-root .text-gray-900 { color: var(--voxket-text-primary); }
|
|
592
|
-
|
|
593
|
-
.voxket-widget-root .border-gray-200 { border-color: var(--voxket-border); }
|
|
594
|
-
.voxket-widget-root .border-gray-300 { border-color: var(--voxket-border); }
|
|
595
|
-
|
|
596
|
-
.voxket-widget-root .text-xs { font-size: 0.75rem; line-height: 1rem; }
|
|
597
|
-
.voxket-widget-root .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
|
|
598
|
-
.voxket-widget-root .text-base { font-size: 1rem; line-height: 1.5rem; }
|
|
599
|
-
.voxket-widget-root .text-lg { font-size: 1.125rem; line-height: 1.75rem; }
|
|
600
|
-
.voxket-widget-root .text-xl { font-size: 1.25rem; line-height: 1.75rem; }
|
|
601
|
-
.voxket-widget-root .text-2xl { font-size: 1.5rem; line-height: 2rem; }
|
|
602
|
-
|
|
603
|
-
.voxket-widget-root .font-normal { font-weight: 400; }
|
|
604
|
-
.voxket-widget-root .font-medium { font-weight: 500; }
|
|
605
|
-
.voxket-widget-root .font-semibold { font-weight: 600; }
|
|
606
|
-
.voxket-widget-root .font-bold { font-weight: 700; }
|
|
607
|
-
|
|
608
|
-
.voxket-widget-root .shadow { box-shadow: var(--voxket-shadow); }
|
|
609
|
-
.voxket-widget-root .shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
|
|
610
|
-
.voxket-widget-root .shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
|
|
611
|
-
.voxket-widget-root .shadow-xl { box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }
|
|
612
|
-
|
|
613
|
-
.voxket-widget-root .cursor-pointer { cursor: pointer; }
|
|
614
|
-
.voxket-widget-root .cursor-not-allowed { cursor: not-allowed; }
|
|
615
|
-
|
|
616
|
-
.voxket-widget-root .opacity-0 { opacity: 0; }
|
|
617
|
-
.voxket-widget-root .opacity-50 { opacity: 0.5; }
|
|
618
|
-
.voxket-widget-root .opacity-75 { opacity: 0.75; }
|
|
619
|
-
.voxket-widget-root .opacity-100 { opacity: 1; }
|
|
620
|
-
|
|
621
|
-
.voxket-widget-root .transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
|
|
622
|
-
.voxket-widget-root .transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
|
|
623
|
-
|
|
624
|
-
.voxket-widget-root .hover\\:bg-gray-100:hover { background-color: var(--voxket-bg-secondary); }
|
|
625
|
-
.voxket-widget-root .hover\\:bg-blue-600:hover { background-color: #2563eb; }
|
|
626
|
-
|
|
627
|
-
.voxket-widget-root .focus\\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
|
|
628
|
-
|
|
629
|
-
.voxket-widget-root .disabled\\:opacity-50:disabled { opacity: 0.5; }
|
|
630
|
-
.voxket-widget-root .disabled\\:cursor-not-allowed:disabled { cursor: not-allowed; }
|
|
631
|
-
|
|
632
|
-
/* Widget component specific styles */
|
|
633
|
-
.voxket-widget-root button {
|
|
634
|
-
border: none;
|
|
635
|
-
background: none;
|
|
636
|
-
padding: 0;
|
|
637
|
-
margin: 0;
|
|
638
|
-
cursor: pointer;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
.voxket-widget-root input, .voxket-widget-root textarea {
|
|
642
|
-
border: 1px solid var(--voxket-border);
|
|
643
|
-
border-radius: 0.375rem;
|
|
644
|
-
padding: 0.5rem;
|
|
645
|
-
font-size: 0.875rem;
|
|
646
|
-
background-color: var(--voxket-bg-primary);
|
|
647
|
-
color: var(--voxket-text-primary);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
.voxket-widget-root input:focus, .voxket-widget-root textarea:focus {
|
|
651
|
-
outline: none;
|
|
652
|
-
border-color: #3b82f6;
|
|
653
|
-
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
/* Overflow utilities */
|
|
657
|
-
.voxket-widget-root .overflow-hidden { overflow: hidden; }
|
|
658
|
-
.voxket-widget-root .overflow-auto { overflow: auto; }
|
|
659
|
-
.voxket-widget-root .overflow-scroll { overflow: scroll; }
|
|
660
|
-
.voxket-widget-root .overflow-x-hidden { overflow-x: hidden; }
|
|
661
|
-
.voxket-widget-root .overflow-y-auto { overflow-y: auto; }
|
|
662
|
-
.voxket-widget-root .overflow-y-scroll { overflow-y: scroll; }
|
|
663
|
-
|
|
664
|
-
/* Text alignment */
|
|
665
|
-
.voxket-widget-root .text-left { text-align: left; }
|
|
666
|
-
.voxket-widget-root .text-center { text-align: center; }
|
|
667
|
-
.voxket-widget-root .text-right { text-align: right; }
|
|
668
|
-
|
|
669
|
-
/* Gap utilities */
|
|
670
|
-
.voxket-widget-root .gap-1 { gap: 0.25rem; }
|
|
671
|
-
.voxket-widget-root .gap-2 { gap: 0.5rem; }
|
|
672
|
-
.voxket-widget-root .gap-3 { gap: 0.75rem; }
|
|
673
|
-
.voxket-widget-root .gap-4 { gap: 1rem; }
|
|
674
|
-
|
|
675
|
-
/* Flex grow/shrink */
|
|
676
|
-
.voxket-widget-root .flex-1 { flex: 1 1 0%; }
|
|
677
|
-
.voxket-widget-root .flex-grow { flex-grow: 1; }
|
|
678
|
-
.voxket-widget-root .flex-shrink-0 { flex-shrink: 0; }
|
|
679
|
-
|
|
680
|
-
/* Grid utilities */
|
|
681
|
-
.voxket-widget-root .grid { display: grid; }
|
|
682
|
-
.voxket-widget-root .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
|
683
|
-
.voxket-widget-root .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
684
|
-
.voxket-widget-root .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
685
|
-
|
|
686
|
-
/* Text transform */
|
|
687
|
-
.voxket-widget-root .uppercase { text-transform: uppercase; }
|
|
688
|
-
.voxket-widget-root .lowercase { text-transform: lowercase; }
|
|
689
|
-
.voxket-widget-root .capitalize { text-transform: capitalize; }
|
|
690
|
-
|
|
691
|
-
/* Object fit */
|
|
692
|
-
.voxket-widget-root .object-cover { object-fit: cover; }
|
|
693
|
-
.voxket-widget-root .object-contain { object-fit: contain; }
|
|
694
|
-
|
|
695
|
-
/* Aspect ratio */
|
|
696
|
-
.voxket-widget-root .aspect-square { aspect-ratio: 1 / 1; }
|
|
697
|
-
.voxket-widget-root .aspect-video { aspect-ratio: 16 / 9; }
|
|
698
|
-
`;let gl=!1;function tc(){if(gl||typeof document>"u")return;if(document.getElementById("voxket-widget-styles")){gl=!0;return}const t=document.createElement("style");t.id="voxket-widget-styles",t.type="text/css",t.textContent=Q5,document.head.firstChild?document.head.insertBefore(t,document.head.firstChild):document.head.appendChild(t),gl=!0}typeof window<"u"&&tc();class Re extends Error{constructor(e,n,i){super(e),this.code=n,this.details=i,this.name="VoxketError"}}class Ks extends Ih{constructor(n){super();Ye(this,"config");Ye(this,"room",null);Ye(this,"pluginManager");Ye(this,"rpcManager");Ye(this,"isConnected",!1);Ye(this,"currentSession",null);Ye(this,"connectionState",he.Disconnected);Ye(this,"renderedComponents",new Map);Ye(this,"textStreamHandlersRegistered",!1);Ye(this,"currentAgentInfo",null);Ye(this,"chatMessages",[]);this.config=n,this.pluginManager=new Sw(this),this.rpcManager=new X5,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,i;this.isConnected=!0,(i=(n=this.config).onConnected)==null||i.call(n)}),this.on("connection.disconnected",n=>{var i,r;this.isConnected=!1,(r=(i=this.config).onDisconnected)==null||r.call(i,n)}),this.on("connection.error",n=>{var i,r;(r=(i=this.config).onError)==null||r.call(i,n)}),this.on("chat.message.received",n=>{var i,r;this.addChatMessage(n),(r=(i=this.config).onMessageReceived)==null||r.call(i,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var i,r;(r=(i=this.config).onTranscriptionReceived)==null||r.call(i,n)}),this.on("session.state.changed",n=>{var i,r;(r=(i=this.config).onSessionStateChanged)==null||r.call(i,n)}),this.on("session.created",n=>{var i,r;(r=(i=this.config).onSessionStart)==null||r.call(i,n.id)}),this.on("session.ended",(n,i)=>{var r,s;(s=(r=this.config).onSessionEnd)==null||s.call(r,i)}),this.on("participant.joined",n=>{var i,r;(r=(i=this.config).onUserJoined)==null||r.call(i,n.id)}),this.on("participant.left",n=>{var i,r;(r=(i=this.config).onUserLeft)==null||r.call(i,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new ei,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(V.Connected,()=>{var n,i;this.connectionState=he.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(i=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&i.includes("voice")&&setTimeout(async()=>{var r;try{(r=this.room)!=null&&r.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(s){console.warn("VoxketClient: Failed to enable microphone after room connection:",s)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(V.Disconnected,n=>{this.connectionState=he.Disconnected,this.textStreamHandlersRegistered=!1,this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(V.ConnectionStateChanged,n=>{this.connectionState=n,n===he.Connecting&&this.emit("connection.connecting")}),this.room.on(V.ParticipantConnected,n=>{const i={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",i)}),this.room.on(V.ParticipantDisconnected,n=>{const i={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",i)}))}setupTextStreamHandlers(){if(this.room){try{this.room.registerTextStreamHandler("lk.chat",async(n,i)=>{try{const r=await n.readAll(),s={id:`msg_${Date.now()}_${i.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:r,timestamp:new Date,sender:{id:i.identity||"user",name:i.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",s)}catch(r){console.error("VoxketClient: Failed to process lk.chat message:",r)}})}catch(n){console.warn("VoxketClient: lk.chat handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("lk.transcription",async(n,i)=>{var r,s;try{const o=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let a="";const c=((r=this.currentAgentInfo)==null?void 0:r.name)||i.identity||"AI Assistant",l={id:o,content:"",timestamp:new Date,sender:{id:i.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",l);for await(const h of n){a+=h;const p=this.convertMarkdownToText(a),v={...l,content:p,metadata:{...l.metadata,streaming:!0}};this.emit("chat.message.updated",v)}const d=this.convertMarkdownToText(a),u={...l,content:d,metadata:{...l.metadata,streaming:!1}};this.emit("chat.message.updated",u)}catch(o){console.error("VoxketClient: Failed to process lk.transcription message:",o);try{const a=await n.readAll(),c=((s=this.currentAgentInfo)==null?void 0:s.name)||i.identity||"AI Assistant",l={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:a,timestamp:new Date,sender:{id:i.identity||"agent",name:c,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",l)}catch(a){console.error("VoxketClient: Fallback failed for lk.transcription:",a)}}})}catch(n){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("suggested_response",async n=>{const i=await n.readAll();let r=[];try{r=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(s){console.warn("VoxketClient: Failed to parse suggested_response:",s,i)}this.emit("suggested.response",r)})}catch(n){console.warn("VoxketClient: suggested_response handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("agent_state_changed",async(n,i)=>{const r=await n.readAll();let s={};try{s=typeof r=="string"?JSON.parse(r.replace(/'/g,'"')):r}catch(o){console.warn("VoxketClient: Failed to parse agent_state_changed:",o,r)}s.new_state==="speaking"?this.emit("agent.speaking",s):s.new_state==="thinking"&&this.emit("agent.thinking",s)})}catch(n){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("images",async(n,i)=>{try{const r=await n.readAll()}catch(r){console.error("VoxketClient: Error processing images stream:",r)}})}catch(n){console.warn("VoxketClient: images handler already registered, skipping:",n)}try{this.room.registerByteStreamHandler("images",async(n,i)=>{var r,s;try{const o=n.info,a={id:`img_${Date.now()}_${i.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${o.name||"Image"}`,sender:{id:i.identity||"agent",name:i.identity||"Agent",type:i.identity===((s=(r=this.room)==null?void 0:r.localParticipant)==null?void 0:s.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.mimeType,streamId:o.id,downloading:!0}};this.emit("chat.message.received",a),n.onProgress&&(n.onProgress=h=>{const p={...a,metadata:{...a.metadata,downloadProgress:h||0}};this.emit("chat.message.updated",p)});const c=[];for await(const h of n)c.push(h);const l=new Blob(c,{type:o.mimeType||"application/octet-stream"}),d=URL.createObjectURL(l),u={...a,metadata:{...a.metadata,downloading:!1,downloadProgress:1,downloadUrl:d,blob:l}};this.emit("chat.message.updated",u)}catch(o){console.error("VoxketClient: Error processing image attachment:",o)}})}catch(n){console.warn("VoxketClient: image handler already registered, skipping:",n)}this.textStreamHandlersRegistered=!0}}async fetchConnectionDetails(n,i,r){const s=n||this.config.agentId||"default-agent",o=i||this.config.participantName||"User",a=r||this.config.modalities||["voice"];try{const c={agent_id:s,participant_name:o,participant_metadata:{user_id:""},modality:a[0]},l=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(c)});if(!l.ok){let h=`HTTP ${l.status}: Failed to fetch connection details`;try{const p=await l.json();p&&(p.error?h=`API Error: ${p.error}`:p.detail?h=`API Error: ${p.detail}`:p.message&&(h=`API Error: ${p.message}`))}catch{try{const v=await l.text();v&&(h=`API Error: ${v}`)}catch{}}throw new Error(h)}const d=await l.json();let u;return d.agent_info&&(u={id:d.agent_info.id||s,name:d.agent_info.name||"AI Assistant",avatar:d.agent_info.avatar,capabilities:d.agent_info.capabilities||["voice_interaction","text_chat"],metadata:d.agent_info.metadata||{}},this.currentAgentInfo=u),{serverUrl:d.wss_url,participantToken:d.token,voxketSessionId:d.session_id,agentInfo:u}}catch(c){console.error("VoxketClient: fetchConnectionDetails failed:",c);const l=new Re(`Failed to fetch connection details: ${c instanceof Error?c.message:"Unknown error"}`,"CONNECTION_FAILED",c);throw this.emit("connection.error",l),l}}async connect(n,i,r){var s;try{this.emit("connection.connecting");const o=await this.fetchConnectionDetails(n,i,r);return await((s=this.room)==null?void 0:s.connect(o.serverUrl,o.participantToken)),this.isConnected=!0,o}catch(o){console.error("VoxketClient: Connection failed:",o);const a=new Re(`Failed to connect to Voxket services: ${o instanceof Error?o.message:"Unknown error"}`,"CONNECTION_FAILED",o);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new ei,this.setupRoomEventListeners()}catch(i){const r=new Re("Failed to disconnect properly","NETWORK_ERROR",i);throw this.emit("connection.error",r),r}}async createSession(n){var i,r;try{const s=await this.connect(n.agentId,n.participantName,n.modalities),o={id:s.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:s.agentInfo||this.currentAgentInfo};if(this.currentSession=o,this.emit("session.created",o),(i=n.modalities)!=null&&i.includes("voice"))try{await new Promise(a=>setTimeout(a,500)),(r=this.room)!=null&&r.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(a){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",a)}return setTimeout(()=>{this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state))},1e3),o}catch(s){throw console.error("VoxketClient: Failed to create session:",s),s instanceof Re?s:s instanceof TypeError&&s.message.includes("fetch")?new Re("Network connection failed","CONNECTION_FAILED",s):s instanceof Error&&s.message.includes("Failed to fetch connection details")?new Re(`API connection failed: ${s.message}`,"CONNECTION_FAILED",s):new Re(`Failed to create session: ${s instanceof Error?s.message:"Unknown error"}`,"SESSION_NOT_FOUND",s)}}async startSession(n,i){const r={agentId:n||this.config.agentId||"default-agent",participantName:(i==null?void 0:i.participantName)||this.config.participantName||"User",modalities:(i==null?void 0:i.modalities)||this.config.modalities||["voice","chat"],metadata:i==null?void 0:i.metadata};return this.createSession(r)}async endSession(){var n,i;if(!this.currentSession)return null;try{const r={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((i=this.room)==null?void 0:i.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,r),await this.disconnect(),r}catch(r){throw new Re("Failed to end session","SESSION_NOT_FOUND",r)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(r=>r.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const i=this.chatMessages.findIndex(r=>r.id===n.id);i!==-1&&(this.chatMessages[i]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var c,l,d;tc();const i=this.resolveTarget(n.target||"body"),r=this.getTargetKey(i),s=this.renderedComponents.get(r);s&&s.target===i||this.removeUI(i);const o=(s==null?void 0:s.root)||qw.createRoot(i),a={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((l=n.modality)==null?void 0:l.includes("video"))===!0,suportsScreenShare:((d=n.modality)==null?void 0:d.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};o.render(g.default.createElement(Cw,{config:this.config,autoConnect:n.autoStart||!1,children:g.default.createElement(Tw,a)})),this.renderedComponents.set(r,{root:o,target:i})}removeUI(n){const i=n?this.resolveTarget(n):null;if(i){const r=this.getTargetKey(i),s=this.renderedComponents.get(r);s&&(s.root.unmount(),this.renderedComponents.delete(r),i.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(a=>{try{a.remove()}catch(c){console.warn("Failed to remove element:",c)}}),i===document.body&&i.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&c.classList.contains("backdrop-blur-sm"))try{c.remove()}catch(l){console.warn("Failed to remove fixed element:",l)}}))}}removeAllUI(){for(const[n,i]of this.renderedComponents)i.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(i=>{if(i.classList.contains("bg-black")&&(i.classList.contains("backdrop-blur-sm")||i.classList.contains("bg-opacity-30")))try{i.remove()}catch(r){console.warn("Failed to remove overlay:",r)}})}resolveTarget(n){if(typeof n=="string"){const i=document.querySelector(n);if(!i)throw new Error(`Target element not found: ${n}`);return i}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,i){var r;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new Re("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Re("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Re("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const s={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:i||{}},o=await((r=this.room)==null?void 0:r.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",s)}catch(s){throw console.error("VoxketClient: Failed to send chat message:",s),new Re("Failed to send message","NETWORK_ERROR",s)}}async sendChatMessage(n,i){return this.sendMessage(n,i)}async sendAttachments(n,i){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new Re("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Re("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Re("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new Re("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const r=n.filter(s=>s.type.startsWith("image/"));if(r.length===0)throw new Re("Only image files are allowed","INVALID_PARAMETER");r.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const s=r.map(async(o,a)=>{const l={id:`att_${Date.now()}_${a}`,content:`📎 ${o.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...i,type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.type,uploading:!0}};this.emit("chat.message.sent",l);const d=await this.room.localParticipant.sendFile(o,{mimeType:o.type,topic:"images",onProgress:h=>{const p={...l,metadata:{...l.metadata,uploadProgress:h}};this.emit("chat.message.updated",p)}});try{const h=new FileReader,p=new Promise((y,b)=>{h.onload=()=>{typeof h.result=="string"?y(h.result):b(new Error("Failed to convert to base64"))},h.onerror=b});h.readAsDataURL(o);const f={type:"image",data:await p,filename:o.name,mimeType:o.type,size:o.size};await this.room.localParticipant.sendText(JSON.stringify(f),{topic:"images",destinationIdentities:[]})}catch(h){console.warn("VoxketClient: Failed to send image data to agent:",h);try{const p=`I've shared an image: ${o.name}`;await this.room.localParticipant.sendText(p,{topic:"lk.chat",destinationIdentities:[]})}catch(p){console.warn("VoxketClient: Failed to send image notification to agent:",p)}}const u={...l,metadata:{...l.metadata,uploading:!1,uploadProgress:1,streamId:d.id}};return this.emit("chat.message.updated",u),d});await Promise.all(s)}catch(s){throw console.error("VoxketClient: Failed to send attachments:",s),new Re("Failed to send attachments","NETWORK_ERROR",s)}}async sendAttachment(n,i){return this.sendAttachments([n],i)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var i,r;try{const s=(i=this.room)==null?void 0:i.localParticipant.isMicrophoneEnabled,o=n??!s;await((r=this.room)==null?void 0:r.localParticipant.setMicrophoneEnabled(o)),o?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(s){throw console.error("VoxketClient: Failed to toggle microphone:",s),new Re("Failed to toggle microphone","PERMISSION_DENIED",s)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var i,r;try{const s=(i=this.room)==null?void 0:i.localParticipant.isCameraEnabled,o=n??!s;await((r=this.room)==null?void 0:r.localParticipant.setCameraEnabled(o)),o?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(s){throw console.error("VoxketClient: Failed to toggle camera:",s),new Re("Failed to toggle camera","PERMISSION_DENIED",s)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(i){throw new Re("Failed to start screen share","PERMISSION_DENIED",i)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(i){throw new Re("Failed to stop screen share","PERMISSION_DENIED",i)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(i=>i.kind==="audioinput")}catch(n){throw new Re("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(i=>i.kind==="videoinput")}catch(n){throw new Re("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var i;try{if(!((i=this.room)!=null&&i.localParticipant))throw new Error("Not connected to room")}catch(r){throw new Re("Failed to set audio input device","DEVICE_ERROR",r)}}async setVideoInputDevice(n){var i;try{if(!((i=this.room)!=null&&i.localParticipant))throw new Error("Not connected to room")}catch(r){throw new Re("Failed to set video input device","DEVICE_ERROR",r)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const i=n.permissions;if(!i)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const r=s=>!!i.canPublish&&(i.canPublishSources.length===0||i.canPublishSources.includes(s));return{camera:r(1),microphone:r(2),screenShare:r(3),data:i.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===he.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,i]of n.trackPublications)if(i.source===D.Source.Microphone)return i.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,i]of n.trackPublications)if(i.source===D.Source.Camera)return i.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,i]of n.trackPublications)if(i.source===D.Source.ScreenShare)return i.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(i=>{n.push({id:i.identity,name:i.name||i.identity,isLocal:!1})}),n}getSessionMetrics(){var n,i;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((i=this.room)==null?void 0:i.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(i){throw new Re("Failed to start recording","RECORDING_ERROR",i)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(i){throw new Re("Failed to stop recording","RECORDING_ERROR",i)}}async registerFrontendRPC(n,i,r="embedded"){return this.rpcManager.registerFrontendRPC(n,i,r)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,i){return this.on(n,i)}registerEventEmitter(n,i){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async r=>{try{const s=await r.readAll();i(s)}catch(s){console.error(`Error processing event for topic '${n}':`,s)}})}catch(r){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,r)}}convertMarkdownToText(n){if(!n)return"";let i=n;return i=i.replace(/\*\*(.*?)\*\*/g,"$1"),i=i.replace(/__(.*?)__/g,"$1"),i=i.replace(/\*(.*?)\*/g,"$1"),i=i.replace(/_(.*?)_/g,"$1"),i=i.replace(/~~(.*?)~~/g,"$1"),i=i.replace(/`([^`]+)`/g,"$1"),i=i.replace(/```[\s\S]*?```/g,""),i=i.replace(/^#{1,6}\s+/gm,""),i=i.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),i.trim()}}const ej=ge.create(M5),tj=ge.create(B5),nj=ge.create(z5),ij=ge.create(G5);function rj({onClick:t,text:e="Open Chat",position:n="bottom-right",theme:i}){const r={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},s=ut(i);return m.jsx(ge.button,{onClick:t,className:`fixed ${r[n]} z-50 px-4 py-2 rounded-full shadow-lg ${s.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:e})}function qg({children:t,theme:e,displayType:n="widget",onClose:i,popupPosition:r="bottom-right",onExpand:s}){const o=ut(e);if(n==="fullscreen")return m.jsx("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",children:m.jsxs("div",{className:"w-full h-full max-w-6xl max-h-[90vh] rounded-2xl relative bg-transparent",children:[i&&m.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),i()},className:"absolute top-4 cursor-pointer right-4 z-[100] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),m.jsxs("div",{id:"voice-card",className:`${o.card} w-full h-full flex flex-col rounded-xl shadow-2xl`,style:{minHeight:"600px"},children:[m.jsx("div",{className:o.cardTopGradient}),m.jsx("div",{className:o.cardPurpleBlur}),m.jsx("div",{className:o.cardPinkBlur}),m.jsx("div",{className:" flex flex-col h-full",children:t}),m.jsx("div",{className:o.cardPulse1}),m.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return m.jsx("div",{className:"fixed rounded-2xl inset-0 z-50 pointer-events-none",children:m.jsxs("div",{className:`fixed rounded-2xl ${a[r]} pointer-events-auto`,children:[i&&m.jsx("button",{onClick:i,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"×"}),m.jsxs("div",{id:"voice-card",className:`${o.card} rounded-2xl flex flex-col`,style:{width:"300px",height:"450px"},children:[m.jsx("div",{className:o.cardPurpleBlur}),m.jsx("div",{className:o.cardPinkBlur}),m.jsx("div",{className:" flex flex-col h-full",children:t}),m.jsx("div",{className:o.cardPulse1}),m.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return m.jsxs("div",{id:"voice-card",className:`${o.card}`,children:[s&&m.jsx("button",{onClick:s,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),m.jsx("div",{className:o.cardTopGradient}),m.jsx("div",{className:o.cardPurpleBlur}),m.jsx("div",{className:o.cardPinkBlur}),t,m.jsx("div",{className:o.cardPulse1}),m.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})}function Tw(t){if(typeof window>"u")return null;console.log("🎯 Widget component rendering with props:",{displayType:t.displayType,popupPosition:t.popupPosition,theme:t.theme});const{agentId:e,participantName:n,baseUrl:i,appSecret:r,appId:s,prompts:o,statusMessage:a,welcomeTitle:c,welcomeSubTitle:l,className:d,width:u,height:h,loadingText:p,suportsChatInput:v=!0,suportsVideoInput:f=!0,suportsScreenShare:y=!0,theme:b="vox",onSessionStart:S,onSessionEnd:k,enableSessionLogging:w=!0,onSessionLogsUpdate:x,onSessionMetricsUpdate:T,modalities:E=["voice"],displayType:P="widget",popupPosition:I="bottom-right",popupTriggerText:C="Open Chat",onPopupToggle:A,voxketClient:N,onDisplayTypeChange:Z}=t,[Q,se]=g.useState(()=>N?!!N.getCurrentSession():!1),[te,Y]=g.useState(!1),[_,ie]=g.useState(e||""),[L,F]=g.useState(n||"User"),[ee,j]=g.useState(()=>N?N.getCurrentSession():null),[W,J]=g.useState(()=>{var pe,Un,Ft;if(N){const Fe=N.getCurrentSession();if((pe=Fe==null?void 0:Fe.activeModalities)!=null&&pe.includes("chat"))return"chat";if((Un=Fe==null?void 0:Fe.activeModalities)!=null&&Un.includes("voice"))return"voice";if((Ft=Fe==null?void 0:Fe.activeModalities)!=null&&Ft.includes("video"))return"video"}return"welcome"}),[G,O]=g.useState(!1);g.useEffect(()=>{console.log("🎯 Widget displayType prop changed to:",P)},[P]),g.useEffect(()=>{console.log("📊 Session state changed:",{currentMode:W,sessionStarted:Q,loading:te,currentSession:ee==null?void 0:ee.id,isPopupOpen:G})},[W,Q,te,ee,G]);const $=g.useMemo(()=>{if(N)return console.log("🔄 Using passed VoxketClient to preserve session state"),N;console.log("🆕 Creating new VoxketClient instance");const pe={appId:s,appSecret:r,baseUrl:i,agentId:_,participantName:L||"User",modalities:E};return new Ks(pe)},[N,s,r,i,_,L,E]),X=E,z=g.useMemo(()=>$.getRoom()||new ei,[$]),oe={suportsChatInput:v,suportsVideoInput:f,suportsScreenShare:y},{sessionMetrics:H,sessionLogs:ue,logEvent:we}=ww({room:z,onSessionStart:S,onSessionEnd:k,enableConsoleLogging:w,enableLocalStorage:w,voxketSessionId:ee==null?void 0:ee.id});g.useEffect(()=>{x&&x(ue)},[ue,x]),g.useEffect(()=>{T&&H&&T(H)},[H,T]),g.useEffect(()=>{const pe=Ft=>{console.log("🔴 Room disconnected:",Ft),Y(!1),se(!1),j(null),J("welcome")},Un=Ft=>{console.log("📹 Media devices error:",Ft),co({title:"Allow access to your microphone/camera",description:`${Ft.name}: ${Ft.message}`})};return z.on(V.MediaDevicesError,Un),z.on(V.Disconnected,pe),()=>{z.off(V.Disconnected,pe),z.off(V.MediaDevicesError,Un)}},[z]);const rt=async()=>{try{console.log("🎤 Starting voice session...",{agentId:_,participantName:L}),console.log("🎤 Pre-start state:",{currentMode:W,sessionStarted:Q,loading:te}),Y(!0),se(!0),J("voice"),console.log("🎤 State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),we("USER_STARTED_VOICE_SESSION",{agentId:_,participantName:L});const pe=await $.startSession(_,{participantName:L||"User",modalities:["voice",...f?["video"]:[]]});console.log("✅ Voice session started successfully:",pe.id),j(pe),Y(!1),S&&S(pe.id)}catch(pe){console.error("❌ Failed to start voice session:",pe),co({title:"Failed to start voice session",description:pe instanceof Error?pe.message:"Unknown error occurred"}),Y(!1),se(!1),J("welcome")}},Qt=async()=>{try{Y(!0),se(!0),J("chat"),we("USER_STARTED_CHAT_SESSION",{agentId:_,participantName:L});const pe=await $.startSession(_,{participantName:L||"User",modalities:["chat"]});j(pe),Y(!1),S&&S(pe.id)}catch(pe){console.error("Failed to start chat session:",pe),co({title:"Failed to start chat session",description:pe instanceof Error?pe.message:"Unknown error occurred"}),Y(!1),se(!1),J("welcome")}},vi=async()=>{try{console.log("📺 Starting video session...",{agentId:_,participantName:L}),console.log("📺 Pre-start state:",{currentMode:W,sessionStarted:Q,loading:te}),Y(!0),se(!0),J("video"),console.log("📺 State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),we("USER_STARTED_VIDEO_SESSION",{agentId:_,participantName:L});const pe=await $.startSession(_,{participantName:L||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",pe.id),j(pe),Y(!1),S&&S(pe.id)}catch(pe){console.error("❌ Failed to start video session:",pe),co({title:"Failed to start video session",description:pe instanceof Error?pe.message:"Unknown error occurred"}),Y(!1),se(!1),J("welcome")}},yi=()=>{J("welcome"),Z&&Z(t.displayType||"widget"),ee&&Q&&(se(!1),j(null),$.disconnect()),P==="popup"&&!G&&O(!0)},en=()=>{const pe=!G;O(pe),A&&A(pe),!pe&&!(ee&&Q)&&(J("welcome"),se(!1),j(null))},Uw=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),t.onDisplayTypeChange?t.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},Bw=()=>{t.onDisplayTypeChange&&t.onDisplayTypeChange("fullscreen")};g.useEffect(()=>{var pe,Un,Ft;if(N&&$){console.log("🔄 Syncing widget state with existing client session state");const Fe=$.getCurrentSession(),$w=$.connected;console.log("🔍 Existing session state:",{hasSession:!!Fe,sessionId:Fe==null?void 0:Fe.id,isConnected:$w,activeModalities:Fe==null?void 0:Fe.activeModalities}),Fe&&(console.log("✅ Restoring session state from existing client"),j(Fe),se(!0),Y(!1),(pe=Fe.activeModalities)!=null&&pe.includes("chat")?J("chat"):(Un=Fe.activeModalities)!=null&&Un.includes("voice")?J("voice"):(Ft=Fe.activeModalities)!=null&&Ft.includes("video")&&J("video"))}},[N,$]),g.useEffect(()=>()=>{console.log("🧹 Cleaning up widget component"),N?console.log("🔄 Widget cleanup: preserving passed client instance"):(console.log("🧹 Widget cleanup: disconnecting self-created client"),$.disconnect())},[$,N]);let ic="w-96",rc="h-[25rem]",sc={};if(u&&(u.startsWith("w-")?ic=u:(sc.width=u,ic="")),h&&(h.startsWith("h-")?rc=h:(sc.height=h,rc="")),P==="popup"&&!G)return console.log("🟡 Showing popup trigger button"),m.jsx(rj,{onClick:en,text:C,position:I,theme:b});console.log("🟢 Rendering widget content, displayType:",P,"isPopupOpen:",G,"currentMode:",W,"sessionStarted:",Q,"loading:",te);let oc=`voxket-widget-root theme-${b}`,Ys={scrollMargin:0,scrollPadding:0,contain:"layout style paint",backgroundColor:b==="dark"?"#0f172a":b==="vox"?"#1a1a2e":"#ffffff",color:b==="dark"?"#f1f5f9":b==="vox"?"#eee6ff":"#0f172a"};P==="widget"?(oc+=` flex items-center justify-center min-h-fit ${ic} ${rc} ${d}`,Ys={...Ys,...sc}):(oc=`voxket-widget-root theme-${b} ${d||""}`,Ys={backgroundColor:b==="dark"?"#0f172a":b==="vox"?"#1a1a2e":"#ffffff",color:b==="dark"?"#f1f5f9":b==="vox"?"#eee6ff":"#0f172a"});const jh=m.jsx(m.Fragment,{children:m.jsxs(yr,{mode:"wait",children:[W==="welcome"&&!te&&m.jsx(ij,{agentId:_,participantName:L||"",onAgentIdChange:ie,onParticipantNameChange:F,onStartCall:rt,onStartChat:Qt,onStartVideo:vi,disabled:Q||te,prompts:o,statusMessage:a,title:c,subTitle:l,theme:b,modalities:X,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),W==="voice"&&m.jsxs(ua.Provider,{value:z,children:[m.jsx(bp,{}),m.jsx(gp,{label:"Start Audio"}),m.jsx(ej,{loadingText:p,participantName:L||"User",capabilities:oe,sessionStarted:Q,disabled:!Q,theme:b,client:$,displayType:P,onBack:P==="popup"?en:yi,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),W==="chat"&&m.jsx(tj,{client:$,theme:b,displayType:P,onBack:P==="popup"?en:yi,onEndChat:yi,disabled:!Q,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),W==="video"&&m.jsxs(ua.Provider,{value:z,children:[m.jsx(bp,{}),m.jsx(gp,{label:"Start Audio"}),m.jsx(nj,{client:$,theme:b,displayType:P,onBack:P==="popup"?en:yi,onEndCall:yi,disabled:!Q,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return P==="fullscreen"||P==="popup"?(console.log("📱 Rendering fullscreen/popup mode, displayType:",P),m.jsx(qg,{theme:b,displayType:P,popupPosition:I,onClose:P==="fullscreen"?Uw:en,children:jh})):(console.log("📦 Rendering widget mode"),m.jsx("div",{className:oc,style:Ys,children:m.jsx(qg,{theme:b,displayType:P,popupPosition:I,onExpand:Bw,children:jh})}))}function sj({logs:t,onClear:e,onExport:n}){const[i,r]=g.default.useState(!1),[s,o]=g.default.useState(""),a=t.filter(c=>!s||c.event.toLowerCase().includes(s.toLowerCase()));return i?m.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:m.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[m.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[m.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",t.length,")"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",placeholder:"Filter events...",value:s,onChange:c=>o(c.target.value),className:"px-3 py-1 border rounded text-sm"}),m.jsx("button",{onClick:e,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),m.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),m.jsx("button",{onClick:()=>r(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),m.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?m.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):m.jsx("div",{className:"space-y-2",children:a.map((c,l)=>m.jsxs("div",{className:"border rounded p-3 text-sm",children:[m.jsxs("div",{className:"flex items-center justify-between mb-1",children:[m.jsx("span",{className:"font-semibold text-blue-600",children:c.event}),m.jsx("span",{className:"text-gray-500 text-xs",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.sessionId&&m.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",c.sessionId]}),c.data&&m.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:m.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(c.data,null,2)})})]},l))})})]})}):m.jsxs("button",{onClick:()=>r(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",t.length,")"]})}function oj({metrics:t}){return t?m.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[m.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),m.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Session ID:"}),m.jsx("div",{className:"font-mono text-xs",children:t.sessionId})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Start Time:"}),m.jsx("div",{children:new Date(t.startTime).toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Messages:"}),m.jsx("div",{children:t.totalMessages})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Participants:"}),m.jsx("div",{children:t.participantCount})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),m.jsx("div",{children:t.connectionIssues})]}),m.jsxs("div",{children:[m.jsx("span",{className:"text-gray-600",children:"Duration:"}),m.jsxs("div",{children:[Math.round((Date.now()-new Date(t.startTime).getTime())/1e3),"s"]})]})]})]}):null}function Hi(){const{currentSession:t,sessionState:e,sessionMetrics:n,createSession:i,endSession:r}=xn(),s=M.useCallback(async(a,c)=>await i(a,c),[i]),o=M.useCallback(async()=>await r(),[r]);return{session:t,state:e,metrics:n,isActive:t!==null&&e!=="disconnected",isConnecting:e==="connecting",isConnected:e==="connected"||e==="active",start:s,stop:o}}function Ew(){const{sessionMetrics:t,currentSession:e}=xn();return{metrics:t,sessionId:e==null?void 0:e.id,duration:t==null?void 0:t.duration,participantCount:t==null?void 0:t.participantCount,messageCount:t==null?void 0:t.messageCount,audioQuality:t==null?void 0:t.audioQuality,networkStats:t==null?void 0:t.networkStats}}function Pw(){const{setMicrophoneEnabled:t,client:e}=xn(),[n,i]=M.useState(!1),[r,s]=M.useState(!1),o=M.useCallback(async()=>{if(!r){s(!0);try{const l=!n;await t(l),i(l)}catch(l){console.error("Failed to toggle microphone:",l)}finally{s(!1)}}},[n,r,t]),a=M.useCallback(async()=>{if(!(n||r)){s(!0);try{await t(!0),i(!0)}catch(l){console.error("Failed to enable microphone:",l)}finally{s(!1)}}},[n,r,t]),c=M.useCallback(async()=>{if(!(!n||r)){s(!0);try{await t(!1),i(!1)}catch(l){console.error("Failed to disable microphone:",l)}finally{s(!1)}}},[n,r,t]);return{isEnabled:n,isLoading:r,toggle:o,enable:a,disable:c}}function Rw(){const{setCameraEnabled:t}=xn(),[e,n]=M.useState(!1),[i,r]=M.useState(!1),s=M.useCallback(async()=>{if(!i){r(!0);try{const c=!e;await t(c),n(c)}catch(c){console.error("Failed to toggle camera:",c)}finally{r(!1)}}},[e,i,t]),o=M.useCallback(async()=>{if(!(e||i)){r(!0);try{await t(!0),n(!0)}catch(c){console.error("Failed to enable camera:",c)}finally{r(!1)}}},[e,i,t]),a=M.useCallback(async()=>{if(!(!e||i)){r(!0);try{await t(!1),n(!1)}catch(c){console.error("Failed to disable camera:",c)}finally{r(!1)}}},[e,i,t]);return{isEnabled:e,isLoading:i,toggle:s,enable:o,disable:a}}function Aw(){const{startScreenShare:t,stopScreenShare:e}=xn(),[n,i]=M.useState(!1),[r,s]=M.useState(!1),o=M.useCallback(async()=>{if(!(n||r)){s(!0);try{await t(),i(!0)}catch(l){console.error("Failed to start screen share:",l)}finally{s(!1)}}},[n,r,t]),a=M.useCallback(async()=>{if(!(!n||r)){s(!0);try{await e(),i(!1)}catch(l){console.error("Failed to stop screen share:",l)}finally{s(!1)}}},[n,r,e]),c=M.useCallback(async()=>{n?await a():await o()},[n,o,a]);return{isSharing:n,isLoading:r,start:o,stop:a,toggle:c}}function aj(){const{client:t}=xn(),[e,n]=M.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),i=M.useMemo(()=>e.tracks.find(f=>f.isLocal),[e.tracks]),r=M.useMemo(()=>e.tracks.filter(f=>!f.isLocal),[e.tracks]),s=M.useCallback(async()=>{try{i!=null&&i.isEnabled?await(t==null?void 0:t.disableCamera()):await(t==null?void 0:t.enableCamera())}catch(f){throw console.error("Failed to toggle camera:",f),f}},[t,i]),o=M.useCallback(async()=>{try{e.tracks.find(y=>y.isScreenShare)?await(t==null?void 0:t.stopScreenShare()):await(t==null?void 0:t.startScreenShare())}catch(f){throw console.error("Failed to toggle screen share:",f),f}},[t,e.tracks]),a=M.useCallback(f=>{n(y=>({...y,layout:f}))},[]),c=M.useCallback(f=>{n(y=>({...y,pinnedTrack:f}))},[]),l=M.useCallback(()=>{n(f=>({...f,pinnedTrack:void 0}))},[]),d=M.useCallback(async()=>{try{await(t==null?void 0:t.startRecording()),n(f=>({...f,isRecording:!0}))}catch(f){throw console.error("Failed to start recording:",f),f}},[t]),u=M.useCallback(async()=>{try{await(t==null?void 0:t.stopRecording()),n(f=>({...f,isRecording:!1}))}catch(f){throw console.error("Failed to stop recording:",f),f}},[t]),h=M.useCallback(f=>e.tracks.find(y=>y.id===f),[e.tracks]),p=M.useCallback(f=>e.tracks.filter(y=>y.participantId===f),[e.tracks]),v=M.useCallback(f=>f.isEnabled&&e.tracks.includes(f),[e.tracks]);return M.useEffect(()=>{if(!t)return;const f=S=>{n(k=>({...k,tracks:[...k.tracks.filter(w=>w.id!==S.id),S]}))},y=S=>{n(k=>{var w;return{...k,tracks:k.tracks.filter(x=>x.id!==S),pinnedTrack:((w=k.pinnedTrack)==null?void 0:w.id)===S?void 0:k.pinnedTrack}})},b=S=>{n(k=>({...k,tracks:k.tracks.map(w=>w.id===S.id?S:w)}))};return t.on("videoTrackAdded",f),t.on("videoTrackRemoved",y),t.on("videoTrackUpdated",b),()=>{t.off("videoTrackAdded",f),t.off("videoTrackRemoved",y),t.off("videoTrackUpdated",b)}},[t]),{tracks:e.tracks,localTrack:i,remoteTraracks:r,pinnedTrack:e.pinnedTrack,layout:e.layout,isRecording:e.isRecording,toggleCamera:s,toggleScreenShare:o,setLayout:a,pinTrack:c,unpinTrack:l,startRecording:d,stopRecording:u,getTrackById:h,getTracksByParticipant:p,isTrackActive:v}}function nc(){const{chatMessages:t,sendChatMessage:e,currentSession:n}=xn(),[i,r]=M.useState(!1),s=M.useCallback(async l=>{if(!(!l.trim()||i||!n)){r(!0);try{await e(l.trim())}catch(d){throw console.error("Failed to send chat message:",d),d}finally{r(!1)}}},[e,i,n]),{userMessages:o,agentMessages:a,allMessages:c}=M.useMemo(()=>{const l=t.filter(u=>u.sender.type==="participant"),d=t.filter(u=>u.sender.type==="agent");return{userMessages:l,agentMessages:d,allMessages:t}},[t]);return{messages:c,userMessages:o,agentMessages:a,messageCount:c.length,isSending:i,canSend:!!n&&!i,send:s}}function cj(){const{send:t,isSending:e,canSend:n}=nc(),[i,r]=M.useState(""),s=M.useCallback(async()=>{if(!(!i.trim()||!n))try{await t(i),r("")}catch(a){throw a}},[i,t,n]),o=M.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),s())},[s]);return{value:i,setValue:r,send:s,handleKeyPress:o,isSending:e,canSend:n&&i.trim().length>0}}function Nh(){const{isConnected:t,isConnecting:e,connectionError:n,connect:i,disconnect:r}=xn(),s=M.useCallback(async()=>{if(!(t||e))try{await i()}catch(a){throw console.error("Failed to connect:",a),a}},[i,t,e]),o=M.useCallback(async()=>{if(t)try{await r()}catch(a){throw console.error("Failed to disconnect:",a),a}},[r,t]);return{isConnected:t,isConnecting:e,isDisconnected:!t&&!e,error:n,hasError:!!n,connect:s,disconnect:o}}function Iw(){const{participants:t}=xn();return{participants:t,count:t.length,localParticipant:t.find(e=>e.isLocal),remoteParticipants:t.filter(e=>!e.isLocal)}}const Mw=M.createContext({}),Zs=()=>M.useContext(Mw);function Nw({children:t,...e}){return m.jsx(Mw.Provider,{value:e,children:t})}function Ko({name:t,children:e,fallback:n,className:i}){return m.jsx("div",{className:`voxket-slot voxket-slot--${t} ${i||""}`,children:e||n})}function _w(t,e={}){return Object.assign(t,e)}function Ow({showMicrophoneControl:t=!0,showCameraControl:e=!0,showScreenShareControl:n=!0,showSessionActions:i=!0,customControls:r,className:s=""}){const o=Hi(),a=Pw(),c=Rw(),l=Aw(),d=Zs(),u=["voxket-session-controls",`voxket-session-controls--${d.variant||"default"}`,`voxket-session-controls--${d.size||"md"}`,o.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",s].filter(Boolean).join(" ");return!o.isActive&&!i?m.jsx("div",{className:u,children:m.jsx("div",{className:"voxket-controls-inactive",children:m.jsx("p",{children:"Controls available during active session"})})}):m.jsxs("div",{className:u,children:[i&&m.jsx("div",{className:"voxket-session-actions",children:o.isActive?m.jsx("button",{onClick:o.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):m.jsx(lj,{})}),o.isActive&&m.jsxs("div",{className:"voxket-media-controls",children:[t&&m.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[m.jsx("span",{className:"voxket-icon",children:"🎤"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),e&&m.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isEnabled?"voxket-button--active":""}`,title:c.isEnabled?"Stop camera":"Start camera",children:[m.jsx("span",{className:"voxket-icon",children:"📹"}),c.isLoading?"Loading...":c.isEnabled?"Stop Video":"Start Video"]}),n&&m.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isSharing?"voxket-button--active":""}`,title:l.isSharing?"Stop screen share":"Start screen share",children:[m.jsx("span",{className:"voxket-icon",children:"🖥️"}),l.isLoading?"Loading...":l.isSharing?"Stop Share":"Share Screen"]})]}),r&&m.jsx("div",{className:"voxket-custom-controls",children:r})]})}function lj(){Hi();const[t,e]=g.default.useState(!1),n=async()=>{e(!0);try{console.log("Start session - agentId needed")}catch(i){console.error("Failed to start session:",i)}finally{e(!1)}};return m.jsx("button",{onClick:n,disabled:t,className:"voxket-button voxket-button--primary",children:t?"Starting...":"Start Session"})}function _h({showConnectionStatus:t=!0,showSessionInfo:e=!0,showAgentInfo:n=!0,className:i=""}){const r=Hi(),s=Nh(),o=Zs(),a=["voxket-session-header",`voxket-session-header--${o.variant||"default"}`,`voxket-session-header--${o.size||"md"}`,i].filter(Boolean).join(" ");return m.jsxs("div",{className:a,children:[t&&m.jsxs("div",{className:"voxket-connection-status",children:[m.jsx("div",{className:`voxket-status-indicator ${s.isConnected?"connected":"disconnected"}`}),m.jsx("span",{className:"voxket-status-text",children:s.isConnecting?"Connecting...":s.isConnected?"Connected":"Disconnected"})]}),e&&r.session&&m.jsxs("div",{className:"voxket-session-info",children:[m.jsxs("div",{className:"voxket-session-id",children:["Session: ",r.session.id.slice(-8)]}),m.jsxs("div",{className:"voxket-session-state",children:["State: ",r.state]})]}),n&&r.session&&m.jsxs("div",{className:"voxket-agent-info",children:[m.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",r.session.agentId]}),m.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",r.session.activeModalities.join(", ")]})]}),s.error&&m.jsxs("div",{className:"voxket-error-message",children:["Error: ",s.error.message]})]})}function Oh({showChat:t=!0,showTranscriptions:e=!1,customContent:n,className:i=""}){const r=Hi(),s=nc(),o=Zs(),a=["voxket-session-content",`voxket-session-content--${o.variant||"default"}`,`voxket-session-content--${o.size||"md"}`,i].filter(Boolean).join(" ");return r.isActive?m.jsx("div",{className:a,children:n||m.jsxs(m.Fragment,{children:[t&&m.jsxs("div",{className:"voxket-chat-container",children:[m.jsxs("div",{className:"voxket-chat-messages",children:[s.messages.map(c=>m.jsxs("div",{className:`voxket-message voxket-message--${c.sender.type}`,children:[m.jsxs("div",{className:"voxket-message-header",children:[m.jsx("span",{className:"voxket-message-sender",children:c.sender.name}),m.jsx("span",{className:"voxket-message-time",children:c.timestamp.toLocaleTimeString()})]}),m.jsx("div",{className:"voxket-message-content",children:c.content})]},c.id)),s.messages.length===0&&m.jsx("div",{className:"voxket-empty-messages",children:m.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),m.jsx(dj,{})]}),e&&m.jsx("div",{className:"voxket-transcriptions",children:m.jsx("div",{className:"voxket-transcription-placeholder",children:m.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):m.jsx("div",{className:a,children:m.jsx("div",{className:"voxket-inactive-state",children:m.jsxs("div",{className:"voxket-inactive-message",children:[m.jsx("h3",{children:"Start a conversation"}),m.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function dj(){const t=nc(),[e,n]=g.default.useState(""),i=async()=>{if(!(!e.trim()||!t.canSend))try{await t.send(e),n("")}catch(s){console.error("Failed to send message:",s)}},r=s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i())};return m.jsxs("div",{className:"voxket-chat-input",children:[m.jsx("input",{type:"text",value:e,onChange:s=>n(s.target.value),onKeyPress:r,placeholder:"Type your message...",disabled:!t.canSend,className:"voxket-input"}),m.jsx("button",{onClick:i,disabled:!t.canSend||!e.trim(),className:"voxket-send-button",children:t.isSending?"Sending...":"Send"})]})}function Dh({showMetrics:t=!0,showParticipants:e=!0,showStatus:n=!0,customFooter:i,className:r=""}){const s=Hi(),o=Ew(),a=Iw(),c=Zs(),l=["voxket-session-footer",`voxket-session-footer--${c.variant||"default"}`,`voxket-session-footer--${c.size||"md"}`,r].filter(Boolean).join(" ");return s.isActive?m.jsx("div",{className:l,children:i||m.jsxs(m.Fragment,{children:[n&&m.jsxs("div",{className:"voxket-session-status",children:[m.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),m.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),t&&o.metrics&&m.jsxs("div",{className:"voxket-session-metrics",children:[m.jsxs("div",{className:"voxket-metric",children:[m.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),m.jsx("span",{className:"voxket-metric-value",children:uj(o.duration||0)})]}),m.jsxs("div",{className:"voxket-metric",children:[m.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),m.jsx("span",{className:"voxket-metric-value",children:o.metrics.messageCount})]})]}),e&&m.jsxs("div",{className:"voxket-participants-info",children:[m.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&m.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(d=>m.jsx("span",{className:"voxket-participant-name",children:d.name},d.id))})]})]})}):m.jsx("div",{className:l,children:m.jsx("div",{className:"voxket-footer-inactive",children:m.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function uj(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),i=Math.floor(n/60);return i>0?`${i}:${(n%60).toString().padStart(2,"0")}:${(e%60).toString().padStart(2,"0")}`:`${n}:${(e%60).toString().padStart(2,"0")}`}function hj({agentId:t,sessionConfig:e,autoStart:n=!1,onSessionStart:i,onSessionEnd:r,variant:s="default",size:o="md",theme:a,className:c="",children:l}){var p;const d=Hi(),u=Nh();M.useEffect(()=>{n&&t&&u.isConnected&&!d.isActive&&d.start(t,e).catch(console.error)},[n,t,u.isConnected,d.isActive]),M.useEffect(()=>{var v;(v=d.session)!=null&&v.id&&i&&i(d.session.id)},[(p=d.session)==null?void 0:p.id,i]),M.useEffect(()=>()=>{d.isActive&&r&&d.stop().then(r).catch(console.error)},[]);const h=["voxket-session",`voxket-session--${s}`,`voxket-session--${o}`,d.isActive?"voxket-session--active":"voxket-session--inactive",c].filter(Boolean).join(" ");return m.jsx(Nw,{variant:s,size:o,theme:a,className:c,children:m.jsx("div",{className:h,children:l||m.jsxs(m.Fragment,{children:[m.jsx(Ko,{name:"header",fallback:m.jsx(_h,{})}),m.jsx(Ko,{name:"content",fallback:m.jsx(Oh,{})}),m.jsx(Ko,{name:"footer",fallback:m.jsx(Dh,{})})]})})})}const Dw=_w(hj,{Header:_h,Content:Oh,Footer:Dh,Controls:Ow}),Ni={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},qd={...Ni,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},Gd={...Ni,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},jw=M.createContext(null),Lw=()=>{const t=M.useContext(jw);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};function fj({theme:t="default",themes:e={},children:n,cssVariables:i=!0,className:r=""}){const[s,o]=g.default.useState(()=>{const h={default:Ni,dark:qd,enterprise:Gd,...e};return typeof t=="string"?h[t]||Ni:t}),[a,c]=g.default.useState(()=>({default:Ni,dark:qd,enterprise:Gd,...e})),l=h=>{if(typeof h=="string"){const p=a[h];p&&o(p)}else o(h)},d=h=>{c(p=>({...p,[h.name]:h}))};M.useEffect(()=>{if(i&&typeof document<"u"){const h=document.documentElement;Object.entries(Vw(s)).forEach(([p,v])=>{h.style.setProperty(`--voxket-${p}`,v)})}},[s,i]);const u={theme:s,setTheme:l,themes:a,registerTheme:d};return m.jsx(jw.Provider,{value:u,children:m.jsx("div",{className:`voxket-theme voxket-theme--${s.name} ${r}`,children:n})})}function Vw(t){const e={},n=(i,r="")=>{for(const[s,o]of Object.entries(i)){const a=r?`${r}-${s}`:s;typeof o=="object"&&o!==null&&!Array.isArray(o)?n(o,a):e[a]=String(o)}};return n(t),e}function mj(t=Ni,e){return{...t,...e,colors:{...t.colors,...e.colors},typography:{...t.typography,...e.typography},spacing:{...t.spacing,...e.spacing},borderRadius:{...t.borderRadius,...e.borderRadius},shadows:{...t.shadows,...e.shadows}}}function pj(t){var n;const{theme:e}=Lw();return((n=e.components)==null?void 0:n[t])||{}}const gj=Mh("voice-modality","voice",{onActivate:async t=>{const e=t.config;e.enableTranscription&&vj(t),e.enableVoiceActivation&&yj(t,e),console.log("Voice modality activated",e)},onDeactivate:async t=>{console.log("Voice modality deactivated")},onMessage:async(t,e)=>{e.type==="audio"&&bj(t,e)}});function vj(t,e){t.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),t.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function yj(t,e){const n=e.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function bj(t,e){console.log("Playing audio response:",e.content)}const xj=Mh("chat-modality","chat",{onActivate:async t=>{const e=t.config;e.enableRichText&&wj(),e.enableFileUpload&&Sj(t),e.enableCustomComponents&&kj(),console.log("Chat modality activated",e)},onDeactivate:async t=>{console.log("Chat modality deactivated")},onMessage:async(t,e)=>{const n=t.config;e.type==="ui_component"?Cj(t,e):e.type==="text"&&n.enableRichText&&Tj(t,e)}});function wj(t){console.log("Rich text support enabled")}function Sj(t){console.log("File upload enabled"),t.on("chat.file.uploaded",e=>{console.log("File uploaded:",e.name)})}function kj(t){console.log("Custom components enabled");const e=new Map;e.set("quick-actions",Ej),e.set("form",Pj),e.set("card",Rj),e.set("chart",Aj)}function Cj(t,e){const{componentType:n,props:i}=e.metadata;console.log("Rendering custom component:",n,i),t.emit("chat.component.render",{type:n,props:i,timestamp:new Date})}function Tj(t,e){console.log("Processing rich text message:",e.content)}function Ej(t){return{type:"quick-actions",actions:t.actions||[],layout:t.layout||"horizontal"}}function Pj(t){return{type:"form",fields:t.fields||[],submitAction:t.submitAction,validation:t.validation}}function Rj(t){return{type:"card",title:t.title,content:t.content,actions:t.actions,variant:t.variant||"default"}}function Aj(t){return{type:"chart",chartType:t.chartType||"line",data:t.data,options:t.options}}function Zo({track:t,participantName:e,showControls:n=!0,showName:i=!0,showMuteIndicator:r=!0,isPinned:s=!1,className:o="",onClick:a,onPin:c,onUnpin:l}){const d=M.useRef(null),[u,h]=M.useState(!1);M.useEffect(()=>{if(!d.current||!t.isEnabled)return;const y=d.current;return y.srcObject=null,()=>{y.srcObject&&(y.srcObject=null)}},[t]);const p=()=>{a==null||a(t)},v=y=>{y.stopPropagation(),s?l==null||l(t):c==null||c(t)},f=["voxket-video-tile",t.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",t.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",s?"voxket-video-tile--pinned":"",t.isEnabled?"":"voxket-video-tile--disabled",u?"voxket-video-tile--hovered":"",o].filter(Boolean).join(" ");return m.jsxs("div",{className:f,onClick:p,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{aspectRatio:t.dimensions?`${t.dimensions.width} / ${t.dimensions.height}`:"16 / 9"},children:[m.jsx("video",{ref:d,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:t.isLocal}),!t.isEnabled&&m.jsxs("div",{className:"voxket-video-placeholder",children:[m.jsx("div",{className:"voxket-video-placeholder-icon",children:t.isScreenShare?"🖥️":"📹"}),m.jsx("p",{className:"voxket-video-placeholder-text",children:t.isScreenShare?"Screen sharing paused":"Camera off"})]}),m.jsxs("div",{className:"voxket-video-overlay",children:[i&&e&&m.jsxs("div",{className:"voxket-video-name",children:[e,t.isLocal&&" (You)"]}),r&&!t.isEnabled&&m.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(u||s)&&m.jsxs("div",{className:"voxket-video-controls",children:[m.jsx("button",{className:`voxket-video-control-btn ${s?"voxket-video-control-btn--active":""}`,onClick:v,title:s?"Unpin video":"Pin video",children:"📌"}),t.isScreenShare&&m.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),t.source&&m.jsx("div",{className:"voxket-video-source",children:t.source})]})]}),!t.isEnabled&&m.jsx("div",{className:"voxket-video-loading",children:m.jsx("div",{className:"voxket-spinner"})})]})}function Ij({tracks:t,layout:e,className:n="",onLayoutChange:i,onTrackClick:r,maxVisibleTracks:s=9,showPagination:o=!0}){const[a,c]=M.useState(0),[l,d]=M.useState(null),u=M.useMemo(()=>{let S=[...t];e.type==="speaker"&&l&&(S=[l,...t.filter(x=>x.id!==l.id)]);const k=a*s,w=k+s;return S.slice(k,w)},[t,e,l,a,s]),h=Math.ceil(t.length/s),p=M.useMemo(()=>{const S=u.length;switch(e.type){case"grid":const k=Math.ceil(Math.sqrt(S)),w=Math.ceil(S/k);return{display:"grid",gridTemplateColumns:`repeat(${k}, 1fr)`,gridTemplateRows:`repeat(${w}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[e.type,u.length]),v=S=>{d(S)},f=()=>{d(null)},y=S=>{i==null||i({...e,type:S})},b=["voxket-video-grid",`voxket-video-grid--${e.type}`,`voxket-video-grid--${u.length}-tracks`,n].filter(Boolean).join(" ");return t.length===0?m.jsx("div",{className:"voxket-video-grid-empty",children:m.jsxs("div",{className:"voxket-video-grid-empty-content",children:[m.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),m.jsx("p",{children:"No video tracks available"})]})}):m.jsxs("div",{className:b,children:[m.jsxs("div",{className:"voxket-video-grid-controls",children:[m.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(S=>m.jsx("button",{className:`voxket-layout-btn ${e.type===S?"voxket-layout-btn--active":""}`,onClick:()=>y(S),title:`Switch to ${S} layout`,children:Mj(S)},S))}),m.jsxs("div",{className:"voxket-video-count",children:[t.length," participant",t.length!==1?"s":""]})]}),m.jsx("div",{className:"voxket-video-grid-content",style:p,children:e.type==="speaker"&&l?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"voxket-video-speaker-main",children:m.jsx(Zo,{track:l,participantName:`Participant ${l.participantId}`,isPinned:!0,onClick:r,onUnpin:f})}),m.jsx("div",{className:"voxket-video-speaker-sidebar",children:u.filter(S=>S.id!==l.id).map(S=>m.jsx(Zo,{track:S,participantName:`Participant ${S.participantId}`,showControls:!1,onClick:r,onPin:v},S.id))})]}):u.map(S=>m.jsx(Zo,{track:S,participantName:`Participant ${S.participantId}`,isPinned:(l==null?void 0:l.id)===S.id,onClick:r,onPin:v,onUnpin:f},S.id))}),o&&h>1&&m.jsxs("div",{className:"voxket-video-pagination",children:[m.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.max(0,a-1)),disabled:a===0,children:"←"}),m.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",h]}),m.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.min(h-1,a+1)),disabled:a===h-1,children:"→"})]})]})}function Mj(t){switch(t){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function Nj({localTrack:t,onToggleCamera:e,onToggleScreenShare:n,onLayoutChange:i,showLayoutControls:r=!0,showCameraControls:s=!0,showScreenShareControls:o=!0,className:a=""}){const c=["voxket-video-controls",a].filter(Boolean).join(" "),l=d=>{i==null||i({type:d,showLocalVideo:!0,aspectRatio:"16:9"})};return m.jsxs("div",{className:c,children:[s&&m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),m.jsxs("button",{className:`voxket-control-btn ${t!=null&&t.isEnabled?"voxket-control-btn--active":""}`,onClick:e,title:t!=null&&t.isEnabled?"Turn off camera":"Turn on camera",children:[m.jsx("span",{className:"voxket-control-icon",children:t!=null&&t.isEnabled?"📹":"📷"}),m.jsx("span",{className:"voxket-control-label",children:t!=null&&t.isEnabled?"Camera On":"Camera Off"})]}),(t==null?void 0:t.dimensions)&&m.jsxs("div",{className:"voxket-video-info",children:[t.dimensions.width," × ",t.dimensions.height]})]}),o&&m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),m.jsxs("button",{className:`voxket-control-btn ${t!=null&&t.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:t!=null&&t.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[m.jsx("span",{className:"voxket-control-icon",children:t!=null&&t.isScreenShare?"🛑":"🖥️"}),m.jsx("span",{className:"voxket-control-label",children:t!=null&&t.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),r&&m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),m.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:d,icon:u,label:h})=>m.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>l(d),title:`Switch to ${h} layout`,children:[m.jsx("span",{className:"voxket-control-icon",children:u}),m.jsx("span",{className:"voxket-control-label",children:h})]},d))})]}),m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),m.jsxs("div",{className:"voxket-video-settings",children:[m.jsxs("div",{className:"voxket-setting-group",children:[m.jsx("label",{className:"voxket-setting-label",children:"Quality"}),m.jsxs("select",{className:"voxket-setting-select",children:[m.jsx("option",{value:"high",children:"High (720p)"}),m.jsx("option",{value:"medium",children:"Medium (480p)"}),m.jsx("option",{value:"low",children:"Low (240p)"})]})]}),m.jsxs("div",{className:"voxket-setting-group",children:[m.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),m.jsxs("select",{className:"voxket-setting-select",children:[m.jsx("option",{value:"30",children:"30 fps"}),m.jsx("option",{value:"15",children:"15 fps"}),m.jsx("option",{value:"10",children:"10 fps"})]})]}),m.jsxs("div",{className:"voxket-setting-group",children:[m.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),m.jsxs("select",{className:"voxket-setting-select",children:[m.jsx("option",{value:"unlimited",children:"Unlimited"}),m.jsx("option",{value:"1000",children:"1 Mbps"}),m.jsx("option",{value:"500",children:"500 Kbps"}),m.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),m.jsxs("div",{className:"voxket-video-controls-section",children:[m.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),m.jsxs("div",{className:"voxket-video-stats",children:[m.jsxs("div",{className:"voxket-stat-item",children:[m.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),m.jsx("span",{className:"voxket-stat-value",children:t!=null&&t.dimensions?`${t.dimensions.width}×${t.dimensions.height}`:"N/A"})]}),m.jsxs("div",{className:"voxket-stat-item",children:[m.jsx("span",{className:"voxket-stat-label",children:"Source:"}),m.jsx("span",{className:"voxket-stat-value",children:(t==null?void 0:t.source)||"None"})]}),m.jsxs("div",{className:"voxket-stat-item",children:[m.jsx("span",{className:"voxket-stat-label",children:"Status:"}),m.jsx("span",{className:`voxket-stat-value ${t!=null&&t.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:t!=null&&t.isEnabled?"Active":"Inactive"})]})]})]})]})}const Fw=({handler:t,loadData:e,data:n,client:i,addLocalMessage:r})=>{const[s,o]=g.useState(null),[a,c]=g.useState(!0),[l,d]=g.useState(!1),[u]=g.useState(Date.now());g.useEffect(()=>{(async()=>{try{if(c(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const y={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};o(y),console.log("📋 AssignmentView: Assignment loaded from RPC data:",y)}}catch(y){console.error("📋 AssignmentView: Error loading assignment:",y),o({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{c(!1)}})()},[n,e]);const h=({message:f,assignment:y})=>{const b=f.toLowerCase().includes("declined"),S=b?"bg-red-50 border-red-200":"bg-green-50 border-green-200",k=b?"text-red-700":"text-green-700",w=b?"❌":"🎉";return m.jsxs("div",{className:`max-w-sm mx-auto ${S} border rounded-lg shadow p-3 flex flex-col items-center`,children:[m.jsx("div",{className:"text-2xl mb-2",children:w}),m.jsx("div",{className:`${k} font-semibold text-sm mb-1`,children:f}),m.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:y.title}),m.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},p=async()=>{if(!(!s||!t)){d(!0);try{const f={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",f),t.didSuccess(f,m.jsx(h,{message:"Assignment accepted!",assignment:s}))}catch(f){console.error("📋 AssignmentView: Error accepting assignment:",f),t.didFail({error:"Failed to accept assignment"})}finally{d(!1)}}},v=async()=>{if(!(!s||!t)){d(!0);try{const f={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",f),t.didSuccess(f,m.jsx(h,{message:"Assignment declined",assignment:s}))}catch(f){console.error("📋 AssignmentView: Error declining assignment:",f),t.didFail({error:"Failed to decline assignment"})}finally{d(!1)}}};return a?m.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:m.jsxs("div",{className:"flex items-center justify-center py-4",children:[m.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),m.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):s?m.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[m.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:m.jsx("div",{className:"flex items-center justify-between",children:m.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:s.title})})}),m.jsxs("div",{className:"p-3",children:[m.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:m.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:s.description})}),m.jsx("div",{className:"mb-3",children:m.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[m.jsx("span",{className:"text-xs mr-1",children:"📅"}),m.jsxs("span",{children:["Est: ",s.estimated_time_of_completion]})]})}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx("button",{onClick:p,disabled:l,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:l?m.jsxs("span",{className:"flex items-center justify-center",children:[m.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),m.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),m.jsx("button",{onClick:v,disabled:l,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):m.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:m.jsxs("div",{className:"text-center py-4",children:[m.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),m.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function _j(){const[t,e]=g.useState(null),[n,i]=g.useState([]);g.useEffect(()=>{const a=new Ks({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return e(a),a.on("rpc.method.called",c=>{console.log("RPC Method Called:",c)}),a.on("rpc.interaction.completed",c=>{console.log("RPC Interaction Completed:",c)}),()=>{a.disconnect()}},[]);const r=async()=>{if(t)try{await t.registerFrontendRPC("give_assignment",Fw,"embedded");const a=t.getRegisteredRpcMethods();i(a),console.log("✅ Assignment RPC registered successfully")}catch(a){console.error("❌ Failed to register assignment RPC:",a)}},s=async()=>{if(!t)return;const a=({handler:c,timeout:l})=>{const[d,u]=g.useState(""),h=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],p=f=>{u(f)},v=()=>{const f=h.find(y=>y.id===d);c==null||c.didSuccess({selectedProduct:d,productName:f==null?void 0:f.name,price:f==null?void 0:f.price,timestamp:new Date().toISOString()})};return m.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[m.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),m.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),m.jsx("div",{className:"space-y-3 mb-6",children:h.map(f=>m.jsx("div",{onClick:()=>p(f.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${d===f.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:m.jsxs("div",{className:"flex justify-between items-center",children:[m.jsxs("div",{children:[m.jsx("h4",{className:"font-medium",children:f.name}),m.jsx("p",{className:"text-gray-600 text-sm",children:f.price})]}),m.jsx("div",{className:`w-4 h-4 rounded-full ${d===f.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},f.id))}),m.jsxs("div",{className:"flex justify-end space-x-3",children:[m.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),m.jsx("button",{onClick:v,disabled:!d,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),l&&m.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",l," seconds"]})]})};try{await t.registerFrontendRPC("recommend_product",a,"modal");const c=t.getRegisteredRpcMethods();i(c),console.log("✅ Product Recommendation RPC registered successfully")}catch(c){console.error("❌ Failed to register product recommendation RPC:",c)}},o=async()=>{if(!t)return;const a=({handler:c})=>{const[l,d]=g.useState(0),[u,h]=g.useState(""),p=()=>{c==null||c.didSuccess({rating:l,comment:u,timestamp:new Date().toISOString()})};return m.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[m.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),m.jsxs("div",{className:"mb-4",children:[m.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),m.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(v=>m.jsx("button",{onClick:()=>d(v),className:`text-2xl ${v<=l?"text-yellow-400":"text-gray-300"}`,children:"⭐"},v))})]}),m.jsxs("div",{className:"mb-4",children:[m.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),m.jsx("textarea",{value:u,onChange:v=>h(v.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),m.jsxs("div",{className:"flex justify-end space-x-2",children:[m.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),m.jsx("button",{onClick:p,disabled:l===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await t.registerFrontendRPC("collect_feedback",a,"embedded");const c=t.getRegisteredRpcMethods();i(c),console.log("✅ Feedback RPC registered successfully")}catch(c){console.error("❌ Failed to register feedback RPC:",c)}};return m.jsxs("div",{className:"p-6",children:[m.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),m.jsxs("div",{className:"space-y-4 mb-6",children:[m.jsxs("div",{children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),m.jsxs("div",{className:"space-x-2",children:[m.jsx("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),m.jsx("button",{onClick:s,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),m.jsx("button",{onClick:o,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),m.jsxs("div",{children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?m.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>m.jsx("li",{className:"text-gray-700",children:m.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):m.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),m.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[m.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),m.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[m.jsxs("li",{children:["Register RPC methods with React components using ",m.jsx("code",{children:"client.registerFrontendRPC()"})]}),m.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),m.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),m.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),m.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),m.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[m.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),m.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),m.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
|
|
206
|
+
`,style:{minHeight:"2.5rem",display:o===s?"block":"none"},children:i},o))})}function C2({statusMessage:e,theme:t}){const n=Ve(t);return c.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[c.jsx("div",{className:n.statusIndicator}),c.jsx("span",{className:`text-xs ${n.text.muted}`,children:e})]})}const E2=({disabled:e,onStartCall:t,onStartChat:n,onStartVideo:s,prompts:r=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:i="Agent is ready",title:o="Choose how to interact",subTitle:a="Ask me anything or give me a task to complete",theme:l="vox",modalities:d=["voice","chat","video"]})=>{const u=Ve(l),h=d.includes("voice"),m=d.includes("chat"),g=d.includes("video"),x=[h,m,g].filter(Boolean).length;return console.log("🎯 Welcome component debug:",{modalities:d,hasVoice:h,hasChat:m,hasVideo:g,totalButtons:x,onStartVideo:!!s}),c.jsxs("div",{inert:e,className:"flex p-8 flex-col items-center h-full justify-center w-full",children:[c.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[c.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[c.jsx("div",{className:u.pulseRings.ring1}),c.jsx("div",{className:u.pulseRings.ring2,style:{animationDelay:"0.5s"}}),c.jsx("div",{className:u.pulseRings.ring3,style:{animationDelay:"1s"}})]}),c.jsx("div",{className:"relative z-10 flex items-center justify-center",children:h&&m&&g?c.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[c.jsx(ps,{onClick:t,disabled:e,theme:l}),c.jsx(Mr,{onClick:n,disabled:e,theme:l}),c.jsx(Nr,{onClick:s||t,disabled:e,theme:l})]}):x>1?c.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[h&&c.jsx(ps,{onClick:t,disabled:e,theme:l}),m&&c.jsx(Mr,{onClick:n,disabled:e,theme:l}),g&&s&&c.jsx(Nr,{onClick:s,disabled:e,theme:l})]}):c.jsx("div",{className:"flex items-center justify-center",children:h?c.jsx(ps,{onClick:t,disabled:e,theme:l}):m?c.jsx(Mr,{onClick:n,disabled:e,theme:l}):g&&s?c.jsx(Nr,{onClick:s,disabled:e,theme:l}):c.jsx(ps,{onClick:t,disabled:e,theme:l})})})]}),c.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[c.jsx("h3",{className:`text-xl font-semibold mb-2 ${u.text.accent}`,children:o}),c.jsx("p",{className:`text-sm leading-relaxed px-4 ${u.text.secondary}`,children:a}),x>1&&c.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[h&&c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx(gt.Mic,{className:"w-4 h-4"}),c.jsx("span",{className:u.text.muted,children:"Voice"})]}),m&&c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx(gt.Chat,{className:"w-4 h-4"}),c.jsx("span",{className:u.text.muted,children:"Chat"})]}),g&&c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx(gt.Videocam,{className:"w-4 h-4"}),c.jsx("span",{className:u.text.muted,children:"Video"})]})]})]}),c.jsx(S2,{prompts:r,theme:l}),c.jsx(C2,{statusMessage:i,theme:l})]})};function Xu({room:e,onSessionEnd:t,onSessionStart:n,enableConsoleLogging:s=!0,enableLocalStorage:r=!0,voxketSessionId:i}={}){const[o,a]=f.useState(null),[l,d]=f.useState([]),[u,h]=f.useState(null),[m,g]=f.useState([]),x=f.useCallback((y,w)=>{const S={timestamp:new Date,event:y,data:w,sessionId:o==null?void 0:o.sessionId,participantId:u==null?void 0:u.identity};if(d(k=>[...k,S]),r){const k=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");k.push(S),localStorage.setItem("voxket-session-logs",JSON.stringify(k))}return S},[o==null?void 0:o.sessionId,u==null?void 0:u.identity,s,r]);f.useEffect(()=>{if(!e)return;const y=()=>{const I=i||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,$=new Date,F={sessionId:I,startTime:$,totalMessages:0,connectionIssues:0,participantCount:m.length,events:[]};a(F),x("SESSION_STARTED",{sessionId:I,startTime:$}),n==null||n(I)},w=()=>{if(o){const I=new Date,$=I.getTime()-o.startTime.getTime(),F={...o,endTime:I,duration:$,events:l};x("SESSION_ENDED",{sessionId:o.sessionId,duration:`${Math.round($/1e3)}s`,totalMessages:o.totalMessages,connectionIssues:o.connectionIssues}),t==null||t(F),a(null),d([])}},S=I=>{x("CONNECTION_STATE_CHANGED",{state:I}),I===J.ConnectionState.Reconnecting&&o&&(a($=>$?{...$,connectionIssues:$.connectionIssues+1}:null),x("CONNECTION_ISSUE",{type:"reconnecting"}))},k=I=>{x("TRACK_PUBLISHED",{trackKind:I.kind,trackSource:I.source})},T=I=>{x("TRACK_UNPUBLISHED",{trackKind:I.kind,trackSource:I.source})},A=(I,$)=>{o&&a(F=>F?{...F,totalMessages:F.totalMessages+1}:null),x("DATA_RECEIVED",{participantId:$==null?void 0:$.identity,dataSize:I.length})},j=I=>{x("PARTICIPANT_CONNECTED",{participantId:I.identity,participantName:I.name}),g($=>[...$,I]),o&&a($=>$?{...$,participantCount:$.participantCount+1}:null)},V=I=>{x("PARTICIPANT_DISCONNECTED",{participantId:I.identity,participantName:I.name}),g($=>$.filter(F=>F.identity!==I.identity))};return e.localParticipant&&h(e.localParticipant),e.on(J.RoomEvent.Connected,y),e.on(J.RoomEvent.Disconnected,w),e.on(J.RoomEvent.ConnectionStateChanged,S),e.on(J.RoomEvent.TrackPublished,k),e.on(J.RoomEvent.TrackUnpublished,T),e.on(J.RoomEvent.DataReceived,A),e.on(J.RoomEvent.ParticipantConnected,j),e.on(J.RoomEvent.ParticipantDisconnected,V),()=>{e.off(J.RoomEvent.Connected,y),e.off(J.RoomEvent.Disconnected,w),e.off(J.RoomEvent.ConnectionStateChanged,S),e.off(J.RoomEvent.TrackPublished,k),e.off(J.RoomEvent.TrackUnpublished,T),e.off(J.RoomEvent.DataReceived,A),e.off(J.RoomEvent.ParticipantConnected,j),e.off(J.RoomEvent.ParticipantDisconnected,V)}},[e,o,l,m.length,x,t,n]);const p=f.useCallback(()=>r?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):l,[l,r]),v=f.useCallback(()=>{r&&localStorage.removeItem("voxket-session-logs"),d([])},[r]),b=f.useCallback(()=>{const y=p(),w=JSON.stringify(y,null,2),S="data:application/json;charset=utf-8,"+encodeURIComponent(w),k=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,T=document.createElement("a");T.setAttribute("href",S),T.setAttribute("download",k),T.click()},[p]);return{sessionMetrics:o,sessionLogs:l,logEvent:x,getSessionLogs:p,clearSessionLogs:v,exportSessionLogs:b}}var nn={},Ml;function k2(){if(Ml)return nn;Ml=1;var e=yo;if(process.env.NODE_ENV==="production")nn.createRoot=e.createRoot,nn.hydrateRoot=e.hydrateRoot;else{var t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;nn.createRoot=function(n,s){t.usingClientEntryPoint=!0;try{return e.createRoot(n,s)}finally{t.usingClientEntryPoint=!1}},nn.hydrateRoot=function(n,s,r){t.usingClientEntryPoint=!0;try{return e.hydrateRoot(n,s,r)}finally{t.usingClientEntryPoint=!1}}}return nn}var A2=k2();class mi{constructor(){je(this,"listeners",{})}on(t,n){return this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n),()=>this.off(t,n)}once(t,n){const s=(...r)=>{this.off(t,s),n(...r)};return this.on(t,s)}off(t,n){const s=this.listeners[t];if(!s)return;const r=s.indexOf(n);r>-1&&s.splice(r,1)}removeAllListeners(t){t?delete this.listeners[t]:this.listeners={}}emit(t,...n){const s=this.listeners[t];if(!s)return;const r=[...s];for(const i of r)try{i(...n)}catch(o){console.error(`Error in event listener for ${String(t)}:`,o)}}listenerCount(t){var n;return((n=this.listeners[t])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class qu{constructor(t){je(this,"plugins",new Map);je(this,"installedPlugins",new Set);je(this,"context");this.context={client:t,emit:t.emit.bind(t),on:t.on.bind(t),config:{}}}register(t){if(this.plugins.has(t.name))throw new Error(`Plugin '${t.name}' is already registered`);if(t.dependencies){for(const n of t.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${t.name}' depends on '${n}' which is not registered`)}this.plugins.set(t.name,t)}async install(t,n){const s=this.plugins.get(t);if(!s)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t))throw new Error(`Plugin '${t}' is already installed`);if(s.dependencies)for(const i of s.dependencies)this.installedPlugins.has(i)||await this.install(i);const r={...this.context,config:{...s.config,...n}};s.install&&await s.install(r),this.installedPlugins.add(t),this.setupPluginEvents(s,r)}async uninstall(t){var s;const n=this.plugins.get(t);if(!n)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t)){for(const[r,i]of this.plugins)if(this.installedPlugins.has(r)&&((s=i.dependencies)!=null&&s.includes(t)))throw new Error(`Cannot uninstall '${t}' because '${r}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(t)}}isInstalled(t){return this.installedPlugins.has(t)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(t){return this.plugins.get(t)}setupPluginEvents(t,n){t.onSessionStart&&n.on("session.started",s=>{t.onSessionStart(n,s.id)}),t.onSessionEnd&&n.on("session.ended",s=>{t.onSessionEnd(n,s.id)}),t.onAgentResponse&&n.on("agent.response",s=>{t.onAgentResponse(n,s)})}}function T2(e){return e}function pi(e,t,n){return{name:e,version:"1.0.0",description:`${t} modality plugin`,install:async s=>{n.onActivate&&await n.onActivate(s)},uninstall:async s=>{n.onDeactivate&&await n.onDeactivate(s)},onAgentResponse:n.onMessage}}const j2={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async e=>{console.log("Analytics plugin installed"),e.on("session.started",t=>{console.log("Analytics: Session started",t.id)}),e.on("session.ended",(t,n)=>{console.log("Analytics: Session ended",t.id,n)}),e.on("chat.message.sent",t=>{console.log("Analytics: User message sent",t.content.length)})}},P2={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async e=>{console.log("Debug plugin installed");const t=e.emit;e.emit=(n,...s)=>(console.log(`[Debug] Event: ${String(n)}`,s),t(n,...s))}},M2={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async e=>{console.log("Metrics plugin installed");const t=new Map;e.on("session.started",n=>{t.set(n.id,{startTime:Date.now(),events:[]})}),e.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},Ju=E.createContext(null);function Qu({config:e,children:t,autoConnect:n=!1}){const[s,r]=E.useState(null),[i,o]=E.useState(!1),[a,l]=E.useState(!1),[d,u]=E.useState(null),[h,m]=E.useState(null),[g,x]=E.useState("idle"),[p,v]=E.useState(null),[b,y]=E.useState([]),[w,S]=E.useState([]),[k,T]=E.useState([]);E.useEffect(()=>{const P=new es(e);return r(P),A(P),n&&j(P),()=>{P.disconnect().catch(console.error)}},[e,n]);const A=P=>{P.on("connection.connecting",()=>{l(!0),u(null)}),P.on("connection.connected",()=>{o(!0),l(!1),u(null)}),P.on("connection.disconnected",()=>{o(!1),l(!1),m(null),x("idle"),y([]),S([]),T([])}),P.on("connection.error",B=>{u(B),l(!1)}),P.on("session.created",B=>{m(B),x(B.state)}),P.on("session.state.changed",B=>{x(B),h&&m({...h,state:B})}),P.on("session.ended",(B,X)=>{m(null),x("idle"),v(X),y([]),S([]),T([])}),P.on("participant.joined",B=>{y(X=>[...X,B])}),P.on("participant.left",B=>{y(X=>X.filter(_=>_.id!==B.id))}),P.on("chat.message.received",B=>{S(X=>[...X,B])}),P.on("chat.message.sent",B=>{S(X=>[...X,B])}),P.on("transcription.received",B=>{T(X=>[...X,B])})},j=async P=>{const B=P||s;if(B)try{await B.connect()}catch(X){console.error("Failed to connect:",X)}},O={client:s,isConnected:i,isConnecting:a,connectionError:d,currentSession:h,sessionState:g,sessionMetrics:p,participants:b,chatMessages:w,transcriptions:k,connect:()=>j(),disconnect:async()=>{if(s)try{await s.disconnect()}catch(P){console.error("Failed to disconnect:",P)}},createSession:async(P,B={})=>{if(!s)throw new Error("Client not initialized");const X={agentId:P,participantName:B.participantName||"User",metadata:B.metadata,modalities:B.modalities||["voice"]};return await s.createSession(X)},endSession:async()=>s?await s.endSession():null,sendChatMessage:async P=>{if(!s)throw new Error("Client not initialized");await s.sendChatMessage(P)},setMicrophoneEnabled:async P=>{if(!s)throw new Error("Client not initialized");await s.setMicrophoneEnabled(P)},setCameraEnabled:async P=>{if(!s)throw new Error("Client not initialized");await s.setCameraEnabled(P)},startScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.startScreenShare()},stopScreenShare:async()=>{if(!s)throw new Error("Client not initialized");await s.stopScreenShare()}};return c.jsx(Ju.Provider,{value:O,children:t})}function ht(){const e=E.useContext(Ju);if(!e)throw new Error("useVoxket must be used within a VoxketProvider");return e}class N2 extends mi{constructor(n){super();je(this,"room",null);je(this,"registeredMethods",new Map);je(this,"activeInteractions",new Map);je(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,s,r="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const i={methodName:n,component:s,presentationMode:r};this.registeredMethods.set(n,i);try{this.room.registerRpcMethod(n,async o=>{console.log(`RpcManager: RPC method '${n}' called by ${o.callerIdentity}`),console.log("RpcManager: Payload:",o.payload),this.emit("rpc.method.called",{methodName:n,data:o});let a;console.log(`RpcManager: Current registration for '${n}':`,i);let l=o.responseTimeout||30;try{a=JSON.parse(o.payload)}catch{a=o.payload}try{const d=await this.awaitUserInteraction(n,s,r,a,l);return JSON.stringify(d)}catch(d){throw console.error(`RpcManager: Error in RPC method '${n}':`,d),d}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(o){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,o),o}}async awaitUserInteraction(n,s,r,i,o){return new Promise((a,l)=>{const d=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${o} seconds`);const u={didSuccess:(m,g)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,m),this.clearInteraction(d),this.currentInteraction=null;const x={success:!0,message:"User interaction completed successfully",data:m,timestamp:new Date,...g?{successView:g}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:x}),a(x)},didFail:m=>{console.log(`RpcManager: User interaction failed for method: ${n}`,m),this.clearInteraction(d);const g={success:!1,message:"User interaction failed",error:m,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:g}),a(g)},dismissView:()=>{var g;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(g=this.currentInteraction)==null?void 0:g.methodName),this.clearInteraction(d),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const m={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:m}),this.emit("rpc.interaction.completed",{methodName:n,response:m}),setTimeout(()=>{var x;((x=this.currentInteraction)==null?void 0:x.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(m)},didTimeout:m=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(d),this.currentInteraction=null;const g={success:!0,message:`User interaction timed out after ${o} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...m?{timeoutView:m}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:g}),setTimeout(()=>{var x;((x=this.currentInteraction)==null?void 0:x.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(g)}},h=setTimeout(()=>{u.didTimeout&&u.didTimeout()},o);this.activeInteractions.set(d,{resolve:m=>a(JSON.parse(m)),reject:l,timeoutId:h}),this.currentInteraction={isVisible:!0,methodName:n,component:s,presentationMode:r,timeout:o,data:i,handler:u},this.emit("rpc.interaction.started",{methodName:n,presentationMode:r}),setTimeout(async()=>{var m;if((m=this.currentInteraction)!=null&&m.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,i)}catch(g){console.error("RpcManager: Error loading data into component:",g),u.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const s=this.activeInteractions.get(n);s&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(s.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,s]of this.activeInteractions)clearTimeout(s.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}class pe extends Error{constructor(t,n,s){super(t),this.code=n,this.details=s,this.name="VoxketError"}}class es extends mi{constructor(n){super();je(this,"config");je(this,"room",null);je(this,"pluginManager");je(this,"rpcManager");je(this,"isConnected",!1);je(this,"currentSession",null);je(this,"connectionState",J.ConnectionState.Disconnected);je(this,"renderedComponents",new Map);je(this,"textStreamHandlersRegistered",!1);je(this,"currentAgentInfo",null);je(this,"chatMessages",[]);this.config=n,this.pluginManager=new qu(this),this.rpcManager=new N2,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,s;this.isConnected=!0,(s=(n=this.config).onConnected)==null||s.call(n)}),this.on("connection.disconnected",n=>{var s,r;this.isConnected=!1,(r=(s=this.config).onDisconnected)==null||r.call(s,n)}),this.on("connection.error",n=>{var s,r;(r=(s=this.config).onError)==null||r.call(s,n)}),this.on("chat.message.received",n=>{var s,r;this.addChatMessage(n),(r=(s=this.config).onMessageReceived)==null||r.call(s,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var s,r;(r=(s=this.config).onTranscriptionReceived)==null||r.call(s,n)}),this.on("session.state.changed",n=>{var s,r;(r=(s=this.config).onSessionStateChanged)==null||r.call(s,n)}),this.on("session.created",n=>{var s,r;(r=(s=this.config).onSessionStart)==null||r.call(s,n.id)}),this.on("session.ended",(n,s)=>{var r,i;(i=(r=this.config).onSessionEnd)==null||i.call(r,s)}),this.on("participant.joined",n=>{var s,r;(r=(s=this.config).onUserJoined)==null||r.call(s,n.id)}),this.on("participant.left",n=>{var s,r;(r=(s=this.config).onUserLeft)==null||r.call(s,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new J.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(J.RoomEvent.Connected,()=>{var n,s;this.connectionState=J.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(s=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&s.includes("voice")&&setTimeout(async()=>{var r;try{(r=this.room)!=null&&r.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(i){console.warn("VoxketClient: Failed to enable microphone after room connection:",i)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(J.RoomEvent.Disconnected,n=>{this.connectionState=J.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(J.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===J.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(J.RoomEvent.ParticipantConnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",s)}),this.room.on(J.RoomEvent.ParticipantDisconnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",s)}))}setupTextStreamHandlers(){if(this.room){try{this.room.registerTextStreamHandler("lk.chat",async(n,s)=>{try{const r=await n.readAll(),i={id:`msg_${Date.now()}_${s.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:r,timestamp:new Date,sender:{id:s.identity||"user",name:s.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",i)}catch(r){console.error("VoxketClient: Failed to process lk.chat message:",r)}})}catch(n){console.warn("VoxketClient: lk.chat handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("lk.transcription",async(n,s)=>{var r,i;try{const o=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let a="";const l=((r=this.currentAgentInfo)==null?void 0:r.name)||s.identity||"AI Assistant",d={id:o,content:"",timestamp:new Date,sender:{id:s.identity||"agent",name:l,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",d);for await(const m of n){a+=m;const g=this.convertMarkdownToText(a),x={...d,content:g,metadata:{...d.metadata,streaming:!0}};this.emit("chat.message.updated",x)}const u=this.convertMarkdownToText(a),h={...d,content:u,metadata:{...d.metadata,streaming:!1}};this.emit("chat.message.updated",h)}catch(o){console.error("VoxketClient: Failed to process lk.transcription message:",o);try{const a=await n.readAll(),l=((i=this.currentAgentInfo)==null?void 0:i.name)||s.identity||"AI Assistant",d={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:a,timestamp:new Date,sender:{id:s.identity||"agent",name:l,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",d)}catch(a){console.error("VoxketClient: Fallback failed for lk.transcription:",a)}}})}catch(n){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("suggested_response",async n=>{const s=await n.readAll();let r=[];try{r=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(i){console.warn("VoxketClient: Failed to parse suggested_response:",i,s)}this.emit("suggested.response",r)})}catch(n){console.warn("VoxketClient: suggested_response handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("agent_state_changed",async(n,s)=>{const r=await n.readAll();let i={};try{i=typeof r=="string"?JSON.parse(r.replace(/'/g,'"')):r}catch(o){console.warn("VoxketClient: Failed to parse agent_state_changed:",o,r)}i.new_state==="speaking"?this.emit("agent.speaking",i):i.new_state==="thinking"&&this.emit("agent.thinking",i)})}catch(n){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",n)}try{this.room.registerTextStreamHandler("images",async(n,s)=>{try{const r=await n.readAll()}catch(r){console.error("VoxketClient: Error processing images stream:",r)}})}catch(n){console.warn("VoxketClient: images handler already registered, skipping:",n)}try{this.room.registerByteStreamHandler("images",async(n,s)=>{var r,i;try{const o=n.info,a={id:`img_${Date.now()}_${s.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${o.name||"Image"}`,sender:{id:s.identity||"agent",name:s.identity||"Agent",type:s.identity===((i=(r=this.room)==null?void 0:r.localParticipant)==null?void 0:i.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.mimeType,streamId:o.id,downloading:!0}};this.emit("chat.message.received",a),n.onProgress&&(n.onProgress=m=>{const g={...a,metadata:{...a.metadata,downloadProgress:m||0}};this.emit("chat.message.updated",g)});const l=[];for await(const m of n)l.push(m);const d=new Blob(l,{type:o.mimeType||"application/octet-stream"}),u=URL.createObjectURL(d),h={...a,metadata:{...a.metadata,downloading:!1,downloadProgress:1,downloadUrl:u,blob:d}};this.emit("chat.message.updated",h)}catch(o){console.error("VoxketClient: Error processing image attachment:",o)}})}catch(n){console.warn("VoxketClient: image handler already registered, skipping:",n)}this.textStreamHandlersRegistered=!0}}async fetchConnectionDetails(n,s,r){const i=n||this.config.agentId||"default-agent",o=s||this.config.participantName||"User",a=r||this.config.modalities||["voice"];try{const l={agent_id:i,participant_name:o,participant_metadata:{user_id:""},modality:a[0]},d=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!d.ok){let m=`HTTP ${d.status}: Failed to fetch connection details`;try{const g=await d.json();g&&(g.error?m=`API Error: ${g.error}`:g.detail?m=`API Error: ${g.detail}`:g.message&&(m=`API Error: ${g.message}`))}catch{try{const x=await d.text();x&&(m=`API Error: ${x}`)}catch{}}throw new Error(m)}const u=await d.json();let h;return u.agent_info&&(h={id:u.agent_info.id||i,name:u.agent_info.name||"AI Assistant",avatar:u.agent_info.avatar,capabilities:u.agent_info.capabilities||["voice_interaction","text_chat"],metadata:u.agent_info.metadata||{}},this.currentAgentInfo=h),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:h}}catch(l){console.error("VoxketClient: fetchConnectionDetails failed:",l);const d=new pe(`Failed to fetch connection details: ${l instanceof Error?l.message:"Unknown error"}`,"CONNECTION_FAILED",l);throw this.emit("connection.error",d),d}}async connect(n,s,r){var i;try{this.emit("connection.connecting");const o=await this.fetchConnectionDetails(n,s,r);return await((i=this.room)==null?void 0:i.connect(o.serverUrl,o.participantToken)),this.isConnected=!0,o}catch(o){console.error("VoxketClient: Connection failed:",o);const a=new pe(`Failed to connect to Voxket services: ${o instanceof Error?o.message:"Unknown error"}`,"CONNECTION_FAILED",o);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new J.Room,this.setupRoomEventListeners()}catch(s){const r=new pe("Failed to disconnect properly","NETWORK_ERROR",s);throw this.emit("connection.error",r),r}}async createSession(n){var s,r;try{const i=await this.connect(n.agentId,n.participantName,n.modalities),o={id:i.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:i.agentInfo||this.currentAgentInfo};if(this.currentSession=o,this.emit("session.created",o),(s=n.modalities)!=null&&s.includes("voice"))try{await new Promise(a=>setTimeout(a,500)),(r=this.room)!=null&&r.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(a){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",a)}return setTimeout(()=>{this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state))},1e3),o}catch(i){throw console.error("VoxketClient: Failed to create session:",i),i instanceof pe?i:i instanceof TypeError&&i.message.includes("fetch")?new pe("Network connection failed","CONNECTION_FAILED",i):i instanceof Error&&i.message.includes("Failed to fetch connection details")?new pe(`API connection failed: ${i.message}`,"CONNECTION_FAILED",i):new pe(`Failed to create session: ${i instanceof Error?i.message:"Unknown error"}`,"SESSION_NOT_FOUND",i)}}async startSession(n,s){const r={agentId:n||this.config.agentId||"default-agent",participantName:(s==null?void 0:s.participantName)||this.config.participantName||"User",modalities:(s==null?void 0:s.modalities)||this.config.modalities||["voice","chat"],metadata:s==null?void 0:s.metadata};return this.createSession(r)}async endSession(){var n,s;if(!this.currentSession)return null;try{const r={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,r),await this.disconnect(),r}catch(r){throw new pe("Failed to end session","SESSION_NOT_FOUND",r)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(r=>r.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const s=this.chatMessages.findIndex(r=>r.id===n.id);s!==-1&&(this.chatMessages[s]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var l,d,u;const s=this.resolveTarget(n.target||"body"),r=this.getTargetKey(s),i=this.renderedComponents.get(r);i&&i.target===s||this.removeUI(s);const o=(i==null?void 0:i.root)||A2.createRoot(s),a={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((l=n.modality)==null?void 0:l.includes("chat"))!==!1,suportsVideoInput:((d=n.modality)==null?void 0:d.includes("video"))===!0,suportsScreenShare:((u=n.modality)==null?void 0:u.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};o.render(E.createElement(Qu,{config:this.config,autoConnect:n.autoStart||!1,children:E.createElement(ef,a)})),this.renderedComponents.set(r,{root:o,target:s})}removeUI(n){const s=n?this.resolveTarget(n):null;if(s){const r=this.getTargetKey(s),i=this.renderedComponents.get(r);i&&(i.root.unmount(),this.renderedComponents.delete(r),s.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(a=>{try{a.remove()}catch(l){console.warn("Failed to remove element:",l)}}),s===document.body&&s.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(l=>{if(l.classList.contains("bg-black")&&l.classList.contains("backdrop-blur-sm"))try{l.remove()}catch(d){console.warn("Failed to remove fixed element:",d)}}))}}removeAllUI(){for(const[n,s]of this.renderedComponents)s.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(s=>{if(s.classList.contains("bg-black")&&(s.classList.contains("backdrop-blur-sm")||s.classList.contains("bg-opacity-30")))try{s.remove()}catch(r){console.warn("Failed to remove overlay:",r)}})}resolveTarget(n){if(typeof n=="string"){const s=document.querySelector(n);if(!s)throw new Error(`Target element not found: ${n}`);return s}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,s){var r;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new pe("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new pe("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new pe("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const i={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:s||{}},o=await((r=this.room)==null?void 0:r.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",i)}catch(i){throw console.error("VoxketClient: Failed to send chat message:",i),new pe("Failed to send message","NETWORK_ERROR",i)}}async sendChatMessage(n,s){return this.sendMessage(n,s)}async sendAttachments(n,s){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new pe("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new pe("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new pe("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new pe("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const r=n.filter(i=>i.type.startsWith("image/"));if(r.length===0)throw new pe("Only image files are allowed","INVALID_PARAMETER");r.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const i=r.map(async(o,a)=>{const d={id:`att_${Date.now()}_${a}`,content:`📎 ${o.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...s,type:"attachment",fileName:o.name,fileSize:o.size,mimeType:o.type,uploading:!0}};this.emit("chat.message.sent",d);const u=await this.room.localParticipant.sendFile(o,{mimeType:o.type,topic:"images",onProgress:m=>{const g={...d,metadata:{...d.metadata,uploadProgress:m}};this.emit("chat.message.updated",g)}});try{const m=new FileReader,g=new Promise((v,b)=>{m.onload=()=>{typeof m.result=="string"?v(m.result):b(new Error("Failed to convert to base64"))},m.onerror=b});m.readAsDataURL(o);const p={type:"image",data:await g,filename:o.name,mimeType:o.type,size:o.size};await this.room.localParticipant.sendText(JSON.stringify(p),{topic:"images",destinationIdentities:[]})}catch(m){console.warn("VoxketClient: Failed to send image data to agent:",m);try{const g=`I've shared an image: ${o.name}`;await this.room.localParticipant.sendText(g,{topic:"lk.chat",destinationIdentities:[]})}catch(g){console.warn("VoxketClient: Failed to send image notification to agent:",g)}}const h={...d,metadata:{...d.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",h),u});await Promise.all(i)}catch(i){throw console.error("VoxketClient: Failed to send attachments:",i),new pe("Failed to send attachments","NETWORK_ERROR",i)}}async sendAttachment(n,s){return this.sendAttachments([n],s)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var s,r;try{const i=(s=this.room)==null?void 0:s.localParticipant.isMicrophoneEnabled,o=n??!i;await((r=this.room)==null?void 0:r.localParticipant.setMicrophoneEnabled(o)),o?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(i){throw console.error("VoxketClient: Failed to toggle microphone:",i),new pe("Failed to toggle microphone","PERMISSION_DENIED",i)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var s,r;try{const i=(s=this.room)==null?void 0:s.localParticipant.isCameraEnabled,o=n??!i;await((r=this.room)==null?void 0:r.localParticipant.setCameraEnabled(o)),o?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(i){throw console.error("VoxketClient: Failed to toggle camera:",i),new pe("Failed to toggle camera","PERMISSION_DENIED",i)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(s){throw new pe("Failed to start screen share","PERMISSION_DENIED",s)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(s){throw new pe("Failed to stop screen share","PERMISSION_DENIED",s)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="audioinput")}catch(n){throw new pe("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput")}catch(n){throw new pe("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new pe("Failed to set audio input device","DEVICE_ERROR",r)}}async setVideoInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new pe("Failed to set video input device","DEVICE_ERROR",r)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const s=n.permissions;if(!s)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const r=i=>!!s.canPublish&&(s.canPublishSources.length===0||s.canPublishSources.includes(i));return{camera:r(1),microphone:r(2),screenShare:r(3),data:s.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===J.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===J.Track.Source.Microphone)return s.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===J.Track.Source.Camera)return s.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===J.Track.Source.ScreenShare)return s.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(s=>{n.push({id:s.identity,name:s.name||s.identity,isLocal:!1})}),n}getSessionMetrics(){var n,s;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new pe("Failed to start recording","RECORDING_ERROR",s)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new pe("Failed to stop recording","RECORDING_ERROR",s)}}async registerFrontendRPC(n,s,r="embedded"){return this.rpcManager.registerFrontendRPC(n,s,r)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,s){return this.on(n,s)}registerEventEmitter(n,s){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async r=>{try{const i=await r.readAll();s(i)}catch(i){console.error(`Error processing event for topic '${n}':`,i)}})}catch(r){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,r)}}convertMarkdownToText(n){if(!n)return"";let s=n;return s=s.replace(/\*\*(.*?)\*\*/g,"$1"),s=s.replace(/__(.*?)__/g,"$1"),s=s.replace(/\*(.*?)\*/g,"$1"),s=s.replace(/_(.*?)_/g,"$1"),s=s.replace(/~~(.*?)~~/g,"$1"),s=s.replace(/`([^`]+)`/g,"$1"),s=s.replace(/```[\s\S]*?```/g,""),s=s.replace(/^#{1,6}\s+/gm,""),s=s.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),s.trim()}}const R2=ce.create(l2),V2=ce.create(y2),I2=ce.create(w2),D2=ce.create(E2);function L2({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:s}){const r={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},i=Ve(s);return c.jsx(ce.button,{onClick:e,className:`fixed ${r[n]} z-50 px-4 py-2 rounded-full shadow-lg ${i.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:t})}function Nl({children:e,theme:t,displayType:n="widget",onClose:s,popupPosition:r="bottom-right",onExpand:i}){const o=Ve(t);if(n==="fullscreen")return c.jsx("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",children:c.jsxs("div",{className:"w-full h-full max-w-6xl max-h-[90vh] rounded-2xl relative bg-transparent",children:[s&&c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),s()},className:"absolute top-4 cursor-pointer right-4 z-[100] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:c.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),c.jsxs("div",{id:"voice-card",className:`${o.card} w-full h-full flex flex-col rounded-xl shadow-2xl`,style:{minHeight:"600px"},children:[c.jsx("div",{className:o.cardTopGradient}),c.jsx("div",{className:o.cardPurpleBlur}),c.jsx("div",{className:o.cardPinkBlur}),c.jsx("div",{className:" flex flex-col h-full",children:e}),c.jsx("div",{className:o.cardPulse1}),c.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return c.jsx("div",{className:"fixed rounded-2xl inset-0 z-50 pointer-events-none",children:c.jsxs("div",{className:`fixed rounded-2xl ${a[r]} pointer-events-auto`,children:[s&&c.jsx("button",{onClick:s,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"×"}),c.jsxs("div",{id:"voice-card",className:`${o.card} rounded-2xl flex flex-col`,style:{width:"300px",height:"450px"},children:[c.jsx("div",{className:o.cardPurpleBlur}),c.jsx("div",{className:o.cardPinkBlur}),c.jsx("div",{className:" flex flex-col h-full",children:e}),c.jsx("div",{className:o.cardPulse1}),c.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return c.jsxs("div",{id:"voice-card",className:`${o.card}`,children:[i&&c.jsx("button",{onClick:i,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:c.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),c.jsx("div",{className:o.cardTopGradient}),c.jsx("div",{className:o.cardPurpleBlur}),c.jsx("div",{className:o.cardPinkBlur}),e,c.jsx("div",{className:o.cardPulse1}),c.jsx("div",{className:o.cardPulse2,style:{animationDelay:"1s"}})]})}function ef(e){if(typeof window>"u")return null;console.log("🎯 Widget component rendering with props:",{displayType:e.displayType,popupPosition:e.popupPosition,theme:e.theme});const{agentId:t,participantName:n,baseUrl:s,appSecret:r,appId:i,prompts:o,statusMessage:a,welcomeTitle:l,welcomeSubTitle:d,className:u,width:h,height:m,loadingText:g,suportsChatInput:x=!0,suportsVideoInput:p=!0,suportsScreenShare:v=!0,theme:b="vox",onSessionStart:y,onSessionEnd:w,enableSessionLogging:S=!0,onSessionLogsUpdate:k,onSessionMetricsUpdate:T,modalities:A=["voice"],displayType:j="widget",popupPosition:V="bottom-right",popupTriggerText:I="Open Chat",onPopupToggle:$,voxketClient:F,onDisplayTypeChange:se}=e,[Z,ee]=f.useState(()=>F?!!F.getCurrentSession():!1),[G,O]=f.useState(!1),[P,B]=f.useState(t||""),[X,_]=f.useState(n||"User"),[re,M]=f.useState(()=>F?F.getCurrentSession():null),[H,q]=f.useState(()=>{var ae,qe,$e;if(F){const xe=F.getCurrentSession();if((ae=xe==null?void 0:xe.activeModalities)!=null&&ae.includes("chat"))return"chat";if((qe=xe==null?void 0:xe.activeModalities)!=null&&qe.includes("voice"))return"voice";if(($e=xe==null?void 0:xe.activeModalities)!=null&&$e.includes("video"))return"video"}return"welcome"}),[U,N]=f.useState(!1);f.useEffect(()=>{console.log("🎯 Widget displayType prop changed to:",j)},[j]),f.useEffect(()=>{console.log("📊 Session state changed:",{currentMode:H,sessionStarted:Z,loading:G,currentSession:re==null?void 0:re.id,isPopupOpen:U})},[H,Z,G,re,U]);const L=f.useMemo(()=>{if(F)return console.log("🔄 Using passed VoxketClient to preserve session state"),F;console.log("🆕 Creating new VoxketClient instance");const ae={appId:i,appSecret:r,baseUrl:s,agentId:P,participantName:X||"User",modalities:A};return new es(ae)},[F,i,r,s,P,X,A]),W=A,D=f.useMemo(()=>L.getRoom()||new J.Room,[L]),ne={suportsChatInput:x,suportsVideoInput:p,suportsScreenShare:v},{sessionMetrics:te,sessionLogs:de,logEvent:me}=Xu({room:D,onSessionStart:y,onSessionEnd:w,enableConsoleLogging:S,enableLocalStorage:S,voxketSessionId:re==null?void 0:re.id});f.useEffect(()=>{k&&k(de)},[de,k]),f.useEffect(()=>{T&&te&&T(te)},[te,T]),f.useEffect(()=>{const ae=$e=>{console.log("🔴 Room disconnected:",$e),O(!1),ee(!1),M(null),q("welcome")},qe=$e=>{console.log("📹 Media devices error:",$e),cs({title:"Allow access to your microphone/camera",description:`${$e.name}: ${$e.message}`})};return D.on(J.RoomEvent.MediaDevicesError,qe),D.on(J.RoomEvent.Disconnected,ae),()=>{D.off(J.RoomEvent.Disconnected,ae),D.off(J.RoomEvent.MediaDevicesError,qe)}},[D]);const Ae=async()=>{try{console.log("🎤 Starting voice session...",{agentId:P,participantName:X}),console.log("🎤 Pre-start state:",{currentMode:H,sessionStarted:Z,loading:G}),O(!0),ee(!0),q("voice"),console.log("🎤 State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),me("USER_STARTED_VOICE_SESSION",{agentId:P,participantName:X});const ae=await L.startSession(P,{participantName:X||"User",modalities:["voice",...p?["video"]:[]]});console.log("✅ Voice session started successfully:",ae.id),M(ae),O(!1),y&&y(ae.id)}catch(ae){console.error("❌ Failed to start voice session:",ae),cs({title:"Failed to start voice session",description:ae instanceof Error?ae.message:"Unknown error occurred"}),O(!1),ee(!1),q("welcome")}},De=async()=>{try{O(!0),ee(!0),q("chat"),me("USER_STARTED_CHAT_SESSION",{agentId:P,participantName:X});const ae=await L.startSession(P,{participantName:X||"User",modalities:["chat"]});M(ae),O(!1),y&&y(ae.id)}catch(ae){console.error("Failed to start chat session:",ae),cs({title:"Failed to start chat session",description:ae instanceof Error?ae.message:"Unknown error occurred"}),O(!1),ee(!1),q("welcome")}},rt=async()=>{try{console.log("📺 Starting video session...",{agentId:P,participantName:X}),console.log("📺 Pre-start state:",{currentMode:H,sessionStarted:Z,loading:G}),O(!0),ee(!0),q("video"),console.log("📺 State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),me("USER_STARTED_VIDEO_SESSION",{agentId:P,participantName:X});const ae=await L.startSession(P,{participantName:X||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",ae.id),M(ae),O(!1),y&&y(ae.id)}catch(ae){console.error("❌ Failed to start video session:",ae),cs({title:"Failed to start video session",description:ae instanceof Error?ae.message:"Unknown error occurred"}),O(!1),ee(!1),q("welcome")}},ot=()=>{q("welcome"),se&&se(e.displayType||"widget"),re&&Z&&(ee(!1),M(null),L.disconnect()),j==="popup"&&!U&&N(!0)},Fe=()=>{const ae=!U;N(ae),$&&$(ae),!ae&&!(re&&Z)&&(q("welcome"),ee(!1),M(null))},Gs=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},Xs=()=>{e.onDisplayTypeChange&&e.onDisplayTypeChange("fullscreen")};f.useEffect(()=>{var ae,qe,$e;if(F&&L){console.log("🔄 Syncing widget state with existing client session state");const xe=L.getCurrentSession(),qs=L.connected;console.log("🔍 Existing session state:",{hasSession:!!xe,sessionId:xe==null?void 0:xe.id,isConnected:qs,activeModalities:xe==null?void 0:xe.activeModalities}),xe&&(console.log("✅ Restoring session state from existing client"),M(xe),ee(!0),O(!1),(ae=xe.activeModalities)!=null&&ae.includes("chat")?q("chat"):(qe=xe.activeModalities)!=null&&qe.includes("voice")?q("voice"):($e=xe.activeModalities)!=null&&$e.includes("video")&&q("video"))}},[F,L]),f.useEffect(()=>()=>{console.log("🧹 Cleaning up widget component"),F?console.log("🔄 Widget cleanup: preserving passed client instance"):(console.log("🧹 Widget cleanup: disconnecting self-created client"),L.disconnect())},[L,F]);let Rt="w-96",Tn="h-[25rem]",jn={};if(h&&(h.startsWith("w-")?Rt=h:(jn.width=h,Rt="")),m&&(m.startsWith("h-")?Tn=m:(jn.height=m,Tn="")),j==="popup"&&!U)return console.log("🟡 Showing popup trigger button"),c.jsx(L2,{onClick:Fe,text:I,position:V,theme:b});console.log("🟢 Rendering widget content, displayType:",j,"isPopupOpen:",U,"currentMode:",H,"sessionStarted:",Z,"loading:",G);let Yt=`voxket-widget-root theme-${b}`,Vt={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};j==="widget"?(Yt+=` flex items-center justify-center min-h-fit ${Rt} ${Tn} ${u}`,Vt={...Vt,...jn}):(Yt=`${u||""}`,Vt={});const Pn=c.jsx(c.Fragment,{children:c.jsxs(dn,{mode:"wait",children:[H==="welcome"&&!G&&c.jsx(D2,{agentId:P,participantName:X||"",onAgentIdChange:B,onParticipantNameChange:_,onStartCall:Ae,onStartChat:De,onStartVideo:rt,disabled:Z||G,prompts:o,statusMessage:a,title:l,subTitle:d,theme:b,modalities:W,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),H==="voice"&&c.jsxs(ke.RoomContext.Provider,{value:D,children:[c.jsx(ke.RoomAudioRenderer,{}),c.jsx(ke.StartAudio,{label:"Start Audio"}),c.jsx(R2,{loadingText:g,participantName:X||"User",capabilities:ne,sessionStarted:Z,disabled:!Z,theme:b,client:L,displayType:j,onBack:j==="popup"?Fe:ot,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),H==="chat"&&c.jsx(V2,{client:L,theme:b,displayType:j,onBack:j==="popup"?Fe:ot,onEndChat:ot,disabled:!Z,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),H==="video"&&c.jsxs(ke.RoomContext.Provider,{value:D,children:[c.jsx(ke.RoomAudioRenderer,{}),c.jsx(ke.StartAudio,{label:"Start Audio"}),c.jsx(I2,{client:L,theme:b,displayType:j,onBack:j==="popup"?Fe:ot,onEndCall:ot,disabled:!Z,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return j==="fullscreen"||j==="popup"?(console.log("📱 Rendering fullscreen/popup mode, displayType:",j),c.jsx(Nl,{theme:b,displayType:j,popupPosition:V,onClose:j==="fullscreen"?Gs:Fe,children:Pn})):(console.log("📦 Rendering widget mode"),c.jsx("div",{className:Yt,style:Vt,children:c.jsx(Nl,{theme:b,displayType:j,popupPosition:V,onExpand:Xs,children:Pn})}))}function F2({logs:e,onClear:t,onExport:n}){const[s,r]=E.useState(!1),[i,o]=E.useState(""),a=e.filter(l=>!i||l.event.toLowerCase().includes(i.toLowerCase()));return s?c.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:c.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[c.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"text",placeholder:"Filter events...",value:i,onChange:l=>o(l.target.value),className:"px-3 py-1 border rounded text-sm"}),c.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),c.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),c.jsx("button",{onClick:()=>r(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?c.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):c.jsx("div",{className:"space-y-2",children:a.map((l,d)=>c.jsxs("div",{className:"border rounded p-3 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"font-semibold text-blue-600",children:l.event}),c.jsx("span",{className:"text-gray-500 text-xs",children:new Date(l.timestamp).toLocaleTimeString()})]}),l.sessionId&&c.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",l.sessionId]}),l.data&&c.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:c.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(l.data,null,2)})})]},d))})})]})}):c.jsxs("button",{onClick:()=>r(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function O2({metrics:e}){return e?c.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[c.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Session ID:"}),c.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Start Time:"}),c.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Messages:"}),c.jsx("div",{children:e.totalMessages})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Participants:"}),c.jsx("div",{children:e.participantCount})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),c.jsx("div",{children:e.connectionIssues})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-gray-600",children:"Duration:"}),c.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}function Kt(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:s,endSession:r}=ht(),i=E.useCallback(async(a,l)=>await s(a,l),[s]),o=E.useCallback(async()=>await r(),[r]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:i,stop:o}}function tf(){const{sessionMetrics:e,currentSession:t}=ht();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function nf(){const{setMicrophoneEnabled:e,client:t}=ht(),[n,s]=E.useState(!1),[r,i]=E.useState(!1),o=E.useCallback(async()=>{if(!r){i(!0);try{const d=!n;await e(d),s(d)}catch(d){console.error("Failed to toggle microphone:",d)}finally{i(!1)}}},[n,r,e]),a=E.useCallback(async()=>{if(!(n||r)){i(!0);try{await e(!0),s(!0)}catch(d){console.error("Failed to enable microphone:",d)}finally{i(!1)}}},[n,r,e]),l=E.useCallback(async()=>{if(!(!n||r)){i(!0);try{await e(!1),s(!1)}catch(d){console.error("Failed to disable microphone:",d)}finally{i(!1)}}},[n,r,e]);return{isEnabled:n,isLoading:r,toggle:o,enable:a,disable:l}}function sf(){const{setCameraEnabled:e}=ht(),[t,n]=E.useState(!1),[s,r]=E.useState(!1),i=E.useCallback(async()=>{if(!s){r(!0);try{const l=!t;await e(l),n(l)}catch(l){console.error("Failed to toggle camera:",l)}finally{r(!1)}}},[t,s,e]),o=E.useCallback(async()=>{if(!(t||s)){r(!0);try{await e(!0),n(!0)}catch(l){console.error("Failed to enable camera:",l)}finally{r(!1)}}},[t,s,e]),a=E.useCallback(async()=>{if(!(!t||s)){r(!0);try{await e(!1),n(!1)}catch(l){console.error("Failed to disable camera:",l)}finally{r(!1)}}},[t,s,e]);return{isEnabled:t,isLoading:s,toggle:i,enable:o,disable:a}}function rf(){const{startScreenShare:e,stopScreenShare:t}=ht(),[n,s]=E.useState(!1),[r,i]=E.useState(!1),o=E.useCallback(async()=>{if(!(n||r)){i(!0);try{await e(),s(!0)}catch(d){console.error("Failed to start screen share:",d)}finally{i(!1)}}},[n,r,e]),a=E.useCallback(async()=>{if(!(!n||r)){i(!0);try{await t(),s(!1)}catch(d){console.error("Failed to stop screen share:",d)}finally{i(!1)}}},[n,r,t]),l=E.useCallback(async()=>{n?await a():await o()},[n,o,a]);return{isSharing:n,isLoading:r,start:o,stop:a,toggle:l}}function _2(){const{client:e}=ht(),[t,n]=E.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),s=E.useMemo(()=>t.tracks.find(p=>p.isLocal),[t.tracks]),r=E.useMemo(()=>t.tracks.filter(p=>!p.isLocal),[t.tracks]),i=E.useCallback(async()=>{try{s!=null&&s.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(p){throw console.error("Failed to toggle camera:",p),p}},[e,s]),o=E.useCallback(async()=>{try{t.tracks.find(v=>v.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(p){throw console.error("Failed to toggle screen share:",p),p}},[e,t.tracks]),a=E.useCallback(p=>{n(v=>({...v,layout:p}))},[]),l=E.useCallback(p=>{n(v=>({...v,pinnedTrack:p}))},[]),d=E.useCallback(()=>{n(p=>({...p,pinnedTrack:void 0}))},[]),u=E.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(p=>({...p,isRecording:!0}))}catch(p){throw console.error("Failed to start recording:",p),p}},[e]),h=E.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(p=>({...p,isRecording:!1}))}catch(p){throw console.error("Failed to stop recording:",p),p}},[e]),m=E.useCallback(p=>t.tracks.find(v=>v.id===p),[t.tracks]),g=E.useCallback(p=>t.tracks.filter(v=>v.participantId===p),[t.tracks]),x=E.useCallback(p=>p.isEnabled&&t.tracks.includes(p),[t.tracks]);return E.useEffect(()=>{if(!e)return;const p=y=>{n(w=>({...w,tracks:[...w.tracks.filter(S=>S.id!==y.id),y]}))},v=y=>{n(w=>{var S;return{...w,tracks:w.tracks.filter(k=>k.id!==y),pinnedTrack:((S=w.pinnedTrack)==null?void 0:S.id)===y?void 0:w.pinnedTrack}})},b=y=>{n(w=>({...w,tracks:w.tracks.map(S=>S.id===y.id?y:S)}))};return e.on("videoTrackAdded",p),e.on("videoTrackRemoved",v),e.on("videoTrackUpdated",b),()=>{e.off("videoTrackAdded",p),e.off("videoTrackRemoved",v),e.off("videoTrackUpdated",b)}},[e]),{tracks:t.tracks,localTrack:s,remoteTraracks:r,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:i,toggleScreenShare:o,setLayout:a,pinTrack:l,unpinTrack:d,startRecording:u,stopRecording:h,getTrackById:m,getTracksByParticipant:g,isTrackActive:x}}function Ys(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=ht(),[s,r]=E.useState(!1),i=E.useCallback(async d=>{if(!(!d.trim()||s||!n)){r(!0);try{await t(d.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{r(!1)}}},[t,s,n]),{userMessages:o,agentMessages:a,allMessages:l}=E.useMemo(()=>{const d=e.filter(h=>h.sender.type==="participant"),u=e.filter(h=>h.sender.type==="agent");return{userMessages:d,agentMessages:u,allMessages:e}},[e]);return{messages:l,userMessages:o,agentMessages:a,messageCount:l.length,isSending:s,canSend:!!n&&!s,send:i}}function $2(){const{send:e,isSending:t,canSend:n}=Ys(),[s,r]=E.useState(""),i=E.useCallback(async()=>{if(!(!s.trim()||!n))try{await e(s),r("")}catch(a){throw a}},[s,e,n]),o=E.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),i())},[i]);return{value:s,setValue:r,send:i,handleKeyPress:o,isSending:t,canSend:n&&s.trim().length>0}}function gi(){const{isConnected:e,isConnecting:t,connectionError:n,connect:s,disconnect:r}=ht(),i=E.useCallback(async()=>{if(!(e||t))try{await s()}catch(a){throw console.error("Failed to connect:",a),a}},[s,e,t]),o=E.useCallback(async()=>{if(e)try{await r()}catch(a){throw console.error("Failed to disconnect:",a),a}},[r,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:i,disconnect:o}}function of(){const{participants:e}=ht();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const af=E.createContext({}),ts=()=>E.useContext(af);function lf({children:e,...t}){return c.jsx(af.Provider,{value:t,children:e})}function Cs({name:e,children:t,fallback:n,className:s}){return c.jsx("div",{className:`voxket-slot voxket-slot--${e} ${s||""}`,children:t||n})}function cf(e,t={}){return Object.assign(e,t)}function df({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:s=!0,customControls:r,className:i=""}){const o=Kt(),a=nf(),l=sf(),d=rf(),u=ts(),h=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,o.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",i].filter(Boolean).join(" ");return!o.isActive&&!s?c.jsx("div",{className:h,children:c.jsx("div",{className:"voxket-controls-inactive",children:c.jsx("p",{children:"Controls available during active session"})})}):c.jsxs("div",{className:h,children:[s&&c.jsx("div",{className:"voxket-session-actions",children:o.isActive?c.jsx("button",{onClick:o.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):c.jsx(B2,{})}),o.isActive&&c.jsxs("div",{className:"voxket-media-controls",children:[e&&c.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[c.jsx("span",{className:"voxket-icon",children:"🎤"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),t&&c.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isEnabled?"voxket-button--active":""}`,title:l.isEnabled?"Stop camera":"Start camera",children:[c.jsx("span",{className:"voxket-icon",children:"📹"}),l.isLoading?"Loading...":l.isEnabled?"Stop Video":"Start Video"]}),n&&c.jsxs("button",{onClick:d.toggle,disabled:d.isLoading,className:`voxket-button voxket-button--media ${d.isSharing?"voxket-button--active":""}`,title:d.isSharing?"Stop screen share":"Start screen share",children:[c.jsx("span",{className:"voxket-icon",children:"🖥️"}),d.isLoading?"Loading...":d.isSharing?"Stop Share":"Share Screen"]})]}),r&&c.jsx("div",{className:"voxket-custom-controls",children:r})]})}function B2(){Kt();const[e,t]=E.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(s){console.error("Failed to start session:",s)}finally{t(!1)}};return c.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function xi({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:s=""}){const r=Kt(),i=gi(),o=ts(),a=["voxket-session-header",`voxket-session-header--${o.variant||"default"}`,`voxket-session-header--${o.size||"md"}`,s].filter(Boolean).join(" ");return c.jsxs("div",{className:a,children:[e&&c.jsxs("div",{className:"voxket-connection-status",children:[c.jsx("div",{className:`voxket-status-indicator ${i.isConnected?"connected":"disconnected"}`}),c.jsx("span",{className:"voxket-status-text",children:i.isConnecting?"Connecting...":i.isConnected?"Connected":"Disconnected"})]}),t&&r.session&&c.jsxs("div",{className:"voxket-session-info",children:[c.jsxs("div",{className:"voxket-session-id",children:["Session: ",r.session.id.slice(-8)]}),c.jsxs("div",{className:"voxket-session-state",children:["State: ",r.state]})]}),n&&r.session&&c.jsxs("div",{className:"voxket-agent-info",children:[c.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",r.session.agentId]}),c.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",r.session.activeModalities.join(", ")]})]}),i.error&&c.jsxs("div",{className:"voxket-error-message",children:["Error: ",i.error.message]})]})}function yi({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:s=""}){const r=Kt(),i=Ys(),o=ts(),a=["voxket-session-content",`voxket-session-content--${o.variant||"default"}`,`voxket-session-content--${o.size||"md"}`,s].filter(Boolean).join(" ");return r.isActive?c.jsx("div",{className:a,children:n||c.jsxs(c.Fragment,{children:[e&&c.jsxs("div",{className:"voxket-chat-container",children:[c.jsxs("div",{className:"voxket-chat-messages",children:[i.messages.map(l=>c.jsxs("div",{className:`voxket-message voxket-message--${l.sender.type}`,children:[c.jsxs("div",{className:"voxket-message-header",children:[c.jsx("span",{className:"voxket-message-sender",children:l.sender.name}),c.jsx("span",{className:"voxket-message-time",children:l.timestamp.toLocaleTimeString()})]}),c.jsx("div",{className:"voxket-message-content",children:l.content})]},l.id)),i.messages.length===0&&c.jsx("div",{className:"voxket-empty-messages",children:c.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),c.jsx(H2,{})]}),t&&c.jsx("div",{className:"voxket-transcriptions",children:c.jsx("div",{className:"voxket-transcription-placeholder",children:c.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):c.jsx("div",{className:a,children:c.jsx("div",{className:"voxket-inactive-state",children:c.jsxs("div",{className:"voxket-inactive-message",children:[c.jsx("h3",{children:"Start a conversation"}),c.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function H2(){const e=Ys(),[t,n]=E.useState(""),s=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(i){console.error("Failed to send message:",i)}},r=i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),s())};return c.jsxs("div",{className:"voxket-chat-input",children:[c.jsx("input",{type:"text",value:t,onChange:i=>n(i.target.value),onKeyPress:r,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),c.jsx("button",{onClick:s,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function vi({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:s,className:r=""}){const i=Kt(),o=tf(),a=of(),l=ts(),d=["voxket-session-footer",`voxket-session-footer--${l.variant||"default"}`,`voxket-session-footer--${l.size||"md"}`,r].filter(Boolean).join(" ");return i.isActive?c.jsx("div",{className:d,children:s||c.jsxs(c.Fragment,{children:[n&&c.jsxs("div",{className:"voxket-session-status",children:[c.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),c.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&o.metrics&&c.jsxs("div",{className:"voxket-session-metrics",children:[c.jsxs("div",{className:"voxket-metric",children:[c.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),c.jsx("span",{className:"voxket-metric-value",children:U2(o.duration||0)})]}),c.jsxs("div",{className:"voxket-metric",children:[c.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),c.jsx("span",{className:"voxket-metric-value",children:o.metrics.messageCount})]})]}),t&&c.jsxs("div",{className:"voxket-participants-info",children:[c.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&c.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(u=>c.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):c.jsx("div",{className:d,children:c.jsx("div",{className:"voxket-footer-inactive",children:c.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function U2(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function z2({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:s,onSessionEnd:r,variant:i="default",size:o="md",theme:a,className:l="",children:d}){var g;const u=Kt(),h=gi();E.useEffect(()=>{n&&e&&h.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,h.isConnected,u.isActive]),E.useEffect(()=>{var x;(x=u.session)!=null&&x.id&&s&&s(u.session.id)},[(g=u.session)==null?void 0:g.id,s]),E.useEffect(()=>()=>{u.isActive&&r&&u.stop().then(r).catch(console.error)},[]);const m=["voxket-session",`voxket-session--${i}`,`voxket-session--${o}`,u.isActive?"voxket-session--active":"voxket-session--inactive",l].filter(Boolean).join(" ");return c.jsx(lf,{variant:i,size:o,theme:a,className:l,children:c.jsx("div",{className:m,children:d||c.jsxs(c.Fragment,{children:[c.jsx(Cs,{name:"header",fallback:c.jsx(xi,{})}),c.jsx(Cs,{name:"content",fallback:c.jsx(yi,{})}),c.jsx(Cs,{name:"footer",fallback:c.jsx(vi,{})})]})})})}const uf=cf(z2,{Header:xi,Content:yi,Footer:vi,Controls:df}),Ht={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},go={...Ht,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},xo={...Ht,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},ff=E.createContext(null),hf=()=>{const e=E.useContext(ff);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function Z2({theme:e="default",themes:t={},children:n,cssVariables:s=!0,className:r=""}){const[i,o]=E.useState(()=>{const m={default:Ht,dark:go,enterprise:xo,...t};return typeof e=="string"?m[e]||Ht:e}),[a,l]=E.useState(()=>({default:Ht,dark:go,enterprise:xo,...t})),d=m=>{if(typeof m=="string"){const g=a[m];g&&o(g)}else o(m)},u=m=>{l(g=>({...g,[m.name]:m}))};E.useEffect(()=>{if(s&&typeof document<"u"){const m=document.documentElement;Object.entries(mf(i)).forEach(([g,x])=>{m.style.setProperty(`--voxket-${g}`,x)})}},[i,s]);const h={theme:i,setTheme:d,themes:a,registerTheme:u};return c.jsx(ff.Provider,{value:h,children:c.jsx("div",{className:`voxket-theme voxket-theme--${i.name} ${r}`,children:n})})}function mf(e){const t={},n=(s,r="")=>{for(const[i,o]of Object.entries(s)){const a=r?`${r}-${i}`:i;typeof o=="object"&&o!==null&&!Array.isArray(o)?n(o,a):t[a]=String(o)}};return n(e),t}function W2(e=Ht,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function K2(e){var n;const{theme:t}=hf();return((n=t.components)==null?void 0:n[e])||{}}const Y2=pi("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&G2(e),t.enableVoiceActivation&&X2(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&q2(e,t)}});function G2(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function X2(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function q2(e,t){console.log("Playing audio response:",t.content)}const J2=pi("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&Q2(),t.enableFileUpload&&ew(e),t.enableCustomComponents&&tw(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?nw(e,t):t.type==="text"&&n.enableRichText&&sw(e,t)}});function Q2(e){console.log("Rich text support enabled")}function ew(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function tw(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",rw),t.set("form",ow),t.set("card",iw),t.set("chart",aw)}function nw(e,t){const{componentType:n,props:s}=t.metadata;console.log("Rendering custom component:",n,s),e.emit("chat.component.render",{type:n,props:s,timestamp:new Date})}function sw(e,t){console.log("Processing rich text message:",t.content)}function rw(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function ow(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function iw(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function aw(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function Es({track:e,participantName:t,showControls:n=!0,showName:s=!0,showMuteIndicator:r=!0,isPinned:i=!1,className:o="",onClick:a,onPin:l,onUnpin:d}){const u=E.useRef(null),[h,m]=E.useState(!1);E.useEffect(()=>{if(!u.current||!e.isEnabled)return;const v=u.current;return v.srcObject=null,()=>{v.srcObject&&(v.srcObject=null)}},[e]);const g=()=>{a==null||a(e)},x=v=>{v.stopPropagation(),i?d==null||d(e):l==null||l(e)},p=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",i?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",h?"voxket-video-tile--hovered":"",o].filter(Boolean).join(" ");return c.jsxs("div",{className:p,onClick:g,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[c.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&c.jsxs("div",{className:"voxket-video-placeholder",children:[c.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"🖥️":"📹"}),c.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),c.jsxs("div",{className:"voxket-video-overlay",children:[s&&t&&c.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),r&&!e.isEnabled&&c.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(h||i)&&c.jsxs("div",{className:"voxket-video-controls",children:[c.jsx("button",{className:`voxket-video-control-btn ${i?"voxket-video-control-btn--active":""}`,onClick:x,title:i?"Unpin video":"Pin video",children:"📌"}),e.isScreenShare&&c.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),e.source&&c.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&c.jsx("div",{className:"voxket-video-loading",children:c.jsx("div",{className:"voxket-spinner"})})]})}function lw({tracks:e,layout:t,className:n="",onLayoutChange:s,onTrackClick:r,maxVisibleTracks:i=9,showPagination:o=!0}){const[a,l]=E.useState(0),[d,u]=E.useState(null),h=E.useMemo(()=>{let y=[...e];t.type==="speaker"&&d&&(y=[d,...e.filter(k=>k.id!==d.id)]);const w=a*i,S=w+i;return y.slice(w,S)},[e,t,d,a,i]),m=Math.ceil(e.length/i),g=E.useMemo(()=>{const y=h.length;switch(t.type){case"grid":const w=Math.ceil(Math.sqrt(y)),S=Math.ceil(y/w);return{display:"grid",gridTemplateColumns:`repeat(${w}, 1fr)`,gridTemplateRows:`repeat(${S}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,h.length]),x=y=>{u(y)},p=()=>{u(null)},v=y=>{s==null||s({...t,type:y})},b=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${h.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?c.jsx("div",{className:"voxket-video-grid-empty",children:c.jsxs("div",{className:"voxket-video-grid-empty-content",children:[c.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),c.jsx("p",{children:"No video tracks available"})]})}):c.jsxs("div",{className:b,children:[c.jsxs("div",{className:"voxket-video-grid-controls",children:[c.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(y=>c.jsx("button",{className:`voxket-layout-btn ${t.type===y?"voxket-layout-btn--active":""}`,onClick:()=>v(y),title:`Switch to ${y} layout`,children:cw(y)},y))}),c.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),c.jsx("div",{className:"voxket-video-grid-content",style:g,children:t.type==="speaker"&&d?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"voxket-video-speaker-main",children:c.jsx(Es,{track:d,participantName:`Participant ${d.participantId}`,isPinned:!0,onClick:r,onUnpin:p})}),c.jsx("div",{className:"voxket-video-speaker-sidebar",children:h.filter(y=>y.id!==d.id).map(y=>c.jsx(Es,{track:y,participantName:`Participant ${y.participantId}`,showControls:!1,onClick:r,onPin:x},y.id))})]}):h.map(y=>c.jsx(Es,{track:y,participantName:`Participant ${y.participantId}`,isPinned:(d==null?void 0:d.id)===y.id,onClick:r,onPin:x,onUnpin:p},y.id))}),o&&m>1&&c.jsxs("div",{className:"voxket-video-pagination",children:[c.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.max(0,a-1)),disabled:a===0,children:"←"}),c.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",m]}),c.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.min(m-1,a+1)),disabled:a===m-1,children:"→"})]})]})}function cw(e){switch(e){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function dw({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:s,showLayoutControls:r=!0,showCameraControls:i=!0,showScreenShareControls:o=!0,className:a=""}){const l=["voxket-video-controls",a].filter(Boolean).join(" "),d=u=>{s==null||s({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return c.jsxs("div",{className:l,children:[i&&c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),c.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[c.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"📹":"📷"}),c.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&c.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," × ",e.dimensions.height]})]}),o&&c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),c.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[c.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"🛑":"🖥️"}),c.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),r&&c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),c.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:u,icon:h,label:m})=>c.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>d(u),title:`Switch to ${m} layout`,children:[c.jsx("span",{className:"voxket-control-icon",children:h}),c.jsx("span",{className:"voxket-control-label",children:m})]},u))})]}),c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),c.jsxs("div",{className:"voxket-video-settings",children:[c.jsxs("div",{className:"voxket-setting-group",children:[c.jsx("label",{className:"voxket-setting-label",children:"Quality"}),c.jsxs("select",{className:"voxket-setting-select",children:[c.jsx("option",{value:"high",children:"High (720p)"}),c.jsx("option",{value:"medium",children:"Medium (480p)"}),c.jsx("option",{value:"low",children:"Low (240p)"})]})]}),c.jsxs("div",{className:"voxket-setting-group",children:[c.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),c.jsxs("select",{className:"voxket-setting-select",children:[c.jsx("option",{value:"30",children:"30 fps"}),c.jsx("option",{value:"15",children:"15 fps"}),c.jsx("option",{value:"10",children:"10 fps"})]})]}),c.jsxs("div",{className:"voxket-setting-group",children:[c.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),c.jsxs("select",{className:"voxket-setting-select",children:[c.jsx("option",{value:"unlimited",children:"Unlimited"}),c.jsx("option",{value:"1000",children:"1 Mbps"}),c.jsx("option",{value:"500",children:"500 Kbps"}),c.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),c.jsxs("div",{className:"voxket-video-controls-section",children:[c.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),c.jsxs("div",{className:"voxket-video-stats",children:[c.jsxs("div",{className:"voxket-stat-item",children:[c.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),c.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}×${e.dimensions.height}`:"N/A"})]}),c.jsxs("div",{className:"voxket-stat-item",children:[c.jsx("span",{className:"voxket-stat-label",children:"Source:"}),c.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),c.jsxs("div",{className:"voxket-stat-item",children:[c.jsx("span",{className:"voxket-stat-label",children:"Status:"}),c.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const pf=({handler:e,loadData:t,data:n,client:s,addLocalMessage:r})=>{const[i,o]=f.useState(null),[a,l]=f.useState(!0),[d,u]=f.useState(!1),[h]=f.useState(Date.now());f.useEffect(()=>{(async()=>{try{if(l(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const v={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};o(v),console.log("📋 AssignmentView: Assignment loaded from RPC data:",v)}}catch(v){console.error("📋 AssignmentView: Error loading assignment:",v),o({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{l(!1)}})()},[n,t]);const m=({message:p,assignment:v})=>{const b=p.toLowerCase().includes("declined"),y=b?"bg-red-50 border-red-200":"bg-green-50 border-green-200",w=b?"text-red-700":"text-green-700",S=b?"❌":"🎉";return c.jsxs("div",{className:`max-w-sm mx-auto ${y} border rounded-lg shadow p-3 flex flex-col items-center`,children:[c.jsx("div",{className:"text-2xl mb-2",children:S}),c.jsx("div",{className:`${w} font-semibold text-sm mb-1`,children:p}),c.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:v.title}),c.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},g=async()=>{if(!(!i||!e)){u(!0);try{const p={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",p),e.didSuccess(p,c.jsx(m,{message:"Assignment accepted!",assignment:i}))}catch(p){console.error("📋 AssignmentView: Error accepting assignment:",p),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},x=async()=>{if(!(!i||!e)){u(!0);try{const p={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",p),e.didSuccess(p,c.jsx(m,{message:"Assignment declined",assignment:i}))}catch(p){console.error("📋 AssignmentView: Error declining assignment:",p),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return a?c.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:c.jsxs("div",{className:"flex items-center justify-center py-4",children:[c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),c.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):i?c.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[c.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:c.jsx("div",{className:"flex items-center justify-between",children:c.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:i.title})})}),c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:c.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:i.description})}),c.jsx("div",{className:"mb-3",children:c.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[c.jsx("span",{className:"text-xs mr-1",children:"📅"}),c.jsxs("span",{children:["Est: ",i.estimated_time_of_completion]})]})}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:g,disabled:d,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?c.jsxs("span",{className:"flex items-center justify-center",children:[c.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),c.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),c.jsx("button",{onClick:x,disabled:d,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):c.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:c.jsxs("div",{className:"text-center py-4",children:[c.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),c.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function uw(){const[e,t]=f.useState(null),[n,s]=f.useState([]);f.useEffect(()=>{const a=new es({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(a),a.on("rpc.method.called",l=>{console.log("RPC Method Called:",l)}),a.on("rpc.interaction.completed",l=>{console.log("RPC Interaction Completed:",l)}),()=>{a.disconnect()}},[]);const r=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",pf,"embedded");const a=e.getRegisteredRpcMethods();s(a),console.log("✅ Assignment RPC registered successfully")}catch(a){console.error("❌ Failed to register assignment RPC:",a)}},i=async()=>{if(!e)return;const a=({handler:l,timeout:d})=>{const[u,h]=f.useState(""),m=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],g=p=>{h(p)},x=()=>{const p=m.find(v=>v.id===u);l==null||l.didSuccess({selectedProduct:u,productName:p==null?void 0:p.name,price:p==null?void 0:p.price,timestamp:new Date().toISOString()})};return c.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[c.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),c.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),c.jsx("div",{className:"space-y-3 mb-6",children:m.map(p=>c.jsx("div",{onClick:()=>g(p.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===p.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{children:[c.jsx("h4",{className:"font-medium",children:p.name}),c.jsx("p",{className:"text-gray-600 text-sm",children:p.price})]}),c.jsx("div",{className:`w-4 h-4 rounded-full ${u===p.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},p.id))}),c.jsxs("div",{className:"flex justify-end space-x-3",children:[c.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),c.jsx("button",{onClick:x,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),d&&c.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",d," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",a,"modal");const l=e.getRegisteredRpcMethods();s(l),console.log("✅ Product Recommendation RPC registered successfully")}catch(l){console.error("❌ Failed to register product recommendation RPC:",l)}},o=async()=>{if(!e)return;const a=({handler:l})=>{const[d,u]=f.useState(0),[h,m]=f.useState(""),g=()=>{l==null||l.didSuccess({rating:d,comment:h,timestamp:new Date().toISOString()})};return c.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[c.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),c.jsxs("div",{className:"mb-4",children:[c.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),c.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(x=>c.jsx("button",{onClick:()=>u(x),className:`text-2xl ${x<=d?"text-yellow-400":"text-gray-300"}`,children:"⭐"},x))})]}),c.jsxs("div",{className:"mb-4",children:[c.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),c.jsx("textarea",{value:h,onChange:x=>m(x.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),c.jsxs("div",{className:"flex justify-end space-x-2",children:[c.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),c.jsx("button",{onClick:g,disabled:d===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",a,"embedded");const l=e.getRegisteredRpcMethods();s(l),console.log("✅ Feedback RPC registered successfully")}catch(l){console.error("❌ Failed to register feedback RPC:",l)}};return c.jsxs("div",{className:"p-6",children:[c.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),c.jsxs("div",{className:"space-y-4 mb-6",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),c.jsxs("div",{className:"space-x-2",children:[c.jsx("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),c.jsx("button",{onClick:i,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),c.jsx("button",{onClick:o,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?c.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>c.jsx("li",{className:"text-gray-700",children:c.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):c.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),c.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[c.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),c.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[c.jsxs("li",{children:["Register RPC methods with React components using ",c.jsx("code",{children:"client.registerFrontendRPC()"})]}),c.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),c.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),c.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),c.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),c.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[c.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),c.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),c.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
|
|
699
207
|
const response = await participant.performRpc({
|
|
700
208
|
method: 'give_assignment',
|
|
701
209
|
data: JSON.stringify({
|
|
@@ -706,4 +214,4 @@ const response = await participant.performRpc({
|
|
|
706
214
|
})
|
|
707
215
|
});
|
|
708
216
|
|
|
709
|
-
console.log('User response:', response);`})]})]})}const
|
|
217
|
+
console.log('User response:', response);`})]})]})}const fw={async checkAvailableRpcs(e){const t=e.getRegisteredRpcMethods();return console.log("🔍 Agent: Available RPC methods:",t),t},async triggerAssignment(e,t){const n={title:"Complete Q4 Sales Analysis Report",description:"Please analyze the Q4 sales data and create a comprehensive report with insights, trends, and recommendations for the upcoming quarter. Include visualizations and executive summary.",estimated_time_of_completion:"2-3 hours"};try{console.log("🤖 Agent: Triggering give_assignment RPC with data:",n);const s=await e.localParticipant.performRpc(t,"give_assignment",JSON.stringify(n),{responseTimeout:12e4}),r=JSON.parse(s);return console.log("✅ Agent: Received user response:",r),await this.processAssignmentResponse(r),r}catch(s){throw console.error("❌ Agent: RPC failed:",s),s}},async processAssignmentResponse(e){console.log("🧠 Agent: Processing assignment response...");const t=e.status,n=e.assignmentId,s=e.timeSpent;return t==="accepted"?(console.log("🎉 Agent: User accepted the assignment!"),console.log(`� Assignment ID: ${n}`),console.log(`⏱️ Time to respond: ${s}ms`),console.log("💬 Agent: Sending follow-up:","Great! I've recorded that you've accepted the assignment. You'll receive the detailed requirements and access to the data shortly. Let me know if you need any clarification!")):t==="declined"?(console.log("❌ Agent: User declined the assignment"),console.log("💬 Agent: Sending follow-up:","No problem! Is there anything specific about this assignment that doesn't work for you? I can suggest alternatives or modify the requirements.")):t==="completed"&&(console.log("✅ Agent: User completed the assignment"),console.log("💬 Agent: Sending follow-up:","Excellent work! Could you please share the completed report? I'm excited to review your analysis and insights.")),{status:t,assignmentId:n,timeSpent:s,processed:!0,followupAction:t==="accepted"?"send_requirements":t==="declined"?"offer_alternatives":"request_deliverables"}},getAssignmentExamples(){return{marketing:{title:"Create Social Media Campaign",description:"Design and plan a social media campaign for our new product launch. Include content calendar, post designs, and engagement strategy.",estimated_time_of_completion:"4-5 hours"},technical:{title:"API Integration Documentation",description:"Create comprehensive documentation for our new API endpoints, including examples, error codes, and best practices for developers.",estimated_time_of_completion:"6-8 hours"},research:{title:"Market Research Analysis",description:"Research and analyze competitor pricing strategies in our target market. Provide recommendations for our pricing model.",estimated_time_of_completion:"3-4 hours"},quick:{title:"Customer Feedback Summary",description:"Review this week's customer feedback and create a summary of key themes and actionable insights.",estimated_time_of_completion:"30-45 minutes"}}}},hw=e=>typeof window>"u"?null:E.createElement(ef,e);exports.AssignmentView=pf;exports.CompoundProvider=lf;exports.InteractiveComponent=xn;exports.PluginManager=qu;exports.RpcExamples=uw;exports.SessionContainer=uf;exports.SessionContent=yi;exports.SessionControls=df;exports.SessionFooter=vi;exports.SessionHeader=xi;exports.SessionLogViewer=F2;exports.SessionMetricsComponent=O2;exports.Slot=Cs;exports.ThemeProvider=Z2;exports.VideoControls=dw;exports.VideoGrid=lw;exports.VideoTile=Es;exports.VoxketClient=es;exports.VoxketEventEmitter=mi;exports.VoxketProvider=Qu;exports.VoxketSDK=es;exports.VoxketSessionComponent=uf;exports.agentRpcExample=fw;exports.analyticsPlugin=j2;exports.chatModalityPlugin=J2;exports.createCustomTheme=W2;exports.createModalityPlugin=pi;exports.createPlugin=T2;exports.darkTheme=go;exports.debugPlugin=P2;exports.default=hw;exports.defaultTheme=Ht;exports.enterpriseTheme=xo;exports.flattenTheme=mf;exports.metricsPlugin=M2;exports.useComponentTheme=K2;exports.useCompoundContext=ts;exports.useSessionLogging=Xu;exports.useTheme=hf;exports.useVoxket=ht;exports.useVoxketCamera=sf;exports.useVoxketChat=Ys;exports.useVoxketChatInput=$2;exports.useVoxketConnection=gi;exports.useVoxketMetrics=tf;exports.useVoxketMicrophone=nf;exports.useVoxketParticipants=of;exports.useVoxketScreenShare=rf;exports.useVoxketSession=Kt;exports.useVoxketVideo=_2;exports.voiceModalityPlugin=Y2;exports.withCompoundComponent=cf;
|