obi-sdk 0.6.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/loader.d.ts +1 -0
- package/dist/modular/chunks/index-f31a59cc.js +6 -0
- package/dist/modular/chunks/index-f31a59cc.js.map +1 -0
- package/dist/modular/chunks/{obi-widget-94e8c026.js → obi-widget-6550377d.js} +342 -33
- package/dist/modular/chunks/obi-widget-6550377d.js.map +1 -0
- package/dist/modular/index.js +172 -126
- package/dist/modular/index.js.map +1 -1
- package/dist/modular/ui.js +10 -10
- package/dist/obi-sdk.standalone.iife.js +169 -45
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/react.es.js +2640 -2388
- package/dist/react.es.js.map +1 -1
- package/dist/react.umd.js +207 -83
- package/dist/react.umd.js.map +1 -1
- package/dist/sentry.d.ts +1 -1
- package/dist/ui/components/courses/course-modal.d.ts +1 -0
- package/dist/ui/components/obi-widget/obi-widget.d.ts +1 -0
- package/dist/ui/components/session-start-modal/session-start-modal.d.ts +4 -0
- package/package.json +4 -3
- package/dist/modular/chunks/index-d7a5d2f6.js +0 -6
- package/dist/modular/chunks/index-d7a5d2f6.js.map +0 -1
- package/dist/modular/chunks/obi-widget-94e8c026.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!(function(A){"use strict";const t="https://app.coragents.ai/api",e=/\{[^{}]+\}/g;function i(A,t,e){if(null==t)return"";if("object"==typeof t)throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${A}=${!0===e?.allowReserved?t:encodeURIComponent(t)}`}function n(A,t,e){if(!t||"object"!=typeof t)return"";const n=[],r={simple:",",label:".",matrix:";"}[e.style]||"&";if("deepObject"!==e.style&&!1===e.explode){for(const A in t)n.push(A,!0===e.allowReserved?t[A]:encodeURIComponent(t[A]));const i=n.join(",");switch(e.style){case"form":return`${A}=${i}`;case"label":return`.${i}`;case"matrix":return`;${A}=${i}`;default:return i}}for(const o in t){const r="deepObject"===e.style?`${A}[${o}]`:o;n.push(i(r,t[o],e))}const s=n.join(r);return"label"===e.style||"matrix"===e.style?`${r}${s}`:s}function r(A,t,e){if(!Array.isArray(t))return"";if(!1===e.explode){const i={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[e.style]||",",n=(!0===e.allowReserved?t:t.map((A=>encodeURIComponent(A)))).join(i);switch(e.style){case"simple":return n;case"label":return`.${n}`;case"matrix":return`;${A}=${n}`;default:return`${A}=${n}`}}const n={simple:",",label:".",matrix:";"}[e.style]||"&",r=[];for(const s of t)"simple"===e.style||"label"===e.style?r.push(!0===e.allowReserved?s:encodeURIComponent(s)):r.push(i(A,s,e));return"label"===e.style||"matrix"===e.style?`${n}${r.join(n)}`:r.join(n)}function s(A){return function(t){const e=[];if(t&&"object"==typeof t)for(const s in t){const o=t[s];if(null!=o)if(Array.isArray(o)){if(0===o.length)continue;e.push(r(s,o,{style:"form",explode:!0,...A?.array,allowReserved:A?.allowReserved||!1}))}else"object"!=typeof o?e.push(i(s,o,A)):e.push(n(s,o,{style:"deepObject",explode:!0,...A?.object,allowReserved:A?.allowReserved||!1}))}return e.join("&")}}function o(A){return A instanceof FormData?A:JSON.stringify(A)}function a(...A){const t=new Headers;for(const e of A){if(!e||"object"!=typeof e)continue;const A=e instanceof Headers?e.entries():Object.entries(e);for(const[e,i]of A)if(null===i)t.delete(e);else if(Array.isArray(i))for(const A of i)t.append(e,A);else void 0!==i&&t.set(e,i)}return t}function c(A){return A.endsWith("/")?A.substring(0,A.length-1):A}class u{constructor(A){this.client=(function(A){let{baseUrl:t="",Request:u=globalThis.Request,fetch:h=globalThis.fetch,querySerializer:l,bodySerializer:d,headers:B,...f}={...A};t=c(t);const w=[];async function g(A,g){const{baseUrl:p,fetch:v=h,Request:m=u,headers:Q,params:U={},parseAs:C="json",querySerializer:F,bodySerializer:y=d??o,body:b,...E}=g||{};p&&(t=c(p));let I="function"==typeof l?l:s(l);F&&(I="function"==typeof F?F:s({..."object"==typeof l?l:{},...F}));const H=void 0===b?void 0:y(b),k=void 0===H||H instanceof FormData?{}:{"Content-Type":"application/json"},T={redirect:"follow",...f,...E,body:H,headers:a(k,B,Q,U.header)};let S,O,K=new u((function(A,t){let s=`${t.baseUrl}${A}`;t.params?.path&&(s=(function(A,t){let s=A;for(const o of A.match(e)??[]){let A=o.substring(1,o.length-1),e=!1,a="simple";if(A.endsWith("*")&&(e=!0,A=A.substring(0,A.length-1)),A.startsWith(".")?(a="label",A=A.substring(1)):A.startsWith(";")&&(a="matrix",A=A.substring(1)),!t||void 0===t[A]||null===t[A])continue;const c=t[A];s=Array.isArray(c)?s.replace(o,r(A,c,{style:a,explode:e})):"object"!=typeof c?"matrix"!==a?s.replace(o,"label"===a?`.${encodeURIComponent(c)}`:encodeURIComponent(c)):s.replace(o,`;${i(A,c)}`):s.replace(o,n(A,c,{style:a,explode:e}))}return s})(s,t.params.path));let o=t.querySerializer(t.params.query??{});return o.startsWith("?")&&(o=o.substring(1)),o&&(s+=`?${o}`),s})(A,{baseUrl:t,params:U,querySerializer:I}),T);for(const t in E)t in K||(K[t]=E[t]);if(w.length){S=Math.random().toString(36).slice(2,11),O=Object.freeze({baseUrl:t,fetch:v,parseAs:C,querySerializer:I,bodySerializer:y});for(const t of w)if(t&&"object"==typeof t&&"function"==typeof t.onRequest){const e=await t.onRequest({request:K,schemaPath:A,params:U,options:O,id:S});if(e){if(!(e instanceof u))throw new Error("onRequest: must return new Request() when modifying the request");K=e}}}let D=await v(K);if(w.length)for(let t=w.length-1;t>=0;t--){const e=w[t];if(e&&"object"==typeof e&&"function"==typeof e.onResponse){const t=await e.onResponse({request:K,response:D,schemaPath:A,params:U,options:O,id:S});if(t){if(!(t instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");D=t}}}if(204===D.status||"0"===D.headers.get("Content-Length"))return D.ok?{data:{},response:D}:{error:{},response:D};if(D.ok)return"stream"===C?{data:D.body,response:D}:{data:await D[C](),response:D};let M=await D.text();try{M=JSON.parse(M)}catch{}return{error:M,response:D}}return{GET:(A,t)=>g(A,{...t,method:"GET"}),PUT:(A,t)=>g(A,{...t,method:"PUT"}),POST:(A,t)=>g(A,{...t,method:"POST"}),DELETE:(A,t)=>g(A,{...t,method:"DELETE"}),OPTIONS:(A,t)=>g(A,{...t,method:"OPTIONS"}),HEAD:(A,t)=>g(A,{...t,method:"HEAD"}),PATCH:(A,t)=>g(A,{...t,method:"PATCH"}),TRACE:(A,t)=>g(A,{...t,method:"TRACE"}),use(...A){for(const t of A)if(t){if("object"!=typeof t||!("onRequest"in t)&&!("onResponse"in t))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");w.push(t)}},eject(...A){for(const t of A){const A=w.indexOf(t);-1!==A&&w.splice(A,1)}}}})({baseUrl:A.baseUrl,headers:A.headers,fetch:A.fetch})}setAuthToken(A){this.client.use({onRequest:({request:t})=>(t.headers.set("Authorization",`Bearer ${A}`),t)})}setApiToken(A){this.client.use({onRequest:({request:t})=>(t.headers.set("Authorization",`Token ${A}`),t)})}async getAuthUrl(A){return await this.client.GET("/auth/{type}",{params:{path:{type:A}}})}async getConnectUrl(A){return await this.client.GET("/connect/{type}",{params:{path:{type:A}}})}async logout(){return await this.client.POST("/logout")}async getCurrentUser(){return await this.client.GET("/me")}async createPresignedUploadUrl(A){return await this.client.POST("/files",{body:A})}async createKnowledgeBlock(A){return await this.client.POST("/knowledge",{body:A})}async listOnboardees(){return await this.client.GET("/onboardees")}async getOnboardeeWhitelistedDomains(A){return await this.client.GET("/onboardees/{id}/whitelisted-domains",{params:{path:{id:A}}})}async listPlans(){return await this.client.GET("/plans")}async createPlan(A){return await this.client.POST("/plans",{body:A})}async getPlan(A){return await this.client.GET("/plans/{id}",{params:{path:{id:A}}})}async replacePlan(A,t){return await this.client.PUT("/plans/{id}",{params:{path:{id:A}},body:t})}async updatePlan(A,t){return await this.client.PATCH("/plans/{id}",{params:{path:{id:A}},body:t})}async listSessions(A){return await this.client.GET("/sessions",{params:{query:A?{token:A}:{}}})}async createSession(A){return await this.client.POST("/sessions",{body:A})}async getSession(A){return await this.client.GET("/sessions/{id}",{params:{path:{id:A}}})}async startSession(A,t){return await this.client.GET("/sessions/{id}/start-session",{params:{path:{id:A},query:t?{token:t}:{}}})}async getSessionRecording(A){return await this.client.GET("/sessions/{id}/recording",{params:{path:{id:A}}})}async getSessionProductUrl(A){return await this.client.GET("/sessions/{id}/product-url",{params:{path:{id:A}}})}async getJoinToken(A,{skipIntro:t}={}){return await this.client.GET("/join-token",{params:{query:{token:A,...t&&{skip_intro:"true"}}}})}getClient(){return this.client}}function h(A){return A&&A.A&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var l={exports:{}};!(function(A){var t=Object.prototype.hasOwnProperty,e="~";function i(){}function n(A,t,e){this.fn=A,this.context=t,this.once=e||!1}function r(A,t,i,r,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,r||A,s),a=e?e+t:t;return A.B[a]?A.B[a].fn?A.B[a]=[A.B[a],o]:A.B[a].push(o):(A.B[a]=o,A.U++),A}function s(A,t){0===--A.U?A.B=new i:delete A.B[t]}function o(){this.B=new i,this.U=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(e=!1)),o.prototype.eventNames=function(){var A,i,n=[];if(0===this.U)return n;for(i in A=this.B)t.call(A,i)&&n.push(e?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(A)):n},o.prototype.listeners=function(A){var t=e?e+A:A,i=this.B[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,r=i.length,s=new Array(r);n<r;n++)s[n]=i[n].fn;return s},o.prototype.listenerCount=function(A){var t=e?e+A:A,i=this.B[t];return i?i.fn?1:i.length:0},o.prototype.emit=function(A,t,i,n,r,s){var o=e?e+A:A;if(!this.B[o])return!1;var a,c,u=this.B[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(A,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,n),!0;case 5:return u.fn.call(u.context,t,i,n,r),!0;case 6:return u.fn.call(u.context,t,i,n,r,s),!0}for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var l,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(A,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,n);break;default:if(!a)for(l=1,a=new Array(h-1);l<h;l++)a[l-1]=arguments[l];u[c].fn.apply(u[c].context,a)}}return!0},o.prototype.on=function(A,t,e){return r(this,A,t,e,!1)},o.prototype.once=function(A,t,e){return r(this,A,t,e,!0)},o.prototype.removeListener=function(A,t,i,n){var r=e?e+A:A;if(!this.B[r])return this;if(!t)return s(this,r),this;var o=this.B[r];if(o.fn)o.fn!==t||n&&!o.once||i&&o.context!==i||s(this,r);else{for(var a=0,c=[],u=o.length;a<u;a++)(o[a].fn!==t||n&&!o[a].once||i&&o[a].context!==i)&&c.push(o[a]);c.length?this.B[r]=1===c.length?c[0]:c:s(this,r)}return this},o.prototype.removeAllListeners=function(A){var t;return A?(t=e?e+A:A,this.B[t]&&s(this,t)):(this.B=new i,this.U=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,A.exports=o})(l);const d=h(l.exports);function B(A,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(e){if("default"!==e&&!(e in A)){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(A,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})}}))})),Object.freeze(A)}var f=Object.defineProperty,w=(A,t,e)=>((A,t,e)=>t in A?f(A,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):A[t]=e)(A,"symbol"!=typeof t?t+"":t,e);let g=class{constructor(){w(this,"_locking"),w(this,"_locks"),this.F=Promise.resolve(),this.I=0}isLocked(){return this.I>0}lock(){let A;this.I+=1;const t=new Promise((t=>A=()=>{this.I-=1,t()})),e=this.F.then((()=>A));return this.F=this.F.then((()=>t)),e}};function p(A,t){if(!A)throw new Error(t)}function v(A){if("number"!=typeof A)throw new Error("invalid int 32: "+typeof A);if(!Number.isInteger(A)||A>2147483647||A<-2147483648)throw new Error("invalid int 32: "+A)}function m(A){if("number"!=typeof A)throw new Error("invalid uint 32: "+typeof A);if(!Number.isInteger(A)||A>4294967295||A<0)throw new Error("invalid uint 32: "+A)}function Q(A){if("number"!=typeof A)throw new Error("invalid float 32: "+typeof A);if(Number.isFinite(A)&&(A>34028234663852886e22||A<-34028234663852886e22))throw new Error("invalid float 32: "+A)}const U=Symbol("@bufbuild/protobuf/enum-type");function C(A,t,e,i){A[U]=F(t,e.map((t=>({no:t.no,name:t.name,localName:A[t.no]}))))}function F(A,t,e){const i=Object.create(null),n=Object.create(null),r=[];for(const s of t){const A=y(s);r.push(A),i[s.name]=A,n[s.no]=A}return{typeName:A,values:r,findName:A=>i[A],findNumber:A=>n[A]}}function y(A){return"localName"in A?A:Object.assign(Object.assign({},A),{localName:A.name})}class b{equals(A){return this.getType().runtime.util.equals(this.getType(),this,A)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(A,t){const e=this.getType().runtime.bin,i=e.makeReadOptions(t);return e.readMessage(this,i.readerFactory(A),A.byteLength,i),this}fromJson(A,t){const e=this.getType(),i=e.runtime.json,n=i.makeReadOptions(t);return i.readMessage(e,A,n,this),this}fromJsonString(A,t){let e;try{e=JSON.parse(A)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(e,t)}toBinary(A){const t=this.getType().runtime.bin,e=t.makeWriteOptions(A),i=e.writerFactory();return t.writeMessage(this,i,e),i.finish()}toJson(A){const t=this.getType().runtime.json,e=t.makeWriteOptions(A);return t.writeMessage(this,e)}toJsonString(A){var t;const e=this.toJson(A);return JSON.stringify(e,null,null!==(t=null==A?void 0:A.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function E(){let A=0,t=0;for(let i=0;i<28;i+=7){let e=this.buf[this.pos++];if(A|=(127&e)<<i,!(128&e))return this.assertBounds(),[A,t]}let e=this.buf[this.pos++];if(A|=(15&e)<<28,t=(112&e)>>4,!(128&e))return this.assertBounds(),[A,t];for(let i=3;i<=31;i+=7){let e=this.buf[this.pos++];if(t|=(127&e)<<i,!(128&e))return this.assertBounds(),[A,t]}throw new Error("invalid varint")}function I(A,t,e){for(let r=0;r<28;r+=7){const i=A>>>r,n=!(i>>>7==0&&0==t),s=255&(n?128|i:i);if(e.push(s),!n)return}const i=A>>>28&15|(7&t)<<4,n=!!(t>>3);if(e.push(255&(n?128|i:i)),n){for(let A=3;A<31;A+=7){const i=t>>>A,n=!(i>>>7==0),r=255&(n?128|i:i);if(e.push(r),!n)return}e.push(t>>>31&1)}}const H=4294967296;function k(A){const t="-"===A[0];t&&(A=A.slice(1));const e=1e6;let i=0,n=0;function r(t,r){const s=Number(A.slice(t,r));n*=e,i=i*e+s,i>=H&&(n+=i/H|0,i%=H)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),t?O(i,n):S(i,n)}function T(A,t){if(({lo:A,hi:t}=(function(A,t){return{lo:A>>>0,hi:t>>>0}})(A,t)),t<=2097151)return String(H*t+A);const e=16777215&(A>>>24|t<<8),i=t>>16&65535;let n=(16777215&A)+6777216*e+6710656*i,r=e+8147497*i,s=2*i;const o=1e7;return n>=o&&(r+=Math.floor(n/o),n%=o),r>=o&&(s+=Math.floor(r/o),r%=o),s.toString()+K(r)+K(n)}function S(A,t){return{lo:0|A,hi:0|t}}function O(A,t){return t=~t,A?A=1+~A:t+=1,S(A,t)}const K=A=>{const t=String(A);return"0000000".slice(t.length)+t};function D(A,t){if(A>=0){for(;A>127;)t.push(127&A|128),A>>>=7;t.push(A)}else{for(let e=0;e<9;e++)t.push(127&A|128),A>>=7;t.push(1)}}function M(){let A=this.buf[this.pos++],t=127&A;if(!(128&A))return this.assertBounds(),t;if(A=this.buf[this.pos++],t|=(127&A)<<7,!(128&A))return this.assertBounds(),t;if(A=this.buf[this.pos++],t|=(127&A)<<14,!(128&A))return this.assertBounds(),t;if(A=this.buf[this.pos++],t|=(127&A)<<21,!(128&A))return this.assertBounds(),t;A=this.buf[this.pos++],t|=(15&A)<<28;for(let e=5;128&A&&e<10;e++)A=this.buf[this.pos++];if(128&A)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const L=(function(){const A=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof A.getBigInt64&&"function"==typeof A.getBigUint64&&"function"==typeof A.setBigInt64&&"function"==typeof A.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),e=BigInt("9223372036854775807"),i=BigInt("0"),n=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(A){const i="bigint"==typeof A?A:BigInt(A);if(i>e||i<t)throw new Error("int64 invalid: ".concat(A));return i},uParse(A){const t="bigint"==typeof A?A:BigInt(A);if(t>n||t<i)throw new Error("uint64 invalid: ".concat(A));return t},enc(t){return A.setBigInt64(0,this.parse(t),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},uEnc(t){return A.setBigInt64(0,this.uParse(t),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},dec:(t,e)=>(A.setInt32(0,t,!0),A.setInt32(4,e,!0),A.getBigInt64(0,!0)),uDec:(t,e)=>(A.setInt32(0,t,!0),A.setInt32(4,e,!0),A.getBigUint64(0,!0))}}const t=A=>p(/^-?[0-9]+$/.test(A),"int64 invalid: ".concat(A)),e=A=>p(/^[0-9]+$/.test(A),"uint64 invalid: ".concat(A));return{zero:"0",supported:!1,parse:A=>("string"!=typeof A&&(A=A.toString()),t(A),A),uParse:A=>("string"!=typeof A&&(A=A.toString()),e(A),A),enc:A=>("string"!=typeof A&&(A=A.toString()),t(A),k(A)),uEnc:A=>("string"!=typeof A&&(A=A.toString()),e(A),k(A)),dec:(A,t)=>(function(A,t){let e=S(A,t);const i=2147483648&e.hi;i&&(e=O(e.lo,e.hi));const n=T(e.lo,e.hi);return i?"-"+n:n})(A,t),uDec:(A,t)=>T(A,t)}})();var x,_,R,N,j,G;function P(A,t,e){if(t===e)return!0;if(A==x.BYTES){if(!(t instanceof Uint8Array&&e instanceof Uint8Array))return!1;if(t.length!==e.length)return!1;for(let A=0;A<t.length;A++)if(t[A]!==e[A])return!1;return!0}switch(A){case x.UINT64:case x.FIXED64:case x.INT64:case x.SFIXED64:case x.SINT64:return t==e}return!1}function V(A,t){switch(A){case x.BOOL:return!1;case x.UINT64:case x.FIXED64:case x.INT64:case x.SFIXED64:case x.SINT64:return 0==t?L.zero:"0";case x.DOUBLE:case x.FLOAT:return 0;case x.BYTES:return new Uint8Array(0);case x.STRING:return"";default:return 0}}function J(A,t){switch(A){case x.BOOL:return!1===t;case x.STRING:return""===t;case x.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(_=x||(x={}))[_.DOUBLE=1]="DOUBLE",_[_.FLOAT=2]="FLOAT",_[_.INT64=3]="INT64",_[_.UINT64=4]="UINT64",_[_.INT32=5]="INT32",_[_.FIXED64=6]="FIXED64",_[_.FIXED32=7]="FIXED32",_[_.BOOL=8]="BOOL",_[_.STRING=9]="STRING",_[_.BYTES=12]="BYTES",_[_.UINT32=13]="UINT32",_[_.SFIXED32=15]="SFIXED32",_[_.SFIXED64=16]="SFIXED64",_[_.SINT32=17]="SINT32",_[_.SINT64=18]="SINT64",(N=R||(R={}))[N.BIGINT=0]="BIGINT",N[N.STRING=1]="STRING",(G=j||(j={}))[G.Varint=0]="Varint",G[G.Bit64=1]="Bit64",G[G.LengthDelimited=2]="LengthDelimited",G[G.StartGroup=3]="StartGroup",G[G.EndGroup=4]="EndGroup",G[G.Bit32=5]="Bit32";class X{constructor(A){this.stack=[],this.textEncoder=null!=A?A:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let A=0;for(let i=0;i<this.chunks.length;i++)A+=this.chunks[i].length;let t=new Uint8Array(A),e=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],e),e+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let A=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(A.byteLength),this.raw(A)}tag(A,t){return this.uint32((A<<3|t)>>>0)}raw(A){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(A),this}uint32(A){for(m(A);A>127;)this.buf.push(127&A|128),A>>>=7;return this.buf.push(A),this}int32(A){return v(A),D(A,this.buf),this}bool(A){return this.buf.push(A?1:0),this}bytes(A){return this.uint32(A.byteLength),this.raw(A)}string(A){let t=this.textEncoder.encode(A);return this.uint32(t.byteLength),this.raw(t)}float(A){Q(A);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,A,!0),this.raw(t)}double(A){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,A,!0),this.raw(t)}fixed32(A){m(A);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,A,!0),this.raw(t)}sfixed32(A){v(A);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,A,!0),this.raw(t)}sint32(A){return v(A),D(A=(A<<1^A>>31)>>>0,this.buf),this}sfixed64(A){let t=new Uint8Array(8),e=new DataView(t.buffer),i=L.enc(A);return e.setInt32(0,i.lo,!0),e.setInt32(4,i.hi,!0),this.raw(t)}fixed64(A){let t=new Uint8Array(8),e=new DataView(t.buffer),i=L.uEnc(A);return e.setInt32(0,i.lo,!0),e.setInt32(4,i.hi,!0),this.raw(t)}int64(A){let t=L.enc(A);return I(t.lo,t.hi,this.buf),this}sint64(A){let t=L.enc(A),e=t.hi>>31;return I(t.lo<<1^e,(t.hi<<1|t.lo>>>31)^e,this.buf),this}uint64(A){let t=L.uEnc(A);return I(t.lo,t.hi,this.buf),this}}class Y{constructor(A,t){this.varint64=E,this.uint32=M,this.buf=A,this.len=A.length,this.pos=0,this.view=new DataView(A.buffer,A.byteOffset,A.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let A=this.uint32(),t=A>>>3,e=7&A;if(t<=0||e<0||e>5)throw new Error("illegal tag: field no "+t+" wire type "+e);return[t,e]}skip(A,t){let e=this.pos;switch(A){case j.Varint:for(;128&this.buf[this.pos++];);break;case j.Bit64:this.pos+=4;case j.Bit32:this.pos+=4;break;case j.LengthDelimited:let e=this.uint32();this.pos+=e;break;case j.StartGroup:for(;;){const[A,e]=this.tag();if(e===j.EndGroup){if(void 0!==t&&A!==t)throw new Error("invalid end group tag");break}this.skip(e,A)}break;default:throw new Error("cant skip wire type "+A)}return this.assertBounds(),this.buf.subarray(e,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let A=this.uint32();return A>>>1^-(1&A)}int64(){return L.dec(...this.varint64())}uint64(){return L.uDec(...this.varint64())}sint64(){let[A,t]=this.varint64(),e=-(1&A);return A=(A>>>1|(1&t)<<31)^e,t=t>>>1^e,L.dec(A,t)}bool(){let[A,t]=this.varint64();return 0!==A||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return L.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return L.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 A=this.uint32(),t=this.pos;return this.pos+=A,this.assertBounds(),this.buf.subarray(t,t+A)}string(){return this.textDecoder.decode(this.bytes())}}function $(A){const t=A.field.localName,e=Object.create(null);return e[t]=(function(A){const t=A.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return V(t.T,t.L);case"message":const A=t.T,e=new A;return A.fieldWrapper?A.fieldWrapper.unwrapField(e):e;case"map":throw"map fields are not allowed to be extensions"}})(A),[e,()=>e[t]]}let W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Z=[];for(let OC=0;OC<W.length;OC++)Z[W[OC].charCodeAt(0)]=OC;Z["-".charCodeAt(0)]=W.indexOf("+"),Z["_".charCodeAt(0)]=W.indexOf("/");const q={dec(A){let t=3*A.length/4;"="==A[A.length-2]?t-=2:"="==A[A.length-1]&&(t-=1);let e,i=new Uint8Array(t),n=0,r=0,s=0;for(let o=0;o<A.length;o++){if(e=Z[A.charCodeAt(o)],void 0===e)switch(A[o]){case"=":r=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:s=e,r=1;break;case 1:i[n++]=s<<2|(48&e)>>4,s=e,r=2;break;case 2:i[n++]=(15&s)<<4|(60&e)>>2,s=e,r=3;break;case 3:i[n++]=(3&s)<<6|e,r=0}}if(1==r)throw Error("invalid base64 string.");return i.subarray(0,n)},enc(A){let t,e="",i=0,n=0;for(let r=0;r<A.length;r++)switch(t=A[r],i){case 0:e+=W[t>>2],n=(3&t)<<4,i=1;break;case 1:e+=W[n|t>>4],n=(15&t)<<2,i=2;break;case 2:e+=W[n|t>>6],e+=W[63&t],i=0}return i&&(e+=W[n],e+="=",1==i&&(e+="=")),e}};function z(A,t,e){eA(t,A);const i=t.runtime.bin.makeReadOptions(e),n=(function(A,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let e=A.length-1;e>=0;--e)if(A[e].no==t.no)return[A[e]];return[]}return A.filter((A=>A.no===t.no))})(A.getType().runtime.bin.listUnknownFields(A),t.field),[r,s]=$(t);for(const o of n)t.runtime.bin.readField(r,i.readerFactory(o.data),t.field,o.wireType,i);return s()}function AA(A,t,e,i){eA(t,A);const n=t.runtime.bin.makeReadOptions(i),r=t.runtime.bin.makeWriteOptions(i);if(tA(A,t)){const e=A.getType().runtime.bin.listUnknownFields(A).filter((A=>A.no!=t.field.no));A.getType().runtime.bin.discardUnknownFields(A);for(const t of e)A.getType().runtime.bin.onUnknownField(A,t.no,t.wireType,t.data)}const s=r.writerFactory();let o=t.field;o.opt||o.repeated||"enum"!=o.kind&&"scalar"!=o.kind||(o=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(o,e,s,r);const a=n.readerFactory(s.finish());for(;a.pos<a.len;){const[t,e]=a.tag(),i=a.skip(e,t);A.getType().runtime.bin.onUnknownField(A,t,e,i)}}function tA(A,t){const e=A.getType();return t.extendee.typeName===e.typeName&&!!e.runtime.bin.listUnknownFields(A).find((A=>A.no==t.field.no))}function eA(A,t){p(A.extendee.typeName==t.getType().typeName,"extension ".concat(A.typeName," can only be applied to message ").concat(A.extendee.typeName))}function iA(A,t){const e=A.localName;if(A.repeated)return t[e].length>0;if(A.oneof)return t[A.oneof.localName].case===e;switch(A.kind){case"enum":case"scalar":return A.opt||A.req?void 0!==t[e]:"enum"==A.kind?t[e]!==A.T.values[0].no:!J(A.T,t[e]);case"message":return void 0!==t[e];case"map":return Object.keys(t[e]).length>0}}function nA(A,t){const e=A.localName,i=!A.opt&&!A.req;if(A.repeated)t[e]=[];else if(A.oneof)t[A.oneof.localName]={case:void 0};else switch(A.kind){case"map":t[e]={};break;case"enum":t[e]=i?A.T.values[0].no:void 0;break;case"scalar":t[e]=i?V(A.T,A.L):void 0;break;case"message":t[e]=void 0}}function rA(A,t){if(null===A||"object"!=typeof A)return!1;if(!Object.getOwnPropertyNames(b.prototype).every((t=>t in A&&"function"==typeof A[t])))return!1;const e=A.getType();return null!==e&&"function"==typeof e&&"typeName"in e&&"string"==typeof e.typeName&&(void 0===t||e.typeName==t.typeName)}function sA(A,t){return rA(t)||!A.fieldWrapper?t:A.fieldWrapper.wrapField(t)}x.DOUBLE,x.FLOAT,x.INT64,x.UINT64,x.INT32,x.UINT32,x.BOOL,x.STRING,x.BYTES;const oA={ignoreUnknownFields:!1},aA={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},cA=Symbol(),uA=Symbol();function hA(A){if(null===A)return"null";switch(typeof A){case"object":return Array.isArray(A)?"array":"object";case"string":return A.length>100?"string":'"'.concat(A.split('"').join('\\"'),'"');default:return String(A)}}function lA(A,t,e,i,n){let r=e.localName;if(e.repeated){if(p("map"!=e.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t)));const o=A[r];for(const A of t){if(null===A)throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(A)));switch(e.kind){case"message":o.push(e.T.fromJson(A,i));break;case"enum":const t=fA(e.T,A,i.ignoreUnknownFields,!0);t!==uA&&o.push(t);break;case"scalar":try{o.push(BA(e.T,A,e.L,!0))}catch(s){let t="cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(A));throw s instanceof Error&&s.message.length>0&&(t+=": ".concat(s.message)),new Error(t)}}}}else if("map"==e.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t)));const o=A[r];for(const[A,r]of Object.entries(t)){if(null===r)throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: map value null"));let a;try{a=dA(e.K,A)}catch(s){let A="cannot decode map key for field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t));throw s instanceof Error&&s.message.length>0&&(A+=": ".concat(s.message)),new Error(A)}switch(e.V.kind){case"message":o[a]=e.V.T.fromJson(r,i);break;case"enum":const A=fA(e.V.T,r,i.ignoreUnknownFields,!0);A!==uA&&(o[a]=A);break;case"scalar":try{o[a]=BA(e.V.T,r,R.BIGINT,!0)}catch(s){let A="cannot decode map value for field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t));throw s instanceof Error&&s.message.length>0&&(A+=": ".concat(s.message)),new Error(A)}}}}else switch(e.oneof&&(A=A[e.oneof.localName]={case:r},r="value"),e.kind){case"message":const o=e.T;if(null===t&&"google.protobuf.Value"!=o.typeName)return;let a=A[r];rA(a)?a.fromJson(t,i):(A[r]=a=o.fromJson(t,i),o.fieldWrapper&&!e.oneof&&(A[r]=o.fieldWrapper.unwrapField(a)));break;case"enum":const c=fA(e.T,t,i.ignoreUnknownFields,!1);switch(c){case cA:nA(e,A);break;case uA:break;default:A[r]=c}break;case"scalar":try{const i=BA(e.T,t,e.L,!1);i===cA?nA(e,A):A[r]=i}catch(s){let A="cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t));throw s instanceof Error&&s.message.length>0&&(A+=": ".concat(s.message)),new Error(A)}}}function dA(A,t){if(A===x.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return BA(A,t,R.BIGINT,!0).toString()}function BA(A,t,e,i){if(null===t)return i?V(A,e):cA;switch(A){case x.DOUBLE:case x.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const i=Number(t);if(Number.isNaN(i))break;if(!Number.isFinite(i))break;return A==x.FLOAT&&Q(i),i;case x.INT32:case x.FIXED32:case x.SFIXED32:case x.SINT32:case x.UINT32:let r;if("number"==typeof t?r=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(r=Number(t)),void 0===r)break;return A==x.UINT32||A==x.FIXED32?m(r):v(r),r;case x.INT64:case x.SFIXED64:case x.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const s=L.parse(t);return e?s.toString():s;case x.FIXED64:case x.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const o=L.uParse(t);return e?o.toString():o;case x.BOOL:if("boolean"!=typeof t)break;return t;case x.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(n){throw new Error("invalid UTF8")}return t;case x.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return q.dec(t)}throw new Error}function fA(A,t,e,i){if(null===t)return"google.protobuf.NullValue"==A.typeName?0:i?A.values[0].no:cA;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const i=A.findName(t);if(void 0!==i)return i.no;if(e)return uA}throw new Error("cannot decode enum ".concat(A.typeName," from JSON: ").concat(hA(t)))}function wA(A){return!(!A.repeated&&"map"!=A.kind&&(A.oneof||"message"==A.kind||A.opt||A.req))}function gA(A,t,e){if("map"==A.kind){p("object"==typeof t&&null!=t);const i={},n=Object.entries(t);switch(A.V.kind){case"scalar":for(const[e,r]of n)i[e.toString()]=vA(A.V.T,r);break;case"message":for(const[A,r]of n)i[A.toString()]=r.toJson(e);break;case"enum":const t=A.V.T;for(const[A,r]of n)i[A.toString()]=pA(t,r,e.enumAsInteger)}return e.emitDefaultValues||n.length>0?i:void 0}if(A.repeated){p(Array.isArray(t));const i=[];switch(A.kind){case"scalar":for(let e=0;e<t.length;e++)i.push(vA(A.T,t[e]));break;case"enum":for(let n=0;n<t.length;n++)i.push(pA(A.T,t[n],e.enumAsInteger));break;case"message":for(let A=0;A<t.length;A++)i.push(t[A].toJson(e))}return e.emitDefaultValues||i.length>0?i:void 0}switch(A.kind){case"scalar":return vA(A.T,t);case"enum":return pA(A.T,t,e.enumAsInteger);case"message":return sA(A.T,t).toJson(e)}}function pA(A,t,e){var i;if(p("number"==typeof t),"google.protobuf.NullValue"==A.typeName)return null;if(e)return t;const n=A.findNumber(t);return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:t}function vA(A,t){switch(A){case x.INT32:case x.SFIXED32:case x.SINT32:case x.FIXED32:case x.UINT32:return p("number"==typeof t),t;case x.FLOAT:case x.DOUBLE:return p("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case x.STRING:return p("string"==typeof t),t;case x.BOOL:return p("boolean"==typeof t),t;case x.UINT64:case x.FIXED64:case x.INT64:case x.SFIXED64:case x.SINT64:return p("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case x.BYTES:return p(t instanceof Uint8Array),q.enc(t)}}const mA=Symbol("@bufbuild/protobuf/unknown-fields"),QA={readUnknownFields:!0,readerFactory:A=>new Y(A)},UA={writeUnknownFields:!0,writerFactory:()=>new X};function CA(A,t,e,i,n){let{repeated:r,localName:s}=e;switch(e.oneof&&((A=A[e.oneof.localName]).case!=s&&delete A.value,A.case=s,s="value"),e.kind){case"scalar":case"enum":const o="enum"==e.kind?x.INT32:e.T;let a=bA;if("scalar"==e.kind&&e.L>0&&(a=yA),r){let e=A[s];if(i==j.LengthDelimited&&o!=x.STRING&&o!=x.BYTES){let A=t.uint32()+t.pos;for(;t.pos<A;)e.push(a(t,o))}else e.push(a(t,o))}else A[s]=a(t,o);break;case"message":const c=e.T;r?A[s].push(FA(t,new c,n,e)):rA(A[s])?FA(t,A[s],n,e):(A[s]=FA(t,new c,n,e),!c.fieldWrapper||e.oneof||e.repeated||(A[s]=c.fieldWrapper.unwrapField(A[s])));break;case"map":let[u,h]=(function(A,t,e){const i=t.uint32(),n=t.pos+i;let r,s;for(;t.pos<n;){const[i]=t.tag();switch(i){case 1:r=bA(t,A.K);break;case 2:switch(A.V.kind){case"scalar":s=bA(t,A.V.T);break;case"enum":s=t.int32();break;case"message":s=FA(t,new A.V.T,e,void 0)}}}if(void 0===r&&(r=V(A.K,R.BIGINT)),"string"!=typeof r&&"number"!=typeof r&&(r=r.toString()),void 0===s)switch(A.V.kind){case"scalar":s=V(A.V.T,R.BIGINT);break;case"enum":s=A.V.T.values[0].no;break;case"message":s=new A.V.T}return[r,s]})(e,t,n);A[s][u]=h}}function FA(A,t,e,i){const n=t.getType().runtime.bin,r=null==i?void 0:i.delimited;return n.readMessage(t,A,r?i.no:A.uint32(),e,r),t}function yA(A,t){const e=bA(A,t);return"bigint"==typeof e?e.toString():e}function bA(A,t){switch(t){case x.STRING:return A.string();case x.BOOL:return A.bool();case x.DOUBLE:return A.double();case x.FLOAT:return A.float();case x.INT32:return A.int32();case x.INT64:return A.int64();case x.UINT64:return A.uint64();case x.FIXED64:return A.fixed64();case x.BYTES:return A.bytes();case x.FIXED32:return A.fixed32();case x.SFIXED32:return A.sfixed32();case x.SFIXED64:return A.sfixed64();case x.SINT64:return A.sint64();case x.UINT32:return A.uint32();case x.SINT32:return A.sint32()}}function EA(A,t,e,i){p(void 0!==t);const n=A.repeated;switch(A.kind){case"scalar":case"enum":let r="enum"==A.kind?x.INT32:A.T;if(n)if(p(Array.isArray(t)),A.packed)!(function(A,t,e,i){if(!i.length)return;A.tag(e,j.LengthDelimited).fork();let[,n]=TA(t);for(let r=0;r<i.length;r++)A[n](i[r]);A.join()})(e,r,A.no,t);else for(const i of t)kA(e,r,A.no,i);else kA(e,r,A.no,t);break;case"message":if(n){p(Array.isArray(t));for(const n of t)HA(e,i,A,n)}else HA(e,i,A,t);break;case"map":p("object"==typeof t&&null!=t);for(const[n,s]of Object.entries(t))IA(e,i,A,n,s)}}function IA(A,t,e,i,n){A.tag(e.no,j.LengthDelimited),A.fork();let r=i;switch(e.K){case x.INT32:case x.FIXED32:case x.UINT32:case x.SFIXED32:case x.SINT32:r=Number.parseInt(i);break;case x.BOOL:p("true"==i||"false"==i),r="true"==i}switch(kA(A,e.K,1,r),e.V.kind){case"scalar":kA(A,e.V.T,2,n);break;case"enum":kA(A,x.INT32,2,n);break;case"message":p(void 0!==n),A.tag(2,j.LengthDelimited).bytes(n.toBinary(t))}A.join()}function HA(A,t,e,i){const n=sA(e.T,i);e.delimited?A.tag(e.no,j.StartGroup).raw(n.toBinary(t)).tag(e.no,j.EndGroup):A.tag(e.no,j.LengthDelimited).bytes(n.toBinary(t))}function kA(A,t,e,i){p(void 0!==i);let[n,r]=TA(t);A.tag(e,n)[r](i)}function TA(A){let t=j.Varint;switch(A){case x.BYTES:case x.STRING:t=j.LengthDelimited;break;case x.DOUBLE:case x.FIXED64:case x.SFIXED64:t=j.Bit64;break;case x.FIXED32:case x.SFIXED32:case x.FLOAT:t=j.Bit32}return[t,x[A].toLowerCase()]}function SA(A){if(void 0===A)return A;if(rA(A))return A.clone();if(A instanceof Uint8Array){const t=new Uint8Array(A.byteLength);return t.set(A),t}return A}function OA(A){return A instanceof Uint8Array?A:new Uint8Array(A)}class KA{constructor(A,t){this.H=A,this.S=t}findJsonName(A){if(!this.jsonNames){const A={};for(const t of this.list())A[t.jsonName]=A[t.name]=t;this.jsonNames=A}return this.jsonNames[A]}find(A){if(!this.numbers){const A={};for(const t of this.list())A[t.no]=t;this.numbers=A}return this.numbers[A]}list(){return this.all||(this.all=this.S(this.H)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort(((A,t)=>A.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const A=this.members;let t;for(const e of this.list())e.oneof?e.oneof!==t&&(t=e.oneof,A.push(t)):A.push(e)}return this.members}}function DA(A,t){const e=LA(A);return t?e:jA(NA(e))}const MA=LA;function LA(A){let t=!1;const e=[];for(let i=0;i<A.length;i++){let n=A.charAt(i);switch(n){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":e.push(n),t=!1;break;default:t&&(t=!1,n=n.toUpperCase()),e.push(n)}}return e.join("")}const xA=new Set(["constructor","toString","toJSON","valueOf"]),_A=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),RA=A=>"".concat(A,"$"),NA=A=>_A.has(A)?RA(A):A,jA=A=>xA.has(A)?RA(A):A;class GA{constructor(A){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=A,this.localName=DA(A,!1)}addField(A){p(A.oneof===this,"field ".concat(A.name," not one of ").concat(this.name)),this.fields.push(A)}findField(A){if(!this.D){this.D=Object.create(null);for(let A=0;A<this.fields.length;A++)this.D[this.fields[A].localName]=this.fields[A]}return this.D[A]}}const PA=(VA=A=>new KA(A,(A=>(function(A){var t,e,i,n,r,s;const o=[];let a;for(const c of"function"==typeof A?A():A){const A=c;if(A.localName=DA(c.name,void 0!==c.oneof),A.jsonName=null!==(t=c.jsonName)&&void 0!==t?t:MA(c.name),A.repeated=null!==(e=c.repeated)&&void 0!==e&&e,"scalar"==c.kind&&(A.L=null!==(i=c.L)&&void 0!==i?i:R.BIGINT),A.delimited=null!==(n=c.delimited)&&void 0!==n&&n,A.req=null!==(r=c.req)&&void 0!==r&&r,A.opt=null!==(s=c.opt)&&void 0!==s&&s,void 0===c.packed&&(A.packed="enum"==c.kind||"scalar"==c.kind&&c.T!=x.BYTES&&c.T!=x.STRING),void 0!==c.oneof){const t="string"==typeof c.oneof?c.oneof:c.oneof.name;a&&a.name==t||(a=new GA(t)),A.oneof=a,a.addField(A)}o.push(A)}return o})(A))),JA=A=>{for(const t of A.getType().fields.byMember()){if(t.opt)continue;const e=t.localName,i=A;if(t.repeated)i[e]=[];else switch(t.kind){case"oneof":i[e]={case:void 0};break;case"enum":i[e]=0;break;case"map":i[e]={};break;case"scalar":i[e]=V(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:function(A){return A?Object.assign(Object.assign({},oA),A):oA},makeWriteOptions:function(A){return A?Object.assign(Object.assign({},aA),A):aA},readMessage(A,t,e,i){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(A.typeName," from JSON: ").concat(hA(t)));i=null!=i?i:new A;const n=new Map,r=e.typeRegistry;for(const[s,o]of Object.entries(t)){const t=A.fields.findJsonName(s);if(t){if(t.oneof){if(null===o&&"scalar"==t.kind)continue;const e=n.get(t.oneof);if(void 0!==e)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(e,'", "').concat(s,'"'));n.set(t.oneof,s)}lA(i,o,t,e,A)}else{let t=!1;if((null==r?void 0:r.findExtension)&&s.startsWith("[")&&s.endsWith("]")){const n=r.findExtension(s.substring(1,s.length-1));if(n&&n.extendee.typeName==A.typeName){t=!0;const[A,r]=$(n);lA(A,o,n.field,e,n),AA(i,n,r(),e)}}if(!t&&!e.ignoreUnknownFields)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: key "').concat(s,'" is unknown'))}}return i},writeMessage(A,t){const e=A.getType(),i={};let n;try{for(n of e.fields.byNumber()){if(!iA(n,A)){if(n.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!wA(n))continue}const e=gA(n,n.oneof?A[n.oneof.localName].value:A[n.localName],t);void 0!==e&&(i[t.useProtoFieldName?n.name:n.jsonName]=e)}const r=t.typeRegistry;if(null==r?void 0:r.findExtensionFor)for(const n of e.runtime.bin.listUnknownFields(A)){const s=r.findExtensionFor(e.typeName,n.no);if(s&&tA(A,s)){const e=z(A,s,t),n=gA(s.field,e,t);void 0!==n&&(i[s.field.jsonName]=n)}}}catch(r){const A=n?"cannot encode field ".concat(e.typeName,".").concat(n.name," to JSON"):"cannot encode message ".concat(e.typeName," to JSON"),t=r instanceof Error?r.message:String(r);throw new Error(A+(t.length>0?": ".concat(t):""))}return i},readScalar:(A,t,e)=>BA(A,t,null!=e?e:R.BIGINT,!0),writeScalar(A,t,e){if(void 0!==t)return e||J(A,t)?vA(A,t):void 0},debug:hA},bin:{makeReadOptions:function(A){return A?Object.assign(Object.assign({},QA),A):QA},makeWriteOptions:function(A){return A?Object.assign(Object.assign({},UA),A):UA},listUnknownFields(A){var t;return null!==(t=A[mA])&&void 0!==t?t:[]},discardUnknownFields(A){delete A[mA]},writeUnknownFields(A,t){const e=A[mA];if(e)for(const i of e)t.tag(i.no,i.wireType).raw(i.data)},onUnknownField(A,t,e,i){const n=A;Array.isArray(n[mA])||(n[mA]=[]),n[mA].push({no:t,wireType:e,data:i})},readMessage(A,t,e,i,n){const r=A.getType(),s=n?t.len:t.pos+e;let o,a;for(;t.pos<s&&([o,a]=t.tag(),!0!==n||a!=j.EndGroup);){const e=r.fields.find(o);if(e)CA(A,t,e,a,i);else{const e=t.skip(a,o);i.readUnknownFields&&this.onUnknownField(A,o,a,e)}}if(n&&(a!=j.EndGroup||o!==e))throw new Error("invalid end group tag")},readField:CA,writeMessage(A,t,e){const i=A.getType();for(const n of i.fields.byNumber())if(iA(n,A))EA(n,n.oneof?A[n.oneof.localName].value:A[n.localName],t,e);else if(n.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(n.name," to binary: required field not set"));return e.writeUnknownFields&&this.writeUnknownFields(A,t),t},writeField(A,t,e,i){void 0!==t&&EA(A,t,e,i)}},util:Object.assign(Object.assign({},{setEnumType:C,initPartial(A,t){if(void 0===A)return;const e=t.getType();for(const i of e.fields.byMember()){const e=i.localName,n=t,r=A;if(null!=r[e])switch(i.kind){case"oneof":const A=r[e].case;if(void 0===A)continue;const t=i.findField(A);let s=r[e].value;t&&"message"==t.kind&&!rA(s,t.T)?s=new t.T(s):t&&"scalar"===t.kind&&t.T===x.BYTES&&(s=OA(s)),n[e]={case:A,value:s};break;case"scalar":case"enum":let o=r[e];i.T===x.BYTES&&(o=i.repeated?o.map(OA):OA(o)),n[e]=o;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===x.BYTES)for(const[t,i]of Object.entries(r[e]))n[e][t]=OA(i);else Object.assign(n[e],r[e]);break;case"message":const A=i.V.T;for(const t of Object.keys(r[e])){let i=r[e][t];A.fieldWrapper||(i=new A(i)),n[e][t]=i}}break;case"message":const a=i.T;if(i.repeated)n[e]=r[e].map((A=>rA(A,a)?A:new a(A)));else{const A=r[e];a.fieldWrapper?"google.protobuf.BytesValue"===a.typeName?n[e]=OA(A):n[e]=A:n[e]=rA(A,a)?A:new a(A)}}}},equals:(A,t,e)=>t===e||!(!t||!e)&&A.fields.byMember().every((A=>{const i=t[A.localName],n=e[A.localName];if(A.repeated){if(i.length!==n.length)return!1;switch(A.kind){case"message":return i.every(((t,e)=>A.T.equals(t,n[e])));case"scalar":return i.every(((t,e)=>P(A.T,t,n[e])));case"enum":return i.every(((A,t)=>P(x.INT32,A,n[t])))}throw new Error("repeated cannot contain ".concat(A.kind))}switch(A.kind){case"message":return A.T.equals(i,n);case"enum":return P(x.INT32,i,n);case"scalar":return P(A.T,i,n);case"oneof":if(i.case!==n.case)return!1;const t=A.findField(i.case);if(void 0===t)return!0;switch(t.kind){case"message":return t.T.equals(i.value,n.value);case"enum":return P(x.INT32,i.value,n.value);case"scalar":return P(t.T,i.value,n.value)}throw new Error("oneof cannot contain ".concat(t.kind));case"map":const e=Object.keys(i).concat(Object.keys(n));switch(A.V.kind){case"message":const t=A.V.T;return e.every((A=>t.equals(i[A],n[A])));case"enum":return e.every((A=>P(x.INT32,i[A],n[A])));case"scalar":const r=A.V.T;return e.every((A=>P(r,i[A],n[A])))}}})),clone(A){const t=A.getType(),e=new t,i=e;for(const n of t.fields.byMember()){const t=A[n.localName];let e;if(n.repeated)e=t.map(SA);else if("map"==n.kind){e=i[n.localName];for(const[A,i]of Object.entries(t))e[A]=SA(i)}else e="oneof"==n.kind?n.findField(t.case)?{case:t.case,value:SA(t.value)}:{case:void 0}:SA(t);i[n.localName]=e}for(const n of t.runtime.bin.listUnknownFields(A))t.runtime.bin.onUnknownField(i,n.no,n.wireType,n.data);return e}}),{newFieldList:VA,initFields:JA}),makeMessageType(A,t,e){return(function(A,t,e,i){var n;const r=null!==(n=null==i?void 0:i.localName)&&void 0!==n?n:t.substring(t.lastIndexOf(".")+1),s={[r]:function(t){A.util.initFields(this),A.util.initPartial(t,this)}}[r];return Object.setPrototypeOf(s.prototype,new b),Object.assign(s,{runtime:A,typeName:t,fields:A.util.newFieldList(e),fromBinary:(A,t)=>(new s).fromBinary(A,t),fromJson:(A,t)=>(new s).fromJson(A,t),fromJsonString:(A,t)=>(new s).fromJsonString(A,t),equals:(t,e)=>A.util.equals(s,t,e)}),s})(this,A,t,e)},makeEnum:function(A,t,e){const i={};for(const n of t){const A=y(n);i[A.localName]=A.no,i[A.no]=A.localName}return C(i,A,t),i},makeEnumType:F,getEnumType:function(A){const t=A[U];return p(t,"missing enum type on enum object"),t},makeExtension(A,t,e){return(function(A,t,e,i){let n;return{typeName:t,extendee:e,get field(){if(!n){const e="function"==typeof i?i():i;e.name=t.split(".").pop(),e.jsonName="[".concat(t,"]"),n=A.util.newFieldList([e]).list()[0]}return n},runtime:A}})(this,A,t,e)}});var VA,JA;class XA extends b{constructor(A){super(),this.seconds=L.zero,this.nanos=0,PA.util.initPartial(A,this)}fromJson(A,t){if("string"!=typeof A)throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(PA.json.debug(A)));const e=A.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(!e)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(e[1]+"-"+e[2]+"-"+e[3]+"T"+e[4]+":"+e[5]+":"+e[6]+(e[8]?e[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>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=L.parse(i/1e3),this.nanos=0,e[7]&&(this.nanos=parseInt("1"+e[7]+"0".repeat(9-e[7].length))-1e9),this}toJson(A){const t=1e3*Number(this.seconds);if(t<Date.parse("0001-01-01T00:00:00Z")||t>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 e="Z";if(this.nanos>0){const A=(this.nanos+1e9).toString().substring(1);e="000000"===A.substring(3)?"."+A.substring(0,3)+"Z":"000"===A.substring(6)?"."+A.substring(0,6)+"Z":"."+A+"Z"}return new Date(t).toISOString().replace(".000Z",e)}toDate(){return new Date(1e3*Number(this.seconds)+Math.ceil(this.nanos/1e6))}static now(){return XA.fromDate(new Date)}static fromDate(A){const t=A.getTime();return new XA({seconds:L.parse(Math.floor(t/1e3)),nanos:t%1e3*1e6})}static fromBinary(A,t){return(new XA).fromBinary(A,t)}static fromJson(A,t){return(new XA).fromJson(A,t)}static fromJsonString(A,t){return(new XA).fromJsonString(A,t)}static equals(A,t){return PA.util.equals(XA,A,t)}}XA.runtime=PA,XA.typeName="google.protobuf.Timestamp",XA.fields=PA.util.newFieldList((()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]));const YA=PA.makeMessageType("livekit.MetricsBatch",(()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:XA},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:$A,repeated:!0},{no:5,name:"events",kind:"message",T:ZA,repeated:!0}])),$A=PA.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:WA,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}])),WA=PA.makeMessageType("livekit.MetricSample",(()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:XA},{no:3,name:"value",kind:"scalar",T:2}])),ZA=PA.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:XA},{no:7,name:"normalized_end_timestamp",kind:"message",T:XA,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}])),qA=PA.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),zA=PA.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),At=PA.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"}]),tt=PA.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),et=PA.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),it=PA.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),nt=PA.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"}]),rt=PA.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"}]),st=PA.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),ot=PA.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"}]),at=PA.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:ct,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:Rt}])),ct=PA.makeMessageType("livekit.Codec",(()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}])),ut=PA.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:PA.getEnumType(At),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}])),ht=PA.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:PA.getEnumType(lt)},{no:4,name:"tracks",kind:"message",T:gt,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:ut},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:PA.getEnumType(dt)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:PA.getEnumType(nt)},{no:18,name:"kind_details",kind:"enum",T:PA.getEnumType(Bt),repeated:!0}])),lt=PA.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),dt=PA.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),Bt=PA.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),ft=PA.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),wt=PA.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:pt,repeated:!0}])),gt=PA.makeMessageType("livekit.TrackInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:PA.getEnumType(zA)},{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:PA.getEnumType(At)},{no:10,name:"layers",kind:"message",T:pt,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:wt,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:PA.getEnumType(ft)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:Rt},{no:19,name:"audio_features",kind:"enum",T:PA.getEnumType(ot),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:PA.getEnumType(qA)}])),pt=PA.makeMessageType("livekit.VideoLayer",(()=>[{no:1,name:"quality",kind:"enum",T:PA.getEnumType(tt)},{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}])),vt=PA.makeMessageType("livekit.DataPacket",(()=>[{no:1,name:"kind",kind:"enum",T:PA.getEnumType(mt)},{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:Ct,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Qt,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:Ft,oneof:"value"},{no:7,name:"transcription",kind:"message",T:yt,oneof:"value"},{no:8,name:"metrics",kind:"message",T:YA,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:Et,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:It,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:Ht,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:kt,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:Pt,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Vt,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Jt,oneof:"value"}])),mt=PA.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),Qt=PA.makeMessageType("livekit.ActiveSpeakerUpdate",(()=>[{no:1,name:"speakers",kind:"message",T:Ut,repeated:!0}])),Ut=PA.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}])),Ct=PA.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}])),Ft=PA.makeMessageType("livekit.SipDTMF",(()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}])),yt=PA.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:bt,repeated:!0}])),bt=PA.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}])),Et=PA.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}])),It=PA.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}])),Ht=PA.makeMessageType("livekit.RpcAck",(()=>[{no:1,name:"request_id",kind:"scalar",T:9}])),kt=PA.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:Tt,oneof:"value"}])),Tt=PA.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}])),St=PA.makeMessageType("livekit.ParticipantTracks",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}])),Ot=PA.makeMessageType("livekit.ServerInfo",(()=>[{no:1,name:"edition",kind:"enum",T:PA.getEnumType(Kt)},{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}])),Kt=PA.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),Dt=PA.makeMessageType("livekit.ClientInfo",(()=>[{no:1,name:"sdk",kind:"enum",T:PA.getEnumType(Mt)},{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}])),Mt=PA.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"}]),Lt=PA.makeMessageType("livekit.ClientConfiguration",(()=>[{no:1,name:"video",kind:"message",T:xt},{no:2,name:"screen",kind:"message",T:xt},{no:3,name:"resume_connection",kind:"enum",T:PA.getEnumType(it)},{no:4,name:"disabled_codecs",kind:"message",T:_t},{no:5,name:"force_relay",kind:"enum",T:PA.getEnumType(it)}])),xt=PA.makeMessageType("livekit.VideoConfiguration",(()=>[{no:1,name:"hardware_encoder",kind:"enum",T:PA.getEnumType(it)}])),_t=PA.makeMessageType("livekit.DisabledCodecs",(()=>[{no:1,name:"codecs",kind:"message",T:ct,repeated:!0},{no:2,name:"publish",kind:"message",T:ct,repeated:!0}])),Rt=PA.makeMessageType("livekit.TimedVersion",(()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}])),Nt=PA.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),jt=PA.makeMessageType("livekit.DataStream.TextHeader",(()=>[{no:1,name:"operation_type",kind:"enum",T:PA.getEnumType(Nt)},{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"}),Gt=PA.makeMessageType("livekit.DataStream.ByteHeader",(()=>[{no:1,name:"name",kind:"scalar",T:9}]),{localName:"DataStream_ByteHeader"}),Pt=PA.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:PA.getEnumType(ft)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:jt,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:Gt,oneof:"content_header"}]),{localName:"DataStream_Header"}),Vt=PA.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"}),Jt=PA.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"}),Xt=PA.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Yt=PA.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),$t=PA.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),Wt=PA.makeMessageType("livekit.SignalRequest",(()=>[{no:1,name:"offer",kind:"message",T:se,oneof:"message"},{no:2,name:"answer",kind:"message",T:se,oneof:"message"},{no:3,name:"trickle",kind:"message",T:Ae,oneof:"message"},{no:4,name:"add_track",kind:"message",T:zt,oneof:"message"},{no:5,name:"mute",kind:"message",T:te,oneof:"message"},{no:6,name:"subscription",kind:"message",T:ae,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:ce,oneof:"message"},{no:8,name:"leave",kind:"message",T:le,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:Be,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:Ee,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:ke,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Se,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:fe,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:Oe,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:ue,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:he,oneof:"message"}])),Zt=PA.makeMessageType("livekit.SignalResponse",(()=>[{no:1,name:"join",kind:"message",T:ee,oneof:"message"},{no:2,name:"answer",kind:"message",T:se,oneof:"message"},{no:3,name:"offer",kind:"message",T:se,oneof:"message"},{no:4,name:"trickle",kind:"message",T:Ae,oneof:"message"},{no:5,name:"update",kind:"message",T:oe,oneof:"message"},{no:6,name:"track_published",kind:"message",T:ne,oneof:"message"},{no:8,name:"leave",kind:"message",T:le,oneof:"message"},{no:9,name:"mute",kind:"message",T:te,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:ge,oneof:"message"},{no:11,name:"room_update",kind:"message",T:pe,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:me,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:Ue,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:ye,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:Ie,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:re,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:ie,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:Ke,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:Le,oneof:"message"},{no:22,name:"request_response",kind:"message",T:xe,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:Re,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:He,oneof:"message"}])),qt=PA.makeMessageType("livekit.SimulcastCodec",(()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}])),zt=PA.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:PA.getEnumType(zA)},{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:PA.getEnumType(At)},{no:9,name:"layers",kind:"message",T:pt,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:qt,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:PA.getEnumType(ft)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:PA.getEnumType(qA)},{no:17,name:"audio_features",kind:"enum",T:PA.getEnumType(ot),repeated:!0}])),Ae=PA.makeMessageType("livekit.TrickleRequest",(()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:PA.getEnumType(Xt)},{no:3,name:"final",kind:"scalar",T:8}])),te=PA.makeMessageType("livekit.MuteTrackRequest",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}])),ee=PA.makeMessageType("livekit.JoinResponse",(()=>[{no:1,name:"room",kind:"message",T:at},{no:2,name:"participant",kind:"message",T:ht},{no:3,name:"other_participants",kind:"message",T:ht,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:we,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:Lt},{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:Ot},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:ct,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}])),ie=PA.makeMessageType("livekit.ReconnectResponse",(()=>[{no:1,name:"ice_servers",kind:"message",T:we,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Lt}])),ne=PA.makeMessageType("livekit.TrackPublishedResponse",(()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:gt}])),re=PA.makeMessageType("livekit.TrackUnpublishedResponse",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9}])),se=PA.makeMessageType("livekit.SessionDescription",(()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9}])),oe=PA.makeMessageType("livekit.ParticipantUpdate",(()=>[{no:1,name:"participants",kind:"message",T:ht,repeated:!0}])),ae=PA.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:St,repeated:!0}])),ce=PA.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:PA.getEnumType(tt)},{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}])),ue=PA.makeMessageType("livekit.UpdateLocalAudioTrack",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:PA.getEnumType(ot),repeated:!0}])),he=PA.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}])),le=PA.makeMessageType("livekit.LeaveRequest",(()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:PA.getEnumType(nt)},{no:3,name:"action",kind:"enum",T:PA.getEnumType(de)},{no:4,name:"regions",kind:"message",T:De}])),de=PA.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),Be=PA.makeMessageType("livekit.UpdateVideoLayers",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:pt,repeated:!0}])),fe=PA.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}])),we=PA.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}])),ge=PA.makeMessageType("livekit.SpeakersChanged",(()=>[{no:1,name:"speakers",kind:"message",T:Ut,repeated:!0}])),pe=PA.makeMessageType("livekit.RoomUpdate",(()=>[{no:1,name:"room",kind:"message",T:at}])),ve=PA.makeMessageType("livekit.ConnectionQualityInfo",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:PA.getEnumType(et)},{no:3,name:"score",kind:"scalar",T:2}])),me=PA.makeMessageType("livekit.ConnectionQualityUpdate",(()=>[{no:1,name:"updates",kind:"message",T:ve,repeated:!0}])),Qe=PA.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:PA.getEnumType(Yt)}])),Ue=PA.makeMessageType("livekit.StreamStateUpdate",(()=>[{no:1,name:"stream_states",kind:"message",T:Qe,repeated:!0}])),Ce=PA.makeMessageType("livekit.SubscribedQuality",(()=>[{no:1,name:"quality",kind:"enum",T:PA.getEnumType(tt)},{no:2,name:"enabled",kind:"scalar",T:8}])),Fe=PA.makeMessageType("livekit.SubscribedCodec",(()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Ce,repeated:!0}])),ye=PA.makeMessageType("livekit.SubscribedQualityUpdate",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Ce,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:Fe,repeated:!0}])),be=PA.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}])),Ee=PA.makeMessageType("livekit.SubscriptionPermission",(()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:be,repeated:!0}])),Ie=PA.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}])),He=PA.makeMessageType("livekit.RoomMovedResponse",(()=>[{no:1,name:"room",kind:"message",T:at},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:ht},{no:4,name:"other_participants",kind:"message",T:ht,repeated:!0}])),ke=PA.makeMessageType("livekit.SyncState",(()=>[{no:1,name:"answer",kind:"message",T:se},{no:2,name:"subscription",kind:"message",T:ae},{no:3,name:"publish_tracks",kind:"message",T:ne,repeated:!0},{no:4,name:"data_channels",kind:"message",T:Te,repeated:!0},{no:5,name:"offer",kind:"message",T:se},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0}])),Te=PA.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:PA.getEnumType(Xt)}])),Se=PA.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:PA.getEnumType($t),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"}])),Oe=PA.makeMessageType("livekit.Ping",(()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}])),Ke=PA.makeMessageType("livekit.Pong",(()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}])),De=PA.makeMessageType("livekit.RegionSettings",(()=>[{no:1,name:"regions",kind:"message",T:Me,repeated:!0}])),Me=PA.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}])),Le=PA.makeMessageType("livekit.SubscriptionResponse",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:PA.getEnumType(st)}])),xe=PA.makeMessageType("livekit.RequestResponse",(()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:PA.getEnumType(_e)},{no:3,name:"message",kind:"scalar",T:9}])),_e=PA.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),Re=PA.makeMessageType("livekit.TrackSubscribed",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]));function Ne(A){return A&&A.A&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var je,Ge,Pe,Ve,Je,Xe,Ye,$e,We={exports:{}},Ze=(je||(je=1,Pe=We.exports,Ve=function(){var A=function(){},t="undefined",e=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],n={},r=null;function s(A,t){var e=A[t];if("function"==typeof e.bind)return e.bind(A);try{return Function.prototype.bind.call(e,A)}catch(i){return function(){return Function.prototype.apply.apply(e,[A,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(){for(var e=this.getLevel(),n=0;n<i.length;n++){var r=i[n];this[r]=n<e?A:this.methodFactory(r,e,this.name)}if(this.log=this.debug,typeof console===t&&e<this.levels.SILENT)return"No console available for logging"}function c(A){return function(){typeof console!==t&&(a.call(this),this[A].apply(this,arguments))}}function u(i,n,r){return(function(i){return"debug"===i&&(i="log"),typeof console!==t&&("trace"===i&&e?o:void 0!==console[i]?s(console,i):void 0!==console.log?s(console,"log"):A)})(i)||c.apply(this,arguments)}function h(A,e){var s,o,c,h=this,l="loglevel";function d(){var A;if(typeof window!==t&&l){try{A=window.localStorage[l]}catch(r){}if(typeof A===t)try{var e=window.document.cookie,i=encodeURIComponent(l),n=e.indexOf(i+"=");-1!==n&&(A=/^([^;]+)/.exec(e.slice(n+i.length+1))[1])}catch(r){}return void 0===h.levels[A]&&(A=void 0),A}}function B(A){var t=A;if("string"==typeof t&&void 0!==h.levels[t.toUpperCase()]&&(t=h.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=h.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+A)}"string"==typeof A?l+=":"+A:"symbol"==typeof A&&(l=void 0),h.name=A,h.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},h.methodFactory=e||u,h.getLevel=function(){return null!=c?c:null!=o?o:s},h.setLevel=function(A,e){return c=B(A),!1!==e&&(function(A){var e=(i[A]||"silent").toUpperCase();if(typeof window!==t&&l){try{return void(window.localStorage[l]=e)}catch(n){}try{window.document.cookie=encodeURIComponent(l)+"="+e+";"}catch(n){}}})(c),a.call(h)},h.setDefaultLevel=function(A){o=B(A),d()||h.setLevel(A,!1)},h.resetLevel=function(){c=null,(function(){if(typeof window!==t&&l){try{window.localStorage.removeItem(l)}catch(A){}try{window.document.cookie=encodeURIComponent(l)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(A){}}})(),a.call(h)},h.enableAll=function(A){h.setLevel(h.levels.TRACE,A)},h.disableAll=function(A){h.setLevel(h.levels.SILENT,A)},h.rebuild=function(){if(r!==h&&(s=B(r.getLevel())),a.call(h),r===h)for(var A in n)n[A].rebuild()},s=B(r?r.getLevel():"WARN");var f=d();null!=f&&(c=B(f)),a.call(h)}(r=new h).getLogger=function(A){if("symbol"!=typeof A&&"string"!=typeof A||""===A)throw new TypeError("You must supply a name when creating a logger.");var t=n[A];return t||(t=n[A]=new h(A,r.methodFactory)),t};var l=typeof window!==t?window.log:void 0;return r.noConflict=function(){return typeof window!==t&&window.log===r&&(window.log=l),r},r.getLoggers=function(){return n},r.default=r,r},(Ge=We).exports?Ge.exports=Ve():Pe.log=Ve()),We.exports);(Xe=Je||(Je={}))[Xe.trace=0]="trace",Xe[Xe.debug=1]="debug",Xe[Xe.info=2]="info",Xe[Xe.warn=3]="warn",Xe[Xe.error=4]="error",Xe[Xe.silent=5]="silent",($e=Ye||(Ye={})).Default="livekit",$e.Room="livekit-room",$e.Participant="livekit-participant",$e.Track="livekit-track",$e.Publication="livekit-track-publication",$e.Engine="livekit-engine",$e.Signal="livekit-signal",$e.PCManager="livekit-pc-manager",$e.PCTransport="livekit-pc-transport",$e.E2EE="lk-e2ee";let qe=Ze.getLogger("livekit");function ze(A){const t=Ze.getLogger(A);return t.setDefaultLevel(qe.getLevel()),t}Object.values(Ye).map((A=>Ze.getLogger(A))),qe.setDefaultLevel(Je.info);const Ai=Ze.getLogger("lk-e2ee"),ti=7e3,ei=[0,300,1200,2700,4800,ti,ti,ti,ti,ti];function ii(A,t,e,i){return new(e||(e=Promise))((function(n,r){function s(A){try{a(i.next(A))}catch(t){r(t)}}function o(A){try{a(i.throw(A))}catch(t){r(t)}}function a(A){var t;A.done?n(A.value):(t=A.value,t instanceof e?t:new e((function(A){A(t)}))).then(s,o)}a((i=i.apply(A,t||[])).next())}))}function ni(A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=A[Symbol.asyncIterator];return e?e.call(A):(A=(function(A){var t="function"==typeof Symbol&&Symbol.iterator,e=t&&A[t],i=0;if(e)return e.call(A);if(A&&"number"==typeof A.length)return{next:function(){return A&&i>=A.length&&(A=void 0),{value:A&&A[i++],done:!A}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")})(A),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(e){t[e]=A[e]&&function(t){return new Promise((function(i,n){!(function(A,t,e,i){Promise.resolve(i).then((function(t){A({value:t,done:e})}),t)})(i,n,(t=A[e](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError;var ri,si={exports:{}},oi=(function(){if(ri)return si.exports;ri=1;var A,t="object"==typeof Reflect?Reflect:null,e=t&&"function"==typeof t.apply?t.apply:function(A,t,e){return Function.prototype.apply.call(A,t,e)};A=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(A){return Object.getOwnPropertyNames(A).concat(Object.getOwnPropertySymbols(A))}:function(A){return Object.getOwnPropertyNames(A)};var i=Number.isNaN||function(A){return A!=A};function n(){n.init.call(this)}si.exports=n,si.exports.once=function(A,t){return new Promise((function(e,i){function n(e){A.removeListener(t,r),i(e)}function r(){"function"==typeof A.removeListener&&A.removeListener("error",n),e([].slice.call(arguments))}B(A,t,r,{once:!0}),"error"!==t&&(function(A,t){"function"==typeof A.on&&B(A,"error",t,{once:!0})})(A,n)}))},n.EventEmitter=n,n.prototype.B=void 0,n.prototype.U=0,n.prototype.M=void 0;var r=10;function s(A){if("function"!=typeof A)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}function o(A){return void 0===A.M?n.defaultMaxListeners:A.M}function a(A,t,e,i){var n,r,a,c;if(s(e),void 0===(r=A.B)?(r=A.B=Object.create(null),A.U=0):(void 0!==r.newListener&&(A.emit("newListener",t,e.listener?e.listener:e),r=A.B),a=r[t]),void 0===a)a=r[t]=e,++A.U;else if("function"==typeof a?a=r[t]=i?[e,a]:[a,e]:i?a.unshift(e):a.push(e),(n=o(A))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=A,u.type=t,u.count=a.length,c=u,console&&console.warn&&console.warn(c)}return A}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(A,t,e){var i={fired:!1,wrapFn:void 0,target:A,type:t,listener:e},n=c.bind(i);return n.listener=e,i.wrapFn=n,n}function h(A,t,e){var i=A.B;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?e?[n.listener||n]:[n]:e?(function(A){for(var t=new Array(A.length),e=0;e<t.length;++e)t[e]=A[e].listener||A[e];return t})(n):d(n,n.length)}function l(A){var t=this.B;if(void 0!==t){var e=t[A];if("function"==typeof e)return 1;if(void 0!==e)return e.length}return 0}function d(A,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=A[i];return e}function B(A,t,e,i){if("function"==typeof A.on)i.once?A.once(t,e):A.on(t,e);else{if("function"!=typeof A.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof A);A.addEventListener(t,(function n(r){i.once&&A.removeEventListener(t,n),e(r)}))}}return Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return r},set:function(A){if("number"!=typeof A||A<0||i(A))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+A+".");r=A}}),n.init=function(){void 0!==this.B&&this.B!==Object.getPrototypeOf(this).B||(this.B=Object.create(null),this.U=0),this.M=this.M||void 0},n.prototype.setMaxListeners=function(A){if("number"!=typeof A||A<0||i(A))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+A+".");return this.M=A,this},n.prototype.getMaxListeners=function(){return o(this)},n.prototype.emit=function(A){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===A,r=this.B;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=r[A];if(void 0===a)return!1;if("function"==typeof a)e(a,this,t);else{var c=a.length,u=d(a,c);for(i=0;i<c;++i)e(u[i],this,t)}return!0},n.prototype.addListener=function(A,t){return a(this,A,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(A,t){return a(this,A,t,!0)},n.prototype.once=function(A,t){return s(t),this.on(A,u(this,A,t)),this},n.prototype.prependOnceListener=function(A,t){return s(t),this.prependListener(A,u(this,A,t)),this},n.prototype.removeListener=function(A,t){var e,i,n,r,o;if(s(t),void 0===(i=this.B))return this;if(void 0===(e=i[A]))return this;if(e===t||e.listener===t)0===--this.U?this.B=Object.create(null):(delete i[A],i.removeListener&&this.emit("removeListener",A,e.listener||t));else if("function"!=typeof e){for(n=-1,r=e.length-1;r>=0;r--)if(e[r]===t||e[r].listener===t){o=e[r].listener,n=r;break}if(n<0)return this;0===n?e.shift():(function(A,t){for(;t+1<A.length;t++)A[t]=A[t+1];A.pop()})(e,n),1===e.length&&(i[A]=e[0]),void 0!==i.removeListener&&this.emit("removeListener",A,o||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(A){var t,e,i;if(void 0===(e=this.B))return this;if(void 0===e.removeListener)return 0===arguments.length?(this.B=Object.create(null),this.U=0):void 0!==e[A]&&(0===--this.U?this.B=Object.create(null):delete e[A]),this;if(0===arguments.length){var n,r=Object.keys(e);for(i=0;i<r.length;++i)"removeListener"!==(n=r[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this.B=Object.create(null),this.U=0,this}if("function"==typeof(t=e[A]))this.removeListener(A,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(A,t[i]);return this},n.prototype.listeners=function(A){return h(this,A,!0)},n.prototype.rawListeners=function(A){return h(this,A,!1)},n.listenerCount=function(A,t){return"function"==typeof A.listenerCount?A.listenerCount(t):l.call(A,t)},n.prototype.listenerCount=l,n.prototype.eventNames=function(){return this.U>0?A(this.B):[]},si.exports})();let ai=!0,ci=!0;function ui(A,t,e){const i=A.match(t);return i&&i.length>=e&&parseInt(i[e],10)}function hi(A,t,e){if(!A.RTCPeerConnection)return;const i=A.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(A,i){if(A!==t)return n.apply(this,arguments);const r=A=>{const t=e(A);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._=this._||{},this._[t]||(this._[t]=new Map),this._[t].set(i,r),n.apply(this,[A,r])};const r=i.removeEventListener;i.removeEventListener=function(A,e){if(A!==t||!this._||!this._[t])return r.apply(this,arguments);if(!this._[t].has(e))return r.apply(this,arguments);const i=this._[t].get(e);return this._[t].delete(e),0===this._[t].size&&delete this._[t],0===Object.keys(this._).length&&delete this._,r.apply(this,[A,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(A){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),A&&this.addEventListener(t,this["_on"+t]=A)},enumerable:!0,configurable:!0})}function li(A){return"boolean"!=typeof A?new Error("Argument type: "+typeof A+". Please use a boolean."):(ai=A,A?"adapter.js logging disabled":"adapter.js logging enabled")}function di(A){return"boolean"!=typeof A?new Error("Argument type: "+typeof A+". Please use a boolean."):(ci=!A,"adapter.js deprecation warnings "+(A?"disabled":"enabled"))}function Bi(){if("object"==typeof window){if(ai)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function fi(A,t){ci&&console.warn(A+" is deprecated, please use "+t+" instead.")}function wi(A){return"[object Object]"===Object.prototype.toString.call(A)}function gi(A){return wi(A)?Object.keys(A).reduce((function(t,e){const i=wi(A[e]),n=i?gi(A[e]):A[e],r=i&&!Object.keys(n).length;return void 0===n||r?t:Object.assign(t,{[e]:n})}),{}):A}function pi(A,t,e){t&&!e.has(t.id)&&(e.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?pi(A,A.get(t[i]),e):i.endsWith("Ids")&&t[i].forEach((t=>{pi(A,A.get(t),e)}))})))}function vi(A,t,e){const i=e?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const r=[];return A.forEach((A=>{"track"===A.type&&A.trackIdentifier===t.id&&r.push(A)})),r.forEach((t=>{A.forEach((e=>{e.type===i&&e.trackId===t.id&&pi(A,e,n)}))})),n}const mi=Bi;function Qi(A,t){const e=A&&A.navigator;if(!e.mediaDevices)return;const i=function(A){if("object"!=typeof A||A.mandatory||A.optional)return A;const t={};return Object.keys(A).forEach((e=>{if("require"===e||"advanced"===e||"mediaSource"===e)return;const i="object"==typeof A[e]?A[e]:{ideal:A[e]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(A,t){return A?A+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let A={};"number"==typeof i.ideal?(A[n("min",e)]=i.ideal,t.optional.push(A),A={},A[n("max",e)]=i.ideal,t.optional.push(A)):(A[n("",e)]=i.ideal,t.optional.push(A))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",e)]=i.exact):["min","max"].forEach((A=>{void 0!==i[A]&&(t.mandatory=t.mandatory||{},t.mandatory[n(A,e)]=i[A])}))})),A.advanced&&(t.optional=(t.optional||[]).concat(A.advanced)),t},n=function(A,n){if(t.version>=61)return n(A);if((A=JSON.parse(JSON.stringify(A)))&&"object"==typeof A.audio){const t=function(A,t,e){t in A&&!(e in A)&&(A[e]=A[t],delete A[t])};t((A=JSON.parse(JSON.stringify(A))).audio,"autoGainControl","googAutoGainControl"),t(A.audio,"noiseSuppression","googNoiseSuppression"),A.audio=i(A.audio)}if(A&&"object"==typeof A.video){let r=A.video.facingMode;r=r&&("object"==typeof r?r:{ideal:r});const s=t.version<66;if(r&&("user"===r.exact||"environment"===r.exact||"user"===r.ideal||"environment"===r.ideal)&&(!e.mediaDevices.getSupportedConstraints||!e.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete A.video.facingMode,"environment"===r.exact||"environment"===r.ideal?t=["back","rear"]:"user"!==r.exact&&"user"!==r.ideal||(t=["front"]),t)return e.mediaDevices.enumerateDevices().then((e=>{let s=(e=e.filter((A=>"videoinput"===A.kind))).find((A=>t.some((t=>A.label.toLowerCase().includes(t)))));return!s&&e.length&&t.includes("back")&&(s=e[e.length-1]),s&&(A.video.deviceId=r.exact?{exact:s.deviceId}:{ideal:s.deviceId}),A.video=i(A.video),mi("chrome: "+JSON.stringify(A)),n(A)}))}A.video=i(A.video)}return mi("chrome: "+JSON.stringify(A)),n(A)},r=function(A){return t.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}}};if(e.getUserMedia=function(A,t,i){n(A,(A=>{e.webkitGetUserMedia(A,t,(A=>{i&&i(r(A))}))}))}.bind(e),e.mediaDevices.getUserMedia){const A=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(t){return n(t,(t=>A(t).then((A=>{if(t.audio&&!A.getAudioTracks().length||t.video&&!A.getVideoTracks().length)throw A.getTracks().forEach((A=>{A.stop()})),new DOMException("","NotFoundError");return A}),(A=>Promise.reject(r(A))))))}}}function Ui(A){A.MediaStream=A.MediaStream||A.webkitMediaStream}function Ci(A){if("object"==typeof A&&A.RTCPeerConnection&&!("ontrack"in A.RTCPeerConnection.prototype)){Object.defineProperty(A.RTCPeerConnection.prototype,"ontrack",{get(){return this.R},set(A){this.R&&this.removeEventListener("track",this.R),this.addEventListener("track",this.R=A)},enumerable:!0,configurable:!0});const t=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){return this.N||(this.N=t=>{t.stream.addEventListener("addtrack",(e=>{let i;i=A.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((A=>A.track&&A.track.id===e.track.id)):{track:e.track};const n=new Event("track");n.track=e.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((e=>{let i;i=A.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((A=>A.track&&A.track.id===e.id)):{track:e};const n=new Event("track");n.track=e,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this.N)),t.apply(this,arguments)}}else hi(A,"track",(A=>(A.transceiver||Object.defineProperty(A,"transceiver",{value:{receiver:A.receiver}}),A)))}function Fi(A){if("object"==typeof A&&A.RTCPeerConnection&&!("getSenders"in A.RTCPeerConnection.prototype)&&"createDTMFSender"in A.RTCPeerConnection.prototype){const t=function(A,t){return{track:t,get dtmf(){return void 0===this.P&&("audio"===t.kind?this.P=A.createDTMFSender(t):this.P=null),this.P},J:A}};if(!A.RTCPeerConnection.prototype.getSenders){A.RTCPeerConnection.prototype.getSenders=function(){return this.X=this.X||[],this.X.slice()};const e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(A,i){let n=e.apply(this,arguments);return n||(n=t(this,A),this.X.push(n)),n};const i=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(A){i.apply(this,arguments);const t=this.X.indexOf(A);-1!==t&&this.X.splice(t,1)}}const e=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(A){this.X=this.X||[],e.apply(this,[A]),A.getTracks().forEach((A=>{this.X.push(t(this,A))}))};const i=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(A){this.X=this.X||[],i.apply(this,[A]),A.getTracks().forEach((A=>{const t=this.X.find((t=>t.track===A));t&&this.X.splice(this.X.indexOf(t),1)}))}}else if("object"==typeof A&&A.RTCPeerConnection&&"getSenders"in A.RTCPeerConnection.prototype&&"createDTMFSender"in A.RTCPeerConnection.prototype&&A.RTCRtpSender&&!("dtmf"in A.RTCRtpSender.prototype)){const t=A.RTCPeerConnection.prototype.getSenders;A.RTCPeerConnection.prototype.getSenders=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A},Object.defineProperty(A.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this.P&&("audio"===this.track.kind?this.P=this.J.createDTMFSender(this.track):this.P=null),this.P}})}}function yi(A){if(!("object"==typeof A&&A.RTCPeerConnection&&A.RTCRtpSender&&A.RTCRtpReceiver))return;if(!("getStats"in A.RTCRtpSender.prototype)){const t=A.RTCPeerConnection.prototype.getSenders;t&&(A.RTCPeerConnection.prototype.getSenders=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A});const e=A.RTCPeerConnection.prototype.addTrack;e&&(A.RTCPeerConnection.prototype.addTrack=function(){const A=e.apply(this,arguments);return A.J=this,A}),A.RTCRtpSender.prototype.getStats=function(){const A=this;return this.J.getStats().then((t=>vi(t,A.track,!0)))}}if(!("getStats"in A.RTCRtpReceiver.prototype)){const t=A.RTCPeerConnection.prototype.getReceivers;t&&(A.RTCPeerConnection.prototype.getReceivers=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A}),hi(A,"track",(A=>(A.receiver.J=A.srcElement,A))),A.RTCRtpReceiver.prototype.getStats=function(){const A=this;return this.J.getStats().then((t=>vi(t,A.track,!1)))}}if(!("getStats"in A.RTCRtpSender.prototype)||!("getStats"in A.RTCRtpReceiver.prototype))return;const t=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof A.MediaStreamTrack){const A=arguments[0];let t,e,i;return this.getSenders().forEach((e=>{e.track===A&&(t?i=!0:t=e)})),this.getReceivers().forEach((t=>(t.track===A&&(e?i=!0:e=t),t.track===A))),i||t&&e?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():e?e.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function bi(A){A.RTCPeerConnection.prototype.getLocalStreams=function(){return this.Y=this.Y||{},Object.keys(this.Y).map((A=>this.Y[A][0]))};const t=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(A,e){if(!e)return t.apply(this,arguments);this.Y=this.Y||{};const i=t.apply(this,arguments);return this.Y[e.id]?-1===this.Y[e.id].indexOf(i)&&this.Y[e.id].push(i):this.Y[e.id]=[e,i],i};const e=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(A){this.Y=this.Y||{},A.getTracks().forEach((A=>{if(this.getSenders().find((t=>t.track===A)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();e.apply(this,arguments);const i=this.getSenders().filter((A=>-1===t.indexOf(A)));this.Y[A.id]=[A].concat(i)};const i=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(A){return this.Y=this.Y||{},delete this.Y[A.id],i.apply(this,arguments)};const n=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(A){return this.Y=this.Y||{},A&&Object.keys(this.Y).forEach((t=>{const e=this.Y[t].indexOf(A);-1!==e&&this.Y[t].splice(e,1),1===this.Y[t].length&&delete this.Y[t]})),n.apply(this,arguments)}}function Ei(A,t){if(!A.RTCPeerConnection)return;if(A.RTCPeerConnection.prototype.addTrack&&t.version>=65)return bi(A);const e=A.RTCPeerConnection.prototype.getLocalStreams;A.RTCPeerConnection.prototype.getLocalStreams=function(){const A=e.apply(this);return this.W=this.W||{},A.map((A=>this.W[A.id]))};const i=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(t){if(this.Z=this.Z||{},this.W=this.W||{},t.getTracks().forEach((A=>{if(this.getSenders().find((t=>t.track===A)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this.W[t.id]){const e=new A.MediaStream(t.getTracks());this.Z[t.id]=e,this.W[e.id]=t,t=e}i.apply(this,[t])};const n=A.RTCPeerConnection.prototype.removeStream;function r(A,t){let e=t.sdp;return Object.keys(A.W||[]).forEach((t=>{const i=A.W[t],n=A.Z[i.id];e=e.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:e})}A.RTCPeerConnection.prototype.removeStream=function(A){this.Z=this.Z||{},this.W=this.W||{},n.apply(this,[this.Z[A.id]||A]),delete this.W[this.Z[A.id]?this.Z[A.id].id:A.id],delete this.Z[A.id]},A.RTCPeerConnection.prototype.addTrack=function(t,e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((A=>A===t)))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((A=>A.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this.Z=this.Z||{},this.W=this.W||{};const n=this.Z[e.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new A.MediaStream([t]);this.Z[e.id]=i,this.W[i.id]=e,this.addStream(i)}return this.getSenders().find((A=>A.track===t))},["createOffer","createAnswer"].forEach((function(t){const e=A.RTCPeerConnection.prototype[t],i={[t](){const A=arguments;return arguments.length&&"function"==typeof arguments[0]?e.apply(this,[t=>{const e=r(this,t);A[0].apply(null,[e])},t=>{A[1]&&A[1].apply(null,t)},arguments[2]]):e.apply(this,arguments).then((A=>r(this,A)))}};A.RTCPeerConnection.prototype[t]=i[t]}));const s=A.RTCPeerConnection.prototype.setLocalDescription;A.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=(function(A,t){let e=t.sdp;return Object.keys(A.W||[]).forEach((t=>{const i=A.W[t],n=A.Z[i.id];e=e.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:e})})(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const o=Object.getOwnPropertyDescriptor(A.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(A.RTCPeerConnection.prototype,"localDescription",{get(){const A=o.get.apply(this);return""===A.type?A:r(this,A)}}),A.RTCPeerConnection.prototype.removeTrack=function(A){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!A.J)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(A.J!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this.Z=this.Z||{},Object.keys(this.Z).forEach((e=>{this.Z[e].getTracks().find((t=>A.track===t))&&(t=this.Z[e])})),t&&(1===t.getTracks().length?this.removeStream(this.W[t.id]):t.removeTrack(A.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ii(A,t){!A.RTCPeerConnection&&A.webkitRTCPeerConnection&&(A.RTCPeerConnection=A.webkitRTCPeerConnection),A.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const e=A.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),e.apply(this,arguments)}};A.RTCPeerConnection.prototype[t]=i[t]}))}function Hi(A,t){hi(A,"negotiationneeded",(A=>{const e=A.target;if(!(t.version<72||e.getConfiguration&&"plan-b"===e.getConfiguration().sdpSemantics)||"stable"===e.signalingState)return A}))}var ki=Object.freeze({__proto__:null,fixNegotiationNeeded:Hi,shimAddTrackRemoveTrack:Ei,shimAddTrackRemoveTrackWithNative:bi,shimGetSendersWithDtmf:Fi,shimGetUserMedia:Qi,shimMediaStream:Ui,shimOnTrack:Ci,shimPeerConnection:Ii,shimSenderReceiverGetStats:yi});function Ti(A,t){const e=A&&A.navigator,i=A&&A.MediaStreamTrack;if(e.getUserMedia=function(A,t,i){fi("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),e.mediaDevices.getUserMedia(A).then(t,i)},!(t.version>55&&"autoGainControl"in e.mediaDevices.getSupportedConstraints())){const A=function(A,t,e){t in A&&!(e in A)&&(A[e]=A[t],delete A[t])},t=e.mediaDevices.getUserMedia.bind(e.mediaDevices);if(e.mediaDevices.getUserMedia=function(e){return"object"==typeof e&&"object"==typeof e.audio&&(e=JSON.parse(JSON.stringify(e)),A(e.audio,"autoGainControl","mozAutoGainControl"),A(e.audio,"noiseSuppression","mozNoiseSuppression")),t(e)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const e=t.apply(this,arguments);return A(e,"mozAutoGainControl","autoGainControl"),A(e,"mozNoiseSuppression","noiseSuppression"),e}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==typeof e&&(e=JSON.parse(JSON.stringify(e)),A(e,"autoGainControl","mozAutoGainControl"),A(e,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[e])}}}}function Si(A){"object"==typeof A&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Oi(A,t){if("object"!=typeof A||!A.RTCPeerConnection&&!A.mozRTCPeerConnection)return;!A.RTCPeerConnection&&A.mozRTCPeerConnection&&(A.RTCPeerConnection=A.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const e=A.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),e.apply(this,arguments)}};A.RTCPeerConnection.prototype[t]=i[t]}));const e={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){const[A,n,r]=arguments;return i.apply(this,[A||null]).then((A=>{if(t.version<53&&!n)try{A.forEach((A=>{A.type=e[A.type]||A.type}))}catch(i){if("TypeError"!==i.name)throw i;A.forEach(((t,i)=>{A.set(i,Object.assign({},t,{type:e[t.type]||t.type}))}))}return A})).then(n,r)}}function Ki(A){if("object"!=typeof A||!A.RTCPeerConnection||!A.RTCRtpSender)return;if(A.RTCRtpSender&&"getStats"in A.RTCRtpSender.prototype)return;const t=A.RTCPeerConnection.prototype.getSenders;t&&(A.RTCPeerConnection.prototype.getSenders=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A});const e=A.RTCPeerConnection.prototype.addTrack;e&&(A.RTCPeerConnection.prototype.addTrack=function(){const A=e.apply(this,arguments);return A.J=this,A}),A.RTCRtpSender.prototype.getStats=function(){return this.track?this.J.getStats(this.track):Promise.resolve(new Map)}}function Di(A){if("object"!=typeof A||!A.RTCPeerConnection||!A.RTCRtpSender)return;if(A.RTCRtpSender&&"getStats"in A.RTCRtpReceiver.prototype)return;const t=A.RTCPeerConnection.prototype.getReceivers;t&&(A.RTCPeerConnection.prototype.getReceivers=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A}),hi(A,"track",(A=>(A.receiver.J=A.srcElement,A))),A.RTCRtpReceiver.prototype.getStats=function(){return this.J.getStats(this.track)}}function Mi(A){A.RTCPeerConnection&&!("removeStream"in A.RTCPeerConnection.prototype)&&(A.RTCPeerConnection.prototype.removeStream=function(A){fi("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&A.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function Li(A){A.DataChannel&&!A.RTCDataChannel&&(A.RTCDataChannel=A.DataChannel)}function xi(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype.addTransceiver;t&&(A.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let A=arguments[1]&&arguments[1].sendEncodings;void 0===A&&(A=[]),A=[...A];const e=A.length>0;e&&A.forEach((A=>{if("rid"in A&&!/^[a-z0-9]{0,16}$/i.test(A.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in A&&!(parseFloat(A.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in A&&!(parseFloat(A.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const i=t.apply(this,arguments);if(e){const{sender:t}=i,e=t.getParameters();(!("encodings"in e)||1===e.encodings.length&&0===Object.keys(e.encodings[0]).length)&&(e.encodings=A,t.sendEncodings=A,this.setParametersPromises.push(t.setParameters(e).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return i})}function _i(A){if("object"!=typeof A||!A.RTCRtpSender)return;const t=A.RTCRtpSender.prototype.getParameters;t&&(A.RTCRtpSender.prototype.getParameters=function(){const A=t.apply(this,arguments);return"encodings"in A||(A.encodings=[].concat(this.sendEncodings||[{}])),A})}function Ri(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function Ni(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype.createAnswer;A.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var ji=Object.freeze({__proto__:null,shimAddTransceiver:xi,shimCreateAnswer:Ni,shimCreateOffer:Ri,shimGetDisplayMedia:function(A,t){A.navigator.mediaDevices&&"getDisplayMedia"in A.navigator.mediaDevices||A.navigator.mediaDevices&&(A.navigator.mediaDevices.getDisplayMedia=function(e){if(!e||!e.video){const A=new DOMException("getDisplayMedia without video constraints is undefined");return A.name="NotFoundError",A.code=8,Promise.reject(A)}return!0===e.video?e.video={mediaSource:t}:e.video.mediaSource=t,A.navigator.mediaDevices.getUserMedia(e)})},shimGetParameters:_i,shimGetUserMedia:Ti,shimOnTrack:Si,shimPeerConnection:Oi,shimRTCDataChannel:Li,shimReceiverGetStats:Di,shimRemoveStream:Mi,shimSenderGetStats:Ki});function Gi(A){if("object"==typeof A&&A.RTCPeerConnection){if("getLocalStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getLocalStreams=function(){return this.AA||(this.AA=[]),this.AA}),!("addStream"in A.RTCPeerConnection.prototype)){const t=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addStream=function(A){this.AA||(this.AA=[]),this.AA.includes(A)||this.AA.push(A),A.getAudioTracks().forEach((e=>t.call(this,e,A))),A.getVideoTracks().forEach((e=>t.call(this,e,A)))},A.RTCPeerConnection.prototype.addTrack=function(A){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return i&&i.forEach((A=>{this.AA?this.AA.includes(A)||this.AA.push(A):this.AA=[A]})),t.apply(this,arguments)}}"removeStream"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.removeStream=function(A){this.AA||(this.AA=[]);const t=this.AA.indexOf(A);if(-1===t)return;this.AA.splice(t,1);const e=A.getTracks();this.getSenders().forEach((A=>{e.includes(A.track)&&this.removeTrack(A)}))})}}function Pi(A){if("object"==typeof A&&A.RTCPeerConnection&&("getRemoteStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getRemoteStreams=function(){return this.tA?this.tA:[]}),!("onaddstream"in A.RTCPeerConnection.prototype))){Object.defineProperty(A.RTCPeerConnection.prototype,"onaddstream",{get(){return this.eA},set(A){this.eA&&(this.removeEventListener("addstream",this.eA),this.removeEventListener("track",this.iA)),this.addEventListener("addstream",this.eA=A),this.addEventListener("track",this.iA=A=>{A.streams.forEach((A=>{if(this.tA||(this.tA=[]),this.tA.includes(A))return;this.tA.push(A);const t=new Event("addstream");t.stream=A,this.dispatchEvent(t)}))})}});const t=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){const A=this;return this.iA||this.addEventListener("track",this.iA=function(t){t.streams.forEach((t=>{if(A.tA||(A.tA=[]),A.tA.indexOf(t)>=0)return;A.tA.push(t);const e=new Event("addstream");e.stream=t,A.dispatchEvent(e)}))}),t.apply(A,arguments)}}}function Vi(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype,e=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,r=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(A,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=e.apply(this,[i]);return t?(n.then(A,t),Promise.resolve()):n},t.createAnswer=function(A,t){const e=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[e]);return t?(n.then(A,t),Promise.resolve()):n};let o=function(A,t,e){const i=n.apply(this,[A]);return e?(i.then(t,e),Promise.resolve()):i};t.setLocalDescription=o,o=function(A,t,e){const i=r.apply(this,[A]);return e?(i.then(t,e),Promise.resolve()):i},t.setRemoteDescription=o,o=function(A,t,e){const i=s.apply(this,[A]);return e?(i.then(t,e),Promise.resolve()):i},t.addIceCandidate=o}function Ji(A){const t=A&&A.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const A=t.mediaDevices,e=A.getUserMedia.bind(A);t.mediaDevices.getUserMedia=A=>e(Xi(A))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(A,e,i){t.mediaDevices.getUserMedia(A).then(e,i)}.bind(t))}function Xi(A){return A&&void 0!==A.video?Object.assign({},A,{video:gi(A.video)}):A}function Yi(A){if(!A.RTCPeerConnection)return;const t=A.RTCPeerConnection;A.RTCPeerConnection=function(A,e){if(A&&A.iceServers){const t=[];for(let e=0;e<A.iceServers.length;e++){let i=A.iceServers[e];void 0===i.urls&&i.url?(fi("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(A.iceServers[e])}A.iceServers=t}return new t(A,e)},A.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(A.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function $i(A){"object"==typeof A&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Wi(A){const t=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(A){if(A){void 0!==A.offerToReceiveAudio&&(A.offerToReceiveAudio=!!A.offerToReceiveAudio);const t=this.getTransceivers().find((A=>"audio"===A.receiver.track.kind));!1===A.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==A.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==A.offerToReceiveVideo&&(A.offerToReceiveVideo=!!A.offerToReceiveVideo);const e=this.getTransceivers().find((A=>"video"===A.receiver.track.kind));!1===A.offerToReceiveVideo&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==A.offerToReceiveVideo||e||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Zi(A){"object"!=typeof A||A.AudioContext||(A.AudioContext=A.webkitAudioContext)}var qi,zi=Object.freeze({__proto__:null,shimAudioContext:Zi,shimCallbacksAPI:Vi,shimConstraints:Xi,shimCreateOfferLegacy:Wi,shimGetUserMedia:Ji,shimLocalStreamsAPI:Gi,shimRTCIceServerUrls:Yi,shimRemoteStreamsAPI:Pi,shimTrackEventTransceiver:$i}),An={exports:{}},tn=(qi||(qi=1,(function(A){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(A){return A.trim().split("\n").map((A=>A.trim()))},t.splitSections=function(A){return A.split("\nm=").map(((A,t)=>(t>0?"m="+A:A).trim()+"\r\n"))},t.getDescription=function(A){const e=t.splitSections(A);return e&&e[0]},t.getMediaSections=function(A){const e=t.splitSections(A);return e.shift(),e},t.matchPrefix=function(A,e){return t.splitLines(A).filter((A=>0===A.indexOf(e)))},t.parseCandidate=function(A){let t;t=0===A.indexOf("a=candidate:")?A.substring(12).split(" "):A.substring(10).split(" ");const e={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let i=8;i<t.length;i+=2)switch(t[i]){case"raddr":e.relatedAddress=t[i+1];break;case"rport":e.relatedPort=parseInt(t[i+1],10);break;case"tcptype":e.tcpType=t[i+1];break;case"ufrag":e.ufrag=t[i+1],e.usernameFragment=t[i+1];break;default:void 0===e[t[i]]&&(e[t[i]]=t[i+1])}return e},t.writeCandidate=function(A){const t=[];t.push(A.foundation);const e=A.component;"rtp"===e?t.push(1):"rtcp"===e?t.push(2):t.push(e),t.push(A.protocol.toUpperCase()),t.push(A.priority),t.push(A.address||A.ip),t.push(A.port);const i=A.type;return t.push("typ"),t.push(i),"host"!==i&&A.relatedAddress&&A.relatedPort&&(t.push("raddr"),t.push(A.relatedAddress),t.push("rport"),t.push(A.relatedPort)),A.tcpType&&"tcp"===A.protocol.toLowerCase()&&(t.push("tcptype"),t.push(A.tcpType)),(A.usernameFragment||A.ufrag)&&(t.push("ufrag"),t.push(A.usernameFragment||A.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(A){return A.substring(14).split(" ")},t.parseRtpMap=function(A){let t=A.substring(9).split(" ");const e={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),e.name=t[0],e.clockRate=parseInt(t[1],10),e.channels=3===t.length?parseInt(t[2],10):1,e.numChannels=e.channels,e},t.writeRtpMap=function(A){let t=A.payloadType;void 0!==A.preferredPayloadType&&(t=A.preferredPayloadType);const e=A.channels||A.numChannels||1;return"a=rtpmap:"+t+" "+A.name+"/"+A.clockRate+(1!==e?"/"+e:"")+"\r\n"},t.parseExtmap=function(A){const t=A.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(A){return"a=extmap:"+(A.id||A.preferredId)+(A.direction&&"sendrecv"!==A.direction?"/"+A.direction:"")+" "+A.uri+(A.attributes?" "+A.attributes:"")+"\r\n"},t.parseFmtp=function(A){const t={};let e;const i=A.substring(A.indexOf(" ")+1).split(";");for(let n=0;n<i.length;n++)e=i[n].trim().split("="),t[e[0].trim()]=e[1];return t},t.writeFmtp=function(A){let t="",e=A.payloadType;if(void 0!==A.preferredPayloadType&&(e=A.preferredPayloadType),A.parameters&&Object.keys(A.parameters).length){const i=[];Object.keys(A.parameters).forEach((t=>{void 0!==A.parameters[t]?i.push(t+"="+A.parameters[t]):i.push(t)})),t+="a=fmtp:"+e+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(A){const t=A.substring(A.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(A){let t="",e=A.payloadType;return void 0!==A.preferredPayloadType&&(e=A.preferredPayloadType),A.rtcpFeedback&&A.rtcpFeedback.length&&A.rtcpFeedback.forEach((A=>{t+="a=rtcp-fb:"+e+" "+A.type+(A.parameter&&A.parameter.length?" "+A.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(A){const t=A.indexOf(" "),e={ssrc:parseInt(A.substring(7,t),10)},i=A.indexOf(":",t);return i>-1?(e.attribute=A.substring(t+1,i),e.value=A.substring(i+1)):e.attribute=A.substring(t+1),e},t.parseSsrcGroup=function(A){const t=A.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((A=>parseInt(A,10)))}},t.getMid=function(A){const e=t.matchPrefix(A,"a=mid:")[0];if(e)return e.substring(6)},t.parseFingerprint=function(A){const t=A.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(A,e){return{role:"auto",fingerprints:t.matchPrefix(A+e,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(A,t){let e="a=setup:"+t+"\r\n";return A.fingerprints.forEach((A=>{e+="a=fingerprint:"+A.algorithm+" "+A.value+"\r\n"})),e},t.parseCryptoLine=function(A){const t=A.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(A){return"a=crypto:"+A.tag+" "+A.cryptoSuite+" "+("object"==typeof A.keyParams?t.writeCryptoKeyParams(A.keyParams):A.keyParams)+(A.sessionParams?" "+A.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(A){if(0!==A.indexOf("inline:"))return null;const t=A.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(A){return A.keyMethod+":"+A.keySalt+(A.lifeTime?"|"+A.lifeTime:"")+(A.mkiValue&&A.mkiLength?"|"+A.mkiValue+":"+A.mkiLength:"")},t.getCryptoParameters=function(A,e){return t.matchPrefix(A+e,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(A,e){const i=t.matchPrefix(A+e,"a=ice-ufrag:")[0],n=t.matchPrefix(A+e,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substring(12),password:n.substring(10)}:null},t.writeIceParameters=function(A){let t="a=ice-ufrag:"+A.usernameFragment+"\r\na=ice-pwd:"+A.password+"\r\n";return A.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(A){const e={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(A)[0].split(" ");e.profile=i[2];for(let r=3;r<i.length;r++){const n=i[r],s=t.matchPrefix(A,"a=rtpmap:"+n+" ")[0];if(s){const i=t.parseRtpMap(s),r=t.matchPrefix(A,"a=fmtp:"+n+" ");switch(i.parameters=r.length?t.parseFmtp(r[0]):{},i.rtcpFeedback=t.matchPrefix(A,"a=rtcp-fb:"+n+" ").map(t.parseRtcpFb),e.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":e.fecMechanisms.push(i.name.toUpperCase())}}}t.matchPrefix(A,"a=extmap:").forEach((A=>{e.headerExtensions.push(t.parseExtmap(A))}));const n=t.matchPrefix(A,"a=rtcp-fb:* ").map(t.parseRtcpFb);return e.codecs.forEach((A=>{n.forEach((t=>{A.rtcpFeedback.find((A=>A.type===t.type&&A.parameter===t.parameter))||A.rtcpFeedback.push(t)}))})),e},t.writeRtpDescription=function(A,e){let i="";i+="m="+A+" ",i+=e.codecs.length>0?"9":"0",i+=" "+(e.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=e.codecs.map((A=>void 0!==A.preferredPayloadType?A.preferredPayloadType:A.payloadType)).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",e.codecs.forEach((A=>{i+=t.writeRtpMap(A),i+=t.writeFmtp(A),i+=t.writeRtcpFb(A)}));let n=0;return e.codecs.forEach((A=>{A.maxptime>n&&(n=A.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),e.headerExtensions&&e.headerExtensions.forEach((A=>{i+=t.writeExtmap(A)})),i},t.parseRtpEncodingParameters=function(A){const e=[],i=t.parseRtpParameters(A),n=-1!==i.fecMechanisms.indexOf("RED"),r=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(A,"a=ssrc:").map((A=>t.parseSsrcMedia(A))).filter((A=>"cname"===A.attribute)),o=s.length>0&&s[0].ssrc;let a;const c=t.matchPrefix(A,"a=ssrc-group:FID").map((A=>A.substring(17).split(" ").map((A=>parseInt(A,10)))));c.length>0&&c[0].length>1&&c[0][0]===o&&(a=c[0][1]),i.codecs.forEach((A=>{if("RTX"===A.name.toUpperCase()&&A.parameters.apt){let t={ssrc:o,codecPayloadType:parseInt(A.parameters.apt,10)};o&&a&&(t.rtx={ssrc:a}),e.push(t),n&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:o,mechanism:r?"red+ulpfec":"red"},e.push(t))}})),0===e.length&&o&&e.push({ssrc:o});let u=t.matchPrefix(A,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,e.forEach((A=>{A.maxBitrate=u}))),e},t.parseRtcpParameters=function(A){const e={},i=t.matchPrefix(A,"a=ssrc:").map((A=>t.parseSsrcMedia(A))).filter((A=>"cname"===A.attribute))[0];i&&(e.cname=i.value,e.ssrc=i.ssrc);const n=t.matchPrefix(A,"a=rtcp-rsize");e.reducedSize=n.length>0,e.compound=0===n.length;const r=t.matchPrefix(A,"a=rtcp-mux");return e.mux=r.length>0,e},t.writeRtcpParameters=function(A){let t="";return A.reducedSize&&(t+="a=rtcp-rsize\r\n"),A.mux&&(t+="a=rtcp-mux\r\n"),void 0!==A.ssrc&&A.cname&&(t+="a=ssrc:"+A.ssrc+" cname:"+A.cname+"\r\n"),t},t.parseMsid=function(A){let e;const i=t.matchPrefix(A,"a=msid:");if(1===i.length)return e=i[0].substring(7).split(" "),{stream:e[0],track:e[1]};const n=t.matchPrefix(A,"a=ssrc:").map((A=>t.parseSsrcMedia(A))).filter((A=>"msid"===A.attribute));return n.length>0?(e=n[0].value.split(" "),{stream:e[0],track:e[1]}):void 0},t.parseSctpDescription=function(A){const e=t.parseMLine(A),i=t.matchPrefix(A,"a=max-message-size:");let n;i.length>0&&(n=parseInt(i[0].substring(19),10)),isNaN(n)&&(n=65536);const r=t.matchPrefix(A,"a=sctp-port:");if(r.length>0)return{port:parseInt(r[0].substring(12),10),protocol:e.fmt,maxMessageSize:n};const s=t.matchPrefix(A,"a=sctpmap:");if(s.length>0){const A=s[0].substring(10).split(" ");return{port:parseInt(A[0],10),protocol:A[1],maxMessageSize:n}}},t.writeSctpDescription=function(A,t){let e=[];return e="DTLS/SCTP"!==A.protocol?["m="+A.kind+" 9 "+A.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+A.kind+" 9 "+A.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&e.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),e.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(A,e,i){let n;const r=void 0!==e?e:2;return n=A||t.generateSessionId(),"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+r+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(A,e){const i=t.splitLines(A);for(let t=0;t<i.length;t++)switch(i[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[t].substring(2)}return e?t.getDirection(e):"sendrecv"},t.getKind=function(A){return t.splitLines(A)[0].split(" ")[0].substring(2)},t.isRejected=function(A){return"0"===A.split(" ",2)[1]},t.parseMLine=function(A){const e=t.splitLines(A)[0].substring(2).split(" ");return{kind:e[0],port:parseInt(e[1],10),protocol:e[2],fmt:e.slice(3).join(" ")}},t.parseOLine=function(A){const e=t.matchPrefix(A,"o=")[0].substring(2).split(" ");return{username:e[0],sessionId:e[1],sessionVersion:parseInt(e[2],10),netType:e[3],addressType:e[4],address:e[5]}},t.isValidSDP=function(A){if("string"!=typeof A||0===A.length)return!1;const e=t.splitLines(A);for(let t=0;t<e.length;t++)if(e[t].length<2||"="!==e[t].charAt(1))return!1;return!0},A.exports=t})(An)),An.exports),en=Ne(tn),nn=B({__proto__:null,default:en},[tn]);function rn(A){if(!A.RTCIceCandidate||A.RTCIceCandidate&&"foundation"in A.RTCIceCandidate.prototype)return;const t=A.RTCIceCandidate;A.RTCIceCandidate=function(A){if("object"==typeof A&&A.candidate&&0===A.candidate.indexOf("a=")&&((A=JSON.parse(JSON.stringify(A))).candidate=A.candidate.substring(2)),A.candidate&&A.candidate.length){const e=new t(A),i=en.parseCandidate(A.candidate);for(const A in i)A in e||Object.defineProperty(e,A,{value:i[A]});return e.toJSON=function(){return{candidate:e.candidate,sdpMid:e.sdpMid,sdpMLineIndex:e.sdpMLineIndex,usernameFragment:e.usernameFragment}},e}return new t(A)},A.RTCIceCandidate.prototype=t.prototype,hi(A,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new A.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function sn(A){!A.RTCIceCandidate||A.RTCIceCandidate&&"relayProtocol"in A.RTCIceCandidate.prototype||hi(A,"icecandidate",(A=>{if(A.candidate){const t=en.parseCandidate(A.candidate.candidate);"relay"===t.type&&(A.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return A}))}function on(A,t){if(!A.RTCPeerConnection)return;"sctp"in A.RTCPeerConnection.prototype||Object.defineProperty(A.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this.nA?null:this.nA}});const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this.nA=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:A}=this.getConfiguration();"plan-b"===A&&Object.defineProperty(this,"sctp",{get(){return void 0===this.nA?null:this.nA},enumerable:!0,configurable:!0})}if((function(A){if(!A||!A.sdp)return!1;const t=en.splitSections(A.sdp);return t.shift(),t.some((A=>{const t=en.parseMLine(A);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))})(arguments[0])){const A=(function(A){const t=A.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const e=parseInt(t[1],10);return e!=e?-1:e})(arguments[0]),e=(function(A){let e=65536;return"firefox"===t.browser&&(e=t.version<57?-1===A?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),e})(A),i=(function(A,e){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=en.matchPrefix(A.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substring(19),10):"firefox"===t.browser&&-1!==e&&(i=2147483637),i})(arguments[0],A);let n;n=0===e&&0===i?Number.POSITIVE_INFINITY:0===e||0===i?Math.max(e,i):Math.min(e,i);const r={};Object.defineProperty(r,"maxMessageSize",{get:()=>n}),this.nA=r}return e.apply(this,arguments)}}function an(A){if(!A.RTCPeerConnection||!("createDataChannel"in A.RTCPeerConnection.prototype))return;function t(A,t){const e=A.send;A.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===A.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return e.apply(A,arguments)}}const e=A.RTCPeerConnection.prototype.createDataChannel;A.RTCPeerConnection.prototype.createDataChannel=function(){const A=e.apply(this,arguments);return t(A,this),A},hi(A,"datachannel",(A=>(t(A.channel,A.target),A)))}function cn(A){if(!A.RTCPeerConnection||"connectionState"in A.RTCPeerConnection.prototype)return;const t=A.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this.rA||null},set(A){this.rA&&(this.removeEventListener("connectionstatechange",this.rA),delete this.rA),A&&this.addEventListener("connectionstatechange",this.rA=A)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((A=>{const e=t[A];t[A]=function(){return this.sA||(this.sA=A=>{const t=A.target;if(t.oA!==t.connectionState){t.oA=t.connectionState;const e=new Event("connectionstatechange",A);t.dispatchEvent(e)}return A},this.addEventListener("iceconnectionstatechange",this.sA)),e.apply(this,arguments)}}))}function un(A,t){if(!A.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const e=t.sdp.split("\n").filter((A=>"a=extmap-allow-mixed"!==A.trim())).join("\n");A.RTCSessionDescription&&t instanceof A.RTCSessionDescription?arguments[0]=new A.RTCSessionDescription({type:t.type,sdp:e}):t.sdp=e}return e.apply(this,arguments)}}function hn(A,t){if(!A.RTCPeerConnection||!A.RTCPeerConnection.prototype)return;const e=A.RTCPeerConnection.prototype.addIceCandidate;e&&0!==e.length&&(A.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ln(A,t){if(!A.RTCPeerConnection||!A.RTCPeerConnection.prototype)return;const e=A.RTCPeerConnection.prototype.setLocalDescription;e&&0!==e.length&&(A.RTCPeerConnection.prototype.setLocalDescription=function(){let A=arguments[0]||{};if("object"!=typeof A||A.type&&A.sdp)return e.apply(this,arguments);if(A={type:A.type,sdp:A.sdp},!A.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":A.type="offer";break;default:A.type="answer"}return A.sdp||"offer"!==A.type&&"answer"!==A.type?e.apply(this,[A]):("offer"===A.type?this.createOffer:this.createAnswer).apply(this).then((A=>e.apply(this,[A])))})}var dn=Object.freeze({__proto__:null,removeExtmapAllowMixed:un,shimAddIceCandidateNullOrEmpty:hn,shimConnectionState:cn,shimMaxMessageSize:on,shimParameterlessSetLocalDescription:ln,shimRTCIceCandidate:rn,shimRTCIceCandidateRelayProtocol:sn,shimSendThrowTypeError:an});!(function(){let{window:A}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const e=Bi,i=(function(A){const t={browser:null,version:null};if(void 0===A||!A.navigator||!A.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:e}=A;if(e.userAgentData&&e.userAgentData.brands){const A=e.userAgentData.brands.find((A=>"Chromium"===A.brand));if(A)return{browser:"chrome",version:parseInt(A.version,10)}}if(e.mozGetUserMedia)t.browser="firefox",t.version=ui(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia||!1===A.isSecureContext&&A.webkitRTCPeerConnection)t.browser="chrome",t.version=ui(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!A.RTCPeerConnection||!e.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=ui(e.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=A.RTCRtpTransceiver&&"currentDirection"in A.RTCRtpTransceiver.prototype}return t})(A),n={browserDetails:i,commonShim:dn,extractVersion:ui,disableLog:li,disableWarnings:di,sdp:nn};switch(i.browser){case"chrome":if(!ki||!Ii||!t.shimChrome)return e("Chrome shim is not included in this adapter release."),n;if(null===i.version)return e("Chrome shim can not determine version, not shimming."),n;e("adapter.js shimming chrome."),n.browserShim=ki,hn(A,i),ln(A),Qi(A,i),Ui(A),Ii(A,i),Ci(A),Ei(A,i),Fi(A),yi(A),Hi(A,i),rn(A),sn(A),cn(A),on(A,i),an(A),un(A,i);break;case"firefox":if(!ji||!Oi||!t.shimFirefox)return e("Firefox shim is not included in this adapter release."),n;e("adapter.js shimming firefox."),n.browserShim=ji,hn(A,i),ln(A),Ti(A,i),Oi(A,i),Si(A),Mi(A),Ki(A),Di(A),Li(A),xi(A),_i(A),Ri(A),Ni(A),rn(A),cn(A),on(A,i),an(A);break;case"safari":if(!zi||!t.shimSafari)return e("Safari shim is not included in this adapter release."),n;e("adapter.js shimming safari."),n.browserShim=zi,hn(A,i),ln(A),Yi(A),Wi(A),Vi(A),Gi(A),Pi(A),$i(A),Ji(A),Zi(A),rn(A),sn(A),on(A,i),an(A),un(A,i);break;default:e("Unsupported browser!")}})({window:"undefined"==typeof window?void 0:window});const Bn="lk_e2ee";var fn,wn,gn,pn,vn,mn,Qn,Un,Cn,Fn,yn,bn,En,In,Hn,kn,Tn,Sn,On,Kn;function Dn(){return void 0!==window.RTCRtpScriptTransform}(wn=fn||(fn={})).SetKey="setKey",wn.RatchetRequest="ratchetRequest",wn.KeyRatcheted="keyRatcheted",(gn||(gn={})).KeyRatcheted="keyRatcheted",(vn=pn||(pn={})).ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",vn.EncryptionError="encryptionError",(mn||(mn={})).Error="cryptorError",oi.EventEmitter;class Mn extends Error{constructor(A,t){super(t||"an error has occured"),this.name="LiveKitError",this.code=A}}(Un=Qn||(Qn={}))[Un.NotAllowed=0]="NotAllowed",Un[Un.ServerUnreachable=1]="ServerUnreachable",Un[Un.InternalError=2]="InternalError",Un[Un.Cancelled=3]="Cancelled",Un[Un.LeaveRequest=4]="LeaveRequest";class Ln extends Mn{constructor(A,t,e,i){super(1,A),this.name="ConnectionError",this.status=e,this.reason=t,this.context=i,this.reasonName=Qn[t]}}class xn extends Mn{constructor(A){super(21,null!=A?A:"device is unsupported"),this.name="DeviceUnsupportedError"}}class _n extends Mn{constructor(A){super(20,null!=A?A:"track is invalid"),this.name="TrackInvalidError"}}class Rn extends Mn{constructor(A){super(10,null!=A?A:"unsupported server"),this.name="UnsupportedServer"}}class Nn extends Mn{constructor(A){super(12,null!=A?A:"unexpected connection state"),this.name="UnexpectedConnectionState"}}class jn extends Mn{constructor(A){super(13,null!=A?A:"unable to negotiate"),this.name="NegotiationError"}}class Gn extends Mn{constructor(A,t){super(15,A),this.name="PublishTrackError",this.status=t}}class Pn extends Mn{constructor(A,t){super(15,A),this.reason=t,this.reasonName="string"==typeof t?t:_e[t]}}(Fn=Cn||(Cn={})).PermissionDenied="PermissionDenied",Fn.NotFound="NotFound",Fn.DeviceInUse="DeviceInUse",Fn.Other="Other",(function(A){A.getFailure=function(t){if(t&&"name"in t)return"NotFoundError"===t.name||"DevicesNotFoundError"===t.name?A.NotFound:"NotAllowedError"===t.name||"PermissionDeniedError"===t.name?A.PermissionDenied:"NotReadableError"===t.name||"TrackStartError"===t.name?A.DeviceInUse:A.Other}})(Cn||(Cn={})),(bn=yn||(yn={}))[bn.InvalidKey=0]="InvalidKey",bn[bn.MissingKey=1]="MissingKey",bn[bn.InternalError=2]="InternalError",(In=En||(En={})).Connected="connected",In.Reconnecting="reconnecting",In.SignalReconnecting="signalReconnecting",In.Reconnected="reconnected",In.Disconnected="disconnected",In.ConnectionStateChanged="connectionStateChanged",In.Moved="moved",In.MediaDevicesChanged="mediaDevicesChanged",In.ParticipantConnected="participantConnected",In.ParticipantDisconnected="participantDisconnected",In.TrackPublished="trackPublished",In.TrackSubscribed="trackSubscribed",In.TrackSubscriptionFailed="trackSubscriptionFailed",In.TrackUnpublished="trackUnpublished",In.TrackUnsubscribed="trackUnsubscribed",In.TrackMuted="trackMuted",In.TrackUnmuted="trackUnmuted",In.LocalTrackPublished="localTrackPublished",In.LocalTrackUnpublished="localTrackUnpublished",In.LocalAudioSilenceDetected="localAudioSilenceDetected",In.ActiveSpeakersChanged="activeSpeakersChanged",In.ParticipantMetadataChanged="participantMetadataChanged",In.ParticipantNameChanged="participantNameChanged",In.ParticipantAttributesChanged="participantAttributesChanged",In.ParticipantActive="participantActive",In.RoomMetadataChanged="roomMetadataChanged",In.DataReceived="dataReceived",In.SipDTMFReceived="sipDTMFReceived",In.TranscriptionReceived="transcriptionReceived",In.ConnectionQualityChanged="connectionQualityChanged",In.TrackStreamStateChanged="trackStreamStateChanged",In.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",In.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",In.AudioPlaybackStatusChanged="audioPlaybackChanged",In.VideoPlaybackStatusChanged="videoPlaybackChanged",In.MediaDevicesError="mediaDevicesError",In.ParticipantPermissionsChanged="participantPermissionsChanged",In.SignalConnected="signalConnected",In.RecordingStatusChanged="recordingStatusChanged",In.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",In.EncryptionError="encryptionError",In.DCBufferStatusChanged="dcBufferStatusChanged",In.ActiveDeviceChanged="activeDeviceChanged",In.ChatMessage="chatMessage",In.LocalTrackSubscribed="localTrackSubscribed",In.MetricsReceived="metricsReceived",(kn=Hn||(Hn={})).TrackPublished="trackPublished",kn.TrackSubscribed="trackSubscribed",kn.TrackSubscriptionFailed="trackSubscriptionFailed",kn.TrackUnpublished="trackUnpublished",kn.TrackUnsubscribed="trackUnsubscribed",kn.TrackMuted="trackMuted",kn.TrackUnmuted="trackUnmuted",kn.LocalTrackPublished="localTrackPublished",kn.LocalTrackUnpublished="localTrackUnpublished",kn.ParticipantMetadataChanged="participantMetadataChanged",kn.ParticipantNameChanged="participantNameChanged",kn.DataReceived="dataReceived",kn.SipDTMFReceived="sipDTMFReceived",kn.TranscriptionReceived="transcriptionReceived",kn.IsSpeakingChanged="isSpeakingChanged",kn.ConnectionQualityChanged="connectionQualityChanged",kn.TrackStreamStateChanged="trackStreamStateChanged",kn.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",kn.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",kn.MediaDevicesError="mediaDevicesError",kn.AudioStreamAcquired="audioStreamAcquired",kn.ParticipantPermissionsChanged="participantPermissionsChanged",kn.PCTrackAdded="pcTrackAdded",kn.AttributesChanged="attributesChanged",kn.LocalTrackSubscribed="localTrackSubscribed",kn.ChatMessage="chatMessage",kn.Active="active",(Sn=Tn||(Tn={})).TransportsCreated="transportsCreated",Sn.Connected="connected",Sn.Disconnected="disconnected",Sn.Resuming="resuming",Sn.Resumed="resumed",Sn.Restarting="restarting",Sn.Restarted="restarted",Sn.SignalResumed="signalResumed",Sn.SignalRestarted="signalRestarted",Sn.Closing="closing",Sn.MediaTrackAdded="mediaTrackAdded",Sn.ActiveSpeakersUpdate="activeSpeakersUpdate",Sn.DataPacketReceived="dataPacketReceived",Sn.RTPVideoMapUpdate="rtpVideoMapUpdate",Sn.DCBufferStatusChanged="dcBufferStatusChanged",Sn.ParticipantUpdate="participantUpdate",Sn.RoomUpdate="roomUpdate",Sn.SpeakersChanged="speakersChanged",Sn.StreamStateChanged="streamStateChanged",Sn.ConnectionQualityUpdate="connectionQualityUpdate",Sn.SubscriptionError="subscriptionError",Sn.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",Sn.RemoteMute="remoteMute",Sn.SubscribedQualityUpdate="subscribedQualityUpdate",Sn.LocalTrackUnpublished="localTrackUnpublished",Sn.LocalTrackSubscribed="localTrackSubscribed",Sn.Offline="offline",Sn.SignalRequestResponse="signalRequestResponse",Sn.SignalConnected="signalConnected",Sn.RoomMoved="roomMoved",(Kn=On||(On={})).Message="message",Kn.Muted="muted",Kn.Unmuted="unmuted",Kn.Restarted="restarted",Kn.Ended="ended",Kn.Subscribed="subscribed",Kn.Unsubscribed="unsubscribed",Kn.UpdateSettings="updateSettings",Kn.UpdateSubscription="updateSubscription",Kn.AudioPlaybackStarted="audioPlaybackStarted",Kn.AudioPlaybackFailed="audioPlaybackFailed",Kn.AudioSilenceDetected="audioSilenceDetected",Kn.VisibilityChanged="visibilityChanged",Kn.VideoDimensionsChanged="videoDimensionsChanged",Kn.VideoPlaybackStarted="videoPlaybackStarted",Kn.VideoPlaybackFailed="videoPlaybackFailed",Kn.ElementAttached="elementAttached",Kn.ElementDetached="elementDetached",Kn.UpstreamPaused="upstreamPaused",Kn.UpstreamResumed="upstreamResumed",Kn.SubscriptionPermissionChanged="subscriptionPermissionChanged",Kn.SubscriptionStatusChanged="subscriptionStatusChanged",Kn.SubscriptionFailed="subscriptionFailed",Kn.TrackProcessorUpdate="trackProcessorUpdate",Kn.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",Kn.TranscriptionReceived="transcriptionReceived",Kn.TimeSyncUpdate="timeSyncUpdate";const Vn=/version\/(\d+(\.?_?\d+)+)/i;let Jn;function Xn(A){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===A&&"undefined"==typeof navigator)return;const e=(null!=A?A:navigator.userAgent).toLowerCase();if(void 0===Jn||t){const A=Yn.find((A=>{let{test:t}=A;return t.test(e)}));Jn=null==A?void 0:A.describe(e)}return Jn}const Yn=[{test:/firefox|iceweasel|fxios/i,describe:A=>({name:"Firefox",version:$n(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:Wn(A)})},{test:/chrom|crios|crmo/i,describe:A=>({name:"Chrome",version:$n(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("crios")?"iOS":void 0,osVersion:Wn(A)})},{test:/safari|applewebkit/i,describe:A=>({name:"Safari",version:$n(Vn,A),os:A.includes("mobile/")?"iOS":"macOS",osVersion:Wn(A)})}];function $n(A,t){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const i=t.match(A);return i&&i.length>=e&&i[e]||""}function Wn(A){return A.includes("mac os")?$n(/\(.+?(\d+_\d+(:?_\d+)?)/,A,1).replace(/_/g,"."):void 0}class Zn{}Zn.setTimeout=function(){return setTimeout(...arguments)},Zn.setInterval=function(){return setInterval(...arguments)},Zn.clearTimeout=function(){return clearTimeout(...arguments)},Zn.clearInterval=function(){return clearInterval(...arguments)};const qn=[];var zn,Ar;(Ar=zn||(zn={}))[Ar.LOW=0]="LOW",Ar[Ar.MEDIUM=1]="MEDIUM",Ar[Ar.HIGH=2]="HIGH";class tr extends oi.EventEmitter{constructor(A,t){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=tr.StreamState.Active,this.isInBackground=!1,this.aA=0,this.log=qe,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),"hidden"===document.visibilityState?this.backgroundTimeout=setTimeout((()=>this.handleAppVisibilityChanged()),5e3):this.handleAppVisibilityChanged()},this.log=ze(null!==(i=e.loggerName)&&void 0!==i?i:Ye.Track),this.loggerContextCb=e.loggerContextCb,this.setMaxListeners(100),this.kind=t,this.cA=A,this.uA=A.id,this.source=tr.Source.Unknown}get logContext(){var A;return Object.assign(Object.assign({},null===(A=this.loggerContextCb)||void 0===A?void 0:A.call(this)),as(this))}get currentBitrate(){return this.aA}get mediaStreamTrack(){return this.cA}get mediaStreamID(){return this.uA}attach(A){let t="audio";this.kind===tr.Kind.Video&&(t="video"),0===this.attachedElements.length&&this.kind===tr.Kind.Video&&this.addAppVisibilityListener(),A||("audio"===t&&(qn.forEach((t=>{null!==t.parentElement||A||(A=t)})),A&&qn.splice(qn.indexOf(A),1)),A||(A=document.createElement(t))),this.attachedElements.includes(A)||this.attachedElements.push(A),er(this.mediaStreamTrack,A);const e=A.srcObject.getTracks(),i=e.some((A=>"audio"===A.kind));return A.play().then((()=>{this.emit(i?On.AudioPlaybackStarted:On.VideoPlaybackStarted)})).catch((t=>{"NotAllowedError"===t.name?this.emit(i?On.AudioPlaybackFailed:On.VideoPlaybackFailed,t):"AbortError"===t.name?qe.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):qe.warn("could not playback ".concat(i?"audio":"video"),t),i&&A&&e.some((A=>"video"===A.kind))&&"NotAllowedError"===t.name&&(A.muted=!0,A.play().catch((()=>{})))})),this.emit(On.ElementAttached,A),A}detach(A){try{if(A){ir(this.mediaStreamTrack,A);const t=this.attachedElements.indexOf(A);return t>=0&&(this.attachedElements.splice(t,1),this.recycleElement(A),this.emit(On.ElementDetached,A)),A}const t=[];return this.attachedElements.forEach((A=>{ir(this.mediaStreamTrack,A),t.push(A),this.recycleElement(A),this.emit(On.ElementDetached,A)})),this.attachedElements=[],t}finally{0===this.attachedElements.length&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this.cA.stop()}enable(){this.cA.enabled=!0}disable(){this.cA.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(A){A.loggerName&&(this.log=ze(A.loggerName)),A.loggerContextCb&&(this.loggerContextCb=A.loggerContextCb)}recycleElement(A){if(A instanceof HTMLAudioElement){let t=!0;A.pause(),qn.forEach((A=>{A.parentElement||(t=!1)})),t&&qn.push(A)}}handleAppVisibilityChanged(){return ii(this,void 0,void 0,(function*(){this.isInBackground="hidden"===document.visibilityState,this.isInBackground||this.kind!==tr.Kind.Video||setTimeout((()=>this.attachedElements.forEach((A=>A.play().catch((()=>{}))))),0)}))}addAppVisibilityListener(){Fr()?(this.isInBackground="hidden"===document.visibilityState,document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Fr()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function er(A,t){let e,i;e=t.srcObject instanceof MediaStream?t.srcObject:new MediaStream,i="audio"===A.kind?e.getAudioTracks():e.getVideoTracks(),i.includes(A)||(i.forEach((A=>{e.removeTrack(A)})),e.addTrack(A)),Ur()&&t instanceof HTMLVideoElement||(t.autoplay=!0),t.muted=0===e.getAudioTracks().length,t instanceof HTMLVideoElement&&(t.playsInline=!0),t.srcObject!==e&&(t.srcObject=e,(Ur()||Qr())&&t instanceof HTMLVideoElement&&setTimeout((()=>{t.srcObject=e,t.play().catch((()=>{}))}),0))}function ir(A,t){if(t.srcObject instanceof MediaStream){const e=t.srcObject;e.removeTrack(A),e.getTracks().length>0?t.srcObject=e:t.srcObject=null}}!(function(A){let t;var e;let i;var n;let r;var s;(e=t=A.Kind||(A.Kind={})).Audio="audio",e.Video="video",e.Unknown="unknown",(n=i=A.Source||(A.Source={})).Camera="camera",n.Microphone="microphone",n.ScreenShare="screen_share",n.ScreenShareAudio="screen_share_audio",n.Unknown="unknown",(s=r=A.StreamState||(A.StreamState={})).Active="active",s.Paused="paused",s.Unknown="unknown",A.kindToProto=function(A){switch(A){case t.Audio:return zA.AUDIO;case t.Video:return zA.VIDEO;default:return zA.DATA}},A.kindFromProto=function(A){switch(A){case zA.AUDIO:return t.Audio;case zA.VIDEO:return t.Video;default:return t.Unknown}},A.sourceToProto=function(A){switch(A){case i.Camera:return At.CAMERA;case i.Microphone:return At.MICROPHONE;case i.ScreenShare:return At.SCREEN_SHARE;case i.ScreenShareAudio:return At.SCREEN_SHARE_AUDIO;default:return At.UNKNOWN}},A.sourceFromProto=function(A){switch(A){case At.CAMERA:return i.Camera;case At.MICROPHONE:return i.Microphone;case At.SCREEN_SHARE:return i.ScreenShare;case At.SCREEN_SHARE_AUDIO:return i.ScreenShareAudio;default:return i.Unknown}},A.streamStateFromProto=function(A){switch(A){case Yt.ACTIVE:return r.Active;case Yt.PAUSED:return r.Paused;default:return r.Unknown}}})(tr||(tr={}));class nr{constructor(A,t,e,i,n){if("object"==typeof A)this.width=A.width,this.height=A.height,this.aspectRatio=A.aspectRatio,this.encoding={maxBitrate:A.maxBitrate,maxFramerate:A.maxFramerate,priority:A.priority};else{if(void 0===t||void 0===e)throw new TypeError("Unsupported options: provide at least width, height and maxBitrate");this.width=A,this.height=t,this.aspectRatio=A/t,this.encoding={maxBitrate:e,maxFramerate:i,priority:n}}}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const rr=["vp8","h264"],sr=["vp8","h264","vp9","av1"];function or(A){return!!rr.find((t=>t===A))}var ar,cr,ur,hr;(cr=ar||(ar={}))[cr.PREFER_REGRESSION=0]="PREFER_REGRESSION",cr[cr.SIMULCAST=1]="SIMULCAST",cr[cr.REGRESSION=2]="REGRESSION",(hr=ur||(ur={})).telephone={maxBitrate:12e3},hr.speech={maxBitrate:24e3},hr.music={maxBitrate:48e3},hr.musicStereo={maxBitrate:64e3},hr.musicHighQuality={maxBitrate:96e3},hr.musicHighQualityStereo={maxBitrate:128e3};const lr={h90:new nr(160,90,9e4,20),h180:new nr(320,180,16e4,20),h216:new nr(384,216,18e4,20),h360:new nr(640,360,45e4,20),h540:new nr(960,540,8e5,25),h720:new nr(1280,720,17e5,30),h1080:new nr(1920,1080,3e6,30),h1440:new nr(2560,1440,5e6,30),h2160:new nr(3840,2160,8e6,30)},dr={h120:new nr(160,120,7e4,20),h180:new nr(240,180,125e3,20),h240:new nr(320,240,14e4,20),h360:new nr(480,360,33e4,20),h480:new nr(640,480,5e5,20),h540:new nr(720,540,6e5,25),h720:new nr(960,720,13e5,30),h1080:new nr(1440,1080,23e5,30),h1440:new nr(1920,1440,38e5,30)},Br={h360fps3:new nr(640,360,2e5,3,"medium"),h360fps15:new nr(640,360,4e5,15,"medium"),h720fps5:new nr(1280,720,8e5,5,"medium"),h720fps15:new nr(1280,720,15e5,15,"medium"),h720fps30:new nr(1280,720,2e6,30,"medium"),h1080fps15:new nr(1920,1080,25e5,15,"medium"),h1080fps30:new nr(1920,1080,5e6,30,"medium"),original:new nr(0,0,7e6,30,"medium")},fr="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function wr(A){return ii(this,void 0,void 0,(function*(){return new Promise((t=>Zn.setTimeout(t,A)))}))}function gr(){return"addTransceiver"in RTCPeerConnection.prototype}function pr(){return"addTrack"in RTCPeerConnection.prototype}function vr(A){return"av1"===A||"vp9"===A}function mr(A){return!!document&&(A||(A=document.createElement("audio")),"setSinkId"in A)}function Qr(){var A;return"Firefox"===(null===(A=Xn())||void 0===A?void 0:A.name)}function Ur(){var A;return"Safari"===(null===(A=Xn())||void 0===A?void 0:A.name)}function Cr(){var A,t;return!!Fr()&&(null!==(t=null===(A=navigator.userAgentData)||void 0===A?void 0:A.mobile)&&void 0!==t?t:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent))}function Fr(){return"undefined"!=typeof document}function yr(){return"ReactNative"==navigator.product}function br(A){return A.hostname.endsWith(".livekit.cloud")||A.hostname.endsWith(".livekit.run")}function Er(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Ir(){if(!yr())return;let A=Er();return A?A.platform:void 0}function Hr(){if(Fr())return window.devicePixelRatio;if(yr()){let A=Er();if(A)return A.devicePixelRatio}return 1}function kr(A,t){const e=A.split("."),i=t.split("."),n=Math.min(e.length,i.length);for(let r=0;r<n;++r){const A=parseInt(e[r],10),t=parseInt(i[r],10);if(A>t)return 1;if(A<t)return-1;if(r===n-1&&A===t)return 0}return""===A&&""!==t?-1:""===t?1:e.length==i.length?0:e.length<i.length?-1:1}function Tr(A){for(const t of A)t.target.handleResize(t)}function Sr(A){for(const t of A)t.target.handleVisibilityChanged(t)}let Or=null;const Kr=()=>(Or||(Or=new ResizeObserver(Tr)),Or);let Dr=null;const Mr=()=>(Dr||(Dr=new IntersectionObserver(Sr,{root:null,rootMargin:"0px"})),Dr);function Lr(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=document.createElement("canvas");n.width=A,n.height=t;const r=n.getContext("2d");null==r||r.fillRect(0,0,n.width,n.height),i&&r&&(r.beginPath(),r.arc(A/2,t/2,50,0,2*Math.PI,!0),r.closePath(),r.fillStyle="grey",r.fill());const s=n.captureStream(),[o]=s.getTracks();if(!o)throw Error("Could not get empty media stream video track");return o.enabled=e,o}let xr;function _r(){if(!xr){const A=new AudioContext,t=A.createOscillator(),e=A.createGain();e.gain.setValueAtTime(0,0);const i=A.createMediaStreamDestination();if(t.connect(e),e.connect(i),t.start(),[xr]=i.stream.getAudioTracks(),!xr)throw Error("Could not get empty media stream audio track");xr.enabled=!1}return xr.clone()}class Rr{constructor(A,t){this.onFinally=t,this.promise=new Promise(((t,e)=>ii(this,void 0,void 0,(function*(){this.resolve=t,this.reject=e,A&&(yield A(t,e))})))).finally((()=>{var A;return null===(A=this.onFinally)||void 0===A?void 0:A.call(this)}))}}function Nr(A){if("string"==typeof A||"number"==typeof A)return A;if(Array.isArray(A))return A[0];if(A.exact)return Array.isArray(A.exact)?A.exact[0]:A.exact;if(A.ideal)return Array.isArray(A.ideal)?A.ideal[0]:A.ideal;throw Error("could not unwrap constraint")}function jr(A){return A.startsWith("ws")?A.replace(/^(ws)/,"http"):A}function Gr(A){switch(A.reason){case Qn.LeaveRequest:return A.context;case Qn.Cancelled:return nt.CLIENT_INITIATED;case Qn.NotAllowed:return nt.USER_REJECTED;case Qn.ServerUnreachable:return nt.JOIN_FAILURE;default:return nt.UNKNOWN_REASON}}function Pr(A){return void 0!==A?Number(A):void 0}function Vr(A){return void 0!==A?BigInt(A):void 0}function Jr(A){return!!A&&!(A instanceof MediaStreamTrack)&&A.isLocal}function Xr(A){return!!A&&A.kind==tr.Kind.Audio}function Yr(A){return!!A&&A.kind==tr.Kind.Video}function $r(A){return Jr(A)&&Yr(A)}function Wr(A){return Jr(A)&&Xr(A)}function Zr(A){return!!A&&!A.isLocal}function qr(A){return!!A&&!A.isLocal}function zr(A){return Zr(A)&&Yr(A)}function As(A,t,e){var i,n,r,s;const{optionsWithoutProcessor:o,audioProcessor:a,videoProcessor:c}=cs(null!=A?A:{}),u=null==t?void 0:t.processor,h=null==e?void 0:e.processor,l=null!=o?o:{};return!0===l.audio&&(l.audio={}),!0===l.video&&(l.video={}),l.audio&&(ts(l.audio,t),null!==(i=(r=l.audio).deviceId)&&void 0!==i||(r.deviceId={ideal:"default"}),(a||u)&&(l.audio.processor=null!=a?a:u)),l.video&&(ts(l.video,e),null!==(n=(s=l.video).deviceId)&&void 0!==n||(s.deviceId={ideal:"default"}),(c||h)&&(l.video.processor=null!=c?c:h)),l}function ts(A,t){return Object.keys(t).forEach((e=>{void 0===A[e]&&(A[e]=t[e])})),A}function es(A){var t,e,i,n;const r={};if(A.video)if("object"==typeof A.video){const e={},n=e,s=A.video;Object.keys(s).forEach((A=>{"resolution"===A?ts(n,s.resolution):n[A]=s[A]})),r.video=e,null!==(t=(i=r.video).deviceId)&&void 0!==t||(i.deviceId={ideal:"default"})}else r.video=!!A.video&&{deviceId:{ideal:"default"}};else r.video=!1;return A.audio?"object"==typeof A.audio?(r.audio=A.audio,null!==(e=(n=r.audio).deviceId)&&void 0!==e||(n.deviceId={ideal:"default"})):r.audio={deviceId:{ideal:"default"}}:r.audio=!1,r}function is(){var A;const t="undefined"!=typeof window&&(window.AudioContext||window.webkitAudioContext);if(t){const e=new t({latencyHint:"interactive"});if("suspended"===e.state&&"undefined"!=typeof window&&(null===(A=window.document)||void 0===A?void 0:A.body)){const A=()=>ii(this,void 0,void 0,(function*(){var t;try{"suspended"===e.state&&(yield e.resume())}catch(i){console.warn("Error trying to auto-resume audio context",i)}null===(t=window.document.body)||void 0===t||t.removeEventListener("click",A)}));window.document.body.addEventListener("click",A)}return e}}function ns(A){return"audioinput"===A?tr.Source.Microphone:"videoinput"===A?tr.Source.Camera:tr.Source.Unknown}function rs(A){return A===tr.Source.Microphone?"audioinput":A===tr.Source.Camera?"videoinput":void 0}function ss(A){return A.split("/")[1].toLowerCase()}function os(A){const t=[];return A.forEach((A=>{void 0!==A.track&&t.push(new ne({cid:A.track.mediaStreamID,track:A.trackInfo}))})),t}function as(A){return"mediaStreamTrack"in A?{trackID:A.sid,source:A.source,muted:A.isMuted,enabled:A.mediaStreamTrack.enabled,kind:A.kind,streamID:A.mediaStreamID,streamTrackID:A.mediaStreamTrack.id}:{trackID:A.trackSid,enabled:A.isEnabled,muted:A.isMuted,trackInfo:Object.assign({mimeType:A.mimeType,name:A.trackName,encrypted:A.isEncrypted,kind:A.kind,source:A.source},A.track?as(A.track):{})}}function cs(A){const t=Object.assign({},A);let e,i;return"object"==typeof t.audio&&t.audio.processor&&(e=t.audio.processor,t.audio=Object.assign(Object.assign({},t.audio),{processor:void 0})),"object"==typeof t.video&&t.video.processor&&(i=t.video.processor,t.video=Object.assign(Object.assign({},t.video),{processor:void 0})),{audioProcessor:e,videoProcessor:i,optionsWithoutProcessor:(n=t,void 0===n?n:"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n)))};var n}class us extends oi.EventEmitter{constructor(A){super(),this.onWorkerMessage=A=>{var t,e;const{kind:i,data:n}=A.data;switch(i){case"error":qe.error(n.error.message),this.emit(pn.EncryptionError,n.error);break;case"initAck":n.enabled&&this.keyProvider.getKeys().forEach((A=>{this.postKey(A)}));break;case"enable":if(n.enabled&&this.keyProvider.getKeys().forEach((A=>{this.postKey(A)})),this.encryptionEnabled!==n.enabled&&n.participantIdentity===(null===(t=this.room)||void 0===t?void 0:t.localParticipant.identity))this.emit(pn.ParticipantEncryptionStatusChanged,n.enabled,this.room.localParticipant),this.encryptionEnabled=n.enabled;else if(n.participantIdentity){const A=null===(e=this.room)||void 0===e?void 0:e.getParticipantByIdentity(n.participantIdentity);if(!A)throw TypeError("couldn't set encryption status, participant not found".concat(n.participantIdentity));this.emit(pn.ParticipantEncryptionStatusChanged,n.enabled,A)}break;case"ratchetKey":this.keyProvider.emit(fn.KeyRatcheted,n.ratchetResult,n.participantIdentity,n.keyIndex)}},this.onWorkerError=A=>{qe.error("e2ee worker encountered an error:",{error:A.error}),this.emit(pn.EncryptionError,A.error)},this.keyProvider=A.keyProvider,this.worker=A.worker,this.encryptionEnabled=!1}setup(A){if(!(void 0!==window.RTCRtpSender&&void 0!==window.RTCRtpSender.prototype.createEncodedStreams||Dn()))throw new xn("tried to setup end-to-end encryption on an unsupported browser");if(qe.info("setting up e2ee"),A!==this.room){this.room=A,this.setupEventListeners(A,this.keyProvider);const t={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Ai.getLevel()}};this.worker&&(qe.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(A,t){qe.debug("set e2ee to ".concat(A," for participant ").concat(t)),this.postEnable(A,t)}setSifTrailer(A){A&&0!==A.length?this.postSifTrailer(A):qe.warn("ignoring server sent trailer as it's empty")}setupEngine(A){A.on(Tn.RTPVideoMapUpdate,(A=>{this.postRTPMap(A)}))}setupEventListeners(A,t){A.on(En.TrackPublished,((A,t)=>this.setParticipantCryptorEnabled(A.trackInfo.encryption!==ft.NONE,t.identity))),A.on(En.ConnectionStateChanged,(t=>{t===Ho.Connected&&A.remoteParticipants.forEach((A=>{A.trackPublications.forEach((t=>{this.setParticipantCryptorEnabled(t.trackInfo.encryption!==ft.NONE,A.identity)}))}))})).on(En.TrackUnsubscribed,((A,t,e)=>{var i;const n={kind:"removeTransform",data:{participantIdentity:e.identity,trackId:A.mediaStreamID}};null===(i=this.worker)||void 0===i||i.postMessage(n)})).on(En.TrackSubscribed,((A,t,e)=>{this.setupE2EEReceiver(A,e.identity,t.trackInfo)})).on(En.SignalConnected,(()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");t.getKeys().forEach((A=>{this.postKey(A)})),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)})),A.localParticipant.on(Hn.LocalTrackPublished,(A=>ii(this,void 0,void 0,(function*(){this.setupE2EESender(A.track,A.track.sender)})))),t.on(fn.SetKey,(A=>this.postKey(A))).on(fn.RatchetRequest,((A,t)=>this.postRatchetRequest(A,t)))}postRatchetRequest(A,t){if(!this.worker)throw Error("could not ratchet key, worker is missing");const e={kind:"ratchetRequest",data:{participantIdentity:A,keyIndex:t}};this.worker.postMessage(e)}postKey(A){let{key:t,participantIdentity:e,keyIndex:i}=A;var n;if(!this.worker)throw Error("could not set key, worker is missing");const r={kind:"setKey",data:{participantIdentity:e,isPublisher:e===(null===(n=this.room)||void 0===n?void 0:n.localParticipant.identity),key:t,keyIndex:i}};this.worker.postMessage(r)}postEnable(A,t){if(!this.worker)throw new ReferenceError("failed to enable e2ee, worker is not ready");{const e={kind:"enable",data:{enabled:A,participantIdentity:t}};this.worker.postMessage(e)}}postRTPMap(A){var t;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(null===(t=this.room)||void 0===t?void 0:t.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const e={kind:"setRTPMap",data:{map:A,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(e)}postSifTrailer(A){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const t={kind:"setSifTrailer",data:{trailer:A}};this.worker.postMessage(t)}setupE2EEReceiver(A,t,e){if(A.receiver){if(!(null==e?void 0:e.mimeType)||""===e.mimeType)throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(A.receiver,A.mediaStreamID,t,"video"===A.kind?ss(e.mimeType):void 0)}}setupE2EESender(A,t){Jr(A)&&t?this.handleSender(t,A.mediaStreamID,void 0):t||qe.warn("early return because sender is not ready")}handleReceiver(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(this.worker){if(Dn()){const n={kind:"decode",participantIdentity:e,trackId:t,codec:i};A.transform=new RTCRtpScriptTransform(this.worker,n)}else{if(Bn in A&&i){const A={kind:"updateCodec",data:{trackId:t,codec:i,participantIdentity:e}};return void this.worker.postMessage(A)}let n=A.writableStream,r=A.readableStream;if(!n||!r){const t=A.createEncodedStreams();A.writableStream=t.writable,n=t.writable,A.readableStream=t.readable,r=t.readable}const s={kind:"decode",data:{readableStream:r,writableStream:n,trackId:t,codec:i,participantIdentity:e}};this.worker.postMessage(s,[r,n])}A[Bn]=!0}}))}handleSender(A,t,e){var i;if(!(Bn in A)&&this.worker){if(!(null===(i=this.room)||void 0===i?void 0:i.localParticipant.identity)||""===this.room.localParticipant.identity)throw TypeError("local identity needs to be known in order to set up encrypted sender");if(Dn()){qe.info("initialize script transform");const i={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:t,codec:e};A.transform=new RTCRtpScriptTransform(this.worker,i)}else{qe.info("initialize encoded streams");const i=A.createEncodedStreams(),n={kind:"encode",data:{readableStream:i.readable,writableStream:i.writable,codec:e,trackId:t,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n,[i.readable,i.writable])}A[Bn]=!0}}}const hs="default";class ls{constructor(){this.hA=[]}static getInstance(){return void 0===this.instance&&(this.instance=new ls),this.instance}get previousDevices(){return this.hA}getDevices(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){var i;if((null===(i=ls.userMediaPromiseMap)||void 0===i?void 0:i.size)>0){qe.debug("awaiting getUserMedia promise");try{A?yield ls.userMediaPromiseMap.get(A):yield Promise.all(ls.userMediaPromiseMap.values())}catch(r){qe.warn("error waiting for media permissons")}}let n=yield navigator.mediaDevices.enumerateDevices();if(e&&(!Ur()||!t.hasDeviceInUse(A))&&(0===n.filter((t=>t.kind===A)).length||n.some((t=>{const e=""===t.label,i=!A||t.kind===A;return e&&i})))){const t={video:"audioinput"!==A&&"audiooutput"!==A,audio:"videoinput"!==A&&{deviceId:{ideal:"default"}}},e=yield navigator.mediaDevices.getUserMedia(t);n=yield navigator.mediaDevices.enumerateDevices(),e.getTracks().forEach((A=>{A.stop()}))}return t.hA=n,A&&(n=n.filter((t=>t.kind===A))),n})()}))}normalizeDeviceId(A,t,e){return ii(this,void 0,void 0,(function*(){if(t!==hs)return t;const i=yield this.getDevices(A),n=i.find((A=>A.deviceId===hs));if(!n)return void qe.warn("could not reliably determine default device");const r=i.find((A=>A.deviceId!==hs&&A.groupId===(null!=e?e:n.groupId)));if(r)return null==r?void 0:r.deviceId;qe.warn("could not reliably determine default device")}))}hasDeviceInUse(A){return A?ls.userMediaPromiseMap.has(A):ls.userMediaPromiseMap.size>0}}var ds,Bs;ls.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],ls.userMediaPromiseMap=new Map,(Bs=ds||(ds={}))[Bs.WAITING=0]="WAITING",Bs[Bs.RUNNING=1]="RUNNING",Bs[Bs.COMPLETED=2]="COMPLETED";class fs{constructor(){this.pendingTasks=new Map,this.taskMutex=new g,this.nextTaskIndex=0}run(A){return ii(this,void 0,void 0,(function*(){const t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:ds.WAITING};this.pendingTasks.set(t.id,t);const e=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=ds.RUNNING,yield A()}finally{t.status=ds.COMPLETED,this.pendingTasks.delete(t.id),e()}}))}flush(){return ii(this,void 0,void 0,(function*(){return this.run((()=>ii(this,void 0,void 0,(function*(){}))))}))}snapshot(){return Array.from(this.pendingTasks.values())}}function ws(A,t){return A.pathname="".concat((function(A){return A.endsWith("/")?A:"".concat(A,"/")})(A.pathname)).concat(t),A.toString()}const gs=["syncState","trickle","offer","answer","simulate","leave"];var ps,vs;(vs=ps||(ps={}))[vs.CONNECTING=0]="CONNECTING",vs[vs.CONNECTED=1]="CONNECTED",vs[vs.RECONNECTING=2]="RECONNECTING",vs[vs.DISCONNECTING=3]="DISCONNECTING",vs[vs.DISCONNECTED=4]="DISCONNECTED";class ms{get currentState(){return this.state}get isDisconnected(){return this.state===ps.DISCONNECTING||this.state===ps.DISCONNECTED}get isEstablishingConnection(){return this.state===ps.CONNECTING||this.state===ps.RECONNECTING}getNextRequestId(){return this.lA+=1,this.lA}constructor(){let A=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var e;this.rtt=0,this.state=ps.DISCONNECTED,this.log=qe,this.lA=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=ze(null!==(e=t.loggerName)&&void 0!==e?e:Ye.Signal),this.loggerContextCb=t.loggerContextCb,this.useJSON=A,this.requestQueue=new fs,this.queuedRequests=[],this.closingLock=new g,this.connectionLock=new g,this.state=ps.DISCONNECTED}get logContext(){var A,t;return null!==(t=null===(A=this.loggerContextCb)||void 0===A?void 0:A.call(this))&&void 0!==t?t:{}}join(A,t,e,i){return ii(this,void 0,void 0,(function*(){return this.state=ps.CONNECTING,this.options=e,yield this.connect(A,t,e,i)}))}reconnect(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(this.options)return this.state=ps.RECONNECTING,this.clearPingInterval(),yield this.connect(A,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:e,reconnectReason:i}));this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext)}))}connect(A,t,e,i){this.connectOptions=e;const n=(function(A,t,e){var i;const n=new URLSearchParams;return n.set("access_token",A),e.reconnect&&(n.set("reconnect","1"),e.sid&&n.set("sid",e.sid)),n.set("auto_subscribe",e.autoSubscribe?"1":"0"),n.set("sdk",yr()?"reactnative":"js"),n.set("version",t.version),n.set("protocol",t.protocol.toString()),t.deviceModel&&n.set("device_model",t.deviceModel),t.os&&n.set("os",t.os),t.osVersion&&n.set("os_version",t.osVersion),t.browser&&n.set("browser",t.browser),t.browserVersion&&n.set("browser_version",t.browserVersion),e.adaptiveStream&&n.set("adaptive_stream","1"),e.reconnectReason&&n.set("reconnect_reason",e.reconnectReason.toString()),(null===(i=navigator.connection)||void 0===i?void 0:i.type)&&n.set("network",navigator.connection.type),n})(t,(function(){var A;const t=new Dt({sdk:Mt.JS,protocol:16,version:"2.13.0"});return yr()&&(t.os=null!==(A=Ir())&&void 0!==A?A:""),t})(),e),r=(function(A,t){const e=new URL((function(A){return A.startsWith("http")?A.replace(/^(http)/,"ws"):A})(A));return t.forEach(((A,t)=>{e.searchParams.set(t,A)})),ws(e,"rtc")})(A,n),s=ws(new URL(jr(r)),"validate");return new Promise(((A,t)=>ii(this,void 0,void 0,(function*(){const n=yield this.connectionLock.lock();try{const n=()=>ii(this,void 0,void 0,(function*(){this.close(),clearTimeout(o),t(new Ln("room connection has been cancelled (signal)",Qn.Cancelled))})),o=setTimeout((()=>{this.close(),t(new Ln("room connection has timed out (signal)",Qn.ServerUnreachable))}),e.websocketTimeout);(null==i?void 0:i.aborted)&&n(),null==i||i.addEventListener("abort",n);const a=new URL(r);a.searchParams.has("access_token")&&a.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(a),Object.assign({reconnect:e.reconnect,reconnectReason:e.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(r),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(o)},this.ws.onerror=A=>ii(this,void 0,void 0,(function*(){if(this.state===ps.CONNECTED)this.handleWSError(A);else{this.state=ps.DISCONNECTED,clearTimeout(o);try{const e=yield fetch(s);if(e.status.toFixed(0).startsWith("4")){const A=yield e.text();t(new Ln(A,Qn.NotAllowed,e.status))}else t(new Ln("Encountered unknown websocket error during connection: ".concat(A.toString()),Qn.InternalError,e.status))}catch(e){t(new Ln(e instanceof Error?e.message:"server was not reachable",Qn.ServerUnreachable))}}})),this.ws.onmessage=r=>ii(this,void 0,void 0,(function*(){var s,o,a;let c;if("string"==typeof r.data){const A=JSON.parse(r.data);c=Zt.fromJson(A,{ignoreUnknownFields:!0})}else{if(!(r.data instanceof ArrayBuffer))return void this.log.error("could not decode websocket message: ".concat(typeof r.data),this.logContext);c=Zt.fromBinary(new Uint8Array(r.data))}if(this.state!==ps.CONNECTED){let r=!1;if("join"===(null===(s=c.message)||void 0===s?void 0:s.case)?(this.state=ps.CONNECTED,null==i||i.removeEventListener("abort",n),this.pingTimeoutDuration=c.message.value.pingTimeout,this.pingIntervalDuration=c.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()),A(c.message.value)):this.state===ps.RECONNECTING&&"leave"!==c.message.case?(this.state=ps.CONNECTED,null==i||i.removeEventListener("abort",n),this.startPingInterval(),"reconnect"===(null===(o=c.message)||void 0===o?void 0:o.case)?A(c.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),A(void 0),r=!0)):this.isEstablishingConnection&&"leave"===c.message.case?t(new Ln("Received leave request while trying to (re)connect",Qn.LeaveRequest,void 0,c.message.value.reason)):e.reconnect||t(new Ln("did not receive join response, got ".concat(null===(a=c.message)||void 0===a?void 0:a.case," instead"),Qn.InternalError)),!r)return}this.signalLatency&&(yield wr(this.signalLatency)),this.handleSignalResponse(c)})),this.ws.onclose=A=>{this.isEstablishingConnection&&t(new Ln("Websocket got closed during a (re)connection attempt",Qn.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:A.reason,code:A.code,wasClean:A.wasClean,state:this.state})),this.handleOnClose(A.reason)}}finally{n()}}))))}close(){return ii(this,arguments,void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){const e=yield A.closingLock.lock();try{if(A.clearPingInterval(),t&&(A.state=ps.DISCONNECTING),A.ws){A.ws.onmessage=null,A.ws.onopen=null,A.ws.onclose=null;const t=new Promise((t=>{A.ws?A.ws.onclose=()=>{t()}:t()}));A.ws.readyState<A.ws.CLOSING&&(A.ws.close(),yield Promise.race([t,wr(250)])),A.ws=void 0}}finally{t&&(A.state=ps.DISCONNECTED),e()}})()}))}sendOffer(A){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:A.sdp})),this.sendRequest({case:"offer",value:Us(A)})}sendAnswer(A){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:A.sdp})),this.sendRequest({case:"answer",value:Us(A)})}sendIceCandidate(A,t){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:A})),this.sendRequest({case:"trickle",value:new Ae({candidateInit:JSON.stringify(A),target:t})})}sendMuteTrack(A,t){return this.sendRequest({case:"mute",value:new te({sid:A,muted:t})})}sendAddTrack(A){return this.sendRequest({case:"addTrack",value:A})}sendUpdateLocalMetadata(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(function*(){const n=e.getNextRequestId();return yield e.sendRequest({case:"updateMetadata",value:new fe({requestId:n,metadata:A,name:t,attributes:i})}),n})()}))}sendUpdateTrackSettings(A){this.sendRequest({case:"trackSetting",value:A})}sendUpdateSubscription(A){return this.sendRequest({case:"subscription",value:A})}sendSyncState(A){return this.sendRequest({case:"syncState",value:A})}sendUpdateVideoLayers(A,t){return this.sendRequest({case:"updateLayers",value:new Be({trackSid:A,layers:t})})}sendUpdateSubscriptionPermissions(A,t){return this.sendRequest({case:"subscriptionPermission",value:new Ee({allParticipants:A,trackPermissions:t})})}sendSimulateScenario(A){return this.sendRequest({case:"simulate",value:A})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:L.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new Oe({timestamp:L.parse(Date.now()),rtt:L.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(A,t){return this.sendRequest({case:"updateAudioTrack",value:new ue({trackSid:A,features:t})})}sendLeave(){return this.sendRequest({case:"leave",value:new le({reason:nt.CLIENT_INITIATED,action:de.DISCONNECT})})}sendRequest(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(function*(){const i=!e&&!(function(A){const t=gs.indexOf(A.case)>=0;return qe.trace("request allowed to bypass queue:",{canPass:t,req:A}),t})(A);if(i&&t.state===ps.RECONNECTING)return void t.queuedRequests.push((()=>ii(t,void 0,void 0,(function*(){yield this.sendRequest(A,!0)}))));if(e||(yield t.requestQueue.flush()),t.signalLatency&&(yield wr(t.signalLatency)),!t.ws||t.ws.readyState!==t.ws.OPEN)return void t.log.error("cannot send signal request before connected, type: ".concat(null==A?void 0:A.case),t.logContext);const n=new Wt({message:A});try{t.useJSON?t.ws.send(n.toJsonString()):t.ws.send(n.toBinary())}catch(r){t.log.error("error sending signal message",Object.assign(Object.assign({},t.logContext),{error:r}))}})()}))}handleSignalResponse(A){var t,e;const i=A.message;if(null==i)return void this.log.debug("received unsupported message",this.logContext);let n=!1;if("answer"===i.case){const A=Qs(i.value);this.onAnswer&&this.onAnswer(A)}else if("offer"===i.case){const A=Qs(i.value);this.onOffer&&this.onOffer(A)}else if("trickle"===i.case){const A=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(A,i.value.target)}else"update"===i.case?this.onParticipantUpdate&&this.onParticipantUpdate(null!==(t=i.value.participants)&&void 0!==t?t:[]):"trackPublished"===i.case?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):"speakersChanged"===i.case?this.onSpeakersChanged&&this.onSpeakersChanged(null!==(e=i.value.speakers)&&void 0!==e?e:[]):"leave"===i.case?this.onLeave&&this.onLeave(i.value):"mute"===i.case?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):"roomUpdate"===i.case?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):"connectionQuality"===i.case?this.onConnectionQuality&&this.onConnectionQuality(i.value):"streamStateUpdate"===i.case?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):"subscribedQualityUpdate"===i.case?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):"subscriptionPermissionUpdate"===i.case?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):"refreshToken"===i.case?this.onTokenRefresh&&this.onTokenRefresh(i.value):"trackUnpublished"===i.case?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):"subscriptionResponse"===i.case?this.onSubscriptionError&&this.onSubscriptionError(i.value):"pong"===i.case||("pongResp"===i.case?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),n=!0):"requestResponse"===i.case?this.onRequestResponse&&this.onRequestResponse(i.value):"trackSubscribed"===i.case?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):"roomMoved"===i.case?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:i.case})));n||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const A=this.queuedRequests.shift();A&&this.requestQueue.run(A)}}handleOnClose(A){return ii(this,void 0,void 0,(function*(){if(this.state===ps.DISCONNECTED)return;const t=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(A),Object.assign(Object.assign({},this.logContext),{reason:A})),t&&t(A)}))}handleWSError(A){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:A}))}resetPingTimeout(){this.clearPingTimeout(),this.pingTimeoutDuration?this.pingTimeout=Zn.setTimeout((()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-1e3*this.pingTimeoutDuration).toUTCString()),this.logContext),this.handleOnClose("ping timeout")}),1e3*this.pingTimeoutDuration):this.log.warn("ping timeout duration not set",this.logContext)}clearPingTimeout(){this.pingTimeout&&Zn.clearTimeout(this.pingTimeout)}startPingInterval(){this.clearPingInterval(),this.resetPingTimeout(),this.pingIntervalDuration?(this.log.debug("start ping interval",this.logContext),this.pingInterval=Zn.setInterval((()=>{this.sendPing()}),1e3*this.pingIntervalDuration)):this.log.warn("ping interval duration not set",this.logContext)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Zn.clearInterval(this.pingInterval)}}function Qs(A){const t={type:"offer",sdp:A.sdp};switch(A.type){case"answer":case"offer":case"pranswer":case"rollback":t.type=A.type}return t}function Us(A){return new se({sdp:A.sdp,type:A.type})}var Cs,Fs,ys,bs,Es,Is={},Hs={},ks={exports:{}};function Ts(){if(Cs)return ks.exports;Cs=1;var A=ks.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(A){return A.encoding?"rtpmap:%d %s/%s/%s":A.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(A){return null!=A.address?"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(A){return null!=A.subtype?"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(A){return"extmap:%d"+(A.direction?"/%s":"%v")+(A["encrypt-uri"]?" %s":"%v")+" %s"+(A.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(A){return null!=A.sessionConfig?"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(A){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=A.raddr?" raddr %s rport %d":"%v%v",t+=null!=A.tcptype?" tcptype %s":"%v",null!=A.generation&&(t+=" generation %d"),(t+=null!=A["network-id"]?" network-id %d":"%v")+(null!=A["network-cost"]?" network-cost %d":"%v")}},{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(A){var t="ssrc:%d";return null!=A.attribute&&(t+=" %s",null!=A.value&&(t+=":%s")),t}},{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(A){return null!=A.maxMessageSize?"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(A){return A.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(A){return"imageattr:%s %s %s"+(A.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(A){return"simulcast:%s %s"+(A.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(A){return"ts-refclk:%s"+(null!=A.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(A){var t="mediaclk:";return t+=null!=A.id?"id=%s %s":"%v%s",t+=null!=A.mediaClockValue?"=%s":"",(t+=null!=A.rateNumerator?" rate=%s":"")+(null!=A.rateDenominator?"/%s":"")}},{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(A).forEach((function(t){A[t].forEach((function(A){A.reg||(A.reg=/(.*)/),A.format||(A.format="%s")}))})),ks.exports}function Ss(){if(bs)return ys;bs=1;var A=Ts(),t=/%[sdv%]/g,e=function(A){var e=1,i=arguments,n=i.length;return A.replace(t,(function(A){if(e>=n)return A;var t=i[e];switch(e+=1,A){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}}))},i=function(A,t,i){var n=[A+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var r=0;r<t.names.length;r+=1){var s=t.names[r];t.name?n.push(i[t.name][s]):n.push(i[t.names[r]])}else n.push(i[t.name]);return e.apply(null,n)},n=["v","o","s","i","u","e","p","c","b","t","r","z","a"],r=["i","c","b","a"];return ys=function(t,e){e=e||{},null==t.version&&(t.version=0),null==t.name&&(t.name=" "),t.media.forEach((function(A){null==A.payloads&&(A.payloads="")}));var s=e.outerOrder||n,o=e.innerOrder||r,a=[];return s.forEach((function(e){A[e].forEach((function(A){A.name in t&&null!=t[A.name]?a.push(i(e,A,t)):A.push in t&&null!=t[A.push]&&t[A.push].forEach((function(t){a.push(i(e,A,t))}))}))})),t.media.forEach((function(t){a.push(i("m",A.m[0],t)),o.forEach((function(e){A[e].forEach((function(A){A.name in t&&null!=t[A.name]?a.push(i(e,A,t)):A.push in t&&null!=t[A.push]&&t[A.push].forEach((function(t){a.push(i(e,A,t))}))}))}))})),a.join("\r\n")+"\r\n"}}var Os=(function(){if(Es)return Is;Es=1;var A=(Fs||(Fs=1,(function(A){var t=function(A){return String(Number(A))===A?Number(A):A},e=function(A,e,i){var n=A.name&&A.names;A.push&&!e[A.push]?e[A.push]=[]:n&&!e[A.name]&&(e[A.name]={});var r=A.push?{}:n?e[A.name]:e;!(function(A,e,i,n){if(n&&!i)e[n]=t(A[1]);else for(var r=0;r<i.length;r+=1)null!=A[r+1]&&(e[i[r]]=t(A[r+1]))})(i.match(A.reg),r,A.names,A.name),A.push&&e[A.push].push(r)},i=Ts(),n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);A.parse=function(A){var t={},r=[],s=t;return A.split(/(\r\n|\r|\n)/).filter(n).forEach((function(A){var t=A[0],n=A.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),s=r[r.length-1]);for(var o=0;o<(i[t]||[]).length;o+=1){var a=i[t][o];if(a.reg.test(n))return e(a,s,n)}})),t.media=r,t};var r=function(A,e){var i=e.split(/=(.+)/,2);return 2===i.length?A[i[0]]=t(i[1]):1===i.length&&e.length>1&&(A[i[0]]=void 0),A};A.parseParams=function(A){return A.split(/;\s?/).reduce(r,{})},A.parseFmtpConfig=A.parseParams,A.parsePayloads=function(A){return A.toString().split(" ").map(Number)},A.parseRemoteCandidates=function(A){for(var e=[],i=A.split(" ").map(t),n=0;n<i.length;n+=3)e.push({component:i[n],ip:i[n+1],port:i[n+2]});return e},A.parseImageAttributes=function(A){return A.split(" ").map((function(A){return A.substring(1,A.length-1).split(",").reduce(r,{})}))},A.parseSimulcastStreamList=function(A){return A.split(";").map((function(A){return A.split(",").map((function(A){var e,i=!1;return"~"!==A[0]?e=t(A):(e=t(A.substring(1,A.length)),i=!0),{scid:e,paused:i}}))}))}})(Hs)),Hs),t=Ss(),e=Ts();return Is.grammar=e,Is.write=t,Is.parse=A.parse,Is.parseParams=A.parseParams,Is.parseFmtpConfig=A.parseFmtpConfig,Is.parsePayloads=A.parsePayloads,Is.parseRemoteCandidates=A.parseRemoteCandidates,Is.parseImageAttributes=A.parseImageAttributes,Is.parseSimulcastStreamList=A.parseSimulcastStreamList,Is})();function Ks(A,t,e){var i,n,r;void 0===t&&(t=50),void 0===e&&(e={});var s=null!=(i=e.isImmediate)&&i,o=null!=(n=e.callback)&&n,a=e.maxWait,c=Date.now(),u=[],h=function(){var e=[].slice.call(arguments),i=this;return new Promise((function(n,h){var l=s&&void 0===r;if(void 0!==r&&clearTimeout(r),r=setTimeout((function(){if(r=void 0,c=Date.now(),!s){var t=A.apply(i,e);o&&o(t),u.forEach((function(A){return(0,A.resolve)(t)})),u=[]}}),(function(){if(void 0!==a){var A=Date.now()-c;if(A+t>=a)return a-A}return t})()),l){var d=A.apply(i,e);return o&&o(d),n(d)}u.push({resolve:n,reject:h})}))};return h.cancel=function(A){void 0!==r&&clearTimeout(r),u.forEach((function(t){return(0,t.reject)(A)})),u=[]},h}const Ds="negotiationStarted",Ms="negotiationComplete",Ls="rtpVideoPayloadTypes";class xs extends oi.EventEmitter{get pc(){return this.J||(this.J=this.createPC()),this.J}constructor(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var e;super(),this.log=qe,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=Ks((A=>ii(this,void 0,void 0,(function*(){this.emit(Ds);try{yield this.createAndSendOffer()}catch(t){if(!A)throw t;A(t)}}))),20),this.close=()=>{this.J&&(this.J.close(),this.J.onconnectionstatechange=null,this.J.oniceconnectionstatechange=null,this.J.onicegatheringstatechange=null,this.J.ondatachannel=null,this.J.onnegotiationneeded=null,this.J.onsignalingstatechange=null,this.J.onicecandidate=null,this.J.ondatachannel=null,this.J.ontrack=null,this.J.onconnectionstatechange=null,this.J.oniceconnectionstatechange=null,this.J=null)},this.log=ze(null!==(e=t.loggerName)&&void 0!==e?e:Ye.PCTransport),this.loggerOptions=t,this.config=A,this.J=this.createPC()}createPC(){const A=new RTCPeerConnection(this.config);return A.onicecandidate=A=>{var t;A.candidate&&(null===(t=this.onIceCandidate)||void 0===t||t.call(this,A.candidate))},A.onicecandidateerror=A=>{var t;null===(t=this.onIceCandidateError)||void 0===t||t.call(this,A)},A.oniceconnectionstatechange=()=>{var t;null===(t=this.onIceConnectionStateChange)||void 0===t||t.call(this,A.iceConnectionState)},A.onsignalingstatechange=()=>{var t;null===(t=this.onSignalingStatechange)||void 0===t||t.call(this,A.signalingState)},A.onconnectionstatechange=()=>{var t;null===(t=this.onConnectionStateChange)||void 0===t||t.call(this,A.connectionState)},A.ondatachannel=A=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,A)},A.ontrack=A=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,A)},A}get logContext(){var A,t;return Object.assign({},null===(t=(A=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(A))}get isICEConnected(){return null!==this.J&&("connected"===this.pc.iceConnectionState||"completed"===this.pc.iceConnectionState)}addIceCandidate(A){return ii(this,void 0,void 0,(function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(A);this.pendingCandidates.push(A)}))}setRemoteDescription(A){return ii(this,void 0,void 0,(function*(){var t;let e;if("offer"===A.type){let{stereoMids:t,nackMids:e}=(function(A){var t;const e=[],i=[],n=Os.parse(null!==(t=A.sdp)&&void 0!==t?t:"");let r=0;return n.media.forEach((A=>{var t;"audio"===A.type&&(A.rtp.some((A=>"opus"===A.codec&&(r=A.payload,!0))),(null===(t=A.rtcpFb)||void 0===t?void 0:t.some((A=>A.payload===r&&"nack"===A.type)))&&i.push(A.mid),A.fmtp.some((t=>t.payload===r&&(t.config.includes("sprop-stereo=1")&&e.push(A.mid),!0))))})),{stereoMids:e,nackMids:i}})(A);this.remoteStereoMids=t,this.remoteNackMids=e}else if("answer"===A.type){const i=Os.parse(null!==(t=A.sdp)&&void 0!==t?t:"");i.media.forEach((A=>{"audio"===A.type&&this.trackBitrates.some((t=>{if(!t.transceiver||A.mid!=t.transceiver.mid)return!1;let e=0;if(A.rtp.some((A=>A.codec.toUpperCase()===t.codec.toUpperCase()&&(e=A.payload,!0))),0===e)return!0;let i=!1;for(const n of A.fmtp)if(n.payload===e){n.config=n.config.split(";").filter((A=>!A.includes("maxaveragebitrate"))).join(";"),t.maxbr>0&&(n.config+=";maxaveragebitrate=".concat(1e3*t.maxbr)),i=!0;break}return i||t.maxbr>0&&A.fmtp.push({payload:e,config:"maxaveragebitrate=".concat(1e3*t.maxbr)}),!0}))})),e=Os.write(i)}yield this.setMungedSDP(A,e,!0),this.pendingCandidates.forEach((A=>{this.pc.addIceCandidate(A)})),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):"answer"===A.type&&(this.emit(Ms),A.sdp)&&Os.parse(A.sdp).media.forEach((A=>{"video"===A.type&&this.emit(Ls,A.rtp)}))}))}createAndSendOffer(A){return ii(this,void 0,void 0,(function*(){var t;if(void 0===this.onOffer)return;if((null==A?void 0:A.iceRestart)&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this.J&&"have-local-offer"===this.J.signalingState){const t=this.J.remoteDescription;if(!(null==A?void 0:A.iceRestart)||!t)return void(this.renegotiate=!0);yield this.J.setRemoteDescription(t)}else if(!this.J||"closed"===this.J.signalingState)return void this.log.warn("could not createOffer with closed peer connection",this.logContext);this.log.debug("starting to negotiate",this.logContext);const e=yield this.pc.createOffer(A);this.log.debug("original offer",Object.assign({sdp:e.sdp},this.logContext));const i=Os.parse(null!==(t=e.sdp)&&void 0!==t?t:"");i.media.forEach((A=>{Rs(A),"audio"===A.type?_s(A,[],[]):"video"===A.type&&this.trackBitrates.some((t=>{if(!A.msid||!t.cid||!A.msid.includes(t.cid))return!1;let e=0;if(A.rtp.some((A=>A.codec.toUpperCase()===t.codec.toUpperCase()&&(e=A.payload,!0))),0===e)return!0;if(vr(t.codec)&&this.ensureVideoDDExtensionForSVC(A,i),"av1"!==t.codec)return!0;const n=Math.round(.7*t.maxbr);for(const i of A.fmtp)if(i.payload===e){i.config.includes("x-google-start-bitrate")||(i.config+=";x-google-start-bitrate=".concat(n));break}return!0}))})),yield this.setMungedSDP(e,Os.write(i)),this.onOffer(e)}))}createAndSetAnswer(){return ii(this,void 0,void 0,(function*(){var A;const t=yield this.pc.createAnswer(),e=Os.parse(null!==(A=t.sdp)&&void 0!==A?A:"");return e.media.forEach((A=>{Rs(A),"audio"===A.type&&_s(A,this.remoteStereoMids,this.remoteNackMids)})),yield this.setMungedSDP(t,Os.write(e)),t}))}createDataChannel(A,t){return this.pc.createDataChannel(A,t)}addTransceiver(A,t){return this.pc.addTransceiver(A,t)}addTrack(A){if(!this.J)throw new Nn("PC closed, cannot add track");return this.J.addTrack(A)}setTrackCodecBitrate(A){this.trackBitrates.push(A)}setConfiguration(A){var t;if(!this.J)throw new Nn("PC closed, cannot configure");return null===(t=this.J)||void 0===t?void 0:t.setConfiguration(A)}canRemoveTrack(){var A;return!!(null===(A=this.J)||void 0===A?void 0:A.removeTrack)}removeTrack(A){var t;return null===(t=this.J)||void 0===t?void 0:t.removeTrack(A)}getConnectionState(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.connectionState)&&void 0!==t?t:"closed"}getICEConnectionState(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.iceConnectionState)&&void 0!==t?t:"closed"}getSignallingState(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.signalingState)&&void 0!==t?t:"closed"}getTransceivers(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.getTransceivers())&&void 0!==t?t:[]}getSenders(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.getSenders())&&void 0!==t?t:[]}getLocalDescription(){var A;return null===(A=this.J)||void 0===A?void 0:A.localDescription}getRemoteDescription(){var A;return null===(A=this.pc)||void 0===A?void 0:A.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return ii(this,void 0,void 0,(function*(){var A;if(!this.J)return;let t="";const e=new Map,i=new Map;if((yield this.J.getStats()).forEach((A=>{switch(A.type){case"transport":t=A.selectedCandidatePairId;break;case"candidate-pair":""===t&&A.selected&&(t=A.id),e.set(A.id,A);break;case"remote-candidate":i.set(A.id,"".concat(A.address,":").concat(A.port))}})),""===t)return;const n=null===(A=e.get(t))||void 0===A?void 0:A.remoteCandidateId;return void 0!==n?i.get(n):void 0}))}setMungedSDP(A,t,e){return ii(this,void 0,void 0,(function*(){if(t){const n=A.sdp;A.sdp=t;try{return this.log.debug("setting munged ".concat(e?"remote":"local"," description"),this.logContext),void(e?yield this.pc.setRemoteDescription(A):yield this.pc.setLocalDescription(A))}catch(i){this.log.warn("not able to set ".concat(A.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:i,sdp:t})),A.sdp=n}}try{e?yield this.pc.setRemoteDescription(A):yield this.pc.setLocalDescription(A)}catch(i){let t="unknown error";i instanceof Error?t=i.message:"string"==typeof i&&(t=i);const n={error:t,sdp:A.sdp};throw!e&&this.pc.remoteDescription&&(n.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(A.type),Object.assign(Object.assign({},this.logContext),{fields:n})),new jn(t)}}))}ensureVideoDDExtensionForSVC(A,t){var e,i;if(!(null===(e=A.ext)||void 0===e?void 0:e.some((A=>A.uri===fr)))){if(0===this.ddExtID){let A=0;t.media.forEach((t=>{var e;"video"===t.type&&(null===(e=t.ext)||void 0===e||e.forEach((t=>{t.value>A&&(A=t.value)})))})),this.ddExtID=A+1}null===(i=A.ext)||void 0===i||i.push({value:this.ddExtID,uri:fr})}}}function _s(A,t,e){let i=0;A.rtp.some((A=>"opus"===A.codec&&(i=A.payload,!0))),i>0&&(A.rtcpFb||(A.rtcpFb=[]),e.includes(A.mid)&&!A.rtcpFb.some((A=>A.payload===i&&"nack"===A.type))&&A.rtcpFb.push({payload:i,type:"nack"}),t.includes(A.mid)&&A.fmtp.some((A=>A.payload===i&&(A.config.includes("stereo=1")||(A.config+=";stereo=1"),!0))))}function Rs(A){if(A.connection){const t=A.connection.ip.indexOf(":")>=0;(4===A.connection.version&&t||6===A.connection.version&&!t)&&(A.connection.ip="0.0.0.0",A.connection.version=4)}}const Ns="vp8",js={audioPreset:ur.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:Br.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Ns,backupCodec:!0},Gs={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Ps={deviceId:{ideal:"default"},resolution:lr.h720.resolution},Vs={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new class{constructor(A){this.dA=void 0!==A?[...A]:ei}nextRetryDelayInMs(A){if(A.retryCount>=this.dA.length)return null;const t=this.dA[A.retryCount];return A.retryCount<=1?t:t+1e3*Math.random()}},disconnectOnPageLeave:!0,webAudioMix:!1},Js={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Xs,Ys;(Ys=Xs||(Xs={}))[Ys.NEW=0]="NEW",Ys[Ys.CONNECTING=1]="CONNECTING",Ys[Ys.CONNECTED=2]="CONNECTED",Ys[Ys.FAILED=3]="FAILED",Ys[Ys.CLOSING=4]="CLOSING",Ys[Ys.CLOSED=5]="CLOSED";class $s{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(A,t,e){var i;this.peerConnectionTimeout=Js.peerConnectionTimeout,this.log=qe,this.updateState=()=>{var A;const t=this.state,e=this.requiredTransports.map((A=>A.getConnectionState()));e.every((A=>"connected"===A))?this.state=Xs.CONNECTED:e.some((A=>"failed"===A))?this.state=Xs.FAILED:e.some((A=>"connecting"===A))?this.state=Xs.CONNECTING:e.every((A=>"closed"===A))?this.state=Xs.CLOSED:e.some((A=>"closed"===A))?this.state=Xs.CLOSING:e.every((A=>"new"===A))&&(this.state=Xs.NEW),t!==this.state&&(this.log.debug("pc state change: from ".concat(Xs[t]," to ").concat(Xs[this.state]),this.logContext),null===(A=this.onStateChange)||void 0===A||A.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=ze(null!==(i=e.loggerName)&&void 0!==i?i:Ye.PCManager),this.loggerOptions=e,this.isPublisherConnectionRequired=!t,this.isSubscriberConnectionRequired=t,this.publisher=new xs(A,e),this.subscriber=new xs(A,e),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=A=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,A,Xt.PUBLISHER)},this.subscriber.onIceCandidate=A=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,A,Xt.SUBSCRIBER)},this.subscriber.onDataChannel=A=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,A)},this.subscriber.onTrack=A=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,A)},this.publisher.onOffer=A=>{var t;null===(t=this.onPublisherOffer)||void 0===t||t.call(this,A)},this.state=Xs.NEW,this.connectionLock=new g,this.remoteOfferLock=new g}get logContext(){var A,t;return Object.assign({},null===(t=(A=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(A))}requirePublisher(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isPublisherConnectionRequired=A,this.updateState()}requireSubscriber(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isSubscriberConnectionRequired=A,this.updateState()}createAndSendPublisherOffer(A){return this.publisher.createAndSendOffer(A)}setPublisherAnswer(A){return this.publisher.setRemoteDescription(A)}removeTrack(A){return this.publisher.removeTrack(A)}close(){return ii(this,void 0,void 0,(function*(){if(this.publisher&&"closed"!==this.publisher.getSignallingState()){const t=this.publisher;for(const e of t.getSenders())try{t.canRemoveTrack()&&t.removeTrack(e)}catch(A){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:A}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()}))}triggerIceRestart(){return ii(this,void 0,void 0,(function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))}))}addIceCandidate(A,t){return ii(this,void 0,void 0,(function*(){t===Xt.PUBLISHER?yield this.publisher.addIceCandidate(A):yield this.subscriber.addIceCandidate(A)}))}createSubscriberAnswerFromOffer(A){return ii(this,void 0,void 0,(function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:A.type,sdp:A.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const t=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(A),yield this.subscriber.createAndSetAnswer()}finally{t()}}))}updateConfiguration(A,t){this.publisher.setConfiguration(A),this.subscriber.setConfiguration(A),t&&this.triggerIceRestart()}ensurePCTransportConnection(A,t){return ii(this,void 0,void 0,(function*(){var e;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&"connected"!==this.publisher.getConnectionState()&&"connecting"!==this.publisher.getConnectionState()&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all(null===(e=this.requiredTransports)||void 0===e?void 0:e.map((e=>this.ensureTransportConnected(e,A,t))))}finally{i()}}))}negotiate(A){return ii(this,void 0,void 0,(function*(){return new Promise(((t,e)=>ii(this,void 0,void 0,(function*(){const i=setTimeout((()=>{e("negotiation timed out")}),this.peerConnectionTimeout);A.signal.addEventListener("abort",(()=>{clearTimeout(i),e("negotiation aborted")})),this.publisher.once(Ds,(()=>{A.signal.aborted||this.publisher.once(Ms,(()=>{clearTimeout(i),t()}))})),yield this.publisher.negotiate((A=>{clearTimeout(i),e(A)}))}))))}))}addPublisherTransceiver(A,t){return this.publisher.addTransceiver(A,t)}addPublisherTrack(A){return this.publisher.addTrack(A)}createPublisherDataChannel(A,t){return this.publisher.createDataChannel(A,t)}getConnectedAddress(A){return A===Xt.PUBLISHER||A===Xt.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const A=[];return this.isPublisherConnectionRequired&&A.push(this.publisher),this.isSubscriberConnectionRequired&&A.push(this.subscriber),A}ensureTransportConnected(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.peerConnectionTimeout;return(function*(){if("connected"!==A.getConnectionState())return new Promise(((A,n)=>ii(e,void 0,void 0,(function*(){const e=()=>{this.log.warn("abort transport connection",this.logContext),Zn.clearTimeout(r),n(new Ln("room connection has been cancelled",Qn.Cancelled))};(null==t?void 0:t.signal.aborted)&&e(),null==t||t.signal.addEventListener("abort",e);const r=Zn.setTimeout((()=>{null==t||t.signal.removeEventListener("abort",e),n(new Ln("could not establish pc connection",Qn.InternalError))}),i);for(;this.state!==Xs.CONNECTED;)if(yield wr(50),null==t?void 0:t.signal.aborted)return void n(new Ln("room connection has been cancelled",Qn.Cancelled));Zn.clearTimeout(r),null==t||t.signal.removeEventListener("abort",e),A()}))))})()}))}}class Ws extends Error{constructor(A,t,e){super(t),this.code=A,this.message=qs(t,Ws.MAX_MESSAGE_BYTES),this.data=e?qs(e,Ws.MAX_DATA_BYTES):void 0}static fromProto(A){return new Ws(A.code,A.message,A.data)}toProto(){return new Tt({code:this.code,message:this.message,data:this.data})}static builtIn(A,t){return new Ws(Ws.ErrorCode[A],Ws.ErrorMessage[A],t)}}function Zs(A){return(new TextEncoder).encode(A).length}function qs(A,t){if(Zs(A)<=t)return A;let e=0,i=A.length;const n=new TextEncoder;for(;e<i;){const r=Math.floor((e+i+1)/2);n.encode(A.slice(0,r)).length<=t?e=r:i=r-1}return A.slice(0,e)}Ws.MAX_MESSAGE_BYTES=256,Ws.MAX_DATA_BYTES=15360,Ws.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},Ws.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 zs=2e3;function Ao(A,t){if(!t)return 0;let e,i;return"bytesReceived"in A?(e=A.bytesReceived,i=t.bytesReceived):"bytesSent"in A&&(e=A.bytesSent,i=t.bytesSent),void 0===e||void 0===i||void 0===A.timestamp||void 0===t.timestamp?0:8*(e-i)*1e3/(A.timestamp-t.timestamp)}class to extends tr{get sender(){return this.BA}set sender(A){this.BA=A}get constraints(){return this.fA}constructor(A,t,e){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(A,t,arguments.length>4?arguments[4]:void 0),this.manuallyStopped=!1,this.wA=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch((()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext))),this.debouncedTrackMuteHandler=Ks((()=>ii(this,void 0,void 0,(function*(){yield this.pauseUpstream()}))),5e3),this.handleTrackUnmuteEvent=()=>ii(this,void 0,void 0,(function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()})),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this.cA.removeEventListener("mute",this.handleTrackMuteEvent),this.cA.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(On.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new g,this.pauseUpstreamLock=new g,this.processorLock=new g,this.restartLock=new g,this.setMediaStreamTrack(A,!0),this.fA=A.getConstraints(),e&&(this.fA=e)}get id(){return this.cA.id}get dimensions(){if(this.kind!==tr.Kind.Video)return;const{width:A,height:t}=this.cA.getSettings();return A&&t?{width:A,height:t}:void 0}get isUpstreamPaused(){return this.wA}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var A,t;return null!==(t=null===(A=this.processor)||void 0===A?void 0:A.processedTrack)&&void 0!==t?t:this.cA}get isLocal(){return!0}getSourceTrackSettings(){return this.cA.getSettings()}setMediaStreamTrack(A,t){return ii(this,void 0,void 0,(function*(){var e;if(A===this.cA&&!t)return;let i;if(this.cA&&(this.attachedElements.forEach((A=>{ir(this.cA,A)})),this.debouncedTrackMuteHandler.cancel("new-track"),this.cA.removeEventListener("ended",this.handleEnded),this.cA.removeEventListener("mute",this.handleTrackMuteEvent),this.cA.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([A]),A&&(A.addEventListener("ended",this.handleEnded),A.addEventListener("mute",this.handleTrackMuteEvent),A.addEventListener("unmute",this.handleTrackUnmuteEvent),this.fA=A.getConstraints()),this.processor&&A){const t=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),"unknown"===this.kind)throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(er(A,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:A,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}finally{t()}}this.sender&&"closed"!==(null===(e=this.sender.transport)||void 0===e?void 0:e.state)&&(yield this.sender.replaceTrack(null!=i?i:A)),this.providedByUser||this.cA===A||this.cA.stop(),this.cA=A,A&&(this.cA.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach((t=>{er(null!=i?i:A,t)})))}))}waitForDimensions(){return ii(this,arguments,void 0,(function(){var A=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return(function*(){var e;if(A.kind===tr.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");"iOS"===(null===(e=Xn())||void 0===e?void 0:e.os)&&(yield wr(10));const i=Date.now();for(;Date.now()-i<t;){const t=A.dimensions;if(t)return t;yield wr(50)}throw new _n("unable to get track dimensions after timeout")})()}))}setDeviceId(A){return ii(this,void 0,void 0,(function*(){return this.fA.deviceId===A&&this.cA.getSettings().deviceId===Nr(A)||(this.fA.deviceId=A,!!this.isMuted||(yield this.restartTrack(),Nr(A)===this.cA.getSettings().deviceId))}))}getDeviceId(){return ii(this,arguments,void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){if(A.source===tr.Source.ScreenShare)return;const{deviceId:e,groupId:i}=A.cA.getSettings(),n=A.kind===tr.Kind.Audio?"audioinput":"videoinput";return t?ls.getInstance().normalizeDeviceId(n,e,i):e})()}))}mute(){return ii(this,void 0,void 0,(function*(){return this.setTrackMuted(!0),this}))}unmute(){return ii(this,void 0,void 0,(function*(){return this.setTrackMuted(!1),this}))}replaceTrack(A,t){return ii(this,void 0,void 0,(function*(){if(!this.sender)throw new _n("unable to replace an unpublished track");let e,i;return"boolean"==typeof t?e=t:void 0!==t&&(e=t.userProvidedTrack,i=t.stopProcessor),this.providedByUser=null==e||e,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(A),i&&this.processor&&(yield this.stopProcessor()),this}))}restart(A){return ii(this,void 0,void 0,(function*(){this.manuallyStopped=!1;const t=yield this.restartLock.lock();try{A||(A=this.fA);const{deviceId:t,facingMode:e}=A,i=(function(A,t){var e={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&t.indexOf(i)<0&&(e[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(A);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(A,i[n])&&(e[i[n]]=A[i[n]])}return e})(A,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:A}));const n={audio:!1,video:!1};this.kind===tr.Kind.Video?n.video=!t&&!e||{deviceId:t,facingMode:e}:n.audio=!t||{deviceId:t},this.attachedElements.forEach((A=>{ir(this.mediaStreamTrack,A)})),this.cA.removeEventListener("ended",this.handleEnded),this.cA.stop();const r=(yield navigator.mediaDevices.getUserMedia(n)).getTracks()[0];return yield r.applyConstraints(i),r.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(r),this.fA=A,this.emit(On.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{t()}}))}setTrackMuted(A){this.log.debug("setting ".concat(this.kind," track ").concat(A?"muted":"unmuted"),this.logContext),this.isMuted===A&&this.cA.enabled!==A||(this.isMuted=A,this.cA.enabled=!A,this.emit(A?On.Muted:On.Unmuted,this))}get needsReAcquisition(){return"live"!==this.cA.readyState||this.cA.muted||!this.cA.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ii(this,void 0,void 0,(function*(){yield A.handleAppVisibilityChanged.call(this),Cr()&&(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 A;this.manuallyStopped=!0,super.stop(),this.cA.removeEventListener("ended",this.handleEnded),this.cA.removeEventListener("mute",this.handleTrackMuteEvent),this.cA.removeEventListener("unmute",this.handleTrackUnmuteEvent),null===(A=this.processor)||void 0===A||A.destroy(),this.processor=void 0}pauseUpstream(){return ii(this,void 0,void 0,(function*(){var A;const t=yield this.pauseUpstreamLock.lock();try{if(!0===this.wA)return;if(!this.sender)return void this.log.warn("unable to pause upstream for an unpublished track",this.logContext);this.wA=!0,this.emit(On.UpstreamPaused,this);const t=Xn();if("Safari"===(null==t?void 0:t.name)&&kr(t.version,"12.0")<0)throw new xn("pauseUpstream is not supported on Safari < 12.");"closed"!==(null===(A=this.sender.transport)||void 0===A?void 0:A.state)&&(yield this.sender.replaceTrack(null))}finally{t()}}))}resumeUpstream(){return ii(this,void 0,void 0,(function*(){var A;const t=yield this.pauseUpstreamLock.lock();try{if(!1===this.wA)return;if(!this.sender)return void this.log.warn("unable to resume upstream for an unpublished track",this.logContext);this.wA=!1,this.emit(On.UpstreamResumed,this),"closed"!==(null===(A=this.sender.transport)||void 0===A?void 0:A.state)&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{t()}}))}getRTCStatsReport(){return ii(this,void 0,void 0,(function*(){var A;if(null===(A=this.sender)||void 0===A?void 0:A.getStats)return yield this.sender.getStats()}))}setProcessor(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){var i;const n=yield t.processorLock.lock();try{t.log.debug("setting up processor",t.logContext);const n=document.createElement(t.kind),r={kind:t.kind,track:t.cA,element:n,audioContext:t.audioContext};if(yield A.init(r),t.log.debug("processor initialized",t.logContext),t.processor&&(yield t.stopProcessor()),"unknown"===t.kind)throw TypeError("cannot set processor on track of unknown kind");if(er(t.cA,n),n.muted=!0,n.play().catch((A=>t.log.error("failed to play processor element",Object.assign(Object.assign({},t.logContext),{error:A})))),t.processor=A,t.processorElement=n,t.processor.processedTrack){for(const A of t.attachedElements)A!==t.processorElement&&e&&(ir(t.cA,A),er(t.processor.processedTrack,A));yield null===(i=t.sender)||void 0===i?void 0:i.replaceTrack(t.processor.processedTrack)}t.emit(On.TrackProcessorUpdate,t.processor)}finally{n()}})()}))}getProcessor(){return this.processor}stopProcessor(){return ii(this,arguments,void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){var e,i;A.processor&&(A.log.debug("stopping processor",A.logContext),null===(e=A.processor.processedTrack)||void 0===e||e.stop(),yield A.processor.destroy(),A.processor=void 0,t||(null===(i=A.processorElement)||void 0===i||i.remove(),A.processorElement=void 0),yield A.cA.applyConstraints(A.fA),yield A.setMediaStreamTrack(A.cA,!0),A.emit(On.TrackProcessorUpdate))})()}))}}class eo extends to{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(A,t){let e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;super(A,tr.Kind.Audio,t,e,n),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>ii(this,void 0,void 0,(function*(){if(!this.sender)return void(this.aA=0);let A;try{A=yield this.getSenderStats()}catch(t){return void this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:t}))}A&&this.prevStats&&(this.aA=Ao(A,this.prevStats)),this.prevStats=A})),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(On.AudioTrackFeatureUpdate,this,ot.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(On.AudioTrackFeatureUpdate,this,ot.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const A=Object.create(null,{mute:{get:()=>super.mute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===tr.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this.cA.stop()),yield A.mute.call(this),this)}finally{t()}}))}unmute(){const A=Object.create(null,{unmute:{get:()=>super.unmute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const t=this.fA.deviceId&&this.cA.getSettings().deviceId!==Nr(this.fA.deviceId);return this.source!==tr.Source.Microphone||!this.stopOnMute&&"ended"!==this.cA.readyState&&!t||this.isUserProvided||(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield A.unmute.call(this),this}finally{t()}}))}restartTrack(A){return ii(this,void 0,void 0,(function*(){let t;if(A){const e=es({audio:A});"boolean"!=typeof e.audio&&(t=e.audio)}yield this.restart(t)}))}restart(A){const t=Object.create(null,{restart:{get:()=>super.restart}});return ii(this,void 0,void 0,(function*(){const e=yield t.restart.call(this,A);return this.checkForSilence(),e}))}startMonitor(){Fr()&&(this.monitorInterval||(this.monitorInterval=setInterval((()=>{this.monitorSender()}),zs)))}setProcessor(A){return ii(this,void 0,void 0,(function*(){var t;const e=yield this.processorLock.lock();try{if(!yr()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const e={kind:this.kind,track:this.cA,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(A.name),this.logContext),yield A.init(e),this.processor=A,this.processor.processedTrack&&(yield null===(t=this.sender)||void 0===t?void 0:t.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(On.TrackProcessorUpdate,this.processor)}finally{e()}}))}setAudioContext(A){this.audioContext=A}getSenderStats(){return ii(this,void 0,void 0,(function*(){var A;if(!(null===(A=this.sender)||void 0===A?void 0:A.getStats))return;let t;return(yield this.sender.getStats()).forEach((A=>{"outbound-rtp"===A.type&&(t={type:"audio",streamId:A.id,packetsSent:A.packetsSent,packetsLost:A.packetsLost,bytesSent:A.bytesSent,timestamp:A.timestamp,roundTripTime:A.roundTripTime,jitter:A.jitter})})),t}))}checkForSilence(){return ii(this,void 0,void 0,(function*(){const A=yield(function(A){return ii(this,arguments,void 0,(function(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return(function*(){const e=is();if(e){const i=e.createAnalyser();i.fftSize=2048;const n=i.frequencyBinCount,r=new Uint8Array(n);e.createMediaStreamSource(new MediaStream([A.mediaStreamTrack])).connect(i),yield wr(t),i.getByteTimeDomainData(r);const s=r.some((A=>128!==A&&0!==A));return e.close(),!s}return!1})()}))})(this);return A&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(On.AudioSilenceDetected)),A}))}}const io=Object.values(lr),no=Object.values(dr),ro=Object.values(Br),so=[lr.h180,lr.h360],oo=[dr.h180,dr.h360],ao=["q","h","f"];function co(A,t,e,i){var n,r;let s=null==i?void 0:i.videoEncoding;A&&(s=null==i?void 0:i.screenShareEncoding);const o=null==i?void 0:i.simulcast,a=null==i?void 0:i.scalabilityMode,c=null==i?void 0:i.videoCodec;if(!s&&!o&&!a||!t||!e)return[{}];s||(s=(function(A,t,e,i){const n=(function(A,t,e){if(A)return ro;const i=t>e?t/e:e/t;return Math.abs(i-16/9)<Math.abs(i-4/3)?io:no})(A,t,e);let{encoding:r}=n[0];const s=Math.max(t,e);for(let o=0;o<n.length;o+=1){const A=n[o];if(r=A.encoding,A.width>=s)break}if(i)switch(i){case"av1":r=Object.assign({},r),r.maxBitrate=.7*r.maxBitrate;break;case"vp9":r=Object.assign({},r),r.maxBitrate=.85*r.maxBitrate}return r})(A,t,e,c),qe.debug("using video encoding",s));const u=s.maxFramerate,h=new nr(t,e,s.maxBitrate,s.maxFramerate,s.priority);if(a&&vr(c)){const A=new Bo(a),t=[];if(A.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(a));const e=Xn();if(Ur()||yr()||"Chrome"===(null==e?void 0:e.name)&&kr(null==e?void 0:e.version,"113")<0){const e="h"==A.suffix?2:3;for(let i=0;i<A.spatial;i+=1)t.push({rid:ao[2-i],maxBitrate:s.maxBitrate/Math.pow(e,i),maxFramerate:h.encoding.maxFramerate});t[0].scalabilityMode=a}else t.push({maxBitrate:s.maxBitrate,maxFramerate:h.encoding.maxFramerate,scalabilityMode:a});return h.encoding.priority&&(t[0].priority=h.encoding.priority,t[0].networkPriority=h.encoding.priority),qe.debug("using svc encoding",{encodings:t}),t}if(!o)return[s];let l,d=[];if(d=A?null!==(n=lo(null==i?void 0:i.screenShareSimulcastLayers))&&void 0!==n?n:uo(A,h):null!==(r=lo(null==i?void 0:i.videoSimulcastLayers))&&void 0!==r?r:uo(A,h),d.length>0){const A=d[0];d.length>1&&([,l]=d);const i=Math.max(t,e);if(i>=960&&l)return ho(t,e,[A,l,h],u);if(i>=480)return ho(t,e,[A,h],u)}return ho(t,e,[h])}function uo(A,t){if(A)return[{scaleResolutionDownBy:2,fps:(e=t).encoding.maxFramerate}].map((A=>{var t,i;return new nr(Math.floor(e.width/A.scaleResolutionDownBy),Math.floor(e.height/A.scaleResolutionDownBy),Math.max(15e4,Math.floor(e.encoding.maxBitrate/(Math.pow(A.scaleResolutionDownBy,2)*((null!==(t=e.encoding.maxFramerate)&&void 0!==t?t:30)/(null!==(i=A.fps)&&void 0!==i?i:30))))),A.fps,e.encoding.priority)}));var e;const{width:i,height:n}=t,r=i>n?i/n:n/i;return Math.abs(r-16/9)<Math.abs(r-4/3)?so:oo}function ho(A,t,e,i){const n=[];if(e.forEach(((e,r)=>{if(r>=ao.length)return;const s=Math.min(A,t),o={rid:ao[r],scaleResolutionDownBy:Math.max(1,s/Math.min(e.width,e.height)),maxBitrate:e.encoding.maxBitrate},a=i&&e.encoding.maxFramerate?Math.min(i,e.encoding.maxFramerate):e.encoding.maxFramerate;a&&(o.maxFramerate=a);const c=Qr()||0===r;e.encoding.priority&&c&&(o.priority=e.encoding.priority,o.networkPriority=e.encoding.priority),n.push(o)})),yr()&&"ios"===Ir()){let A;n.forEach((t=>{A?t.maxFramerate&&t.maxFramerate>A&&(A=t.maxFramerate):A=t.maxFramerate}));let t=!0;n.forEach((e=>{var i;e.maxFramerate!=A&&(t&&(t=!1,qe.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),qe.info('Setting framerate of encoding "'.concat(null!==(i=e.rid)&&void 0!==i?i:"",'" to ').concat(A)),e.maxFramerate=A)}))}return n}function lo(A){if(A)return A.sort(((A,t)=>{const{encoding:e}=A,{encoding:i}=t;return e.maxBitrate>i.maxBitrate?1:e.maxBitrate<i.maxBitrate?-1:e.maxBitrate===i.maxBitrate&&e.maxFramerate&&i.maxFramerate?e.maxFramerate>i.maxFramerate?1:-1:0}))}class Bo{constructor(A){const t=A.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw new Error("invalid scalability mode");if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=t[3]}}toString(){var A;return"L".concat(this.spatial,"T").concat(this.temporal).concat(null!==(A=this.suffix)&&void 0!==A?A:"")}}class fo extends to{get sender(){return this.BA}set sender(A){this.BA=A,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(A,t){let e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0;super(A,tr.Kind.Video,t,e,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>ii(this,void 0,void 0,(function*(){if(!this.sender)return void(this.aA=0);let A;try{A=yield this.getSenderStats()}catch(e){return void this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:e}))}const t=new Map(A.map((A=>[A.rid,A])));if(this.prevStats){let A=0;t.forEach(((t,e)=>{var i;const n=null===(i=this.prevStats)||void 0===i?void 0:i.get(e);A+=Ao(t,n)})),this.aA=A}this.prevStats=t})),this.senderLock=new g}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(A){var t;if(this.signalClient=A,!Fr())return;const e=null===(t=this.sender)||void 0===t?void 0:t.getParameters();e&&(this.encodings=e.encodings),this.monitorInterval||(this.monitorInterval=setInterval((()=>{this.monitorSender()}),zs))}stop(){this.cA.getConstraints(),this.simulcastCodecs.forEach((A=>{A.mediaStreamTrack.stop()})),super.stop()}pauseUpstream(){const A=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return ii(this,void 0,void 0,(function*(){var t,e,i,n,r;yield A.pauseUpstream.call(this);try{for(var s,o=!0,a=ni(this.simulcastCodecs.values());!(t=(s=yield a.next()).done);o=!0){n=s.value,o=!1;const A=n;yield null===(r=A.sender)||void 0===r?void 0:r.replaceTrack(null)}}catch(c){e={error:c}}finally{try{o||t||!(i=a.return)||(yield i.call(a))}finally{if(e)throw e.error}}}))}resumeUpstream(){const A=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return ii(this,void 0,void 0,(function*(){var t,e,i,n,r;yield A.resumeUpstream.call(this);try{for(var s,o=!0,a=ni(this.simulcastCodecs.values());!(t=(s=yield a.next()).done);o=!0){n=s.value,o=!1;const A=n;yield null===(r=A.sender)||void 0===r?void 0:r.replaceTrack(A.mediaStreamTrack)}}catch(c){e={error:c}}finally{try{o||t||!(i=a.return)||(yield i.call(a))}finally{if(e)throw e.error}}}))}mute(){const A=Object.create(null,{mute:{get:()=>super.mute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source!==tr.Source.Camera||this.isUserProvided||(this.log.debug("stopping camera track",this.logContext),this.cA.stop()),yield A.mute.call(this),this)}finally{t()}}))}unmute(){const A=Object.create(null,{unmute:{get:()=>super.unmute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.source!==tr.Source.Camera||this.isUserProvided||(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield A.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{t()}}))}setTrackMuted(A){super.setTrackMuted(A);for(const t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!A}getSenderStats(){return ii(this,void 0,void 0,(function*(){var A;if(!(null===(A=this.sender)||void 0===A?void 0:A.getStats))return[];const t=[],e=yield this.sender.getStats();return e.forEach((A=>{var i;if("outbound-rtp"===A.type){const n={type:"video",streamId:A.id,frameHeight:A.frameHeight,frameWidth:A.frameWidth,framesPerSecond:A.framesPerSecond,framesSent:A.framesSent,firCount:A.firCount,pliCount:A.pliCount,nackCount:A.nackCount,packetsSent:A.packetsSent,bytesSent:A.bytesSent,qualityLimitationReason:A.qualityLimitationReason,qualityLimitationDurations:A.qualityLimitationDurations,qualityLimitationResolutionChanges:A.qualityLimitationResolutionChanges,rid:null!==(i=A.rid)&&void 0!==i?i:A.id,retransmittedPacketsSent:A.retransmittedPacketsSent,targetBitrate:A.targetBitrate,timestamp:A.timestamp},r=e.get(A.remoteId);r&&(n.jitter=r.jitter,n.packetsLost=r.packetsLost,n.roundTripTime=r.roundTripTime),t.push(n)}})),t.sort(((A,t)=>{var e,i;return(null!==(e=t.frameWidth)&&void 0!==e?e:0)-(null!==(i=A.frameWidth)&&void 0!==i?i:0)})),t}))}setPublishingQuality(A){const t=[];for(let e=zn.LOW;e<=zn.HIGH;e+=1)t.push(new Ce({quality:e,enabled:e<=A}));this.log.debug("setting publishing quality. max quality ".concat(A),this.logContext),this.setPublishingLayers(t)}restartTrack(A){return ii(this,void 0,void 0,(function*(){var t,e,i,n,r;let s;if(A){const t=es({video:A});"boolean"!=typeof t.video&&(s=t.video)}yield this.restart(s);try{for(var o,a=!0,c=ni(this.simulcastCodecs.values());!(t=(o=yield c.next()).done);a=!0){n=o.value,a=!1;const A=n;A.sender&&"closed"!==(null===(r=A.sender.transport)||void 0===r?void 0:r.state)&&(A.mediaStreamTrack=this.mediaStreamTrack.clone(),yield A.sender.replaceTrack(A.mediaStreamTrack))}}catch(u){e={error:u}}finally{try{a||t||!(i=c.return)||(yield i.call(c))}finally{if(e)throw e.error}}}))}setProcessor(A){const t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return ii(this,arguments,void 0,(function(A){var e=this;let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){var n,r,s,o,a,c;if(yield t.setProcessor.call(e,A,i),null===(a=e.processor)||void 0===a?void 0:a.processedTrack)try{for(var u,h=!0,l=ni(e.simulcastCodecs.values());!(n=(u=yield l.next()).done);h=!0){o=u.value,h=!1;const A=o;yield null===(c=A.sender)||void 0===c?void 0:c.replaceTrack(e.processor.processedTrack)}}catch(d){r={error:d}}finally{try{h||n||!(s=l.return)||(yield s.call(l))}finally{if(r)throw r.error}}})()}))}setDegradationPreference(A){return ii(this,void 0,void 0,(function*(){if(this.degradationPreference=A,this.sender)try{this.log.debug("setting degradationPreference to ".concat(A),this.logContext);const t=this.sender.getParameters();t.degradationPreference=A,this.sender.setParameters(t)}catch(t){this.log.warn("failed to set degradationPreference",Object.assign({error:t},this.logContext))}}))}addSimulcastTrack(A,t){if(this.simulcastCodecs.has(A))return void this.log.error("".concat(A," already added, skipping adding simulcast codec"),this.logContext);const e={codec:A,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(A,e),e}setSimulcastTrackSender(A,t){const e=this.simulcastCodecs.get(A);e&&(e.sender=t,setTimeout((()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)}),5e3))}setPublishingCodecs(A){return ii(this,void 0,void 0,(function*(){var t,e,i,n,r,s,o;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:A,currentCodec:this.codec})),!this.codec&&A.length>0)return yield this.setPublishingLayers(A[0].qualities),[];this.subscribedCodecs=A;const a=[];try{for(t=!0,e=ni(A);!(n=(i=yield e.next()).done);t=!0){o=i.value,t=!1;const A=o;if(this.codec&&this.codec!==A.codec){const t=this.simulcastCodecs.get(A.codec);if(this.log.debug("try setPublishingCodec for ".concat(A.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:t})),t&&t.sender)t.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(A.codec),this.logContext),yield wo(t.sender,t.encodings,A.qualities,this.senderLock,this.log,this.logContext));else for(const e of A.qualities)if(e.enabled){a.push(A.codec);break}}else yield this.setPublishingLayers(A.qualities)}}catch(c){r={error:c}}finally{try{t||n||!(s=e.return)||(yield s.call(e))}finally{if(r)throw r.error}}return a}))}setPublishingLayers(A){return ii(this,void 0,void 0,(function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:A})),this.sender&&this.encodings&&(yield wo(this.sender,this.encodings,A,this.senderLock,this.log,this.logContext))}))}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ii(this,void 0,void 0,(function*(){yield A.handleAppVisibilityChanged.call(this),Cr()&&this.isInBackground&&this.source===tr.Source.Camera&&(this.cA.enabled=!1)}))}}function wo(A,t,e,i,n,r){return ii(this,void 0,void 0,(function*(){const s=yield i.lock();n.debug("setPublishingLayersForSender",Object.assign(Object.assign({},r),{sender:A,qualities:e,senderEncodings:t}));try{const i=A.getParameters(),{encodings:s}=i;if(!s)return;if(s.length!==t.length)return void n.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},r),{encodings:s,senderEncodings:t}));let o=!1;const a=Xn();if("Chrome"===(null==a?void 0:a.name)&&kr(null==a?void 0:a.version,"133")>0&&s[0].scalabilityMode){const A=s[0],i=new Bo(A.scalabilityMode);let n=tt.OFF;if(e.forEach((A=>{A.enabled&&(n===tt.OFF||A.quality>n)&&(n=A.quality)})),n===tt.OFF)A.active&&(A.active=!1,o=!0);else if(!A.active||i.spatial!==n+1){o=!0,A.active=!0;const e=new Bo(t[0].scalabilityMode);i.spatial=n+1,i.suffix=e.suffix,1===i.spatial&&(i.suffix=void 0),A.scalabilityMode=i.toString(),A.scaleResolutionDownBy=Math.pow(2,2-n),t[0].maxBitrate&&(A.maxBitrate=t[0].maxBitrate/(A.scaleResolutionDownBy*A.scaleResolutionDownBy))}}else s.forEach(((A,i)=>{var s;let a=null!==(s=A.rid)&&void 0!==s?s:"";""===a&&(a="q");const c=go(a),u=e.find((A=>A.quality===c));u&&A.active!==u.enabled&&(o=!0,A.active=u.enabled,n.debug("setting layer ".concat(u.quality," to ").concat(A.active?"enabled":"disabled"),r),Qr()&&(u.enabled?(A.scaleResolutionDownBy=t[i].scaleResolutionDownBy,A.maxBitrate=t[i].maxBitrate,A.maxFrameRate=t[i].maxFrameRate):(A.scaleResolutionDownBy=4,A.maxBitrate=10,A.maxFrameRate=2)))}));o&&(i.encodings=s,n.debug("setting encodings",Object.assign(Object.assign({},r),{encodings:i.encodings})),yield A.setParameters(i))}finally{s()}}))}function go(A){switch(A){case"f":default:return zn.HIGH;case"h":return zn.MEDIUM;case"q":return zn.LOW}}function po(A,t,e,i){if(!e)return[new pt({quality:zn.HIGH,width:A,height:t,bitrate:0,ssrc:0})];if(i){const i=e[0].scalabilityMode,n=new Bo(i),r=[],s="h"==n.suffix?1.5:2,o="h"==n.suffix?2:3;for(let a=0;a<n.spatial;a+=1)r.push(new pt({quality:Math.min(zn.HIGH,n.spatial-1)-a,width:Math.ceil(A/Math.pow(s,a)),height:Math.ceil(t/Math.pow(s,a)),bitrate:e[0].maxBitrate?Math.ceil(e[0].maxBitrate/Math.pow(o,a)):0,ssrc:0}));return r}return e.map((e=>{var i,n,r;const s=null!==(i=e.scaleResolutionDownBy)&&void 0!==i?i:1;let o=go(null!==(n=e.rid)&&void 0!==n?n:"");return new pt({quality:o,width:Math.ceil(A/s),height:Math.ceil(t/s),bitrate:null!==(r=e.maxBitrate)&&void 0!==r?r:0,ssrc:0})}))}const vo="_lossy",mo="_reliable",Qo="leave-reconnect";var Uo,Co,Fo,yo,bo,Eo,Io,Ho,ko,To,So;(Co=Uo||(Uo={}))[Co.New=0]="New",Co[Co.Connected=1]="Connected",Co[Co.Disconnected=2]="Disconnected",Co[Co.Reconnecting=3]="Reconnecting",Co[Co.Closed=4]="Closed";class Oo extends oi.EventEmitter{get isClosed(){return this.gA}get pendingReconnect(){return!!this.reconnectTimeout}constructor(A){var t;super(),this.options=A,this.rtcConfig={},this.peerConnectionTimeout=Js.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=Uo.New,this.gA=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=qe,this.handleDataChannel=A=>ii(this,[A],void 0,(function(A){var t=this;let{channel:e}=A;return(function*(){if(e){if(e.label===mo)t.reliableDCSub=e;else{if(e.label!==vo)return;t.lossyDCSub=e}t.log.debug("on data channel ".concat(e.id,", ").concat(e.label),t.logContext),e.onmessage=t.handleDataMessage}})()})),this.handleDataMessage=A=>ii(this,void 0,void 0,(function*(){var t,e;const i=yield this.dataProcessLock.lock();try{let i;if(A.data instanceof ArrayBuffer)i=A.data;else{if(!(A.data instanceof Blob))return void this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:A.data}));i=yield A.data.arrayBuffer()}const n=vt.fromBinary(new Uint8Array(i));"speaker"===(null===(t=n.value)||void 0===t?void 0:t.case)?this.emit(Tn.ActiveSpeakersUpdate,n.value.value.speakers):("user"===(null===(e=n.value)||void 0===e?void 0:e.case)&&(function(A,t){const e=A.participantIdentity?A.participantIdentity:t.participantIdentity;A.participantIdentity=e,t.participantIdentity=e;const i=0!==A.destinationIdentities.length?A.destinationIdentities:t.destinationIdentities;A.destinationIdentities=i,t.destinationIdentities=i})(n,n.value.value),this.emit(Tn.DataPacketReceived,n))}finally{i()}})),this.handleDataError=A=>{const t=0===A.currentTarget.maxRetransmits?"lossy":"reliable";if(A instanceof ErrorEvent&&A.error){const{error:e}=A.error;this.log.error("DataChannel error on ".concat(t,": ").concat(A.message),Object.assign(Object.assign({},this.logContext),{error:e}))}else this.log.error("Unknown DataChannel error on ".concat(t),Object.assign(Object.assign({},this.logContext),{event:A}))},this.handleBufferedAmountLow=A=>{const t=0===A.currentTarget.maxRetransmits?mt.LOSSY:mt.RELIABLE;this.updateAndEmitDCBufferStatus(t)},this.handleDisconnect=(A,t)=>{if(this.gA)return;this.log.warn("".concat(A," disconnected"),this.logContext),0===this.reconnectAttempts&&(this.reconnectStart=Date.now());const e=Date.now()-this.reconnectStart;let i=this.getNextRetryDelay({elapsedMs:e,retryCount:this.reconnectAttempts});null!==i?(A===Qo&&(i=0),this.log.debug("reconnecting in ".concat(i,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Zn.setTimeout((()=>this.attemptReconnect(t).finally((()=>this.reconnectTimeout=void 0))),i)):(A=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(A,"ms. giving up"),this.logContext),this.emit(Tn.Disconnected),this.close()})(e)},this.waitForRestarted=()=>new Promise(((A,t)=>{this.pcState===Uo.Connected&&A();const e=()=>{this.off(Tn.Disconnected,i),A()},i=()=>{this.off(Tn.Restarted,e),t()};this.once(Tn.Restarted,e),this.once(Tn.Disconnected,i)})),this.updateAndEmitDCBufferStatus=A=>{const t=this.isBufferStatusLow(A);void 0!==t&&t!==this.dcBufferStatus.get(A)&&(this.dcBufferStatus.set(A,t),this.emit(Tn.DCBufferStatusChanged,t,A))},this.isBufferStatusLow=A=>{const t=this.dataChannelForKind(A);if(t)return t.bufferedAmount<=t.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===ps.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(rt.RR_SIGNAL_DISCONNECTED))},this.log=ze(null!==(t=A.loggerName)&&void 0!==t?t:Ye.Engine),this.loggerOptions={loggerName:A.loggerName,loggerContextCb:()=>this.logContext},this.client=new ms(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new g,this.dataProcessLock=new g,this.dcBufferStatus=new Map([[mt.LOSSY,!0],[mt.RELIABLE,!0]]),this.client.onParticipantUpdate=A=>this.emit(Tn.ParticipantUpdate,A),this.client.onConnectionQuality=A=>this.emit(Tn.ConnectionQualityUpdate,A),this.client.onRoomUpdate=A=>this.emit(Tn.RoomUpdate,A),this.client.onSubscriptionError=A=>this.emit(Tn.SubscriptionError,A),this.client.onSubscriptionPermissionUpdate=A=>this.emit(Tn.SubscriptionPermissionUpdate,A),this.client.onSpeakersChanged=A=>this.emit(Tn.SpeakersChanged,A),this.client.onStreamStateUpdate=A=>this.emit(Tn.StreamStateChanged,A),this.client.onRequestResponse=A=>this.emit(Tn.SignalRequestResponse,A)}get logContext(){var A,t,e,i,n,r,s,o;return{room:null===(t=null===(A=this.latestJoinResponse)||void 0===A?void 0:A.room)||void 0===t?void 0:t.name,roomID:null===(i=null===(e=this.latestJoinResponse)||void 0===e?void 0:e.room)||void 0===i?void 0:i.sid,participant:null===(r=null===(n=this.latestJoinResponse)||void 0===n?void 0:n.participant)||void 0===r?void 0:r.identity,pID:null===(o=null===(s=this.latestJoinResponse)||void 0===s?void 0:s.participant)||void 0===o?void 0:o.sid}}join(A,t,e,i){return ii(this,void 0,void 0,(function*(){this.url=A,this.token=t,this.signalOpts=e,this.maxJoinAttempts=e.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const n=yield this.client.join(A,t,e,i);return this.gA=!1,this.latestJoinResponse=n,this.subscriberPrimary=n.subscriberPrimary,this.pcManager||(yield this.configure(n)),this.subscriberPrimary&&!n.fastPublish||this.negotiate(),this.clientConfiguration=n.clientConfiguration,setTimeout((()=>{this.emit(Tn.SignalConnected)}),10),n}catch(n){if(n instanceof Ln&&n.reason===Qn.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(A,t,e,i);throw n}}))}close(){return ii(this,void 0,void 0,(function*(){const A=yield this.closingLock.lock();if(this.isClosed)A();else try{this.gA=!0,this.joinAttempts=0,this.emit(Tn.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{A()}}))}cleanupPeerConnections(){return ii(this,void 0,void 0,(function*(){var A;yield null===(A=this.pcManager)||void 0===A?void 0:A.close(),this.pcManager=void 0;const t=A=>{A&&(A.close(),A.onbufferedamountlow=null,A.onclose=null,A.onclosing=null,A.onerror=null,A.onmessage=null,A.onopen=null)};t(this.lossyDC),t(this.lossyDCSub),t(this.reliableDC),t(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0}))}cleanupClient(){return ii(this,void 0,void 0,(function*(){yield this.client.close(),this.client.resetCallbacks()}))}addTrack(A){if(this.pendingTrackResolvers[A.cid])throw new _n("a track with the same ID has already been published");return new Promise(((t,e)=>{const i=setTimeout((()=>{delete this.pendingTrackResolvers[A.cid],e(new Ln("publication of local track timed out, no response from server",Qn.InternalError))}),1e4);this.pendingTrackResolvers[A.cid]={resolve:A=>{clearTimeout(i),t(A)},reject:()=>{clearTimeout(i),e(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(A)}))}removeTrack(A){if(A.track&&this.pendingTrackResolvers[A.track.id]){const{reject:t}=this.pendingTrackResolvers[A.track.id];t&&t(),delete this.pendingTrackResolvers[A.track.id]}try{return this.pcManager.removeTrack(A),!0}catch(t){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:t}))}return!1}updateMuteStatus(A,t){this.client.sendMuteTrack(A,t)}get dataSubscriberReadyState(){var A;return null===(A=this.reliableDCSub)||void 0===A?void 0:A.readyState}getConnectedServerAddress(){return ii(this,void 0,void 0,(function*(){var A;return null===(A=this.pcManager)||void 0===A?void 0:A.getConnectedAddress()}))}setRegionUrlProvider(A){this.regionUrlProvider=A}configure(A){return ii(this,void 0,void 0,(function*(){var t,e;if(this.pcManager&&this.pcManager.currentState!==Xs.NEW)return;this.participantSid=null===(t=A.participant)||void 0===t?void 0:t.sid;const i=this.makeRTCConfiguration(A);var n;this.pcManager=new $s(i,A.subscriberPrimary,this.loggerOptions),this.emit(Tn.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(A,t)=>{this.client.sendIceCandidate(A,t)},this.pcManager.onPublisherOffer=A=>{this.client.sendOffer(A)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(t,e,i)=>ii(this,void 0,void 0,(function*(){if(this.log.debug("primary PC state changed ".concat(t),this.logContext),["closed","disconnected","failed"].includes(e)&&(this.publisherConnectionPromise=void 0),t===Xs.CONNECTED){const t=this.pcState===Uo.New;this.pcState=Uo.Connected,t&&this.emit(Tn.Connected,A)}else t===Xs.FAILED&&this.pcState===Uo.Connected&&(this.pcState=Uo.Disconnected,this.handleDisconnect("peerconnection failed","failed"===i?rt.RR_SUBSCRIBER_FAILED:rt.RR_PUBLISHER_FAILED));const n=this.client.isDisconnected||this.client.currentState===ps.RECONNECTING,r=[Xs.FAILED,Xs.CLOSING,Xs.CLOSED].includes(t);n&&r&&!this.gA&&this.emit(Tn.Offline)})),this.pcManager.onTrack=A=>{this.emit(Tn.MediaTrackAdded,A.track,A.streams[0],A.receiver)},void 0!==(n=null===(e=A.serverInfo)||void 0===e?void 0:e.protocol)&&n>13||this.createDataChannels()}))}setupSignalClientCallbacks(){this.client.onAnswer=A=>ii(this,void 0,void 0,(function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:A.type})),yield this.pcManager.setPublisherAnswer(A))})),this.client.onTrickle=(A,t)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:A,target:t})),this.pcManager.addIceCandidate(A,t))},this.client.onOffer=A=>ii(this,void 0,void 0,(function*(){if(!this.pcManager)return;const t=yield this.pcManager.createSubscriberAnswerFromOffer(A);this.client.sendAnswer(t)})),this.client.onLocalTrackPublished=A=>{var t;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:A.cid,track:null===(t=A.track)||void 0===t?void 0:t.sid})),!this.pendingTrackResolvers[A.cid])return void this.log.error("missing track resolver for ".concat(A.cid),Object.assign(Object.assign({},this.logContext),{cid:A.cid}));const{resolve:e}=this.pendingTrackResolvers[A.cid];delete this.pendingTrackResolvers[A.cid],e(A.track)},this.client.onLocalTrackUnpublished=A=>{this.emit(Tn.LocalTrackUnpublished,A)},this.client.onLocalTrackSubscribed=A=>{this.emit(Tn.LocalTrackSubscribed,A)},this.client.onTokenRefresh=A=>{this.token=A},this.client.onRemoteMuteChanged=(A,t)=>{this.emit(Tn.RemoteMute,A,t)},this.client.onSubscribedQualityUpdate=A=>{this.emit(Tn.SubscribedQualityUpdate,A)},this.client.onRoomMoved=A=>{var t;this.participantSid=null===(t=A.participant)||void 0===t?void 0:t.sid,this.emit(Tn.RoomMoved,A)},this.client.onClose=()=>{this.handleDisconnect("signal",rt.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=A=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:null==A?void 0:A.reason})),A.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(A.regions)),A.action){case de.DISCONNECT:this.emit(Tn.Disconnected,null==A?void 0:A.reason),this.close();break;case de.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Qo);break;case de.RESUME:this.handleDisconnect(Qo)}}}makeRTCConfiguration(A){var t;const e=Object.assign({},this.rtcConfig);if((null===(t=this.signalOpts)||void 0===t?void 0:t.e2eeEnabled)&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),e.encodedInsertableStreams=!0),A.iceServers&&!e.iceServers){const t=[];A.iceServers.forEach((A=>{const e={urls:A.urls};A.username&&(e.username=A.username),A.credential&&(e.credential=A.credential),t.push(e)})),e.iceServers=t}return A.clientConfiguration&&A.clientConfiguration.forceRelay===it.ENABLED&&(e.iceTransportPolicy="relay"),e.sdpSemantics="unified-plan",e.continualGatheringPolicy="gather_continually",e}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(vo,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(mo,{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(A,t,e){return ii(this,void 0,void 0,(function*(){if(gr())return yield this.createTransceiverRTCRtpSender(A,t,e);if(pr())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(A.mediaStreamTrack);throw new Nn("Required webRTC APIs not supported on this device")}))}createSimulcastSender(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(gr())return this.createSimulcastTransceiverSender(A,t,e,i);if(pr())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(A.mediaStreamTrack);throw new Nn("Cannot stream on this device")}))}createTransceiverRTCRtpSender(A,t,e){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Nn("publisher is closed");const i=[];A.mediaStream&&i.push(A.mediaStream),Yr(A)&&(A.codec=t.videoCodec);const n={direction:"sendonly",streams:i};return e&&(n.sendEncodings=e),(yield this.pcManager.addPublisherTransceiver(A.mediaStreamTrack,n)).sender}))}createSimulcastTransceiverSender(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Nn("publisher is closed");const n={direction:"sendonly"};i&&(n.sendEncodings=i);const r=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,n);if(e.videoCodec)return A.setSimulcastTrackSender(e.videoCodec,r.sender),r.sender}))}createRTCRtpSender(A){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Nn("publisher is closed");return this.pcManager.addPublisherTrack(A)}))}attemptReconnect(A){return ii(this,void 0,void 0,(function*(){var t,e,i;if(!this.gA)if(this.attemptingReconnect)qe.warn("already attempting reconnect, returning early",this.logContext);else{(null===(t=this.clientConfiguration)||void 0===t?void 0:t.resumeConnection)!==it.DISABLED&&(null!==(i=null===(e=this.pcManager)||void 0===e?void 0:e.currentState)&&void 0!==i?i:Xs.NEW)!==Xs.NEW||(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(A),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(n){this.reconnectAttempts+=1;let A=!0;n instanceof Nn?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:n})),A=!1):n instanceof Ko||(this.fullReconnectOnNext=!0),A?this.handleDisconnect("reconnect",rt.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(Tn.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}}))}getNextRetryDelay(A){try{return this.reconnectPolicy.nextRetryDelayInMs(A)}catch(t){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:t}))}return null}restartConnection(A){return ii(this,void 0,void 0,(function*(){var t,e,i;try{if(!this.url||!this.token)throw new Nn("could not reconnect, url or token not saved");let e;this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(Tn.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Ko;e=yield this.join(null!=A?A:this.url,this.token,this.signalOpts)}catch(n){if(n instanceof Ln&&n.reason===Qn.NotAllowed)throw new Nn("could not reconnect, token might be expired");throw new Ko}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(Tn.SignalRestarted,e),yield this.waitForPCReconnected(),this.client.currentState!==ps.CONNECTED)throw new Ko("Signal connection got severed during reconnect");null===(t=this.regionUrlProvider)||void 0===t||t.resetAttempts(),this.emit(Tn.Restarted)}catch(r){const A=yield null===(e=this.regionUrlProvider)||void 0===e?void 0:e.getNextBestRegionUrl();if(A)return void(yield this.restartConnection(A));throw null===(i=this.regionUrlProvider)||void 0===i||i.resetAttempts(),r}}))}resumeConnection(A){return ii(this,void 0,void 0,(function*(){var t;if(!this.url||!this.token)throw new Nn("could not reconnect, url or token not saved");if(!this.pcManager)throw new Nn("publisher and subscriber connections unset");let e;this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(Tn.Resuming);try{this.setupSignalClientCallbacks(),e=yield this.client.reconnect(this.url,this.token,this.participantSid,A)}catch(i){let A="";if(i instanceof Error&&(A=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof Ln&&i.reason===Qn.NotAllowed)throw new Nn("could not reconnect, token might be expired");if(i instanceof Ln&&i.reason===Qn.LeaveRequest)throw i;throw new Ko(A)}if(this.emit(Tn.SignalResumed),e){const A=this.makeRTCConfiguration(e);this.pcManager.updateConfiguration(A)}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!==ps.CONNECTED)throw new Ko("Signal connection got severed during reconnect");this.client.setReconnected(),"open"===(null===(t=this.reliableDC)||void 0===t?void 0:t.readyState)&&null===this.reliableDC.id&&this.createDataChannels(),this.emit(Tn.Resumed)}))}waitForPCInitialConnection(A,t){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Nn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(t,A)}))}waitForPCReconnected(){return ii(this,void 0,void 0,(function*(){this.pcState=Uo.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield wr(2e3),!this.pcManager)throw new Nn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Uo.Connected}catch(A){throw this.pcState=Uo.Disconnected,new Ln("could not establish PC connection, ".concat(A.message),Qn.InternalError)}}))}publishRpcResponse(A,t,e,i){return ii(this,void 0,void 0,(function*(){const n=new vt({destinationIdentities:[A],kind:mt.RELIABLE,value:{case:"rpcResponse",value:new kt({requestId:t,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:null!=e?e:""}})}});yield this.sendDataPacket(n,mt.RELIABLE)}))}publishRpcAck(A,t){return ii(this,void 0,void 0,(function*(){const e=new vt({destinationIdentities:[A],kind:mt.RELIABLE,value:{case:"rpcAck",value:new Ht({requestId:t})}});yield this.sendDataPacket(e,mt.RELIABLE)}))}sendDataPacket(A,t){return ii(this,void 0,void 0,(function*(){const e=A.toBinary();yield this.ensurePublisherConnected(t);const i=this.dataChannelForKind(t);i&&i.send(e),this.updateAndEmitDCBufferStatus(t)}))}waitForBufferStatusLow(A){return new Promise(((t,e)=>ii(this,void 0,void 0,(function*(){if(this.isBufferStatusLow(A))t();else{const i=()=>e("Engine closed");for(this.once(Tn.Closing,i);!this.dcBufferStatus.get(A);)yield wr(10);this.off(Tn.Closing,i),t()}}))))}ensureDataTransportConnected(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.subscriberPrimary;return(function*(){var i;if(!t.pcManager)throw new Nn("PC manager is closed");const n=e?t.pcManager.subscriber:t.pcManager.publisher,r=e?"Subscriber":"Publisher";if(!n)throw new Ln("".concat(r," connection not set"),Qn.InternalError);let s=!1;e||t.dataChannelForKind(A,e)||(t.createDataChannels(),s=!0),s||e||t.pcManager.publisher.isICEConnected||"checking"===t.pcManager.publisher.getICEConnectionState()||(s=!0),s&&t.negotiate();const o=t.dataChannelForKind(A,e);if("open"===(null==o?void 0:o.readyState))return;const a=(new Date).getTime()+t.peerConnectionTimeout;for(;(new Date).getTime()<a;){if(n.isICEConnected&&"open"===(null===(i=t.dataChannelForKind(A,e))||void 0===i?void 0:i.readyState))return;yield wr(50)}throw new Ln("could not establish ".concat(r," connection, state: ").concat(n.getICEConnectionState()),Qn.InternalError)})()}))}ensurePublisherConnected(A){return ii(this,void 0,void 0,(function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(A,!1)),yield this.publisherConnectionPromise}))}verifyTransport(){return!!this.pcManager&&this.pcManager.currentState===Xs.CONNECTED&&!(!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return ii(this,void 0,void 0,(function*(){return new Promise(((A,t)=>ii(this,void 0,void 0,(function*(){if(!this.pcManager)return void t(new jn("PC manager is closed"));this.pcManager.requirePublisher(),0!=this.pcManager.publisher.getTransceivers().length||this.lossyDC||this.reliableDC||this.createDataChannels();const e=new AbortController,i=()=>{e.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),A()};this.isClosed&&t("cannot negotiate on closed engine"),this.on(Tn.Closing,i),this.pcManager.publisher.once(Ls,(A=>{const t=new Map;A.forEach((A=>{const e=A.codec.toLowerCase();var i;i=e,sr.includes(i)&&t.set(A.payload,e)})),this.emit(Tn.RTPVideoMapUpdate,t)}));try{yield this.pcManager.negotiate(e),A()}catch(n){n instanceof jn&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",rt.RR_UNKNOWN),t(n)}finally{this.off(Tn.Closing,i)}}))))}))}dataChannelForKind(A,t){if(t){if(A===mt.LOSSY)return this.lossyDCSub;if(A===mt.RELIABLE)return this.reliableDCSub}else{if(A===mt.LOSSY)return this.lossyDC;if(A===mt.RELIABLE)return this.reliableDC}}sendSyncState(A,t){var e,i;if(!this.pcManager)return void this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);const n=this.pcManager.subscriber.getLocalDescription(),r=this.pcManager.subscriber.getRemoteDescription(),s=null===(i=null===(e=this.signalOpts)||void 0===e?void 0:e.autoSubscribe)||void 0===i||i,o=new Array,a=new Array;A.forEach((A=>{A.isDesired!==s&&o.push(A.trackSid),A.isEnabled||a.push(A.trackSid)})),this.client.sendSyncState(new ke({answer:n?Us({sdp:n.sdp,type:n.type}):void 0,offer:r?Us({sdp:r.sdp,type:r.type}):void 0,subscription:new ae({trackSids:o,subscribe:!s,participantTracks:[]}),publishTracks:os(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:a}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const A=[],t=(t,e)=>{void 0!==(null==t?void 0:t.id)&&null!==t.id&&A.push(new Te({label:t.label,id:t.id,target:e}))};return t(this.dataChannelForKind(mt.LOSSY),Xt.PUBLISHER),t(this.dataChannelForKind(mt.RELIABLE),Xt.PUBLISHER),t(this.dataChannelForKind(mt.LOSSY,!0),Xt.SUBSCRIBER),t(this.dataChannelForKind(mt.RELIABLE,!0),Xt.SUBSCRIBER),A}clearReconnectTimeout(){this.reconnectTimeout&&Zn.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Fr()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Fr()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Ko extends Error{}class Do{constructor(A,t){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(A),this.token=t}updateToken(A){this.token=A}isCloud(){return br(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(A){return ii(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(A));const t=this.regionSettings.regions.filter((A=>!this.attemptedRegions.find((t=>t.url===A.url))));if(t.length>0){const A=t[0];return this.attemptedRegions.push(A),qe.debug("next region: ".concat(A.region)),A.url}return null}))}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(A){return ii(this,void 0,void 0,(function*(){const t=yield fetch("".concat((e=this.serverUrl,"".concat(e.protocol.replace("ws","http"),"//").concat(e.host,"/settings")),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:A});var e;if(t.ok){const A=yield t.json();return this.lastUpdateAt=Date.now(),A}throw new Ln("Could not fetch region settings: ".concat(t.statusText),401===t.status?Qn.NotAllowed:Qn.InternalError,t.status)}))}setServerReportedRegions(A){this.regionSettings=A,this.lastUpdateAt=Date.now()}}class Mo{get info(){return this.pA}constructor(A,t,e){this.reader=t,this.totalByteSize=e,this.pA=A,this.bytesReceived=0}}class Lo extends Mo{handleChunkReceived(A){var t;this.bytesReceived+=A.content.byteLength;const e=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,e)}[Symbol.asyncIterator](){const A=this.reader.getReader();return{next:()=>ii(this,void 0,void 0,(function*(){try{const{done:t,value:e}=yield A.read();return t?{done:!0,value:void 0}:(this.handleChunkReceived(e),{done:!1,value:e.content})}catch(t){return{done:!0,value:void 0}}})),return(){return ii(this,void 0,void 0,(function*(){return A.releaseLock(),{done:!0,value:void 0}}))}}}readAll(){return ii(this,void 0,void 0,(function*(){var A,t,e,i;let n=new Set;try{for(var r,s=!0,o=ni(this);!(A=(r=yield o.next()).done);s=!0){i=r.value,s=!1;const A=i;n.add(A)}}catch(a){t={error:a}}finally{try{s||A||!(e=o.return)||(yield e.call(o))}finally{if(t)throw t.error}}return Array.from(n)}))}}class xo extends Mo{constructor(A,t,e){super(A,t,e),this.receivedChunks=new Map}handleChunkReceived(A){var t;const e=Pr(A.chunkIndex),i=this.receivedChunks.get(e);if(i&&i.version>A.version)return;this.receivedChunks.set(e,A),this.bytesReceived+=A.content.byteLength;const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,n)}[Symbol.asyncIterator](){const A=this.reader.getReader(),t=new TextDecoder;return{next:()=>ii(this,void 0,void 0,(function*(){try{const{done:e,value:i}=yield A.read();return e?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:t.decode(i.content)})}catch(e){return{done:!0,value:void 0}}})),return(){return ii(this,void 0,void 0,(function*(){return A.releaseLock(),{done:!0,value:void 0}}))}}}readAll(){return ii(this,void 0,void 0,(function*(){var A,t,e,i;let n="";try{for(var r,s=!0,o=ni(this);!(A=(r=yield o.next()).done);s=!0)i=r.value,s=!1,n+=i}catch(a){t={error:a}}finally{try{s||A||!(e=o.return)||(yield e.call(o))}finally{if(t)throw t.error}}return n}))}}class _o{constructor(A,t,e){this.writableStream=A,this.defaultWriter=A.getWriter(),this.onClose=e,this.info=t}write(A){return this.defaultWriter.write(A)}close(){return ii(this,void 0,void 0,(function*(){var A;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),null===(A=this.onClose)||void 0===A||A.call(this)}))}}class Ro extends _o{}class No extends _o{}class jo extends tr{constructor(A,t,e,i,n){super(A,e,n),this.sid=t,this.receiver=i}get isLocal(){return!1}setMuted(A){this.isMuted!==A&&(this.isMuted=A,this.cA.enabled=!A,this.emit(A?On.Muted:On.Unmuted,this))}setMediaStream(A){this.mediaStream=A;const t=e=>{e.track===this.cA&&(A.removeEventListener("removetrack",t),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this.aA=0,this.emit(On.Ended,this))};A.addEventListener("removetrack",t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return ii(this,void 0,void 0,(function*(){var A;if(null===(A=this.receiver)||void 0===A?void 0:A.getStats)return yield this.receiver.getStats()}))}setPlayoutDelay(A){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=A: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()),zs)),"undefined"!=typeof RTCRtpReceiver&&"getSynchronizationSources"in RTCRtpReceiver&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const A=()=>{var t;this.timeSyncHandle=requestAnimationFrame((()=>A()));const e=null===(t=this.receiver)||void 0===t?void 0:t.getSynchronizationSources()[0];if(e){const{timestamp:A,rtpTimestamp:t}=e;t&&this.rtpTimestamp!==t&&(this.emit(On.TimeSyncUpdate,{timestamp:A,rtpTimestamp:t}),this.rtpTimestamp=t)}};A()}}class Go extends jo{constructor(A,t,e,i,n,r){super(A,t,tr.Kind.Audio,e,r),this.monitorReceiver=()=>ii(this,void 0,void 0,(function*(){if(!this.receiver)return void(this.aA=0);const A=yield this.getReceiverStats();A&&this.prevStats&&this.receiver&&(this.aA=Ao(A,this.prevStats)),this.prevStats=A})),this.audioContext=i,this.webAudioPluginNodes=[],n&&(this.sinkId=n.deviceId)}setVolume(A){var t;for(const e of this.attachedElements)this.audioContext?null===(t=this.gainNode)||void 0===t||t.gain.setTargetAtTime(A,0,.1):e.volume=A;yr()&&this.cA.vA(A),this.elementVolume=A}getVolume(){if(this.elementVolume)return this.elementVolume;if(yr())return 1;let A=0;return this.attachedElements.forEach((t=>{t.volume>A&&(A=t.volume)})),A}setSinkId(A){return ii(this,void 0,void 0,(function*(){this.sinkId=A,yield Promise.all(this.attachedElements.map((t=>{if(mr(t))return t.setSinkId(A)})))}))}attach(A){const t=0===this.attachedElements.length;return A?super.attach(A):A=super.attach(),this.sinkId&&mr(A)&&A.setSinkId(this.sinkId).catch((A=>{this.log.error("Failed to set sink id on remote audio track",A,this.logContext)})),this.audioContext&&t&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,A),A.volume=0,A.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),A}detach(A){let t;return A?(t=super.detach(A),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}setAudioContext(A){this.audioContext=A,A&&this.attachedElements.length>0?this.connectWebAudio(A,this.attachedElements[0]):A||this.disconnectWebAudio()}setWebAudioPlugins(A){this.webAudioPluginNodes=A,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(A,t){this.disconnectWebAudio(),this.sourceNode=A.createMediaStreamSource(t.srcObject);let e=this.sourceNode;this.webAudioPluginNodes.forEach((A=>{e.connect(A),e=A})),this.gainNode=A.createGain(),e.connect(this.gainNode),this.gainNode.connect(A.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),"running"!==A.state&&A.resume().then((()=>{"running"!==A.state&&this.emit(On.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))})).catch((A=>{this.emit(On.AudioPlaybackFailed,A)}))}disconnectWebAudio(){var A,t;null===(A=this.gainNode)||void 0===A||A.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return ii(this,void 0,void 0,(function*(){if(!this.receiver||!this.receiver.getStats)return;let A;return(yield this.receiver.getStats()).forEach((t=>{"inbound-rtp"===t.type&&(A={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration})})),A}))}}class Po extends jo{constructor(A,t,e,i,n){super(A,t,tr.Kind.Video,e,n),this.elementInfos=[],this.monitorReceiver=()=>ii(this,void 0,void 0,(function*(){if(!this.receiver)return void(this.aA=0);const A=yield this.getReceiverStats();A&&this.prevStats&&this.receiver&&(this.aA=Ao(A,this.prevStats)),this.prevStats=A})),this.debouncedHandleResize=Ks((()=>{this.updateDimensions()}),100),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return void 0!==this.adaptiveStreamSettings}get mediaStreamTrack(){return this.cA}setMuted(A){super.setMuted(A),this.attachedElements.forEach((t=>{A?ir(this.cA,t):er(this.cA,t)}))}attach(A){if(A?super.attach(A):A=super.attach(),this.adaptiveStreamSettings&&void 0===this.elementInfos.find((t=>t.element===A))){const t=new Vo(A);this.observeElementInfo(t)}return A}observeElementInfo(A){this.adaptiveStreamSettings&&void 0===this.elementInfos.find((t=>t===A))?(A.handleResize=()=>{this.debouncedHandleResize()},A.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(A),A.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(A){if(!this.isAdaptiveStream)return void this.log.warn("stopObservingElementInfo ignored",this.logContext);const t=this.elementInfos.filter((t=>t===A));for(const e of t)e.stopObserving();this.elementInfos=this.elementInfos.filter((t=>t!==A)),this.updateVisibility(),this.debouncedHandleResize()}detach(A){let t=[];if(A)return this.stopObservingElement(A),super.detach(A);t=super.detach();for(const e of t)this.stopObservingElement(e);return t}getDecoderImplementation(){var A;return null===(A=this.prevStats)||void 0===A?void 0:A.decoderImplementation}getReceiverStats(){return ii(this,void 0,void 0,(function*(){if(!this.receiver||!this.receiver.getStats)return;const A=yield this.receiver.getStats();let t,e="",i=new Map;return A.forEach((A=>{"inbound-rtp"===A.type?(e=A.codecId,t={type:"video",streamId:A.id,framesDecoded:A.framesDecoded,framesDropped:A.framesDropped,framesReceived:A.framesReceived,packetsReceived:A.packetsReceived,packetsLost:A.packetsLost,frameWidth:A.frameWidth,frameHeight:A.frameHeight,pliCount:A.pliCount,firCount:A.firCount,nackCount:A.nackCount,jitter:A.jitter,timestamp:A.timestamp,bytesReceived:A.bytesReceived,decoderImplementation:A.decoderImplementation}):"codec"===A.type&&i.set(A.id,A)})),t&&""!==e&&i.get(e)&&(t.mimeType=i.get(e).mimeType),t}))}stopObservingElement(A){const t=this.elementInfos.filter((t=>t.element===A));for(const e of t)this.stopObservingElementInfo(e)}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ii(this,void 0,void 0,(function*(){yield A.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()}))}updateVisibility(){var A,t;const e=this.elementInfos.reduce(((A,t)=>Math.max(A,t.visibilityChangedAt||0)),0),i=!(null!==(t=null===(A=this.adaptiveStreamSettings)||void 0===A?void 0:A.pauseVideoInBackground)&&void 0!==t&&!t)&&this.isInBackground,n=this.elementInfos.some((A=>A.pictureInPicture)),r=this.elementInfos.some((A=>A.visible))&&!i||n;this.lastVisible!==r&&(!r&&Date.now()-e<100?Zn.setTimeout((()=>{this.updateVisibility()}),100):(this.lastVisible=r,this.emit(On.VisibilityChanged,r,this)))}updateDimensions(){var A,t;let e=0,i=0;const n=this.getPixelDensity();for(const r of this.elementInfos){const A=r.width()*n,t=r.height()*n;A+t>e+i&&(e=A,i=t)}(null===(A=this.lastDimensions)||void 0===A?void 0:A.width)===e&&(null===(t=this.lastDimensions)||void 0===t?void 0:t.height)===i||(this.lastDimensions={width:e,height:i},this.emit(On.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var A;const t=null===(A=this.adaptiveStreamSettings)||void 0===A?void 0:A.pixelDensity;return"screen"===t?Hr():t||(Hr()>2?2:1)}}class Vo{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(A,t){this.onVisibilityChanged=A=>{var t;const{target:e,isIntersecting:i}=A;e===this.element&&(this.isIntersecting=i,this.isPiP=Jo(this.element),this.visibilityChangedAt=Date.now(),null===(t=this.handleVisibilityChanged)||void 0===t||t.call(this))},this.onEnterPiP=()=>{var A,t,e;null===(t=null===(A=window.documentPictureInPicture)||void 0===A?void 0:A.window)||void 0===t||t.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Jo(this.element),null===(e=this.handleVisibilityChanged)||void 0===e||e.call(this)},this.onLeavePiP=()=>{var A;this.isPiP=Jo(this.element),null===(A=this.handleVisibilityChanged)||void 0===A||A.call(this)},this.element=A,this.isIntersecting=null!=t?t:Xo(A),this.isPiP=Fr()&&Jo(A),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var A,t,e;this.isIntersecting=Xo(this.element),this.isPiP=Jo(this.element),this.element.handleResize=()=>{var A;null===(A=this.handleResize)||void 0===A||A.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Mr().observe(this.element),Kr().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),null===(A=window.documentPictureInPicture)||void 0===A||A.addEventListener("enter",this.onEnterPiP),null===(e=null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)||void 0===e||e.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var A,t,e,i,n;null===(A=Mr())||void 0===A||A.unobserve(this.element),null===(t=Kr())||void 0===t||t.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),null===(e=window.documentPictureInPicture)||void 0===e||e.removeEventListener("enter",this.onEnterPiP),null===(n=null===(i=window.documentPictureInPicture)||void 0===i?void 0:i.window)||void 0===n||n.removeEventListener("pagehide",this.onLeavePiP)}}function Jo(A){var t,e;return document.pictureInPictureElement===A||!!(null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)&&Xo(A,null===(e=window.documentPictureInPicture)||void 0===e?void 0:e.window)}function Xo(A,t){const e=t||window;let i=A.offsetTop,n=A.offsetLeft;const r=A.offsetWidth,s=A.offsetHeight,{hidden:o}=A,{display:a}=getComputedStyle(A);for(;A.offsetParent;)i+=(A=A.offsetParent).offsetTop,n+=A.offsetLeft;return i<e.pageYOffset+e.innerHeight&&n<e.pageXOffset+e.innerWidth&&i+s>e.pageYOffset&&n+r>e.pageXOffset&&!o&&"none"!==a}class Yo extends oi.EventEmitter{constructor(A,t,e,i){var n;super(),this.metadataMuted=!1,this.encryption=ft.NONE,this.log=qe,this.handleMuted=()=>{this.emit(On.Muted)},this.handleUnmuted=()=>{this.emit(On.Unmuted)},this.log=ze(null!==(n=null==i?void 0:i.loggerName)&&void 0!==n?n:Ye.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=A,this.trackSid=t,this.trackName=e,this.source=tr.Source.Unknown}setTrack(A){this.track&&(this.track.off(On.Muted,this.handleMuted),this.track.off(On.Unmuted,this.handleUnmuted)),this.track=A,A&&(A.on(On.Muted,this.handleMuted),A.on(On.Unmuted,this.handleUnmuted))}get logContext(){var A;return Object.assign(Object.assign({},null===(A=this.loggerContextCb)||void 0===A?void 0:A.call(this)),as(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return void 0!==this.track}get isEncrypted(){return this.encryption!==ft.NONE}get audioTrack(){if(Xr(this.track))return this.track}get videoTrack(){if(Yr(this.track))return this.track}updateInfo(A){this.trackSid=A.sid,this.trackName=A.name,this.source=tr.sourceFromProto(A.source),this.mimeType=A.mimeType,this.kind===tr.Kind.Video&&A.width>0&&(this.dimensions={width:A.width,height:A.height},this.simulcasted=A.simulcast),this.encryption=A.encryption,this.trackInfo=A,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:A}))}}(yo=(Fo=Yo||(Yo={})).SubscriptionStatus||(Fo.SubscriptionStatus={})).Desired="desired",yo.Subscribed="subscribed",yo.Unsubscribed="unsubscribed",(bo=Fo.PermissionStatus||(Fo.PermissionStatus={})).Allowed="allowed",bo.NotAllowed="not_allowed";class $o extends Yo{get isUpstreamPaused(){var A;return null===(A=this.track)||void 0===A?void 0:A.isUpstreamPaused}constructor(A,t,e,i){super(A,t.sid,t.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(On.Ended)},this.updateInfo(t),this.setTrack(e)}setTrack(A){this.track&&this.track.off(On.Ended,this.handleTrackEnded),super.setTrack(A),A&&A.on(On.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 ii(this,void 0,void 0,(function*(){var A;return null===(A=this.track)||void 0===A?void 0:A.mute()}))}unmute(){return ii(this,void 0,void 0,(function*(){var A;return null===(A=this.track)||void 0===A?void 0:A.unmute()}))}pauseUpstream(){return ii(this,void 0,void 0,(function*(){var A;yield null===(A=this.track)||void 0===A?void 0:A.pauseUpstream()}))}resumeUpstream(){return ii(this,void 0,void 0,(function*(){var A;yield null===(A=this.track)||void 0===A?void 0:A.resumeUpstream()}))}getTrackFeatures(){var A;if(Xr(this.track)){const t=this.track.getSourceTrackSettings(),e=new Set;return t.autoGainControl&&e.add(ot.TF_AUTO_GAIN_CONTROL),t.echoCancellation&&e.add(ot.TF_ECHO_CANCELLATION),t.noiseSuppression&&e.add(ot.TF_NOISE_SUPPRESSION),t.channelCount&&t.channelCount>1&&e.add(ot.TF_STEREO),(null===(A=this.options)||void 0===A?void 0:A.dtx)||e.add(ot.TF_NO_DTX),this.track.enhancedNoiseCancellation&&e.add(ot.TF_ENHANCED_NOISE_CANCELLATION),Array.from(e.values())}return[]}}function Wo(A,t){return ii(this,void 0,void 0,(function*(){null!=A||(A={});let e=!1;const{audioProcessor:i,videoProcessor:n,optionsWithoutProcessor:r}=cs(A);let s=r.audio,o=r.video;if(i&&"object"==typeof r.audio&&(r.audio.processor=i),n&&"object"==typeof r.video&&(r.video.processor=n),A.audio&&"object"==typeof r.audio&&"string"==typeof r.audio.deviceId){const A=r.audio.deviceId;r.audio.deviceId={exact:A},e=!0,s=Object.assign(Object.assign({},r.audio),{deviceId:{ideal:A}})}if(r.video&&"object"==typeof r.video&&"string"==typeof r.video.deviceId){const A=r.video.deviceId;r.video.deviceId={exact:A},e=!0,o=Object.assign(Object.assign({},r.video),{deviceId:{ideal:A}})}(!0===r.audio||"object"==typeof r.audio&&!r.audio.deviceId)&&(r.audio={deviceId:"default"}),!0===r.video?r.video={deviceId:"default"}:"object"!=typeof r.video||r.video.deviceId||(r.video.deviceId="default");const a=As(r,Gs,Ps),c=es(a),u=navigator.mediaDevices.getUserMedia(c);r.audio&&(ls.userMediaPromiseMap.set("audioinput",u),u.catch((()=>ls.userMediaPromiseMap.delete("audioinput")))),r.video&&(ls.userMediaPromiseMap.set("videoinput",u),u.catch((()=>ls.userMediaPromiseMap.delete("videoinput"))));try{const A=yield u;return yield Promise.all(A.getTracks().map((e=>ii(this,void 0,void 0,(function*(){const r="audio"===e.kind;let s,o=r?a.audio:a.video;"boolean"!=typeof o&&o||(o={});const u=r?c.audio:c.video;"boolean"!=typeof u&&(s=u);const h=e.getSettings().deviceId;(null==s?void 0:s.deviceId)&&Nr(s.deviceId)!==h?s.deviceId=h:s||(s={deviceId:h});const l=(function(A,t,e){switch(A.kind){case"audio":return new eo(A,t,!1,void 0,e);case"video":return new fo(A,t,!1,e);default:throw new _n("unsupported track type: ".concat(A.kind))}})(e,s,t);return l.kind===tr.Kind.Video?l.source=tr.Source.Camera:l.kind===tr.Kind.Audio&&(l.source=tr.Source.Microphone),l.mediaStream=A,Xr(l)&&i?yield l.setProcessor(i):Yr(l)&&n&&(yield l.setProcessor(n)),l})))))}catch(h){if(!e)throw h;return Wo(Object.assign(Object.assign({},A),{audio:s,video:o}),t)}}))}(Io=Eo||(Eo={})).Excellent="excellent",Io.Good="good",Io.Poor="poor",Io.Lost="lost",Io.Unknown="unknown";class Zo extends oi.EventEmitter{get logContext(){var A,t;return Object.assign({},null===(t=null===(A=this.loggerOptions)||void 0===A?void 0:A.loggerContextCb)||void 0===t?void 0:t.call(A))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every((A=>A.isEncrypted))}get isAgent(){var A;return(null===(A=this.permissions)||void 0===A?void 0:A.agent)||this.kind===dt.AGENT}get isActive(){var A;return(null===(A=this.participantInfo)||void 0===A?void 0:A.state)===lt.ACTIVE}get kind(){return this.mA}get attributes(){return Object.freeze(Object.assign({},this.QA))}constructor(A,t,e,i,n,r){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:dt.STANDARD;var o;super(),this.audioLevel=0,this.isSpeaking=!1,this.UA=Eo.Unknown,this.log=qe,this.log=ze(null!==(o=null==r?void 0:r.loggerName)&&void 0!==o?o:Ye.Participant),this.loggerOptions=r,this.setMaxListeners(100),this.sid=A,this.identity=t,this.name=e,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.mA=s,this.QA=null!=n?n:{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(A){for(const[,t]of this.trackPublications)if(t.source===A)return t}getTrackPublicationByName(A){for(const[,t]of this.trackPublications)if(t.trackName===A)return t}waitUntilActive(){return this.isActive?Promise.resolve():(this.activeFuture||(this.activeFuture=new Rr,this.once(Hn.Active,(()=>{var A,t;null===(t=null===(A=this.activeFuture)||void 0===A?void 0:A.resolve)||void 0===t||t.call(A),this.activeFuture=void 0}))),this.activeFuture.promise)}get connectionQuality(){return this.UA}get isCameraEnabled(){var A;const t=this.getTrackPublication(tr.Source.Camera);return!(null===(A=null==t?void 0:t.isMuted)||void 0===A||A)}get isMicrophoneEnabled(){var A;const t=this.getTrackPublication(tr.Source.Microphone);return!(null===(A=null==t?void 0:t.isMuted)||void 0===A||A)}get isScreenShareEnabled(){return!!this.getTrackPublication(tr.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(1e3*Number.parseInt(this.participantInfo.joinedAt.toString())):new Date}updateInfo(A){var t;return!(this.participantInfo&&this.participantInfo.sid===A.sid&&this.participantInfo.version>A.version||(this.identity=A.identity,this.sid=A.sid,this.CA(A.name),this.FA(A.metadata),this.yA(A.attributes),A.state===lt.ACTIVE&&(null===(t=this.participantInfo)||void 0===t?void 0:t.state)!==lt.ACTIVE&&this.emit(Hn.Active),A.permission&&this.setPermissions(A.permission),this.participantInfo=A,0))}FA(A){const t=this.metadata!==A,e=this.metadata;this.metadata=A,t&&this.emit(Hn.ParticipantMetadataChanged,e)}CA(A){const t=this.name!==A;this.name=A,t&&this.emit(Hn.ParticipantNameChanged,A)}yA(A){const t=(function(A,t){var e;void 0===A&&(A={}),void 0===t&&(t={});const i=[...Object.keys(t),...Object.keys(A)],n={};for(const r of i)A[r]!==t[r]&&(n[r]=null!==(e=t[r])&&void 0!==e?e:"");return n})(this.attributes,A);this.QA=A,Object.keys(t).length>0&&this.emit(Hn.AttributesChanged,t)}setPermissions(A){var t,e,i,n,r,s;const o=this.permissions,a=A.canPublish!==(null===(t=this.permissions)||void 0===t?void 0:t.canPublish)||A.canSubscribe!==(null===(e=this.permissions)||void 0===e?void 0:e.canSubscribe)||A.canPublishData!==(null===(i=this.permissions)||void 0===i?void 0:i.canPublishData)||A.hidden!==(null===(n=this.permissions)||void 0===n?void 0:n.hidden)||A.recorder!==(null===(r=this.permissions)||void 0===r?void 0:r.recorder)||A.canPublishSources.length!==this.permissions.canPublishSources.length||A.canPublishSources.some(((A,t)=>{var e;return A!==(null===(e=this.permissions)||void 0===e?void 0:e.canPublishSources[t])}))||A.canSubscribeMetrics!==(null===(s=this.permissions)||void 0===s?void 0:s.canSubscribeMetrics);return this.permissions=A,a&&this.emit(Hn.ParticipantPermissionsChanged,o),a}setIsSpeaking(A){A!==this.isSpeaking&&(this.isSpeaking=A,A&&(this.lastSpokeAt=new Date),this.emit(Hn.IsSpeakingChanged,A))}setConnectionQuality(A){const t=this.UA;this.UA=(function(A){switch(A){case et.EXCELLENT:return Eo.Excellent;case et.GOOD:return Eo.Good;case et.POOR:return Eo.Poor;case et.LOST:return Eo.Lost;default:return Eo.Unknown}})(A),t!==this.UA&&this.emit(Hn.ConnectionQualityChanged,this.UA)}setDisconnected(){var A,t;this.activeFuture&&(null===(t=(A=this.activeFuture).reject)||void 0===t||t.call(A,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(A){this.audioContext=A,this.audioTrackPublications.forEach((t=>Xr(t.track)&&t.track.setAudioContext(A)))}addTrackPublication(A){A.on(On.Muted,(()=>{this.emit(Hn.TrackMuted,A)})),A.on(On.Unmuted,(()=>{this.emit(Hn.TrackUnmuted,A)}));const t=A;switch(t.track&&(t.track.sid=A.trackSid),this.trackPublications.set(A.trackSid,A),A.kind){case tr.Kind.Audio:this.audioTrackPublications.set(A.trackSid,A);break;case tr.Kind.Video:this.videoTrackPublications.set(A.trackSid,A)}}}class qo extends Zo{constructor(A,t,e,i,n){super(A,t,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=ft.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Rr)},this.handleReconnected=()=>{var A,t;null===(t=null===(A=this.reconnectFuture)||void 0===A?void 0:A.resolve)||void 0===t||t.call(A),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var A,t;this.reconnectFuture&&(this.reconnectFuture.promise.catch((A=>this.log.warn(A.message,this.logContext))),null===(t=null===(A=this.reconnectFuture)||void 0===A?void 0:A.reject)||void 0===t||t.call(A,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=A=>{const{requestId:t,reason:e,message:i}=A,n=this.pendingSignalRequests.get(t);n&&(e!==_e.OK&&n.reject(new Pn(i,e)),this.pendingSignalRequests.delete(t))},this.handleDataPacket=A=>{switch(A.value.case){case"rpcResponse":let t=A.value.value,e=null,i=null;"payload"===t.value.case?e=t.value.value:"error"===t.value.case&&(i=Ws.fromProto(t.value.value)),this.handleIncomingRpcResponse(t.requestId,e,i);break;case"rpcAck":let n=A.value.value;this.handleIncomingRpcAck(n.requestId)}},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((A=>(function(A){var t,e,i;if(!A.participantSid&&!A.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new be({participantIdentity:null!==(t=A.participantIdentity)&&void 0!==t?t:"",participantSid:null!==(e=A.participantSid)&&void 0!==e?e:"",allTracks:null!==(i=A.allowAll)&&void 0!==i&&i,trackSids:A.allowedTrackSids||[]})})(A))))},this.onTrackUnmuted=A=>{this.onTrackMuted(A,A.isUpstreamPaused)},this.onTrackMuted=(A,t)=>{void 0===t&&(t=!0),A.sid?this.engine.updateMuteStatus(A.sid,t):this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),as(A)))},this.onTrackUpstreamPaused=A=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),as(A))),this.onTrackMuted(A,!0)},this.onTrackUpstreamResumed=A=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),as(A))),this.onTrackMuted(A,A.isMuted)},this.onTrackFeatureUpdate=A=>{const t=this.audioTrackPublications.get(A.sid);t?this.engine.client.sendUpdateLocalAudioTrack(t.trackSid,t.getTrackFeatures()):this.log.warn("Could not update local audio track settings, missing publication for track ".concat(A.sid),this.logContext)},this.handleSubscribedQualityUpdate=A=>ii(this,void 0,void 0,(function*(){var t,e,i,n,r,s;if(!(null===(r=this.roomOptions)||void 0===r?void 0:r.dynacast))return;const o=this.videoTrackPublications.get(A.trackSid);if(o)if(A.subscribedCodecs.length>0){if(!o.videoTrack)return;const r=yield o.videoTrack.setPublishingCodecs(A.subscribedCodecs);try{for(var a,c=!0,u=ni(r);!(t=(a=yield u.next()).done);c=!0){n=a.value,c=!1;const A=n;or(A)&&(this.log.debug("publish ".concat(A," for ").concat(o.videoTrack.sid),Object.assign(Object.assign({},this.logContext),as(o))),yield this.publishAdditionalCodecForTrack(o.videoTrack,A,o.options))}}catch(h){e={error:h}}finally{try{c||t||!(i=u.return)||(yield i.call(u))}finally{if(e)throw e.error}}}else A.subscribedQualities.length>0&&(yield null===(s=o.videoTrack)||void 0===s?void 0:s.setPublishingLayers(A.subscribedQualities));else this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:A.trackSid}))})),this.handleLocalTrackUnpublished=A=>{const t=this.trackPublications.get(A.trackSid);t?this.unpublishTrack(t.track):this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:A.trackSid}))},this.handleTrackEnded=A=>ii(this,void 0,void 0,(function*(){if(A.source===tr.Source.ScreenShare||A.source===tr.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),as(A))),this.unpublishTrack(A);else if(A.isUserProvided)yield A.mute();else if(Wr(A)||$r(A))try{if(Fr())try{const t=yield null===navigator||void 0===navigator?void 0:navigator.permissions.query({name:A.source===tr.Source.Camera?"camera":"microphone"});if(t&&"denied"===t.state)throw this.log.warn("user has revoked access to ".concat(A.source),Object.assign(Object.assign({},this.logContext),as(A))),t.onchange=()=>{"denied"!==t.state&&(A.isMuted||A.restartTrack(),t.onchange=null)},new Error("GetUserMedia Permission denied")}catch(t){}A.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),as(A))),Wr(A)?yield A.restartTrack({deviceId:"default"}):yield A.restartTrack())}catch(t){this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),as(A))),yield A.mute()}})),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=e,this.roomOptions=i,this.setupEngine(e),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=n}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==ft.NONE}getTrackPublication(A){const t=super.getTrackPublication(A);if(t)return t}getTrackPublicationByName(A){const t=super.getTrackPublicationByName(A);if(t)return t}setupEngine(A){this.engine=A,this.engine.on(Tn.RemoteMute,((A,t)=>{const e=this.trackPublications.get(A);e&&e.track&&(t?e.mute():e.unmute())})),this.engine.on(Tn.Connected,this.handleReconnected).on(Tn.SignalRestarted,this.handleReconnected).on(Tn.SignalResumed,this.handleReconnected).on(Tn.Restarting,this.handleReconnecting).on(Tn.Resuming,this.handleReconnecting).on(Tn.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(Tn.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(Tn.Disconnected,this.handleDisconnected).on(Tn.SignalRequestResponse,this.handleSignalRequestResponse).on(Tn.DataPacketReceived,this.handleDataPacket)}setMetadata(A){return ii(this,void 0,void 0,(function*(){yield this.requestMetadataUpdate({metadata:A})}))}setName(A){return ii(this,void 0,void 0,(function*(){yield this.requestMetadataUpdate({name:A})}))}setAttributes(A){return ii(this,void 0,void 0,(function*(){yield this.requestMetadataUpdate({attributes:A})}))}requestMetadataUpdate(A){return ii(this,arguments,void 0,(function(A){var t=this;let{metadata:e,name:i,attributes:n}=A;return(function*(){return new Promise(((A,r)=>ii(t,void 0,void 0,(function*(){var t,s;try{let o=!1;const a=yield this.engine.client.sendUpdateLocalMetadata(null!==(t=null!=e?e:this.metadata)&&void 0!==t?t:"",null!==(s=null!=i?i:this.name)&&void 0!==s?s:"",n),c=performance.now();for(this.pendingSignalRequests.set(a,{resolve:A,reject:A=>{r(A),o=!0},values:{name:i,metadata:e,attributes:n}});performance.now()-c<5e3&&!o;){if((!i||this.name===i)&&(!e||this.metadata===e)&&(!n||Object.entries(n).every((A=>{let[t,e]=A;return this.attributes[t]===e||""===e&&!this.attributes[t]}))))return this.pendingSignalRequests.delete(a),void A();yield wr(50)}r(new Pn("Request to update local metadata timed out","TimeoutError"))}catch(o){o instanceof Error&&r(o)}}))))})()}))}setCameraEnabled(A,t,e){return this.setTrackEnabled(tr.Source.Camera,A,t,e)}setMicrophoneEnabled(A,t,e){return this.setTrackEnabled(tr.Source.Microphone,A,t,e)}setScreenShareEnabled(A,t,e){return this.setTrackEnabled(tr.Source.ScreenShare,A,t,e)}setPermissions(A){const t=this.permissions,e=super.setPermissions(A);return e&&t&&this.emit(Hn.ParticipantPermissionsChanged,t),e}setE2EEEnabled(A){return ii(this,void 0,void 0,(function*(){this.encryptionType=A?ft.GCM:ft.NONE,yield this.republishAllTracks(void 0,!1)}))}setTrackEnabled(A,t,e,i){return ii(this,void 0,void 0,(function*(){var n,r;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:A,enabled:t})),this.republishPromise&&(yield this.republishPromise);let s=this.getTrackPublication(A);if(t)if(s)yield s.unmute();else{let t;if(this.pendingPublishing.has(A)){const t=yield this.waitForPendingPublicationOfSource(A);return t||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:A})),yield null==t?void 0:t.unmute(),t}this.pendingPublishing.add(A);try{switch(A){case tr.Source.Camera:t=yield this.createTracks({video:null===(n=e)||void 0===n||n});break;case tr.Source.Microphone:t=yield this.createTracks({audio:null===(r=e)||void 0===r||r});break;case tr.Source.ScreenShare:t=yield this.createScreenTracks(Object.assign({},e));break;default:throw new _n(A)}}catch(o){throw null==t||t.forEach((A=>{A.stop()})),o instanceof Error&&this.emit(Hn.MediaDevicesError,o),this.pendingPublishing.delete(A),o}try{const A=[];for(const n of t)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),as(n))),A.push(this.publishTrack(n,i));const e=yield Promise.all(A);[s]=e}catch(o){throw null==t||t.forEach((A=>{A.stop()})),o}finally{this.pendingPublishing.delete(A)}}else if(!(null==s?void 0:s.track)&&this.pendingPublishing.has(A)&&(s=yield this.waitForPendingPublicationOfSource(A),s||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:A}))),s&&s.track)if(A===tr.Source.ScreenShare){s=yield this.unpublishTrack(s.track);const A=this.getTrackPublication(tr.Source.ScreenShareAudio);A&&A.track&&this.unpublishTrack(A.track)}else yield s.mute();return s}))}enableCameraAndMicrophone(){return ii(this,void 0,void 0,(function*(){if(!this.pendingPublishing.has(tr.Source.Camera)&&!this.pendingPublishing.has(tr.Source.Microphone)){this.pendingPublishing.add(tr.Source.Camera),this.pendingPublishing.add(tr.Source.Microphone);try{const A=yield this.createTracks({audio:!0,video:!0});yield Promise.all(A.map((A=>this.publishTrack(A))))}finally{this.pendingPublishing.delete(tr.Source.Camera),this.pendingPublishing.delete(tr.Source.Microphone)}}}))}createTracks(A){return ii(this,void 0,void 0,(function*(){var t,e;null!=A||(A={});const i=As(A,null===(t=this.roomOptions)||void 0===t?void 0:t.audioCaptureDefaults,null===(e=this.roomOptions)||void 0===e?void 0:e.videoCaptureDefaults);try{return(yield Wo(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map((A=>(Xr(A)&&(this.microphoneError=void 0,A.setAudioContext(this.audioContext),A.source=tr.Source.Microphone,this.emit(Hn.AudioStreamAcquired)),Yr(A)&&(this.cameraError=void 0,A.source=tr.Source.Camera),A)))}catch(n){throw n instanceof Error&&(A.audio&&(this.microphoneError=n),A.video&&(this.cameraError=n)),n}}))}createScreenTracks(A){return ii(this,void 0,void 0,(function*(){if(void 0===A&&(A={}),void 0===navigator.mediaDevices.getDisplayMedia)throw new xn("getDisplayMedia not supported");void 0!==A.resolution||(function(){const A=Xn();return"Safari"===(null==A?void 0:A.name)&&A.version.startsWith("17.")})()||(A.resolution=Br.h1080fps30.resolution);const t=(function(A){var t,e;let i=null===(t=A.video)||void 0===t||t;return A.resolution&&A.resolution.width>0&&A.resolution.height>0&&(i="boolean"==typeof i?{}:i,i=Ur()?Object.assign(Object.assign({},i),{width:{max:A.resolution.width},height:{max:A.resolution.height},frameRate:A.resolution.frameRate}):Object.assign(Object.assign({},i),{width:{ideal:A.resolution.width},height:{ideal:A.resolution.height},frameRate:A.resolution.frameRate})),{audio:null!==(e=A.audio)&&void 0!==e&&e,video:i,controller:A.controller,selfBrowserSurface:A.selfBrowserSurface,surfaceSwitching:A.surfaceSwitching,systemAudio:A.systemAudio,preferCurrentTab:A.preferCurrentTab}})(A),e=yield navigator.mediaDevices.getDisplayMedia(t),i=e.getVideoTracks();if(0===i.length)throw new _n("no video track found");const n=new fo(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});n.source=tr.Source.ScreenShare,A.contentHint&&(n.mediaStreamTrack.contentHint=A.contentHint);const r=[n];if(e.getAudioTracks().length>0){this.emit(Hn.AudioStreamAcquired);const A=new eo(e.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});A.source=tr.Source.ScreenShareAudio,r.push(A)}return r}))}publishTrack(A,t){return ii(this,void 0,void 0,(function*(){return this.publishOrRepublishTrack(A,t)}))}publishOrRepublishTrack(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(function*(){var n,r,s,o;let a,c;if(Wr(A)&&A.setAudioContext(e.audioContext),yield null===(n=e.reconnectFuture)||void 0===n?void 0:n.promise,e.republishPromise&&!i&&(yield e.republishPromise),Jr(A)&&e.pendingPublishPromises.has(A)&&(yield e.pendingPublishPromises.get(A)),A instanceof MediaStreamTrack)a=A.getConstraints();else{let t;switch(a=A.constraints,A.source){case tr.Source.Microphone:t="audioinput";break;case tr.Source.Camera:t="videoinput"}t&&e.activeDeviceMap.has(t)&&(a=Object.assign(Object.assign({},a),{deviceId:e.activeDeviceMap.get(t)}))}if(A instanceof MediaStreamTrack)switch(A.kind){case"audio":A=new eo(A,a,!0,e.audioContext,{loggerName:e.roomOptions.loggerName,loggerContextCb:()=>e.logContext});break;case"video":A=new fo(A,a,!0,{loggerName:e.roomOptions.loggerName,loggerContextCb:()=>e.logContext});break;default:throw new _n("unsupported MediaStreamTrack kind ".concat(A.kind))}else A.updateLoggerOptions({loggerName:e.roomOptions.loggerName,loggerContextCb:()=>e.logContext});if(e.trackPublications.forEach((t=>{t.track&&t.track===A&&(c=t)})),c)return e.log.warn("track has already been published, skipping",Object.assign(Object.assign({},e.logContext),as(c))),c;const u="channelCount"in A.mediaStreamTrack.getSettings()&&2===A.mediaStreamTrack.getSettings().channelCount||2===A.mediaStreamTrack.getConstraints().channelCount,h=null!==(r=null==t?void 0:t.forceStereo)&&void 0!==r?r:u;h&&(t||(t={}),void 0===t.dtx&&e.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},e.logContext),as(A))),void 0===t.red&&e.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),null!==(s=t.dtx)&&void 0!==s||(t.dtx=!1),null!==(o=t.red)&&void 0!==o||(t.red=!1));const l=Object.assign(Object.assign({},e.roomOptions.publishDefaults),t);!(function(){const A=Xn(),t="17.2";if(A)return"Safari"!==A.name&&"iOS"!==A.os||!!("iOS"===A.os&&A.osVersion&&kr(t,A.osVersion)>=0)||"Safari"===A.name&&kr(t,A.version)>=0})()&&e.roomOptions.e2ee&&(e.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({},e.logContext)),l.simulcast=!1),l.source&&(A.source=l.source);const d=new Promise(((t,i)=>ii(e,void 0,void 0,(function*(){try{if(this.engine.client.currentState!==ps.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:as(A)}));const e=()=>ii(this,void 0,void 0,(function*(){try{const e=yield this.publish(A,l,h);t(e)}catch(e){i(e)}}));setTimeout((()=>{this.engine.off(Tn.SignalConnected,e),i(new Gn("publishing rejected as engine not connected within timeout",408))}),15e3),this.engine.once(Tn.SignalConnected,e),this.engine.on(Tn.Closing,(()=>{this.engine.off(Tn.SignalConnected,e),i(new Gn("publishing rejected as engine closed",499))}))}else try{const e=yield this.publish(A,l,h);t(e)}catch(e){i(e)}}catch(e){i(e)}}))));e.pendingPublishPromises.set(A,d);try{return yield d}catch(B){throw B}finally{e.pendingPublishPromises.delete(A)}})()}))}hasPermissionsToPublish(A){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),as(A))),!1;const{canPublish:t,canPublishSources:e}=this.permissions;return!(!t||0!==e.length&&!e.map((A=>(function(A){switch(A){case At.CAMERA:return tr.Source.Camera;case At.MICROPHONE:return tr.Source.Microphone;case At.SCREEN_SHARE:return tr.Source.ScreenShare;case At.SCREEN_SHARE_AUDIO:return tr.Source.ScreenShareAudio;default:return tr.Source.Unknown}})(A))).includes(A.source))||(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),as(A))),!1)}publish(A,t,e){return ii(this,void 0,void 0,(function*(){var i,n,r,s,o,a,c,u,h,l;if(!this.hasPermissionsToPublish(A))throw new Gn("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find((t=>Jr(A)&&t.source===A.source))&&A.source!==tr.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(A.source),Object.assign(Object.assign({},this.logContext),as(A))),t.stopMicTrackOnMute&&Xr(A)&&(A.stopOnMute=!0),A.source===tr.Source.ScreenShare&&Qr()&&(t.simulcast=!1),"av1"!==t.videoCodec||(function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(Ur())return!1;const A=RTCRtpSender.getCapabilities("video");let t=!1;if(A)for(const e of A.codecs)if("video/AV1"===e.mimeType){t=!0;break}return t})()||(t.videoCodec=void 0),"vp9"!==t.videoCodec||(function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(Qr())return!1;if(Ur()){const A=Xn();if((null==A?void 0:A.version)&&kr(A.version,"16")<0)return!1}const A=RTCRtpSender.getCapabilities("video");let t=!1;if(A)for(const e of A.codecs)if("video/VP9"===e.mimeType){t=!0;break}return t})()||(t.videoCodec=void 0),void 0===t.videoCodec&&(t.videoCodec=Ns),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some((A=>t.videoCodec===ss(A.mime)))||(t.videoCodec=ss(this.enabledPublishVideoCodecs[0].mime)));const d=t.videoCodec;A.on(On.Muted,this.onTrackMuted),A.on(On.Unmuted,this.onTrackUnmuted),A.on(On.Ended,this.handleTrackEnded),A.on(On.UpstreamPaused,this.onTrackUpstreamPaused),A.on(On.UpstreamResumed,this.onTrackUpstreamResumed),A.on(On.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const B=new zt({cid:A.mediaStreamTrack.id,name:t.name,type:tr.kindToProto(A.kind),muted:A.isMuted,source:tr.sourceToProto(A.source),disableDtx:!(null===(i=t.dtx)||void 0===i||i),encryption:this.encryptionType,stereo:e,disableRed:this.isE2EEEnabled||!(null===(n=t.red)||void 0===n||n),stream:null==t?void 0:t.stream,backupCodecPolicy:null==t?void 0:t.backupCodecPolicy});let f;if(A.kind===tr.Kind.Video){let e={width:0,height:0};try{e=yield A.waitForDimensions()}catch(v){const t=null!==(s=null===(r=this.roomOptions.videoCaptureDefaults)||void 0===r?void 0:r.resolution)&&void 0!==s?s:lr.h720.resolution;e={width:t.width,height:t.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),as(A)),{dims:e}))}B.width=e.width,B.height=e.height,$r(A)&&(vr(d)&&(A.source===tr.Source.ScreenShare&&(t.scalabilityMode="L1T3","contentHint"in A.mediaStreamTrack&&(A.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),as(A))))),t.scalabilityMode=null!==(o=t.scalabilityMode)&&void 0!==o?o:"L3T3_KEY"),B.simulcastCodecs=[new qt({codec:d,cid:A.mediaStreamTrack.id})],!0===t.backupCodec&&(t.backupCodec={codec:Ns}),t.backupCodec&&d!==t.backupCodec.codec&&B.encryption===ft.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),B.simulcastCodecs.push(new qt({codec:t.backupCodec.codec,cid:""})))),f=co(A.source===tr.Source.ScreenShare,B.width,B.height,t),B.layers=po(B.width,B.height,f,vr(t.videoCodec))}else A.kind===tr.Kind.Audio&&(f=[{maxBitrate:null===(a=t.audioPreset)||void 0===a?void 0:a.maxBitrate,priority:null!==(u=null===(c=t.audioPreset)||void 0===c?void 0:c.priority)&&void 0!==u?u:"high",networkPriority:null!==(l=null===(h=t.audioPreset)||void 0===h?void 0:h.priority)&&void 0!==l?l:"high"}]);if(!this.engine||this.engine.isClosed)throw new Nn("cannot publish track when not connected");const w=()=>ii(this,void 0,void 0,(function*(){var e,i,n;if(!this.engine.pcManager)throw new Nn("pcManager is not ready");if(A.sender=yield this.engine.createSender(A,t,f),$r(A)&&(null!==(e=t.degradationPreference)&&void 0!==e||(t.degradationPreference=(function(A){return A.source===tr.Source.ScreenShare||A.constraints.height&&Nr(A.constraints.height)>=1080?"maintain-resolution":"balanced"})(A)),A.setDegradationPreference(t.degradationPreference)),f)if(Qr()&&A.kind===tr.Kind.Audio){let t;for(const e of this.engine.pcManager.publisher.getTransceivers())if(e.sender===A.sender){t=e;break}t&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:t,codec:"opus",maxbr:(null===(i=f[0])||void 0===i?void 0:i.maxBitrate)?f[0].maxBitrate/1e3:0})}else A.codec&&vr(A.codec)&&(null===(n=f[0])||void 0===n?void 0:n.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:B.cid,codec:A.codec,maxbr:f[0].maxBitrate/1e3});yield this.engine.negotiate()}));let g;if(this.enabledPublishVideoCodecs.length>0)g=(yield Promise.all([this.engine.addTrack(B),w()]))[0];else{let e;if(g=yield this.engine.addTrack(B),g.codecs.forEach((A=>{void 0===e&&(e=A.mimeType)})),e&&A.kind===tr.Kind.Video){const i=ss(e);i!==d&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),as(A)),{codec:i})),t.videoCodec=i,f=co(A.source===tr.Source.ScreenShare,B.width,B.height,t))}yield w()}const p=new $o(A.kind,g,A,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return p.options=t,A.sid=g.sid,this.log.debug("publishing ".concat(A.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:f,trackInfo:g})),$r(A)?A.startMonitor(this.engine.client):Wr(A)&&A.startMonitor(),this.addTrackPublication(p),this.emit(Hn.LocalTrackPublished,p),p}))}get isLocal(){return!0}publishAdditionalCodecForTrack(A,t,e){return ii(this,void 0,void 0,(function*(){var i;if(this.encryptionType!==ft.NONE)return;let n;if(this.trackPublications.forEach((t=>{t.track&&t.track===A&&(n=t)})),!n)throw new _n("track is not published");if(!$r(A))throw new _n("track is not a video track");const r=Object.assign(Object.assign({},null===(i=this.roomOptions)||void 0===i?void 0:i.publishDefaults),e),s=(function(A,t,e){var i,n,r,s;if(!e.backupCodec||!0===e.backupCodec||e.backupCodec.codec===e.videoCodec)return;t!==e.backupCodec.codec&&qe.warn("requested a different codec than specified as backup",{serverRequested:t,backup:e.backupCodec.codec}),e.videoCodec=t,e.videoEncoding=e.backupCodec.encoding;const o=A.mediaStreamTrack.getSettings(),a=null!==(i=o.width)&&void 0!==i?i:null===(n=A.dimensions)||void 0===n?void 0:n.width,c=null!==(r=o.height)&&void 0!==r?r:null===(s=A.dimensions)||void 0===s?void 0:s.height;return A.source===tr.Source.ScreenShare&&e.simulcast&&(e.simulcast=!1),co(A.source===tr.Source.ScreenShare,a,c,e)})(A,t,r);if(!s)return void this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),as(A)));const o=A.addSimulcastTrack(t,s);if(!o)return;const a=new zt({cid:o.mediaStreamTrack.id,type:tr.kindToProto(A.kind),muted:A.isMuted,source:tr.sourceToProto(A.source),sid:A.sid,simulcastCodecs:[{codec:r.videoCodec,cid:o.mediaStreamTrack.id}]});if(a.layers=po(a.width,a.height,s),!this.engine||this.engine.isClosed)throw new Nn("cannot publish track when not connected");const c=(yield Promise.all([this.engine.addTrack(a),(()=>ii(this,void 0,void 0,(function*(){yield this.engine.createSimulcastSender(A,o,r,s),yield this.engine.negotiate()})))()]))[0];this.log.debug("published ".concat(t," for track ").concat(A.sid),Object.assign(Object.assign({},this.logContext),{encodings:s,trackInfo:c}))}))}unpublishTrack(A,t){return ii(this,void 0,void 0,(function*(){var e,i;if(Jr(A)){const t=this.pendingPublishPromises.get(A);t&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),as(A))),yield t)}const n=this.getPublicationForTrack(A),r=n?as(n):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),r)),!n||!n.track)return void this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),r));(A=n.track).off(On.Muted,this.onTrackMuted),A.off(On.Unmuted,this.onTrackUnmuted),A.off(On.Ended,this.handleTrackEnded),A.off(On.UpstreamPaused,this.onTrackUpstreamPaused),A.off(On.UpstreamResumed,this.onTrackUpstreamResumed),A.off(On.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),void 0===t&&(t=null===(i=null===(e=this.roomOptions)||void 0===e?void 0:e.stopLocalTrackOnUnpublish)||void 0===i||i),t?A.stop():A.stopMonitor();let s=!1;const o=A.sender;if(A.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Xs.FAILED&&o)try{for(const A of this.engine.pcManager.publisher.getTransceivers())A.sender===o&&(A.direction="inactive",s=!0);if(this.engine.removeTrack(o)&&(s=!0),$r(A)){for(const[,t]of A.simulcastCodecs)t.sender&&(this.engine.removeTrack(t.sender)&&(s=!0),t.sender=void 0);A.simulcastCodecs.clear()}}catch(a){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),r),{error:a}))}switch(this.trackPublications.delete(n.trackSid),n.kind){case tr.Kind.Audio:this.audioTrackPublications.delete(n.trackSid);break;case tr.Kind.Video:this.videoTrackPublications.delete(n.trackSid)}return this.emit(Hn.LocalTrackUnpublished,n),n.setTrack(void 0),s&&(yield this.engine.negotiate()),n}))}unpublishTracks(A){return ii(this,void 0,void 0,(function*(){return(yield Promise.all(A.map((A=>this.unpublishTrack(A))))).filter((A=>!!A))}))}republishAllTracks(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){t.republishPromise&&(yield t.republishPromise),t.republishPromise=new Promise(((i,n)=>ii(t,void 0,void 0,(function*(){try{const t=[];this.trackPublications.forEach((e=>{e.track&&(A&&(e.options=Object.assign(Object.assign({},e.options),A)),t.push(e))})),yield Promise.all(t.map((A=>ii(this,void 0,void 0,(function*(){const t=A.track;yield this.unpublishTrack(t,!1),!e||t.isMuted||t.source===tr.Source.ScreenShare||t.source===tr.Source.ScreenShareAudio||!Wr(t)&&!$r(t)||t.isUserProvided||(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:A.trackSid})),yield t.restartTrack()),yield this.publishOrRepublishTrack(t,A.options,!0)}))))),i()}catch(t){n(t)}finally{this.republishPromise=void 0}})))),yield t.republishPromise})()}))}publishData(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(function*(){const i=e.reliable?mt.RELIABLE:mt.LOSSY,n=e.destinationIdentities,r=e.topic,s=new vt({kind:i,value:{case:"user",value:new Ct({participantIdentity:t.identity,payload:A,destinationIdentities:n,topic:r})}});yield t.engine.sendDataPacket(s,i)})()}))}publishDtmf(A,t){return ii(this,void 0,void 0,(function*(){const e=new vt({kind:mt.RELIABLE,value:{case:"sipDtmf",value:new Ft({code:A,digit:t})}});yield this.engine.sendDataPacket(e,mt.RELIABLE)}))}sendChatMessage(A,t){return ii(this,void 0,void 0,(function*(){const e={id:crypto.randomUUID(),message:A,timestamp:Date.now(),attachedFiles:null==t?void 0:t.attachments},i=new vt({value:{case:"chatMessage",value:new Et(Object.assign(Object.assign({},e),{timestamp:L.parse(e.timestamp)}))}});return yield this.engine.sendDataPacket(i,mt.RELIABLE),this.emit(Hn.ChatMessage,e),e}))}editChatMessage(A,t){return ii(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},t),{message:A,editTimestamp:Date.now()}),i=new vt({value:{case:"chatMessage",value:new Et(Object.assign(Object.assign({},e),{timestamp:L.parse(e.timestamp),editTimestamp:L.parse(e.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,mt.RELIABLE),this.emit(Hn.ChatMessage,e),e}))}sendText(A,t){return ii(this,void 0,void 0,(function*(){var e;const i=crypto.randomUUID(),n=(new TextEncoder).encode(A).byteLength,r=null===(e=null==t?void 0:t.attachments)||void 0===e?void 0:e.map((()=>crypto.randomUUID())),s=new Array(r?r.length+1:1).fill(0),o=(A,e)=>{var i;s[e]=A;const n=s.reduce(((A,t)=>A+t),0);null===(i=null==t?void 0:t.onProgress)||void 0===i||i.call(t,n)},a=yield this.streamText({streamId:i,totalSize:n,destinationIdentities:null==t?void 0:t.destinationIdentities,topic:null==t?void 0:t.topic,attachedStreamIds:r,attributes:null==t?void 0:t.attributes});return yield a.write(A),o(1,0),yield a.close(),(null==t?void 0:t.attachments)&&r&&(yield Promise.all(t.attachments.map(((A,e)=>ii(this,void 0,void 0,(function*(){return this.bA(r[e],A,{topic:t.topic,mimeType:A.type,onProgress:A=>{o(A,e+1)}})})))))),a.info}))}streamText(A){return ii(this,void 0,void 0,(function*(){var t,e;const i=null!==(t=null==A?void 0:A.streamId)&&void 0!==t?t:crypto.randomUUID(),n={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:null!==(e=null==A?void 0:A.topic)&&void 0!==e?e:"",size:null==A?void 0:A.totalSize,attributes:null==A?void 0:A.attributes},r=new Pt({streamId:i,mimeType:n.mimeType,topic:n.topic,timestamp:Vr(n.timestamp),totalLength:Vr(null==A?void 0:A.totalSize),attributes:n.attributes,contentHeader:{case:"textHeader",value:new jt({version:null==A?void 0:A.version,attachedStreamIds:null==A?void 0:A.attachedStreamIds,replyToStreamId:null==A?void 0:A.replyToStreamId,operationType:"update"===(null==A?void 0:A.type)?Nt.UPDATE:Nt.CREATE})}}),s=null==A?void 0:A.destinationIdentities,o=new vt({destinationIdentities:s,value:{case:"streamHeader",value:r}});yield this.engine.sendDataPacket(o,mt.RELIABLE);let a=0;const c=this,u=new WritableStream({write(A){return ii(this,void 0,void 0,(function*(){for(const t of(function(A){const t=[];let e=(new TextEncoder).encode(A);for(;e.length>15e3;){let A=15e3;for(;A>0;){const t=e[A];if(void 0!==t&&128!=(192&t))break;A--}t.push(e.slice(0,A)),e=e.slice(A)}return e.length>0&&t.push(e),t})(A)){yield c.engine.waitForBufferStatusLow(mt.RELIABLE);const A=new Vt({content:t,streamId:i,chunkIndex:Vr(a)}),e=new vt({destinationIdentities:s,value:{case:"streamChunk",value:A}});yield c.engine.sendDataPacket(e,mt.RELIABLE),a+=1}}))},close(){return ii(this,void 0,void 0,(function*(){const A=new Jt({streamId:i}),t=new vt({destinationIdentities:s,value:{case:"streamTrailer",value:A}});yield c.engine.sendDataPacket(t,mt.RELIABLE)}))},abort(A){console.log("Sink error:",A)}});let h=()=>ii(this,void 0,void 0,(function*(){yield l.close()}));c.engine.once(Tn.Closing,h);const l=new Ro(u,n,(()=>this.engine.off(Tn.Closing,h)));return l}))}sendFile(A,t){return ii(this,void 0,void 0,(function*(){const e=crypto.randomUUID();return yield this.bA(e,A,t),{id:e}}))}bA(A,t,e){return ii(this,void 0,void 0,(function*(){var i;const n=yield this.streamBytes({streamId:A,totalSize:t.size,name:t.name,mimeType:null!==(i=null==e?void 0:e.mimeType)&&void 0!==i?i:t.type,topic:null==e?void 0:e.topic,destinationIdentities:null==e?void 0:e.destinationIdentities}),r=t.stream().getReader();for(;;){const{done:A,value:t}=yield r.read();if(A)break;yield n.write(t)}return yield n.close(),n.info}))}streamBytes(A){return ii(this,void 0,void 0,(function*(){var t,e,i,n,r;const s=null!==(t=null==A?void 0:A.streamId)&&void 0!==t?t:crypto.randomUUID(),o=null==A?void 0:A.destinationIdentities,a={id:s,mimeType:null!==(e=null==A?void 0:A.mimeType)&&void 0!==e?e:"application/octet-stream",topic:null!==(i=null==A?void 0:A.topic)&&void 0!==i?i:"",timestamp:Date.now(),attributes:null==A?void 0:A.attributes,size:null==A?void 0:A.totalSize,name:null!==(n=null==A?void 0:A.name)&&void 0!==n?n:"unknown"},c=new Pt({totalLength:Vr(null!==(r=a.size)&&void 0!==r?r:0),mimeType:a.mimeType,streamId:s,topic:a.topic,timestamp:Vr(Date.now()),attributes:a.attributes,contentHeader:{case:"byteHeader",value:new Gt({name:a.name})}}),u=new vt({destinationIdentities:o,value:{case:"streamHeader",value:c}});yield this.engine.sendDataPacket(u,mt.RELIABLE);let h=0;const l=new g,d=this.engine,B=this.log,f=new WritableStream({write(A){return ii(this,void 0,void 0,(function*(){const t=yield l.lock();let e=0;try{for(;e<A.byteLength;){const t=A.slice(e,e+15e3);yield d.waitForBufferStatusLow(mt.RELIABLE);const i=new vt({destinationIdentities:o,value:{case:"streamChunk",value:new Vt({content:t,streamId:s,chunkIndex:Vr(h)})}});yield d.sendDataPacket(i,mt.RELIABLE),h+=1,e+=t.byteLength}}finally{t()}}))},close(){return ii(this,void 0,void 0,(function*(){const A=new Jt({streamId:s}),t=new vt({destinationIdentities:o,value:{case:"streamTrailer",value:A}});yield d.sendDataPacket(t,mt.RELIABLE)}))},abort(A){B.error("Sink error:",A)}});return new No(f,a)}))}performRpc(A){return ii(this,arguments,void 0,(function(A){var t=this;let{destinationIdentity:e,method:i,payload:n,responseTimeout:r=1e4}=A;return(function*(){return new Promise(((A,s)=>ii(t,void 0,void 0,(function*(){var t,o,a,c;if(Zs(n)>15360)return void s(Ws.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));if((null===(o=null===(t=this.engine.latestJoinResponse)||void 0===t?void 0:t.serverInfo)||void 0===o?void 0:o.version)&&kr(null===(c=null===(a=this.engine.latestJoinResponse)||void 0===a?void 0:a.serverInfo)||void 0===c?void 0:c.version,"1.8.0")<0)return void s(Ws.builtIn("UNSUPPORTED_SERVER"));const u=crypto.randomUUID();yield this.publishRpcRequest(e,u,i,n,r-2e3);const h=setTimeout((()=>{this.pendingAcks.delete(u),s(Ws.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(u),clearTimeout(l)}),2e3);this.pendingAcks.set(u,{resolve:()=>{clearTimeout(h)},participantIdentity:e});const l=setTimeout((()=>{this.pendingResponses.delete(u),s(Ws.builtIn("RESPONSE_TIMEOUT"))}),r);this.pendingResponses.set(u,{resolve:(t,e)=>{clearTimeout(l),this.pendingAcks.has(u)&&(console.warn("RPC response received before ack",u),this.pendingAcks.delete(u),clearTimeout(h)),e?s(e):A(null!=t?t:"")},participantIdentity:e})}))))})()}))}registerRpcMethod(A,t){this.rpcHandlers.has(A)&&this.log.warn("you're overriding the RPC handler for method ".concat(A,", in the future this will throw an error")),this.rpcHandlers.set(A,t)}unregisterRpcMethod(A){this.rpcHandlers.delete(A)}setTrackSubscriptionPermissions(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=A,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(A){const t=this.pendingAcks.get(A);t?(t.resolve(),this.pendingAcks.delete(A)):console.error("Ack received for unexpected RPC request",A)}handleIncomingRpcResponse(A,t,e){const i=this.pendingResponses.get(A);i?(i.resolve(t,e),this.pendingResponses.delete(A)):console.error("Response received for unexpected RPC request",A)}publishRpcRequest(A,t,e,i,n){return ii(this,void 0,void 0,(function*(){const r=new vt({destinationIdentities:[A],kind:mt.RELIABLE,value:{case:"rpcRequest",value:new It({id:t,method:e,payload:i,responseTimeoutMs:n,version:1})}});yield this.engine.sendDataPacket(r,mt.RELIABLE)}))}handleParticipantDisconnected(A){for(const[t,{participantIdentity:e}]of this.pendingAcks)e===A&&this.pendingAcks.delete(t);for(const[t,{participantIdentity:e,resolve:i}]of this.pendingResponses)e===A&&(i(null,Ws.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(t))}setEnabledPublishCodecs(A){this.enabledPublishVideoCodecs=A.filter((A=>"video"===A.mime.split("/")[0].toLowerCase()))}updateInfo(A){return!!super.updateInfo(A)&&(A.tracks.forEach((A=>{var t,e;const i=this.trackPublications.get(A.sid);if(i){const n=i.isMuted||null!==(e=null===(t=i.track)||void 0===t?void 0:t.isUpstreamPaused)&&void 0!==e&&e;n!==A.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),as(i)),{mutedOnServer:n})),this.engine.client.sendMuteTrack(A.sid,n))}})),!0)}getPublicationForTrack(A){let t;return this.trackPublications.forEach((e=>{const i=e.track;i&&(A instanceof MediaStreamTrack?(Wr(i)||$r(i))&&i.mediaStreamTrack===A&&(t=e):A===i&&(t=e))})),t}waitForPendingPublicationOfSource(A){return ii(this,void 0,void 0,(function*(){const t=Date.now();for(;Date.now()<t+1e4;){const t=Array.from(this.pendingPublishPromises.entries()).find((t=>{let[e]=t;return e.source===A}));if(t)return t[1];yield wr(20)}}))}}class zo extends Yo{constructor(A,t,e,i){super(A,t.sid,t.name,i),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=zn.HIGH,this.handleEnded=A=>{this.setTrack(void 0),this.emit(On.Ended,A)},this.handleVisibilityChange=A=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(A),this.logContext),this.disabled=!A,this.emitTrackUpdate()},this.handleVideoDimensionsChange=A=>{this.log.debug("adaptivestream video dimensions ".concat(A.width,"x").concat(A.height),this.logContext),this.videoDimensions=A,this.emitTrackUpdate()},this.subscribed=e,this.updateInfo(t)}setSubscribed(A){const t=this.subscriptionStatus,e=this.permissionStatus;this.subscribed=A,A&&(this.allowed=!0);const i=new ae({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new St({participantSid:"",trackSids:[this.trackSid]})]});this.emit(On.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(e)}get subscriptionStatus(){return!1===this.subscribed?Yo.SubscriptionStatus.Unsubscribed:super.isSubscribed?Yo.SubscriptionStatus.Subscribed:Yo.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Yo.PermissionStatus.Allowed:Yo.PermissionStatus.NotAllowed}get isSubscribed(){return!1!==this.subscribed&&super.isSubscribed}get isDesired(){return!1!==this.subscribed}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(A){this.isManualOperationAllowed()&&this.disabled!==!A&&(this.disabled=!A,this.emitTrackUpdate())}setVideoQuality(A){this.isManualOperationAllowed()&&this.currentVideoQuality!==A&&(this.currentVideoQuality=A,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(A){var t,e;this.isManualOperationAllowed()&&((null===(t=this.videoDimensions)||void 0===t?void 0:t.width)===A.width&&(null===(e=this.videoDimensions)||void 0===e?void 0:e.height)===A.height||(zr(this.track)&&(this.videoDimensions=A),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(A){this.isManualOperationAllowed()&&zr(this.track)&&this.fps!==A&&(this.fps=A,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(A){const t=this.subscriptionStatus,e=this.permissionStatus,i=this.track;i!==A&&(i&&(i.off(On.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(On.VisibilityChanged,this.handleVisibilityChange),i.off(On.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(On.Unsubscribed,i)),super.setTrack(A),A&&(A.sid=this.trackSid,A.on(On.VideoDimensionsChanged,this.handleVideoDimensionsChange),A.on(On.VisibilityChanged,this.handleVisibilityChange),A.on(On.Ended,this.handleEnded),this.emit(On.Subscribed,A)),this.emitPermissionUpdateIfChanged(e),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(A){const t=this.subscriptionStatus,e=this.permissionStatus;this.allowed=A,this.emitPermissionUpdateIfChanged(e),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(A){this.emit(On.SubscriptionFailed,A)}updateInfo(A){super.updateInfo(A);const t=this.metadataMuted;this.metadataMuted=A.muted,this.track?this.track.setMuted(A.muted):t!==A.muted&&this.emit(A.muted?On.Muted:On.Unmuted)}emitSubscriptionUpdateIfChanged(A){const t=this.subscriptionStatus;A!==t&&this.emit(On.SubscriptionStatusChanged,t,A)}emitPermissionUpdateIfChanged(A){this.permissionStatus!==A&&this.emit(On.SubscriptionPermissionChanged,this.permissionStatus,A)}isManualOperationAllowed(){return this.kind===tr.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):!!this.isDesired||(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return zr(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const A=new ce({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(A.width=Math.ceil(this.videoDimensions.width),A.height=Math.ceil(this.videoDimensions.height)):void 0!==this.currentVideoQuality?A.quality=this.currentVideoQuality:A.quality=zn.HIGH,this.emit(On.UpdateSettings,A)}}class Aa extends Zo{static fromParticipantInfo(A,t,e){return new Aa(A,t.sid,t.identity,t.name,t.metadata,t.attributes,e,t.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(A,t,e,i,n,r,s){super(t,e||"",i,n,r,s,arguments.length>7&&void 0!==arguments[7]?arguments[7]:dt.STANDARD),this.signalClient=A,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(A){super.addTrackPublication(A),A.on(On.UpdateSettings,(t=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),as(A))),this.signalClient.sendUpdateTrackSettings(t)})),A.on(On.UpdateSubscription,(A=>{A.participantTracks.forEach((A=>{A.participantSid=this.sid})),this.signalClient.sendUpdateSubscription(A)})),A.on(On.SubscriptionPermissionChanged,(t=>{this.emit(Hn.TrackSubscriptionPermissionChanged,A,t)})),A.on(On.SubscriptionStatusChanged,(t=>{this.emit(Hn.TrackSubscriptionStatusChanged,A,t)})),A.on(On.Subscribed,(t=>{this.emit(Hn.TrackSubscribed,t,A)})),A.on(On.Unsubscribed,(t=>{this.emit(Hn.TrackUnsubscribed,t,A)})),A.on(On.SubscriptionFailed,(t=>{this.emit(Hn.TrackSubscriptionFailed,A.trackSid,t)}))}getTrackPublication(A){const t=super.getTrackPublication(A);if(t)return t}getTrackPublicationByName(A){const t=super.getTrackPublicationByName(A);if(t)return t}setVolume(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tr.Source.Microphone;this.volumeMap.set(t,A);const e=this.getTrackPublication(t);e&&e.track&&e.track.setVolume(A)}getVolume(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tr.Source.Microphone;const t=this.getTrackPublication(A);return t&&t.track?t.track.getVolume():this.volumeMap.get(A)}addSubscribedMediaTrack(A,t,e,i,n,r){let s,o=this.getTrackPublicationBySid(t);return o||t.startsWith("TR")||this.trackPublications.forEach((t=>{o||A.kind!==t.kind.toString()||(o=t)})),o?"ended"===A.readyState?(this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),as(o))),void this.emit(Hn.TrackSubscriptionFailed,t)):(s="video"===A.kind?new Po(A,t,i,n):new Go(A,t,i,this.audioContext,this.audioOutput),s.source=o.source,s.isMuted=o.isMuted,s.setMediaStream(e),s.start(),o.setTrack(s),this.volumeMap.has(o.source)&&Zr(s)&&Xr(s)&&s.setVolume(this.volumeMap.get(o.source)),o):0===r?(this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:t})),void this.emit(Hn.TrackSubscriptionFailed,t)):(void 0===r&&(r=20),void setTimeout((()=>{this.addSubscribedMediaTrack(A,t,e,i,n,r-1)}),150))}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(A){return this.trackPublications.get(A)}updateInfo(A){if(!super.updateInfo(A))return!1;const t=new Map,e=new Map;return A.tracks.forEach((A=>{var i,n;let r=this.getTrackPublicationBySid(A.sid);if(r)r.updateInfo(A);else{const t=tr.kindFromProto(A.type);if(!t)return;r=new zo(t,A,null===(i=this.signalClient.connectOptions)||void 0===i?void 0:i.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:null===(n=this.loggerOptions)||void 0===n?void 0:n.loggerName}),r.updateInfo(A),e.set(A.sid,r);const s=Array.from(this.trackPublications.values()).find((A=>A.source===(null==r?void 0:r.source)));s&&r.source!==tr.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(r.source),Object.assign(Object.assign({},this.logContext),{oldTrack:as(s),newTrack:as(r)})),this.addTrackPublication(r)}t.set(A.sid,r)})),this.trackPublications.forEach((A=>{t.has(A.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),as(A))),this.unpublishTrack(A.trackSid,!0))})),e.forEach((A=>{this.emit(Hn.TrackPublished,A)})),!0}unpublishTrack(A,t){const e=this.trackPublications.get(A);if(!e)return;const{track:i}=e;switch(i&&(i.stop(),e.setTrack(void 0)),this.trackPublications.delete(A),e.kind){case tr.Kind.Audio:this.audioTrackPublications.delete(A);break;case tr.Kind.Video:this.videoTrackPublications.delete(A)}t&&this.emit(Hn.TrackUnpublished,e)}setAudioOutput(A){return ii(this,void 0,void 0,(function*(){this.audioOutput=A;const t=[];this.audioTrackPublications.forEach((e=>{var i;Xr(e.track)&&Zr(e.track)&&t.push(e.track.setSinkId(null!==(i=A.deviceId)&&void 0!==i?i:"default"))})),yield Promise.all(t)}))}emit(A){for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:A,args:e})),super.emit(A,...e)}}(ko=Ho||(Ho={})).Disconnected="disconnected",ko.Connecting="connecting",ko.Connected="connected",ko.Reconnecting="reconnecting",ko.SignalReconnecting="signalReconnecting";class ta extends oi.EventEmitter{constructor(A){var t,e,i,n;if(super(),t=this,this.state=Ho.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=qe,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=(A,t,e)=>ii(this,void 0,void 0,(function*(){var i;if("undefined"==typeof RTCPeerConnection||!gr()&&!pr())throw yr()?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 n=yield this.disconnectLock.lock();if(this.state===Ho.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),n(),Promise.resolve();if(this.connectFuture)return n(),this.connectFuture.promise;this.setAndEmitConnectionState(Ho.Connecting),(null===(i=this.regionUrlProvider)||void 0===i?void 0:i.getServerUrl().toString())!==A&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),br(new URL(A))&&(void 0===this.regionUrlProvider?this.regionUrlProvider=new Do(A,t):this.regionUrlProvider.updateToken(t),this.regionUrlProvider.fetchRegionSettings().then((A=>{var t;null===(t=this.regionUrlProvider)||void 0===t||t.setServerReportedRegions(A)})).catch((A=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:A}))})));const r=(i,s,o)=>ii(this,void 0,void 0,(function*(){var a,c;this.abortController&&this.abortController.abort();const u=new AbortController;this.abortController=u,null==n||n();try{yield this.attemptConnection(null!=o?o:A,t,e,u),this.abortController=void 0,i()}catch(h){if(this.regionUrlProvider&&h instanceof Ln&&h.reason!==Qn.Cancelled&&h.reason!==Qn.NotAllowed){let A=null;try{A=yield this.regionUrlProvider.getNextBestRegionUrl(null===(a=this.abortController)||void 0===a?void 0:a.signal)}catch(l){if(l instanceof Ln&&(401===l.status||l.reason===Qn.Cancelled))return this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),void s(l)}A&&!(null===(c=this.abortController)||void 0===c?void 0:c.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(h.message,". Retrying with another region: ").concat(A),this.logContext),this.recreateEngine(),yield r(i,s,A)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Gr(h)),s(h))}else{let A=nt.UNKNOWN_REASON;h instanceof Ln&&(A=Gr(h)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,A),s(h)}}})),s=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Rr(((A,t)=>{r(A,t,s)}),(()=>{this.clearConnectionFutures()})),this.connectFuture.promise})),this.connectSignal=(A,t,e,i,n,r)=>ii(this,void 0,void 0,(function*(){var s,o,a;const c=yield e.join(A,t,{autoSubscribe:i.autoSubscribe,adaptiveStream:"object"==typeof n.adaptiveStream||n.adaptiveStream,maxRetries:i.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:i.websocketTimeout},r.signal);let u=c.serverInfo;if(u||(u={version:c.serverVersion,region:c.serverRegion}),this.serverInfo=u,this.log.debug("connected to Livekit Server ".concat(Object.entries(u).map((A=>{let[t,e]=A;return"".concat(t,": ").concat(e)})).join(", ")),{room:null===(s=c.room)||void 0===s?void 0:s.name,roomSid:null===(o=c.room)||void 0===o?void 0:o.sid,identity:null===(a=c.participant)||void 0===a?void 0:a.identity}),!u.version)throw new Rn("unknown server version");return"0.15.1"===u.version&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),n.dynacast=!1),c})),this.applyJoinResponse=A=>{const t=A.participant;if(this.localParticipant.sid=t.sid,this.localParticipant.identity=t.identity,this.localParticipant.setEnabledPublishCodecs(A.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(A.sifTrailer)}catch(e){this.log.error(e instanceof Error?e.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:e}))}this.handleParticipantUpdates([t,...A.otherParticipants]),A.room&&this.handleRoomUpdate(A.room)},this.attemptConnection=(A,t,e,i)=>ii(this,void 0,void 0,(function*(){var n,r;this.state===Ho.Reconnecting||this.isResuming||(null===(n=this.engine)||void 0===n?void 0:n.pendingReconnect)?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),(null===(r=this.regionUrlProvider)||void 0===r?void 0:r.isCloud())&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Js),e),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const e=yield this.connectSignal(A,t,this.engine,this.connOptions,this.options,i);this.applyJoinResponse(e),this.setupLocalParticipantEvents(),this.emit(En.SignalConnected)}catch(s){yield this.engine.close(),this.recreateEngine();const A=new Ln("could not establish signal connection",Qn.ServerUnreachable);throw s instanceof Error&&(A.message="".concat(A.message,": ").concat(s.message)),s instanceof Ln&&(A.reason=s.reason,A.status=s.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:s})),A}if(i.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ln("Connection attempt aborted",Qn.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,i)}catch(o){throw yield this.engine.close(),this.recreateEngine(),o}Fr()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Fr()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Ho.Connected),this.emit(En.Connected),this.registerConnectionReconcile()})),this.disconnect=function(){for(var A=arguments.length,e=new Array(A),i=0;i<A;i++)e[i]=arguments[i];return ii(t,[...e],void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){var e,i,n,r;const s=yield A.disconnectLock.lock();try{if(A.state===Ho.Disconnected)return void A.log.debug("already disconnected",A.logContext);A.log.info("disconnect from room",Object.assign({},A.logContext)),(A.state===Ho.Connecting||A.state===Ho.Reconnecting||A.isResuming)&&(A.log.warn("abort connection attempt",A.logContext),null===(e=A.abortController)||void 0===e||e.abort(),null===(n=null===(i=A.connectFuture)||void 0===i?void 0:i.reject)||void 0===n||n.call(i,new Ln("Client initiated disconnect",Qn.Cancelled)),A.connectFuture=void 0),(null===(r=A.engine)||void 0===r?void 0:r.client.isDisconnected)||(yield A.engine.client.sendLeave()),A.engine&&(yield A.engine.close()),A.handleDisconnect(t,nt.CLIENT_INITIATED),A.engine=void 0}finally{s()}})()}))},this.onPageLeave=()=>ii(this,void 0,void 0,(function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()})),this.startAudio=()=>ii(this,void 0,void 0,(function*(){const A=[],t=Xn();if(t&&"iOS"===t.os){const t="livekit-dummy-audio-el";let e=document.getElementById(t);if(!e){e=document.createElement("audio"),e.id=t,e.autoplay=!0,e.hidden=!0;const A=_r();A.enabled=!0;const i=new MediaStream([A]);e.srcObject=i,document.addEventListener("visibilitychange",(()=>{e&&(e.srcObject=document.hidden?null:i,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))})),document.body.append(e),this.once(En.Disconnected,(()=>{null==e||e.remove(),e=null}))}A.push(e)}this.remoteParticipants.forEach((t=>{t.audioTrackPublications.forEach((t=>{t.track&&t.track.attachedElements.forEach((t=>{A.push(t)}))}))}));try{yield Promise.all([this.acquireAudioContext(),...A.map((A=>(A.muted=!1,A.play())))]),this.handleAudioPlaybackStarted()}catch(e){throw this.handleAudioPlaybackFailed(e),e}})),this.startVideo=()=>ii(this,void 0,void 0,(function*(){const A=[];for(const t of this.remoteParticipants.values())t.videoTrackPublications.forEach((t=>{var e;null===(e=t.track)||void 0===e||e.attachedElements.forEach((t=>{A.includes(t)||A.push(t)}))}));yield Promise.all(A.map((A=>A.play()))).then((()=>{this.handleVideoPlaybackStarted()})).catch((A=>{"NotAllowedError"===A.name?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 A of this.remoteParticipants.values())this.handleParticipantDisconnected(A.identity,A);this.setAndEmitConnectionState(Ho.Reconnecting)&&this.emit(En.Reconnecting)},this.handleSignalRestarted=A=>ii(this,void 0,void 0,(function*(){this.log.debug("signal reconnected to server, region ".concat(A.serverRegion),Object.assign(Object.assign({},this.logContext),{region:A.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(A);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(t){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:t}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:A.serverRegion}))}catch(e){return}this.setAndEmitConnectionState(Ho.Connected),this.emit(En.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()})),this.handleParticipantUpdates=A=>{A.forEach((A=>{var t;if(A.identity===this.localParticipant.identity)return void this.localParticipant.updateInfo(A);""===A.identity&&(A.identity=null!==(t=this.sidToIdentity.get(A.sid))&&void 0!==t?t:"");let e=this.remoteParticipants.get(A.identity);A.state===lt.DISCONNECTED?this.handleParticipantDisconnected(A.identity,e):e=this.getOrCreateParticipant(A.identity,A)}))},this.handleActiveSpeakersUpdate=A=>{const t=[],e={};A.forEach((A=>{if(e[A.sid]=!0,A.sid===this.localParticipant.sid)this.localParticipant.audioLevel=A.level,this.localParticipant.setIsSpeaking(!0),t.push(this.localParticipant);else{const e=this.getRemoteParticipantBySid(A.sid);e&&(e.audioLevel=A.level,e.setIsSpeaking(!0),t.push(e))}})),e[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach((A=>{e[A.sid]||(A.audioLevel=0,A.setIsSpeaking(!1))})),this.activeSpeakers=t,this.emitWhenConnected(En.ActiveSpeakersChanged,t)},this.handleSpeakersChanged=A=>{const t=new Map;this.activeSpeakers.forEach((A=>{const e=this.remoteParticipants.get(A.identity);e&&e.sid!==A.sid||t.set(A.sid,A)})),A.forEach((A=>{let e=this.getRemoteParticipantBySid(A.sid);A.sid===this.localParticipant.sid&&(e=this.localParticipant),e&&(e.audioLevel=A.level,e.setIsSpeaking(A.active),A.active?t.set(A.sid,e):t.delete(A.sid))}));const e=Array.from(t.values());e.sort(((A,t)=>t.audioLevel-A.audioLevel)),this.activeSpeakers=e,this.emitWhenConnected(En.ActiveSpeakersChanged,e)},this.handleStreamStateUpdate=A=>{A.streamStates.forEach((A=>{const t=this.getRemoteParticipantBySid(A.participantSid);if(!t)return;const e=t.getTrackPublicationBySid(A.trackSid);if(!e||!e.track)return;const i=tr.streamStateFromProto(A.state);i!==e.track.streamState&&(e.track.streamState=i,t.emit(Hn.TrackStreamStateChanged,e,e.track.streamState),this.emitWhenConnected(En.TrackStreamStateChanged,e,e.track.streamState,t))}))},this.handleSubscriptionPermissionUpdate=A=>{const t=this.getRemoteParticipantBySid(A.participantSid);if(!t)return;const e=t.getTrackPublicationBySid(A.trackSid);e&&e.setAllowed(A.allowed)},this.handleSubscriptionError=A=>{const t=Array.from(this.remoteParticipants.values()).find((t=>t.trackPublications.has(A.trackSid)));if(!t)return;const e=t.getTrackPublicationBySid(A.trackSid);e&&e.setSubscriptionError(A.err)},this.handleDataPacket=A=>{const t=this.remoteParticipants.get(A.participantIdentity);if("user"===A.value.case)this.handleUserPacket(t,A.value.value,A.kind);else if("transcription"===A.value.case)this.handleTranscription(t,A.value.value);else if("sipDtmf"===A.value.case)this.handleSipDtmf(t,A.value.value);else if("chatMessage"===A.value.case)this.handleChatMessage(t,A.value.value);else if("metrics"===A.value.case)this.handleMetrics(A.value.value,t);else if("streamHeader"===A.value.case)this.handleStreamHeader(A.value.value,A.participantIdentity);else if("streamChunk"===A.value.case)this.handleStreamChunk(A.value.value);else if("streamTrailer"===A.value.case)this.handleStreamTrailer(A.value.value);else if("rpcRequest"===A.value.case){const t=A.value.value;this.handleIncomingRpcRequest(A.participantIdentity,t.id,t.method,t.payload,t.responseTimeoutMs,t.version)}},this.handleUserPacket=(A,t,e)=>{this.emit(En.DataReceived,t.payload,A,e,t.topic),null==A||A.emit(Hn.DataReceived,t.payload,e)},this.handleSipDtmf=(A,t)=>{this.emit(En.SipDTMFReceived,t,A),null==A||A.emit(Hn.SipDTMFReceived,t)},this.bufferedSegments=new Map,this.handleTranscription=(A,t)=>{const e=t.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(t.transcribedParticipantIdentity),i=null==e?void 0:e.trackPublications.get(t.trackId),n=(function(A,t){return A.segments.map((A=>{let{id:e,text:i,language:n,startTime:r,endTime:s,final:o}=A;var a;const c=null!==(a=t.get(e))&&void 0!==a?a:Date.now(),u=Date.now();return o?t.delete(e):t.set(e,c),{id:e,text:i,startTime:Number.parseInt(r.toString()),endTime:Number.parseInt(s.toString()),final:o,language:n,firstReceivedTime:c,lastReceivedTime:u}}))})(t,this.transcriptionReceivedTimes);null==i||i.emit(On.TranscriptionReceived,n),null==e||e.emit(Hn.TranscriptionReceived,n,i),this.emit(En.TranscriptionReceived,n,e,i)},this.handleChatMessage=(A,t)=>{const e=(function(A){const{id:t,timestamp:e,message:i,editTimestamp:n}=A;return{id:t,timestamp:Number.parseInt(e.toString()),editTimestamp:n?Number.parseInt(n.toString()):void 0,message:i}})(t);this.emit(En.ChatMessage,e,A)},this.handleMetrics=(A,t)=>{this.emit(En.MetricsReceived,A,t)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(En.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=A=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:A})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(En.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(En.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(En.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>ii(this,void 0,void 0,(function*(){var A,t,e;const i=ls.getInstance().previousDevices,n=yield ls.getInstance().getDevices(void 0,!1),r=Xn();if("Chrome"===(null==r?void 0:r.name)&&"iOS"!==r.os)for(let o of n){const A=i.find((A=>A.deviceId===o.deviceId));A&&""!==A.label&&A.kind===o.kind&&A.label!==o.label&&"default"===this.getActiveDevice(o.kind)&&this.emit(En.ActiveDeviceChanged,o.kind,o.deviceId)}const s=["audiooutput","audioinput","videoinput"];for(let o of s){const r=ns(o),s=this.localParticipant.getTrackPublication(r);if(s&&(null===(A=s.track)||void 0===A?void 0:A.isUserProvided))continue;const a=n.filter((A=>A.kind===o)),c=this.getActiveDevice(o);c===(null===(t=i.filter((A=>A.kind===o))[0])||void 0===t?void 0:t.deviceId)&&a.length>0&&(null===(e=a[0])||void 0===e?void 0:e.deviceId)!==c?yield this.switchActiveDevice(o,a[0].deviceId):"audioinput"===o&&!Ur()||"videoinput"===o||a.length>0&&!a.find((A=>A.deviceId===this.getActiveDevice(o)))&&(yield this.switchActiveDevice(o,a[0].deviceId))}this.emit(En.MediaDevicesChanged)})),this.handleRoomUpdate=A=>{const t=this.roomInfo;this.roomInfo=A,t&&t.metadata!==A.metadata&&this.emitWhenConnected(En.RoomMetadataChanged,A.metadata),(null==t?void 0:t.activeRecording)!==A.activeRecording&&this.emitWhenConnected(En.RecordingStatusChanged,A.activeRecording)},this.handleConnectionQualityUpdate=A=>{A.updates.forEach((A=>{if(A.participantSid===this.localParticipant.sid)return void this.localParticipant.setConnectionQuality(A.quality);const t=this.getRemoteParticipantBySid(A.participantSid);t&&t.setConnectionQuality(A.quality)}))},this.onLocalParticipantMetadataChanged=A=>{this.emit(En.ParticipantMetadataChanged,A,this.localParticipant)},this.onLocalParticipantNameChanged=A=>{this.emit(En.ParticipantNameChanged,A,this.localParticipant)},this.onLocalAttributesChanged=A=>{this.emit(En.ParticipantAttributesChanged,A,this.localParticipant)},this.onLocalTrackMuted=A=>{this.emit(En.TrackMuted,A,this.localParticipant)},this.onLocalTrackUnmuted=A=>{this.emit(En.TrackUnmuted,A,this.localParticipant)},this.onTrackProcessorUpdate=A=>{var t;null===(t=null==A?void 0:A.onPublish)||void 0===t||t.call(A,this)},this.onLocalTrackPublished=A=>ii(this,void 0,void 0,(function*(){var t,e,i,n,r,s;null===(t=A.track)||void 0===t||t.on(On.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(e=A.track)||void 0===e||e.on(On.Restarted,this.onLocalTrackRestarted),null===(r=null===(n=null===(i=A.track)||void 0===i?void 0:i.getProcessor())||void 0===n?void 0:n.onPublish)||void 0===r||r.call(n,this),this.emit(En.LocalTrackPublished,A,this.localParticipant),Wr(A.track)&&(yield A.track.checkForSilence())&&this.emit(En.LocalAudioSilenceDetected,A);const o=yield null===(s=A.track)||void 0===s?void 0:s.getDeviceId(!1),a=rs(A.source);a&&o&&o!==this.localParticipant.activeDeviceMap.get(a)&&(this.localParticipant.activeDeviceMap.set(a,o),this.emit(En.ActiveDeviceChanged,a,o))})),this.onLocalTrackUnpublished=A=>{var t,e;null===(t=A.track)||void 0===t||t.off(On.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(e=A.track)||void 0===e||e.off(On.Restarted,this.onLocalTrackRestarted),this.emit(En.LocalTrackUnpublished,A,this.localParticipant)},this.onLocalTrackRestarted=A=>ii(this,void 0,void 0,(function*(){const t=yield A.getDeviceId(!1),e=rs(A.source);e&&t&&t!==this.localParticipant.activeDeviceMap.get(e)&&(this.log.debug("local track restarted, setting ".concat(e," ").concat(t," active"),this.logContext),this.localParticipant.activeDeviceMap.set(e,t),this.emit(En.ActiveDeviceChanged,e,t))})),this.onLocalConnectionQualityChanged=A=>{this.emit(En.ConnectionQualityChanged,A,this.localParticipant)},this.onMediaDevicesError=A=>{this.emit(En.MediaDevicesError,A)},this.onLocalParticipantPermissionsChanged=A=>{this.emit(En.ParticipantPermissionsChanged,A,this.localParticipant)},this.onLocalChatMessageSent=A=>{this.emit(En.ChatMessage,A,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},Vs),A),this.log=ze(null!==(e=this.options.loggerName)&&void 0!==e?e:Ye.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Gs),null==A?void 0:A.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Ps),null==A?void 0:A.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},js),null==A?void 0:A.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new g,this.localParticipant=new qo("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Nr(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Nr(this.options.audioCaptureDefaults.deviceId)),(null===(i=this.options.audioOutput)||void 0===i?void 0:i.deviceId)&&this.switchActiveDevice("audiooutput",Nr(this.options.audioOutput.deviceId)).catch((A=>this.log.warn("Could not set audio output: ".concat(A.message),this.logContext))),this.options.e2ee&&this.setupE2EE(),Fr()){const A=new AbortController;null===(n=navigator.mediaDevices)||void 0===n||n.addEventListener("devicechange",this.handleDeviceChange,{signal:A.signal}),ta.cleanupRegistry&&ta.cleanupRegistry.register(this,(()=>{A.abort()}))}}registerTextStreamHandler(A,t){if(this.textStreamHandlers.has(A))throw new TypeError('A text stream handler for topic "'.concat(A,'" has already been set.'));this.textStreamHandlers.set(A,t)}unregisterTextStreamHandler(A){this.textStreamHandlers.delete(A)}registerByteStreamHandler(A,t){if(this.byteStreamHandlers.has(A))throw new TypeError('A byte stream handler for topic "'.concat(A,'" has already been set.'));this.byteStreamHandlers.set(A,t)}unregisterByteStreamHandler(A){this.byteStreamHandlers.delete(A)}registerRpcMethod(A,t){if(this.rpcHandlers.has(A))throw Error("RPC handler already registered for method ".concat(A,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(A,t)}unregisterRpcMethod(A){this.rpcHandlers.delete(A)}handleIncomingRpcRequest(A,t,e,i,n,r){return ii(this,void 0,void 0,(function*(){if(yield this.engine.publishRpcAck(A,t),1!==r)return void(yield this.engine.publishRpcResponse(A,t,null,Ws.builtIn("UNSUPPORTED_VERSION")));const s=this.rpcHandlers.get(e);if(!s)return void(yield this.engine.publishRpcResponse(A,t,null,Ws.builtIn("UNSUPPORTED_METHOD")));let o=null,a=null;try{const r=yield s({requestId:t,callerIdentity:A,payload:i,responseTimeout:n});Zs(r)>15360?(o=Ws.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(e))):a=r}catch(c){c instanceof Ws?o=c:(console.warn("Uncaught error returned by RPC handler for ".concat(e,". Returning APPLICATION_ERROR instead."),c),o=Ws.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(A,t,a,o)}))}setE2EEEnabled(A){return ii(this,void 0,void 0,(function*(){if(!this.e2eeManager)throw Error("e2ee not configured, please set e2ee settings within the room options");yield Promise.all([this.localParticipant.setE2EEEnabled(A)]),""!==this.localParticipant.identity&&this.e2eeManager.setParticipantCryptorEnabled(A,this.localParticipant.identity)}))}setupE2EE(){var A;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new us(this.options.e2ee),this.e2eeManager.on(pn.ParticipantEncryptionStatusChanged,((A,t)=>{t.isLocal&&(this.isE2EEEnabled=A),this.emit(En.ParticipantEncryptionStatusChanged,A,t)})),this.e2eeManager.on(pn.EncryptionError,(A=>this.emit(En.EncryptionError,A))),null===(A=this.e2eeManager)||void 0===A||A.setup(this))}get logContext(){var A;return{room:this.name,roomID:null===(A=this.roomInfo)||void 0===A?void 0:A.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.activeRecording)&&void 0!==t&&t}getSid(){return ii(this,void 0,void 0,(function*(){return this.state===Ho.Disconnected?"":this.roomInfo&&""!==this.roomInfo.sid?this.roomInfo.sid:new Promise(((A,t)=>{const e=t=>{""!==t.sid&&(this.engine.off(Tn.RoomUpdate,e),A(t.sid))};this.engine.on(Tn.RoomUpdate,e),this.once(En.Disconnected,(()=>{this.engine.off(Tn.RoomUpdate,e),t("Room disconnected before room server id was available")}))}))}))}get name(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.name)&&void 0!==t?t:""}get metadata(){var A;return null===(A=this.roomInfo)||void 0===A?void 0:A.metadata}get numParticipants(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.numParticipants)&&void 0!==t?t:0}get numPublishers(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.numPublishers)&&void 0!==t?t:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Oo(this.options),this.engine.on(Tn.ParticipantUpdate,this.handleParticipantUpdates).on(Tn.RoomUpdate,this.handleRoomUpdate).on(Tn.SpeakersChanged,this.handleSpeakersChanged).on(Tn.StreamStateChanged,this.handleStreamStateUpdate).on(Tn.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(Tn.SubscriptionError,this.handleSubscriptionError).on(Tn.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(Tn.MediaTrackAdded,((A,t,e)=>{this.onTrackAdded(A,t,e)})).on(Tn.Disconnected,(A=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,A)})).on(Tn.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(Tn.DataPacketReceived,this.handleDataPacket).on(Tn.Resuming,(()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(Ho.SignalReconnecting)&&this.emit(En.SignalReconnecting)})).on(Tn.Resumed,(()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Ho.Connected)&&this.emit(En.Reconnected)})).on(Tn.SignalResumed,(()=>{this.bufferedEvents=[],(this.state===Ho.Reconnecting||this.isResuming)&&this.sendSyncState()})).on(Tn.Restarting,this.handleRestarting).on(Tn.SignalRestarted,this.handleSignalRestarted).on(Tn.Offline,(()=>{this.setAndEmitConnectionState(Ho.Reconnecting)&&this.emit(En.Reconnecting)})).on(Tn.DCBufferStatusChanged,((A,t)=>{this.emit(En.DCBufferStatusChanged,A,t)})).on(Tn.LocalTrackSubscribed,(A=>{const t=this.localParticipant.getTrackPublications().find((t=>{let{trackSid:e}=t;return e===A}));t?(this.localParticipant.emit(Hn.LocalTrackSubscribed,t),this.emitWhenConnected(En.LocalTrackSubscribed,t,this.localParticipant)):this.log.warn("could not find local track subscription for subscribed event",this.logContext)})).on(Tn.RoomMoved,(A=>{this.log.debug("room moved",A),A.room&&this.handleRoomUpdate(A.room),this.remoteParticipants.forEach(((A,t)=>{this.handleParticipantDisconnected(t,A)})),this.emit(En.Moved,A.room.name,A.token),A.participant?this.handleParticipantUpdates([A.participant,...A.otherParticipants]):this.handleParticipantUpdates(A.otherParticipants)})),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(A){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return ls.getInstance().getDevices(A,t)}prepareConnection(A,t){return ii(this,void 0,void 0,(function*(){if(this.state===Ho.Disconnected){this.log.debug("prepareConnection to ".concat(A),this.logContext);try{if(br(new URL(A))&&t){this.regionUrlProvider=new Do(A,t);const e=yield this.regionUrlProvider.getNextBestRegionUrl();e&&this.state===Ho.Disconnected&&(this.regionUrl=e,yield fetch(jr(e),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(e),this.logContext))}else yield fetch(jr(A),{method:"HEAD"})}catch(e){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:e}))}}}))}getParticipantByIdentity(A){return this.localParticipant.identity===A?this.localParticipant:this.remoteParticipants.get(A)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(A,t){return ii(this,void 0,void 0,(function*(){let e,i=()=>{};switch(A){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":e=new Se({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":e=new Se({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":e=new Se({scenario:{case:"serverLeave",value:!0}});break;case"migration":e=new Se({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=()=>ii(this,void 0,void 0,(function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")})),e=new Se({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>ii(this,void 0,void 0,(function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")})),e=new Se({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":e=new Se({scenario:{case:"switchCandidateProtocol",value:"force-tls"===A?2:1}}),i=()=>ii(this,void 0,void 0,(function*(){const A=this.engine.client.onLeave;A&&A(new le({reason:nt.CLIENT_INITIATED,action:de.RECONNECT}))}));break;case"subscriber-bandwidth":if(void 0===t||"number"!=typeof t)throw new Error("subscriber-bandwidth requires a number as argument");e=new Se({scenario:{case:"subscriberBandwidth",value:Vr(t)}});break;case"leave-full-reconnect":e=new Se({scenario:{case:"leaveRequestFullReconnect",value:!0}})}e&&(yield this.engine.client.sendSimulateScenario(e),yield i())}))}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(A){return this.localParticipant.activeDeviceMap.get(A)}switchActiveDevice(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(function*(){var n,r,s,o,a,c,u,h;let l=!0,d=!1;const B=i?{exact:t}:t;if("audioinput"===A){d=0===e.localParticipant.audioTrackPublications.size;const t=null!==(n=e.getActiveDevice(A))&&void 0!==n?n:e.options.audioCaptureDefaults.deviceId;e.options.audioCaptureDefaults.deviceId=B;const i=Array.from(e.localParticipant.audioTrackPublications.values()).filter((A=>A.source===tr.Source.Microphone));try{l=(yield Promise.all(i.map((A=>{var t;return null===(t=A.audioTrack)||void 0===t?void 0:t.setDeviceId(B)})))).every((A=>!0===A))}catch(f){throw e.options.audioCaptureDefaults.deviceId=t,f}}else if("videoinput"===A){d=0===e.localParticipant.videoTrackPublications.size;const t=null!==(r=e.getActiveDevice(A))&&void 0!==r?r:e.options.videoCaptureDefaults.deviceId;e.options.videoCaptureDefaults.deviceId=B;const i=Array.from(e.localParticipant.videoTrackPublications.values()).filter((A=>A.source===tr.Source.Camera));try{l=(yield Promise.all(i.map((A=>{var t;return null===(t=A.videoTrack)||void 0===t?void 0:t.setDeviceId(B)})))).every((A=>!0===A))}catch(f){throw e.options.videoCaptureDefaults.deviceId=t,f}}else if("audiooutput"===A){if(!mr()&&!e.options.webAudioMix||e.options.webAudioMix&&e.audioContext&&!("setSinkId"in e.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");e.options.webAudioMix&&(t=null!==(s=yield ls.getInstance().normalizeDeviceId("audiooutput",t))&&void 0!==s?s:""),null!==(o=(h=e.options).audioOutput)&&void 0!==o||(h.audioOutput={});const i=null!==(a=e.getActiveDevice(A))&&void 0!==a?a:e.options.audioOutput.deviceId;e.options.audioOutput.deviceId=t;try{e.options.webAudioMix&&(null===(c=e.audioContext)||void 0===c||c.setSinkId(t)),yield Promise.all(Array.from(e.remoteParticipants.values()).map((A=>A.setAudioOutput({deviceId:t}))))}catch(f){throw e.options.audioOutput.deviceId=i,f}}return(d||"audiooutput"===A)&&(e.localParticipant.activeDeviceMap.set(A,"audiooutput"===A&&(null===(u=e.options.audioOutput)||void 0===u?void 0:u.deviceId)||t),e.emit(En.ActiveDeviceChanged,A,t)),l})()}))}setupLocalParticipantEvents(){this.localParticipant.on(Hn.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(Hn.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(Hn.AttributesChanged,this.onLocalAttributesChanged).on(Hn.TrackMuted,this.onLocalTrackMuted).on(Hn.TrackUnmuted,this.onLocalTrackUnmuted).on(Hn.LocalTrackPublished,this.onLocalTrackPublished).on(Hn.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(Hn.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(Hn.MediaDevicesError,this.onMediaDevicesError).on(Hn.AudioStreamAcquired,this.startAudio).on(Hn.ChatMessage,this.onLocalChatMessageSent).on(Hn.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var A;null===(A=this.engine)||void 0===A||A.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(A,t,e){if(this.state===Ho.Connecting||this.state===Ho.Reconnecting){const i=()=>{this.onTrackAdded(A,t,e),n()},n=()=>{this.off(En.Reconnected,i),this.off(En.Connected,i),this.off(En.Disconnected,n)};return this.once(En.Reconnected,i),this.once(En.Connected,i),void this.once(En.Disconnected,n)}if(this.state===Ho.Disconnected)return void this.log.warn("skipping incoming track after Room disconnected",this.logContext);if("ended"===A.readyState)return void this.log.info("skipping incoming track as it already ended",this.logContext);const i=(function(A){const t=A.split("|");return t.length>1?[t[0],A.substr(t[0].length+1)]:[A,""]})(t.id),n=i[0];let r=i[1],s=A.id;if(r&&r.startsWith("TR")&&(s=r),n===this.localParticipant.sid)return void this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);const o=Array.from(this.remoteParticipants.values()).find((A=>A.sid===n));if(!o)return void this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(n),this.logContext);let a;this.options.adaptiveStream&&(a="object"==typeof this.options.adaptiveStream?this.options.adaptiveStream:{}),o.addSubscribedMediaTrack(A,s,t,e,a)}handleDisconnect(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;var e;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==Ho.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach((A=>{A.trackPublications.forEach((t=>{A.unpublishTrack(t.trackSid)}))})),this.localParticipant.trackPublications.forEach((t=>{var e,i,n;t.track&&this.localParticipant.unpublishTrack(t.track,A),A?(null===(e=t.track)||void 0===e||e.detach(),null===(i=t.track)||void 0===i||i.stop()):null===(n=t.track)||void 0===n||n.stopMonitor()})),this.localParticipant.off(Hn.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(Hn.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(Hn.AttributesChanged,this.onLocalAttributesChanged).off(Hn.TrackMuted,this.onLocalTrackMuted).off(Hn.TrackUnmuted,this.onLocalTrackUnmuted).off(Hn.LocalTrackPublished,this.onLocalTrackPublished).off(Hn.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(Hn.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(Hn.MediaDevicesError,this.onMediaDevicesError).off(Hn.AudioStreamAcquired,this.startAudio).off(Hn.ChatMessage,this.onLocalChatMessageSent).off(Hn.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&&"boolean"==typeof this.options.webAudioMix&&(this.audioContext.close(),this.audioContext=void 0),Fr()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),null===(e=navigator.mediaDevices)||void 0===e||e.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Ho.Disconnected),this.emit(En.Disconnected,t)}}}handleParticipantDisconnected(A,t){var e;this.remoteParticipants.delete(A),t&&(t.trackPublications.forEach((A=>{t.unpublishTrack(A.trackSid,!0)})),this.emit(En.ParticipantDisconnected,t),t.setDisconnected(),null===(e=this.localParticipant)||void 0===e||e.handleParticipantDisconnected(t.identity))}handleStreamHeader(A,t){return ii(this,void 0,void 0,(function*(){var e;if("byteHeader"===A.contentHeader.case){const i=this.byteStreamHandlers.get(A.topic);if(!i)return void this.log.debug("ignoring incoming byte stream due to no handler for topic",A.topic);let n;const r={id:A.streamId,name:null!==(e=A.contentHeader.value.name)&&void 0!==e?e:"unknown",mimeType:A.mimeType,size:A.totalLength?Number(A.totalLength):void 0,topic:A.topic,timestamp:Pr(A.timestamp),attributes:A.attributes},s=new ReadableStream({start:t=>{n=t,this.byteStreamControllers.set(A.streamId,{info:r,controller:n,startTime:Date.now()})}});i(new Lo(r,s,Pr(A.totalLength)),{identity:t})}else if("textHeader"===A.contentHeader.case){const e=this.textStreamHandlers.get(A.topic);if(!e)return void this.log.debug("ignoring incoming text stream due to no handler for topic",A.topic);let i;const n={id:A.streamId,mimeType:A.mimeType,size:A.totalLength?Number(A.totalLength):void 0,topic:A.topic,timestamp:Number(A.timestamp),attributes:A.attributes},r=new ReadableStream({start:t=>{i=t,this.textStreamControllers.set(A.streamId,{info:n,controller:i,startTime:Date.now()})}});e(new xo(n,r,Pr(A.totalLength)),{identity:t})}}))}handleStreamChunk(A){const t=this.byteStreamControllers.get(A.streamId);t&&A.content.length>0&&t.controller.enqueue(A);const e=this.textStreamControllers.get(A.streamId);e&&A.content.length>0&&e.controller.enqueue(A)}handleStreamTrailer(A){const t=this.textStreamControllers.get(A.streamId);t&&(t.info.attributes=Object.assign(Object.assign({},t.info.attributes),A.attributes),t.controller.close(),this.textStreamControllers.delete(A.streamId));const e=this.byteStreamControllers.get(A.streamId);e&&(e.info.attributes=Object.assign(Object.assign({},e.info.attributes),A.attributes),e.controller.close(),this.byteStreamControllers.delete(A.streamId))}acquireAudioContext(){return ii(this,void 0,void 0,(function*(){var A,t;if("boolean"!=typeof this.options.webAudioMix&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:this.audioContext&&"closed"!==this.audioContext.state||(this.audioContext=null!==(A=is())&&void 0!==A?A:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach((A=>A.setAudioContext(this.audioContext))),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&"suspended"===this.audioContext.state)try{yield Promise.race([this.audioContext.resume(),wr(200)])}catch(i){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:i}))}const e="running"===(null===(t=this.audioContext)||void 0===t?void 0:t.state);e!==this.canPlaybackAudio&&(this.audioEnabled=e,this.emit(En.AudioPlaybackStatusChanged,e))}))}createParticipant(A,t){var e;let i;return i=t?Aa.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):new Aa(this.engine.client,"",A,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),(null===(e=this.options.audioOutput)||void 0===e?void 0:e.deviceId)&&i.setAudioOutput(this.options.audioOutput).catch((A=>this.log.warn("Could not set audio output: ".concat(A.message),this.logContext))),i}getOrCreateParticipant(A,t){if(this.remoteParticipants.has(A)){const e=this.remoteParticipants.get(A);return t&&e.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),e}const e=this.createParticipant(A,t);return this.remoteParticipants.set(A,e),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(En.ParticipantConnected,e),e.on(Hn.TrackPublished,(A=>{this.emitWhenConnected(En.TrackPublished,A,e)})).on(Hn.TrackSubscribed,((A,t)=>{A.kind===tr.Kind.Audio?(A.on(On.AudioPlaybackStarted,this.handleAudioPlaybackStarted),A.on(On.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):A.kind===tr.Kind.Video&&(A.on(On.VideoPlaybackFailed,this.handleVideoPlaybackFailed),A.on(On.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(En.TrackSubscribed,A,t,e)})).on(Hn.TrackUnpublished,(A=>{this.emit(En.TrackUnpublished,A,e)})).on(Hn.TrackUnsubscribed,((A,t)=>{this.emit(En.TrackUnsubscribed,A,t,e)})).on(Hn.TrackMuted,(A=>{this.emitWhenConnected(En.TrackMuted,A,e)})).on(Hn.TrackUnmuted,(A=>{this.emitWhenConnected(En.TrackUnmuted,A,e)})).on(Hn.ParticipantMetadataChanged,(A=>{this.emitWhenConnected(En.ParticipantMetadataChanged,A,e)})).on(Hn.ParticipantNameChanged,(A=>{this.emitWhenConnected(En.ParticipantNameChanged,A,e)})).on(Hn.AttributesChanged,(A=>{this.emitWhenConnected(En.ParticipantAttributesChanged,A,e)})).on(Hn.ConnectionQualityChanged,(A=>{this.emitWhenConnected(En.ConnectionQualityChanged,A,e)})).on(Hn.ParticipantPermissionsChanged,(A=>{this.emitWhenConnected(En.ParticipantPermissionsChanged,A,e)})).on(Hn.TrackSubscriptionStatusChanged,((A,t)=>{this.emitWhenConnected(En.TrackSubscriptionStatusChanged,A,t,e)})).on(Hn.TrackSubscriptionFailed,((A,t)=>{this.emit(En.TrackSubscriptionFailed,A,e,t)})).on(Hn.TrackSubscriptionPermissionChanged,((A,t)=>{this.emitWhenConnected(En.TrackSubscriptionPermissionChanged,A,t,e)})).on(Hn.Active,(()=>{this.emitWhenConnected(En.ParticipantActive,e)})),t&&e.updateInfo(t),e}sendSyncState(){const A=Array.from(this.remoteParticipants.values()).reduce(((A,t)=>(A.push(...t.getTrackPublications()),A)),[]),t=this.localParticipant.getTrackPublications();this.engine.sendSyncState(A,t)}updateSubscriptions(){for(const A of this.remoteParticipants.values())for(const t of A.videoTrackPublications.values())t.isSubscribed&&qr(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(A){const t=this.sidToIdentity.get(A);if(t)return this.remoteParticipants.get(t)}registerConnectionReconcile(){this.clearConnectionReconcile();let A=0;this.connectionReconcileInterval=Zn.setInterval((()=>{this.engine&&!this.engine.isClosed&&this.engine.verifyTransport()?A=0:(A++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:A,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),A>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,nt.STATE_MISMATCH)))}),4e3)}clearConnectionReconcile(){this.connectionReconcileInterval&&Zn.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(A){return A!==this.state&&(this.state=A,this.emit(En.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach((A=>{let[t,e]=A;this.emit(t,...e)})),this.bufferedEvents=[]}emitWhenConnected(A){for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];if(this.state===Ho.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([A,e]);else if(this.state===Ho.Connected)return this.emit(A,...e);return!1}simulateParticipants(A){return ii(this,void 0,void 0,(function*(){var t,e;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},A.publish),n=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},A.participants);if(this.handleDisconnect(),this.roomInfo=new at({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:L.parse((new Date).getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new ht({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(En.SignalConnected),this.emit(En.Connected),this.setAndEmitConnectionState(Ho.Connected),i.video){const A=new $o(tr.Kind.Video,new gt({source:At.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO,name:"video-dummy"}),new fo(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:Lr(160*(null!==(t=n.aspectRatios[0])&&void 0!==t?t:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(A),this.localParticipant.emit(Hn.LocalTrackPublished,A)}if(i.audio){const A=new $o(tr.Kind.Audio,new gt({source:At.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO}),new eo(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:_r(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(A),this.localParticipant.emit(Hn.LocalTrackPublished,A)}for(let A=0;A<n.count-1;A+=1){let t=new ht({sid:Math.floor(1e4*Math.random()).toString(),identity:"simulated-".concat(A),state:lt.ACTIVE,tracks:[],joinedAt:L.parse(Date.now())});const i=this.getOrCreateParticipant(t.identity,t);if(n.video){const r=Lr(160*(null!==(e=n.aspectRatios[A%n.aspectRatios.length])&&void 0!==e?e:1),160,!1,!0),s=new gt({source:At.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO});i.addSubscribedMediaTrack(r,s.sid,new MediaStream([r]),new RTCRtpReceiver),t.tracks=[...t.tracks,s]}if(n.audio){const A=_r(),e=new gt({source:At.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO});i.addSubscribedMediaTrack(A,e.sid,new MediaStream([A]),new RTCRtpReceiver),t.tracks=[...t.tracks,e]}i.updateInfo(t)}}))}emit(A){for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];if(A!==En.ActiveSpeakersChanged&&A!==En.TranscriptionReceived){const t=ea(e).filter((A=>void 0!==A));this.log.debug("room event ".concat(A),Object.assign(Object.assign({},this.logContext),{event:A,args:t}))}return super.emit(A,...e)}}function ea(A){return A.map((A=>{if(A)return Array.isArray(A)?ea(A):"object"==typeof A?"logContext"in A?A.logContext:void 0:A}))}ta.cleanupRegistry="undefined"!=typeof FinalizationRegistry&&new FinalizationRegistry((A=>{A()})),(So=To||(To={}))[So.IDLE=0]="IDLE",So[So.RUNNING=1]="RUNNING",So[So.SKIPPED=2]="SKIPPED",So[So.SUCCESS=3]="SUCCESS",So[So.FAILED=4]="FAILED",oi.EventEmitter,oi.EventEmitter;const ia=Symbol.for("@ts-pattern/matcher"),na=Symbol.for("@ts-pattern/isVariadic"),ra="@ts-pattern/anonymous-select-key",sa=A=>Boolean(A&&"object"==typeof A),oa=A=>A&&!!A[ia],aa=(A,t,e)=>{if(oa(A)){const i=A[ia](),{matched:n,selections:r}=i.match(t);return n&&r&&Object.keys(r).forEach((A=>e(A,r[A]))),n}if(sa(A)){if(!sa(t))return!1;if(Array.isArray(A)){if(!Array.isArray(t))return!1;let i=[],n=[],r=[];for(const t of A.keys()){const e=A[t];oa(e)&&e[na]?r.push(e):r.length?n.push(e):i.push(e)}if(r.length){if(r.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<i.length+n.length)return!1;const A=t.slice(0,i.length),s=0===n.length?[]:t.slice(-n.length),o=t.slice(i.length,0===n.length?1/0:-n.length);return i.every(((t,i)=>aa(t,A[i],e)))&&n.every(((A,t)=>aa(A,s[t],e)))&&(0===r.length||aa(r[0],o,e))}return A.length===t.length&&A.every(((A,i)=>aa(A,t[i],e)))}return Reflect.ownKeys(A).every((i=>{const n=A[i];return(i in t||oa(r=n)&&"optional"===r[ia]().matcherType)&&aa(n,t[i],e);var r}))}return Object.is(t,A)},ca=A=>{var t,e,i;return sa(A)?oa(A)?null!=(t=null==(e=(i=A[ia]()).getSelectionKeys)?void 0:e.call(i))?t:[]:Array.isArray(A)?ua(A,ca):ua(Object.values(A),ca):[]},ua=(A,t)=>A.reduce(((A,e)=>A.concat(t(e))),[]);function ha(A){return Object.assign(A,{optional:()=>da(A),and:t=>wa(A,t),or:t=>ga(A,t),select:t=>void 0===t?va(A):va(t,A)})}function la(A){return Object.assign((t=A,Object.assign(t,{[Symbol.iterator](){let A=0;const e=[{value:Object.assign(t,{[na]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var t;return null!=(t=e[A++])?t:e.at(-1)}}}})),{optional:()=>la(da(A)),select:t=>la(void 0===t?va(A):va(t,A))});var t}function da(A){return ha({[ia]:()=>({match:t=>{let e={};const i=(A,t)=>{e[A]=t};return void 0===t?(ca(A).forEach((A=>i(A,void 0))),{matched:!0,selections:e}):{matched:aa(A,t,i),selections:e}},getSelectionKeys:()=>ca(A),matcherType:"optional"})})}const Ba=(A,t)=>{for(const e of A)if(!t(e))return!1;return!0},fa=(A,t)=>{for(const[e,i]of A.entries())if(!t(i,e))return!1;return!0};function wa(...A){return ha({[ia]:()=>({match:t=>{let e={};const i=(A,t)=>{e[A]=t};return{matched:A.every((A=>aa(A,t,i))),selections:e}},getSelectionKeys:()=>ua(A,ca),matcherType:"and"})})}function ga(...A){return ha({[ia]:()=>({match:t=>{let e={};const i=(A,t)=>{e[A]=t};return ua(A,ca).forEach((A=>i(A,void 0))),{matched:A.some((A=>aa(A,t,i))),selections:e}},getSelectionKeys:()=>ua(A,ca),matcherType:"or"})})}function pa(A){return{[ia]:()=>({match:t=>({matched:Boolean(A(t))})})}}function va(...A){const t="string"==typeof A[0]?A[0]:void 0,e=2===A.length?A[1]:"string"==typeof A[0]?void 0:A[0];return ha({[ia]:()=>({match:A=>{let i={[null!=t?t:ra]:A};return{matched:void 0===e||aa(e,A,((A,t)=>{i[A]=t})),selections:i}},getSelectionKeys:()=>[null!=t?t:ra].concat(void 0===e?[]:ca(e))})})}function ma(A){return"number"==typeof A}function Qa(A){return"string"==typeof A}function Ua(A){return"bigint"==typeof A}const Ca=ha(pa((function(A){return!0}))),Fa=Ca,ya=A=>Object.assign(ha(A),{startsWith:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.startsWith(e))))));var e},endsWith:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.endsWith(e))))));var e},minLength:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.length>=e)))));var e},length:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.length===e)))));var e},maxLength:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.length<=e)))));var e},includes:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.includes(e))))));var e},regex:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&Boolean(A.match(e)))))));var e}}),ba=ya(pa(Qa)),Ea=A=>Object.assign(ha(A),{between:(t,e)=>{return Ea(wa(A,(i=t,n=e,pa((A=>ma(A)&&i<=A&&n>=A)))));var i,n},lt:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A<e)))));var e},gt:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A>e)))));var e},lte:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A<=e)))));var e},gte:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A>=e)))));var e},int:()=>Ea(wa(A,pa((A=>ma(A)&&Number.isInteger(A))))),finite:()=>Ea(wa(A,pa((A=>ma(A)&&Number.isFinite(A))))),positive:()=>Ea(wa(A,pa((A=>ma(A)&&A>0)))),negative:()=>Ea(wa(A,pa((A=>ma(A)&&A<0))))}),Ia=Ea(pa(ma)),Ha=A=>Object.assign(ha(A),{between:(t,e)=>{return Ha(wa(A,(i=t,n=e,pa((A=>Ua(A)&&i<=A&&n>=A)))));var i,n},lt:t=>{return Ha(wa(A,(e=t,pa((A=>Ua(A)&&A<e)))));var e},gt:t=>{return Ha(wa(A,(e=t,pa((A=>Ua(A)&&A>e)))));var e},lte:t=>{return Ha(wa(A,(e=t,pa((A=>Ua(A)&&A<=e)))));var e},gte:t=>{return Ha(wa(A,(e=t,pa((A=>Ua(A)&&A>=e)))));var e},positive:()=>Ha(wa(A,pa((A=>Ua(A)&&A>0)))),negative:()=>Ha(wa(A,pa((A=>Ua(A)&&A<0))))}),ka=Ha(pa(Ua)),Ta=ha(pa((function(A){return"boolean"==typeof A}))),Sa=ha(pa((function(A){return"symbol"==typeof A}))),Oa=ha(pa((function(A){return null==A}))),Ka=ha(pa((function(A){return null!=A})));var Da={__proto__:null,matcher:ia,optional:da,array:function(...A){return la({[ia]:()=>({match:t=>{if(!Array.isArray(t))return{matched:!1};if(0===A.length)return{matched:!0};const e=A[0];let i={};if(0===t.length)return ca(e).forEach((A=>{i[A]=[]})),{matched:!0,selections:i};const n=(A,t)=>{i[A]=(i[A]||[]).concat([t])};return{matched:t.every((A=>aa(e,A,n))),selections:i}},getSelectionKeys:()=>0===A.length?[]:ca(A[0])})})},set:function(...A){return ha({[ia]:()=>({match:t=>{if(!(t instanceof Set))return{matched:!1};let e={};if(0===t.size)return{matched:!0,selections:e};if(0===A.length)return{matched:!0};const i=(A,t)=>{e[A]=(e[A]||[]).concat([t])},n=A[0];return{matched:Ba(t,(A=>aa(n,A,i))),selections:e}},getSelectionKeys:()=>0===A.length?[]:ca(A[0])})})},map:function(...A){return ha({[ia]:()=>({match:t=>{if(!(t instanceof Map))return{matched:!1};let e={};if(0===t.size)return{matched:!0,selections:e};const i=(A,t)=>{e[A]=(e[A]||[]).concat([t])};if(0===A.length)return{matched:!0};var n;if(1===A.length)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null==(n=A[0])?void 0:n.toString()}`);const[r,s]=A;return{matched:fa(t,((A,t)=>{const e=aa(r,t,i),n=aa(s,A,i);return e&&n})),selections:e}},getSelectionKeys:()=>0===A.length?[]:[...ca(A[0]),...ca(A[1])]})})},intersection:wa,union:ga,not:function(A){return ha({[ia]:()=>({match:t=>({matched:!aa(A,t,(()=>{}))}),getSelectionKeys:()=>[],matcherType:"not"})})},when:pa,select:va,any:Ca,EA:Fa,string:ba,number:Ia,bigint:ka,boolean:Ta,symbol:Sa,nullish:Oa,nonNullable:Ka,instanceOf:function(A){return ha(pa((t=A,A=>A instanceof t)));var t},shape:function(A){return ha(pa((function(...A){if(1===A.length){const[t]=A;return A=>aa(t,A,(()=>{}))}if(2===A.length){const[t,e]=A;return aa(t,e,(()=>{}))}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${A.length}.`)})(A)))}};class Ma extends Error{constructor(A){let t;try{t=JSON.stringify(A)}catch(e){t=A}super(`Pattern matching error: no pattern matches value ${t}`),this.input=void 0,this.input=A}}const La={matched:!1,value:void 0};function xa(A){return new _a(A,La)}let _a=class A{constructor(A,t){this.input=void 0,this.state=void 0,this.input=A,this.state=t}with(...t){if(this.state.matched)return this;const e=t[t.length-1],i=[t[0]];let n;3===t.length&&"function"==typeof t[1]?n=t[1]:t.length>2&&i.push(...t.slice(1,t.length-1));let r=!1,s={};const o=(A,t)=>{r=!0,s[A]=t},a=!i.some((A=>aa(A,this.input,o)))||n&&!Boolean(n(this.input))?La:{matched:!0,value:e(r?ra in s?s[ra]:s:this.input,this.input)};return new A(this.input,a)}when(t,e){if(this.state.matched)return this;const i=Boolean(t(this.input));return new A(this.input,i?{matched:!0,value:e(this.input,this.input)}:La)}otherwise(A){return this.state.matched?this.state.value:A(this.input)}exhaustive(A=Ra){return this.state.matched?this.state.value:A(this.input)}run(){return this.exhaustive()}returnType(){return this}};function Ra(A){throw new Ma(A)}var Na,ja;(ja=Na||(Na={})).READY="ready",ja.ERROR="error",ja.PAUSED="paused",ja.LOADING="loading",ja.THINKING="thinking",ja.RESEARCHING="researching",ja.AGENT_SPEAKING="agent_speaking",ja.USER_SPEAKING="user_speaking",ja.AWAITING_USER_INPUT="awaiting_user_input";class Ga{constructor({sessionId:A,apiBaseUrl:t}){this.currentState=Na.READY,this.livekitState="speaking",this.assistantAudioContext=null,this.userAudioContext=null,this.IA=null,this.HA=null,this.sessionId=A,this.apiBaseUrl=t||"https://app.coragents.ai/api",this.client=new u({baseUrl:this.apiBaseUrl}),this.emitter=new d}emit(A,t){this.emitter.emit(A,t)}on(A,t){this.emitter.on(A,t)}off(A,t){this.emitter.off(A,t)}setupRoomEventListeners(){this.room&&(this.room.on(En.LocalTrackUnpublished,(A=>{A.source===tr.Source.ScreenShare&&(this.screenStream=void 0)})),this.room.on(En.Disconnected,(()=>{this.disconnect()})),this.room.on(En.ParticipantDisconnected,(()=>{this.disconnect()})),this.room.on(En.TrackSubscribed,((A,t,e)=>{if("audio"===A.kind&&A.attach(),A.source===tr.Source.Microphone&&e.identity.includes("agent-")){const t=A.mediaStream;if(!t)return void console.error("No media stream available for assistant track");const e=new AudioContext,i=e.createAnalyser();e.createMediaStreamSource(t).connect(i),i.fftSize=2048;const n=new Uint8Array(i.frequencyBinCount);this.analyzeAudio(i,n,"ASSISTANT"),this.assistantAudioContext=e}})),this.room.on(En.ParticipantAttributesChanged,(A=>{if(!A["lk.agent.state"])return;if(this.currentState===Na.RESEARCHING||this.currentState===Na.PAUSED)return;const t=A["lk.agent.state"],e=xa(t).with("listening",(()=>Na.USER_SPEAKING)).with("speaking",(()=>Na.AGENT_SPEAKING)).with("thinking",(()=>Na.THINKING)).otherwise((()=>{}));e&&(this.setState(e),this.livekitState=t)})),this.room.on(En.DataReceived,(async A=>{try{const t=JSON.parse((new TextDecoder).decode(A));xa(t.status||t.request).with("using_tool",(()=>{this.currentState=Na.RESEARCHING,this.emitter.emit("stateChanged",Na.RESEARCHING)})).with("using_tool_ended",(()=>{this.currentState=Na.AGENT_SPEAKING,this.emitter.emit("stateChanged",Na.AGENT_SPEAKING)})).with("share_screen",(()=>{this.shareScreen()})).with("prompt_user",(()=>{this.promptContinue()})).with("capture_page_html",(()=>{this.emitter.emit("capturePageHTML")})).with("fill",(()=>{this.emitter.emit("fill",t.value)})).otherwise((()=>{console.warn("Unknown data received:",t)}))}catch(t){console.error("Error parsing data:",t)}})),this.room.localParticipant.registerRpcMethod("screen_capture",(async A=>(this.emitter.emit("screenCaptureRequested"),new Promise((A=>{this.emitter.once("screenCaptureComplete",(async t=>{if("error"!==t)try{await this.room.localParticipant.sendFile(new File([t],"screen_capture.png",{type:"image/png"}),{mimeType:"image/png",topic:"screen_capture"}),A("ok")}catch(e){A("error")}else A("error")}))}))))))}async connect(){if(!this.sessionId)return console.error("No session ID found"),void this.emitter.emit("error",new Error("No session ID provided"));try{await this.requestMicrophone(),this.room=new ta({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners();const A=await this.client.getJoinToken(this.sessionId,{skipIntro:!0});if(await this.room.connect(A.data.url,A.data.token),this.microphoneStream){const A=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(A,{name:"microphone",source:tr.Source.Microphone})}return{url:A.data.url,token:A.data.token}}catch(A){throw console.error("Failed to connect to LiveKit:",A),this.disconnect(),this.emitter.emit("error",A instanceof Error?A:new Error(String(A))),A}}async disconnect(){this.room&&(this.room.disconnect(!0),this.room.removeAllListeners(),this.room=void 0),this.screenStream?.track&&this.screenStream.track.stop(),this.microphoneStream&&this.microphoneStream.getTracks().forEach((A=>A.stop())),this.HA&&(window.clearTimeout(this.HA),this.HA=null),this.IA&&(window.clearTimeout(this.IA),this.IA=null),await(this.userAudioContext?.close().catch((()=>{}))),this.userAudioContext=null,await(this.assistantAudioContext?.close().catch((()=>{}))),this.assistantAudioContext=null,this.setState(Na.READY),this.emitter.emit("disconnected")}setState(A){A!==this.currentState&&(this.currentState=A,this.emitter.emit("stateChanged",A))}getCurrentState(){return this.currentState}async requestMicrophone(){try{const A=await navigator.mediaDevices.getUserMedia({audio:!0});this.microphoneStream=A;const t=new AudioContext;this.userAudioContext=t;const e=t.createAnalyser(),i=t.createMediaStreamSource(A),n=t.createGain();n.gain.value=1.5,i.connect(n),n.connect(e),e.fftSize=2048;const r=new Uint8Array(e.frequencyBinCount);this.analyzeAudio(e,r,"USER")}catch(A){throw console.error("Microphone permission denied:",A),new Error("Microphone permission denied")}}async shareScreen(){if(this.room){this.emitter.emit("preScreenShare");try{if(this.screenStream=await this.room.localParticipant.setScreenShareEnabled(!0,{video:{displaySurface:"window"}}),!this.screenStream)return void console.warn("Failed to share screen");await this.room.localParticipant.publishData((new TextEncoder).encode(JSON.stringify({request:"share_screen",success:!0})),{reliable:!0})}catch(A){console.error("Error sharing screen:",A),this.emitter.emit("error",A instanceof Error?A:new Error(String(A)))}}else console.warn("[obi] shareScreen called while not connected")}pauseRecording(){this.room&&(this.setState(Na.PAUSED),this.room.localParticipant.getTrackPublications().forEach((A=>{A.handleMuted(),A.track?.mediaStream?.getTracks().forEach((A=>A.enabled=!1))})),this.microphoneStream?.getTracks().forEach((A=>A.enabled=!1)),this.screenStream?.track?.mute())}resumeRecording(){if(!this.room)return;const A=xa(this.livekitState).with("listening",(()=>Na.USER_SPEAKING)).with("speaking",(()=>Na.AGENT_SPEAKING)).otherwise((()=>Na.THINKING));this.setState(A),this.room.localParticipant.getTrackPublications().forEach((A=>{A.handleUnmuted(),A.track?.mediaStream?.getTracks().forEach((A=>A.enabled=!0))})),this.microphoneStream?.getTracks().forEach((A=>A.enabled=!0)),this.screenStream?.track?.unmute()}async promptContinue(){await this.room.localParticipant.publishData((new TextEncoder).encode(JSON.stringify({request:"prompt_user",success:!0})),{reliable:!0})}async analyzeAudio(A,t,e){if("USER"===e&&this.currentState===Na.USER_SPEAKING||"ASSISTANT"===e&&this.currentState===Na.AGENT_SPEAKING){A.getByteFrequencyData(t);const i=t.reduce(((A,t)=>A+t),0)/t.length,n=Math.max(.01,Math.min(1,i/128));let r;"USER"===e&&this.currentState===Na.USER_SPEAKING?r="USER":"ASSISTANT"===e&&this.currentState===Na.AGENT_SPEAKING&&(r="ASSISTANT"),r&&this.emitter.emit("volume",{speaker:r,spectrum:Array.from(t),volume:n})}"USER"===e?this.HA=window.setTimeout((()=>this.analyzeAudio(A,t,e)),200):this.IA=window.setTimeout((()=>this.analyzeAudio(A,t,e)),200)}async sendHTML(A){if(this.room)try{const t={type:"page_content",html:A,timestamp:(new Date).toISOString()},e=JSON.stringify(t),i=(new TextEncoder).encode(e);await this.room.localParticipant.publishData(i,{reliable:!0})}catch(t){console.error("Error sending HTML to LiveKit:",t),this.emitter.emit("error",t instanceof Error?t:new Error(String(t)))}else console.log("Cannot send HTML: Not connected to room")}async reconnect(A,t,e){try{if(!A||!t)return console.error("Missing room URL or token for reconnection"),this.emitter.emit("error",new Error("Missing room URL or token for reconnection")),!1;if(await this.requestMicrophone(),this.room=new ta({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners(),await this.room.connect(A,t),this.microphoneStream){const A=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(A,{name:"microphone",source:tr.Source.Microphone})}return this.setState(e),e===Na.PAUSED&&this.pauseRecording(),!0}catch(i){return console.error("Failed to reconnect to room:",i),this.disconnect(),this.emitter.emit("error",i instanceof Error?i:new Error(String(i))),!1}}}const Pa="#a10fff";function Va(A){if(A=A.replace(/^#/,""),!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(A))throw new Error(`Invalid hex color format: ${A}`);3===A.length&&(A=A.split("").map((A=>A+A)).join(""));const t=parseInt(A.slice(0,2),16)/255,e=parseInt(A.slice(2,4),16)/255,i=parseInt(A.slice(4,6),16)/255,n=Math.max(t,e,i),r=Math.min(t,e,i);let s,o,a=(n+r)/2;if(n===r)s=o=0;else{const A=n-r;switch(o=a>.5?A/(2-n-r):A/(n+r),n){case t:s=(e-i)/A+(e<i?6:0);break;case e:s=(i-t)/A+2;break;case i:s=(t-e)/A+4;break;default:s=0}s/=6}return{h:360*s,s:100*o,l:100*a}}function Ja(A,t,e){A/=360,e/=100;const i=(A,t,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?A+6*(t-A)*e:e<.5?t:e<2/3?A+(t-A)*(2/3-e)*6:A);let n,r,s;if(0==(t/=100))n=r=s=e;else{const o=e<.5?e*(1+t):e+t-e*t,a=2*e-o;n=i(a,o,A+1/3),r=i(a,o,A),s=i(a,o,A-1/3)}const o=A=>{const t=Math.round(255*A).toString(16);return 1===t.length?"0"+t:t};return`#${o(n)}${o(r)}${o(s)}`}function Xa(A,t){try{const e=Va(Pa),i=Va(t),n=(i.h-e.h+360)%360,r=n>180?n-360:n,s=i.s-e.s,o=i.l-e.l,a=Va(A),c={h:(a.h+r+360)%360,s:Math.max(0,Math.min(100,a.s+s)),l:Math.max(0,Math.min(100,a.l+o))};return Ja(c.h,c.s,c.l)}catch(e){return console.warn("Failed to generate selected color, using fallback:",e),t}}const Ya="49206C6F7665204F6269_session";var $a=function(A,t){return($a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,t){A.__proto__=t}||function(A,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(A[e]=t[e])})(A,t)};function Wa(A,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=A}$a(A,t),A.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}var Za=function(){return Za=Object.assign||function(A){for(var t,e=1,i=arguments.length;e<i;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(A[n]=t[n]);return A},Za.apply(this,arguments)};function qa(A,t,e,i){return new(e||(e=Promise))((function(n,r){function s(A){try{a(i.next(A))}catch(t){r(t)}}function o(A){try{a(i.throw(A))}catch(t){r(t)}}function a(A){var t;A.done?n(A.value):(t=A.value,t instanceof e?t:new e((function(A){A(t)}))).then(s,o)}a((i=i.apply(A,t||[])).next())}))}function za(A,t){var e,i,n,r,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(o){return function(a){return(function(o){if(e)throw new TypeError("Generator is already executing.");for(;r&&(r=0,o[0]&&(s=0)),s;)try{if(e=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(A,s)}catch(a){o=[6,a],i=0}finally{e=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}})([o,a])}}}function Ac(A,t,e){if(e||2===arguments.length)for(var i,n=0,r=t.length;n<r;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return A.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;for(var tc=(function(){function A(A,t,e,i){this.left=A,this.top=t,this.width=e,this.height=i}return A.prototype.add=function(t,e,i,n){return new A(this.left+t,this.top+e,this.width+i,this.height+n)},A.fromClientRect=function(t,e){return new A(e.left+t.windowBounds.left,e.top+t.windowBounds.top,e.width,e.height)},A.fromDOMRectList=function(t,e){var i=Array.from(e).find((function(A){return 0!==A.width}));return i?new A(i.left+t.windowBounds.left,i.top+t.windowBounds.top,i.width,i.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A})(),ec=function(A,t){return tc.fromClientRect(A,t.getBoundingClientRect())},ic=function(A){for(var t=[],e=0,i=A.length;e<i;){var n=A.charCodeAt(e++);if(n>=55296&&n<=56319&&e<i){var r=A.charCodeAt(e++);56320==(64512&r)?t.push(((1023&n)<<10)+(1023&r)+65536):(t.push(n),e--)}else t.push(n)}return t},nc=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var e=A.length;if(!e)return"";for(var i=[],n=-1,r="";++n<e;){var s=A[n];s<=65535?i.push(s):(s-=65536,i.push(55296+(s>>10),s%1024+56320)),(n+1===e||i.length>16384)&&(r+=String.fromCharCode.apply(String,i),i.length=0)}return r},rc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),sc=0;sc<64;sc++)rc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(sc)]=sc;for(var oc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ac=0;ac<64;ac++)oc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(ac)]=ac;for(var cc=function(A,t,e){return A.slice?A.slice(t,e):new Uint16Array(Array.prototype.slice.call(A,t,e))},uc=(function(){function A(A,t,e,i,n,r){this.initialValue=A,this.errorValue=t,this.highStart=e,this.highValueIndex=i,this.index=n,this.data=r}return A.prototype.get=function(A){var t;if(A>=0){if(A<55296||A>56319&&A<=65535)return t=((t=this.index[A>>5])<<2)+(31&A),this.data[t];if(A<=65535)return t=((t=this.index[2048+(A-55296>>5)])<<2)+(31&A),this.data[t];if(A<this.highStart)return t=2080+(A>>11),t=this.index[t],t+=A>>5&63,t=((t=this.index[t])<<2)+(31&A),this.data[t];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),hc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),lc=0;lc<64;lc++)hc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(lc)]=lc;var dc,Bc,fc,wc,gc,pc,vc,mc,Qc,Uc,Cc=10,Fc=13,yc=15,bc=17,Ec=18,Ic=19,Hc=20,kc=21,Tc=22,Sc=24,Oc=25,Kc=26,Dc=27,Mc=28,Lc=30,xc=32,_c=33,Rc=34,Nc=35,jc=37,Gc=38,Pc=39,Vc=40,Jc=42,Xc=[9001,65288],Yc="\xd7",$c="\xf7",Wc=(wc=(function(A){var t,e,i,n,r,s=39666,o=0;"="===A[52887]&&(s--,"="===A[52886]&&s--);var a="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(s):new Array(s),c=Array.isArray(a)?a:new Uint8Array(a);for(t=0;t<52888;t+=4)e=oc[A.charCodeAt(t)],i=oc[A.charCodeAt(t+1)],n=oc[A.charCodeAt(t+2)],r=oc[A.charCodeAt(t+3)],c[o++]=e<<2|i>>4,c[o++]=(15&i)<<4|n>>2,c[o++]=(3&n)<<6|63&r;return a})("KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA=="),gc=Array.isArray(wc)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=4)e.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return e})(wc):new Uint32Array(wc),vc=cc(pc=Array.isArray(wc)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=2)e.push(A[i+1]<<8|A[i]);return e})(wc):new Uint16Array(wc),12,gc[4]/2),mc=2===gc[5]?cc(pc,(24+gc[4])/2):(dc=gc,Bc=Math.ceil((24+gc[4])/4),dc.slice?dc.slice(Bc,fc):new Uint32Array(Array.prototype.slice.call(dc,Bc,fc))),new uc(gc[0],gc[1],gc[2],gc[3],vc,mc)),Zc=[Lc,36],qc=[1,2,3,5],zc=[Cc,8],Au=[Dc,Kc],tu=qc.concat(zc),eu=[Gc,Pc,Vc,Rc,Nc],iu=[yc,Fc],nu=function(A,t,e,i){var n=i[e];if(Array.isArray(A)?-1!==A.indexOf(n):A===n)for(var r=e;r<=i.length;){if((a=i[++r])===t)return!0;if(a!==Cc)break}if(n===Cc)for(r=e;r>0;){var s=i[--r];if(Array.isArray(A)?-1!==A.indexOf(s):A===s)for(var o=e;o<=i.length;){var a;if((a=i[++o])===t)return!0;if(a!==Cc)break}if(s!==Cc)break}return!1},ru=function(A,t){for(var e=A;e>=0;){var i=t[e];if(i!==Cc)return i;e--}return 0},su=function(A,t,e,i,n){if(0===e[i])return Yc;var r=i-1;if(Array.isArray(n)&&!0===n[r])return Yc;var s=r-1,o=r+1,a=t[r],c=s>=0?t[s]:0,u=t[o];if(2===a&&3===u)return Yc;if(-1!==qc.indexOf(a))return"!";if(-1!==qc.indexOf(u))return Yc;if(-1!==zc.indexOf(u))return Yc;if(8===ru(r,t))return $c;if(11===Wc.get(A[r]))return Yc;if((a===xc||a===_c)&&11===Wc.get(A[o]))return Yc;if(7===a||7===u)return Yc;if(9===a)return Yc;if(-1===[Cc,Fc,yc].indexOf(a)&&9===u)return Yc;if(-1!==[bc,Ec,Ic,Sc,Mc].indexOf(u))return Yc;if(ru(r,t)===Tc)return Yc;if(nu(23,Tc,r,t))return Yc;if(nu([bc,Ec],kc,r,t))return Yc;if(nu(12,12,r,t))return Yc;if(a===Cc)return $c;if(23===a||23===u)return Yc;if(16===u||16===a)return $c;if(-1!==[Fc,yc,kc].indexOf(u)||14===a)return Yc;if(36===c&&-1!==iu.indexOf(a))return Yc;if(a===Mc&&36===u)return Yc;if(u===Hc)return Yc;if(-1!==Zc.indexOf(u)&&a===Oc||-1!==Zc.indexOf(a)&&u===Oc)return Yc;if(a===Dc&&-1!==[jc,xc,_c].indexOf(u)||-1!==[jc,xc,_c].indexOf(a)&&u===Kc)return Yc;if(-1!==Zc.indexOf(a)&&-1!==Au.indexOf(u)||-1!==Au.indexOf(a)&&-1!==Zc.indexOf(u))return Yc;if(-1!==[Dc,Kc].indexOf(a)&&(u===Oc||-1!==[Tc,yc].indexOf(u)&&t[o+1]===Oc)||-1!==[Tc,yc].indexOf(a)&&u===Oc||a===Oc&&-1!==[Oc,Mc,Sc].indexOf(u))return Yc;if(-1!==[Oc,Mc,Sc,bc,Ec].indexOf(u))for(var h=r;h>=0;){if((l=t[h])===Oc)return Yc;if(-1===[Mc,Sc].indexOf(l))break;h--}if(-1!==[Dc,Kc].indexOf(u))for(h=-1!==[bc,Ec].indexOf(a)?s:r;h>=0;){var l;if((l=t[h])===Oc)return Yc;if(-1===[Mc,Sc].indexOf(l))break;h--}if(Gc===a&&-1!==[Gc,Pc,Rc,Nc].indexOf(u)||-1!==[Pc,Rc].indexOf(a)&&-1!==[Pc,Vc].indexOf(u)||-1!==[Vc,Nc].indexOf(a)&&u===Vc)return Yc;if(-1!==eu.indexOf(a)&&-1!==[Hc,Kc].indexOf(u)||-1!==eu.indexOf(u)&&a===Dc)return Yc;if(-1!==Zc.indexOf(a)&&-1!==Zc.indexOf(u))return Yc;if(a===Sc&&-1!==Zc.indexOf(u))return Yc;if(-1!==Zc.concat(Oc).indexOf(a)&&u===Tc&&-1===Xc.indexOf(A[o])||-1!==Zc.concat(Oc).indexOf(u)&&a===Ec)return Yc;if(41===a&&41===u){for(var d=e[r],B=1;d>0&&41===t[--d];)B++;if(B%2!=0)return Yc}return a===xc&&u===_c?Yc:$c},ou=(function(){function A(A,t,e,i){this.codePoints=A,this.required="!"===t,this.start=e,this.end=i}return A.prototype.slice=function(){return nc.apply(void 0,this.codePoints.slice(this.start,this.end))},A})(),au=45,cu=43,uu=-1,hu=function(A){return A>=48&&A<=57},lu=function(A){return hu(A)||A>=65&&A<=70||A>=97&&A<=102},du=function(A){return 10===A||9===A||32===A},Bu=function(A){return(function(A){return(function(A){return A>=97&&A<=122})(A)||(function(A){return A>=65&&A<=90})(A)})(A)||(function(A){return A>=128})(A)||95===A},fu=function(A){return Bu(A)||hu(A)||A===au},wu=function(A){return A>=0&&A<=8||11===A||A>=14&&A<=31||127===A},gu=function(A,t){return 92===A&&10!==t},pu=function(A,t,e){return A===au?Bu(t)||gu(t,e):!!Bu(A)||!(92!==A||!gu(A,t))},vu=function(A,t,e){return A===cu||A===au?!!hu(t)||46===t&&hu(e):hu(46===A?t:A)},mu=function(A){var t=0,e=1;A[t]!==cu&&A[t]!==au||(A[t]===au&&(e=-1),t++);for(var i=[];hu(A[t]);)i.push(A[t++]);var n=i.length?parseInt(nc.apply(void 0,i),10):0;46===A[t]&&t++;for(var r=[];hu(A[t]);)r.push(A[t++]);var s=r.length,o=s?parseInt(nc.apply(void 0,r),10):0;69!==A[t]&&101!==A[t]||t++;var a=1;A[t]!==cu&&A[t]!==au||(A[t]===au&&(a=-1),t++);for(var c=[];hu(A[t]);)c.push(A[t++]);var u=c.length?parseInt(nc.apply(void 0,c),10):0;return e*(n+o*Math.pow(10,-s))*Math.pow(10,a*u)},Qu={type:2},Uu={type:3},Cu={type:4},Fu={type:13},yu={type:8},bu={type:21},Eu={type:9},Iu={type:10},Hu={type:11},ku={type:12},Tu={type:14},Su={type:23},Ou={type:1},Ku={type:25},Du={type:24},Mu={type:26},Lu={type:27},xu={type:28},_u={type:29},Ru={type:31},Nu={type:32},ju=(function(){function A(){this.kA=[]}return A.prototype.write=function(A){this.kA=this.kA.concat(ic(A))},A.prototype.read=function(){for(var A=[],t=this.consumeToken();t!==Nu;)A.push(t),t=this.consumeToken();return A},A.prototype.consumeToken=function(){var A=this.consumeCodePoint();switch(A){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),e=this.peekCodePoint(1),i=this.peekCodePoint(2);if(fu(t)||gu(e,i)){var n=pu(t,e,i)?2:1;return{type:5,value:this.consumeName(),flags:n}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Fu;break;case 39:return this.consumeStringToken(39);case 40:return Qu;case 41:return Uu;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Tu;break;case cu:if(vu(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case 44:return Cu;case au:var r=A,s=this.peekCodePoint(0),o=this.peekCodePoint(1);if(vu(r,s,o))return this.reconsumeCodePoint(A),this.consumeNumericToken();if(pu(r,s,o))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();if(s===au&&62===o)return this.consumeCodePoint(),this.consumeCodePoint(),Du;break;case 46:if(vu(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var a=this.consumeCodePoint();if(42===a&&47===(a=this.consumeCodePoint()))return this.consumeToken();if(a===uu)return this.consumeToken()}break;case 58:return Mu;case 59:return Lu;case 60:if(33===this.peekCodePoint(0)&&this.peekCodePoint(1)===au&&this.peekCodePoint(2)===au)return this.consumeCodePoint(),this.consumeCodePoint(),Ku;break;case 64:var c=this.peekCodePoint(0),u=this.peekCodePoint(1),h=this.peekCodePoint(2);if(pu(c,u,h))return{type:7,value:this.consumeName()};break;case 91:return xu;case 92:if(gu(A,this.peekCodePoint(0)))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();break;case 93:return _u;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),yu;break;case 123:return Hu;case 125:return ku;case 117:case 85:var l=this.peekCodePoint(0),d=this.peekCodePoint(1);return l!==cu||!lu(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(A),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Eu;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),bu;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Iu;break;case uu:return Nu}return du(A)?(this.consumeWhiteSpace(),Ru):hu(A)?(this.reconsumeCodePoint(A),this.consumeNumericToken()):Bu(A)?(this.reconsumeCodePoint(A),this.consumeIdentLikeToken()):{type:6,value:nc(A)}},A.prototype.consumeCodePoint=function(){var A=this.kA.shift();return void 0===A?-1:A},A.prototype.reconsumeCodePoint=function(A){this.kA.unshift(A)},A.prototype.peekCodePoint=function(A){return A>=this.kA.length?-1:this.kA[A]},A.prototype.consumeUnicodeRangeToken=function(){for(var A=[],t=this.consumeCodePoint();lu(t)&&A.length<6;)A.push(t),t=this.consumeCodePoint();for(var e=!1;63===t&&A.length<6;)A.push(t),t=this.consumeCodePoint(),e=!0;if(e)return{type:30,start:parseInt(nc.apply(void 0,A.map((function(A){return 63===A?48:A}))),16),end:parseInt(nc.apply(void 0,A.map((function(A){return 63===A?70:A}))),16)};var i=parseInt(nc.apply(void 0,A),16);if(this.peekCodePoint(0)===au&&lu(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var n=[];lu(t)&&n.length<6;)n.push(t),t=this.consumeCodePoint();return{type:30,start:i,end:parseInt(nc.apply(void 0,n),16)}}return{type:30,start:i,end:i}},A.prototype.consumeIdentLikeToken=function(){var A=this.consumeName();return"url"===A.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:A}):{type:20,value:A}},A.prototype.consumeUrlToken=function(){var A=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===uu)return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var e=this.consumeStringToken(this.consumeCodePoint());return 0===e.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===uu||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:e.value}):(this.consumeBadUrlRemnants(),Su)}for(;;){var i=this.consumeCodePoint();if(i===uu||41===i)return{type:22,value:nc.apply(void 0,A)};if(du(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===uu||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:nc.apply(void 0,A)}):(this.consumeBadUrlRemnants(),Su);if(34===i||39===i||40===i||wu(i))return this.consumeBadUrlRemnants(),Su;if(92===i){if(!gu(i,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),Su;A.push(this.consumeEscapedCodePoint())}else A.push(i)}},A.prototype.consumeWhiteSpace=function(){for(;du(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var A=this.consumeCodePoint();if(41===A||A===uu)return;gu(A,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(A){for(var t="";A>0;){var e=Math.min(5e4,A);t+=nc.apply(void 0,this.kA.splice(0,e)),A-=e}return this.kA.shift(),t},A.prototype.consumeStringToken=function(A){for(var t="",e=0;;){var i=this.kA[e];if(i===uu||void 0===i||i===A)return{type:0,value:t+=this.consumeStringSlice(e)};if(10===i)return this.kA.splice(0,e),Ou;if(92===i){var n=this.kA[e+1];n!==uu&&void 0!==n&&(10===n?(t+=this.consumeStringSlice(e),e=-1,this.kA.shift()):gu(i,n)&&(t+=this.consumeStringSlice(e),t+=nc(this.consumeEscapedCodePoint()),e=-1))}e++}},A.prototype.consumeNumber=function(){var A=[],t=4,e=this.peekCodePoint(0);for(e!==cu&&e!==au||A.push(this.consumeCodePoint());hu(this.peekCodePoint(0));)A.push(this.consumeCodePoint());e=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(46===e&&hu(i))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;hu(this.peekCodePoint(0));)A.push(this.consumeCodePoint());e=this.peekCodePoint(0),i=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((69===e||101===e)&&((i===cu||i===au)&&hu(n)||hu(i)))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;hu(this.peekCodePoint(0));)A.push(this.consumeCodePoint());return[mu(A),t]},A.prototype.consumeNumericToken=function(){var A=this.consumeNumber(),t=A[0],e=A[1],i=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);return pu(i,n,r)?{type:15,number:t,flags:e,unit:this.consumeName()}:37===i?(this.consumeCodePoint(),{type:16,number:t,flags:e}):{type:17,number:t,flags:e}},A.prototype.consumeEscapedCodePoint=function(){var A=this.consumeCodePoint();if(lu(A)){for(var t=nc(A);lu(this.peekCodePoint(0))&&t.length<6;)t+=nc(this.consumeCodePoint());du(this.peekCodePoint(0))&&this.consumeCodePoint();var e=parseInt(t,16);return 0===e||(function(A){return A>=55296&&A<=57343})(e)||e>1114111?65533:e}return A===uu?65533:A},A.prototype.consumeName=function(){for(var A="";;){var t=this.consumeCodePoint();if(fu(t))A+=nc(t);else{if(!gu(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),A;A+=nc(this.consumeEscapedCodePoint())}}},A})(),Gu=(function(){function A(A){this.TA=A}return A.create=function(t){var e=new ju;return e.write(t),new A(e.read())},A.parseValue=function(t){return A.create(t).parseComponentValue()},A.parseValues=function(t){return A.create(t).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var A=this.consumeToken();31===A.type;)A=this.consumeToken();if(32===A.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(A);var t=this.consumeComponentValue();do{A=this.consumeToken()}while(31===A.type);if(32===A.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var A=[];;){var t=this.consumeComponentValue();if(32===t.type)return A;A.push(t),A.push()}},A.prototype.consumeComponentValue=function(){var A=this.consumeToken();switch(A.type){case 11:case 28:case 2:return this.consumeSimpleBlock(A.type);case 19:return this.consumeFunction(A)}return A},A.prototype.consumeSimpleBlock=function(A){for(var t={type:A,values:[]},e=this.consumeToken();;){if(32===e.type||qu(e,A))return t;this.reconsumeToken(e),t.values.push(this.consumeComponentValue()),e=this.consumeToken()}},A.prototype.consumeFunction=function(A){for(var t={name:A.value,values:[],type:18};;){var e=this.consumeToken();if(32===e.type||3===e.type)return t;this.reconsumeToken(e),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var A=this.TA.shift();return void 0===A?Nu:A},A.prototype.reconsumeToken=function(A){this.TA.unshift(A)},A})(),Pu=function(A){return 15===A.type},Vu=function(A){return 17===A.type},Ju=function(A){return 20===A.type},Xu=function(A){return 0===A.type},Yu=function(A,t){return Ju(A)&&A.value===t},$u=function(A){return 31!==A.type},Wu=function(A){return 31!==A.type&&4!==A.type},Zu=function(A){var t=[],e=[];return A.forEach((function(A){if(4===A.type){if(0===e.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(e),void(e=[])}31!==A.type&&e.push(A)})),e.length&&t.push(e),t},qu=function(A,t){return 11===t&&12===A.type||28===t&&29===A.type||2===t&&3===A.type},zu=function(A){return 17===A.type||15===A.type},Ah=function(A){return 16===A.type||zu(A)},th=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},eh={type:17,number:0,flags:4},ih={type:16,number:50,flags:4},nh={type:16,number:100,flags:4},rh=function(A,t,e){var i=A[0],n=A[1];return[sh(i,t),sh(void 0!==n?n:i,e)]},sh=function(A,t){if(16===A.type)return A.number/100*t;if(Pu(A))switch(A.unit){case"rem":case"em":return 16*A.number;default:return A.number}return A.number},oh="grad",ah="turn",ch=function(A,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case oh:return Math.PI/200*t.number;case"rad":return t.number;case ah:return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},uh=function(A){return 15===A.type&&("deg"===A.unit||A.unit===oh||"rad"===A.unit||A.unit===ah)},hh=function(A){switch(A.filter(Ju).map((function(A){return A.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[eh,eh];case"to top":case"bottom":return lh(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[eh,nh];case"to right":case"left":return lh(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[nh,nh];case"to bottom":case"top":return lh(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[nh,eh];case"to left":case"right":return lh(270)}return 0},lh=function(A){return Math.PI*A/180},dh=function(A){return!(255&A)},Bh=function(A){var t=255&A,e=255&A>>8,i=255&A>>16,n=255&A>>24;return t<255?"rgba(".concat(n,",").concat(i,",").concat(e,",").concat(t/255,")"):"rgb(".concat(n,",").concat(i,",").concat(e,")")},fh=function(A,t,e,i){return(A<<24|t<<16|e<<8|Math.round(255*i))>>>0},wh=function(A,t){if(17===A.type)return A.number;if(16===A.type){var e=3===t?1:255;return 3===t?A.number/100*e:Math.round(A.number/100*e)}return 0},gh=function(A){return"from"===(20===A[0].type?A[0].value:"unknown")},ph=function(A,t,e){return Math.min(Math.max(A,t),e)},vh=function(A,t){return[A[0]*t[0]+A[1]*t[1]+A[2]*t[2],A[3]*t[0]+A[4]*t[1]+A[5]*t[2],A[6]*t[0]+A[7]*t[1]+A[8]*t[2]]},mh=function(A){var t=A[0],e=A[1],i=A[2],n=A[3],r=xh([t,e,i]);return fh(ph(Math.round(255*r[0]),0,255),ph(Math.round(255*r[1]),0,255),ph(Math.round(255*r[2]),0,255),n)},Qh=function(A){var t=Mh([A[0],A[1],A[2]]);return mh([t[0],t[1],t[2],A[3]])},Uh=function(A,t){var e=t.filter(Wu),i=e[0],n=e[1],r=e[2],s=e[3];return[(17===i.type?lh(i.number):ch(0,i))/(2*Math.PI),Ah(n)?n.number/100:0,Ah(r)?r.number/100:0,void 0!==s&&Ah(s)?sh(s,1):1]},Ch=function(A,t){if(gh(t))throw new Error("Relative color not supported for hsl()");var e=Uh(0,t),i=e[0],n=e[1],r=e[2],s=e[3],o=kh([i,n,r]);return fh(255*o[0],255*o[1],255*o[2],0===n?1:s)},Fh=function(A){var t=A.filter(Wu);return[Ah(t[0])?t[0].number:0,Ah(t[1])?t[1].number:0,Vu(t[2])||Pu(t[2])?t[2].number:0,void 0!==t[4]&&Ah(t[4])?sh(t[4],1):1]},yh=function(A){var t=A.filter(Wu);return[16===t[0].type?t[0].number/100:Vu(t[0])?t[0].number:0,16===t[1].type?t[1].number/100:Vu(t[1])?t[1].number:0,Vu(t[2])||Pu(t[2])?t[2].number:0,void 0!==t[4]&&Ah(t[4])?sh(t[4],1):1]},bh=function(A){var t=A.filter(Wu);return[16===t[0].type?t[0].number/100:Vu(t[0])?t[0].number:0,16===t[1].type?t[1].number/100:Vu(t[1])?t[1].number:0,Vu(t[2])||Pu(t[2])?t[2].number:0,void 0!==t[4]&&Ah(t[4])?sh(t[4],1):1]},Eh=function(A){return vh([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],A)},Ih=function(A){return vh([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],A)},Hh=function(A,t,e){return e<0&&(e+=1),e>=1&&(e-=1),e<1/6?(t-A)*e*6+A:e<.5?t:e<2/3?6*(t-A)*(2/3-e)+A:A},kh=function(A){var t=A[0],e=A[1],i=A[2];if(0===e)return[255*i,255*i,255*i];var n=i<=.5?i*(e+1):i+e-i*e,r=2*i-n;return[Hh(r,n,t+1/3),Hh(r,n,t),Hh(r,n,t-1/3)]},Th=function(A){var t=A[0],e=A[1],i=A[2];return e<0&&(e=0),isNaN(i)&&(i=0),[t,e*Math.cos(i*Math.PI/180),e*Math.sin(i*Math.PI/180)]},Sh=function(A){var t=vh([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],A).map((function(A){return Math.pow(A,3)}));return vh([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],t)},Oh=function(A){var t=(A[0]+16)/116,e=A[1]/500+t,i=t-A[2]/200,n=24389/27,r=24/116,s=[.3457*(e>r?Math.pow(e,3):(116*e-16)/n)/.3585,A[0]>8?Math.pow(t,3):A[0]/n,.2958*(i>r?Math.pow(i,3):(116*i-16)/n)/.3585];return Ih([s[0],s[1],s[2]])},Kh=function(A){return A},Dh=function(A){return Qh([A[0],A[1],A[2],A[3]])},Mh=function(A){return vh([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],A)},Lh=function(A){return vh([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],A)},xh=function(A){return A.map((function(A){var t=A<0?-1:1,e=Math.abs(A);return e>.0031308?t*(1.055*Math.pow(e,1/2.4)-.055):12.92*A}))},_h=function(A){return A.map((function(A){var t=A<0?-1:1,e=Math.abs(A);return e<=.04045?A/12.92:t*Math.pow((e+.055)/1.055,2.4)}))},Rh=1.09929682680944,Nh=.018053968510807,jh=function(A,t){if(18===t.type){var e=Yh[t.name];if(void 0===e)throw new Error('Attempting to parse an unsupported color function "'.concat(t.name,'"'));return e(A,t.values)}if(5===t.type){var i=Gh(t),n=i[0],r=i[1],s=i[2],o=i[3];return fh(n,r,s,o)}if(20===t.type){var a=Wh[t.value.toUpperCase()];if(void 0!==a)return a}return Wh.TRANSPARENT},Gh=function(A){if(3===A.value.length){var t=A.value.substring(0,1),e=A.value.substring(1,2),i=A.value.substring(2,3);return[parseInt(t+t,16),parseInt(e+e,16),parseInt(i+i,16),1]}if(4===A.value.length){t=A.value.substring(0,1),e=A.value.substring(1,2),i=A.value.substring(2,3);var n=A.value.substring(3,4);return[parseInt(t+t,16),parseInt(e+e,16),parseInt(i+i,16),parseInt(n+n,16)/255]}return 6===A.value.length?(t=A.value.substring(0,2),e=A.value.substring(2,4),i=A.value.substring(4,6),[parseInt(t,16),parseInt(e,16),parseInt(i,16),1]):8===A.value.length?(t=A.value.substring(0,2),e=A.value.substring(2,4),i=A.value.substring(4,6),n=A.value.substring(6,8),[parseInt(t,16),parseInt(e,16),parseInt(i,16),parseInt(n,16)/255]):[0,0,0,1]},Ph=function(A,t){var e=t.filter(Wu);if(gh(e))throw new Error("Relative color not supported for rgb()");if(3===e.length){var i=e.map(wh),n=i[0],r=i[1],s=i[2];return fh(n,r,s,1)}if(4===e.length){var o=e.map(wh),a=(n=o[0],r=o[1],s=o[2],o[3]);return fh(n,r,s,a)}return 0},Vh={srgb:function(A){return fh(ph(Math.round(255*A[0]),0,255),ph(Math.round(255*A[1]),0,255),ph(Math.round(255*A[2]),0,255),ph(A[3],0,1))},"srgb-linear":mh,"display-p3":function(A){var t=(function(A){var t,e=[A[0],A[1],A[2]].map((function(A){var t=A<0?-1:1;return A*t<=.04045?A/12.92:t*Math.pow((A+.055)/1.055,2.4)||0}));return t=[e[0],e[1],e[2]],vh([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],t)})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])},"a98-rgb":function(A){var t,e,i=Mh((t=[(e=[A[0],A[1],A[2]].map((function(A){var t=A<0?-1:1,e=Math.abs(A);return t*Math.pow(e,563/256)})))[0],e[1],e[2]],vh([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],t)));return mh([i[0],i[1],i[2],A[3]])},"prophoto-rgb":function(A){var t=(function(A){var t,e=[A[0],A[1],A[2]].map((function(A){return A<16/512?A/16:Math.pow(A,1.8)}));return Ih((t=[e[0],e[1],e[2]],vh([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],t)))})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])},xyz:Dh,"xyz-d50":function(A){var t=(function(A){return Ih([A[0],A[1],A[2]])})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])},"xyz-d65":Dh,rec2020:function(A){var t=(function(A){var t,e=[A[0],A[1],A[2]].map((function(A){return A<4.5*Nh?A/4.5:Math.pow((A+Rh-1)/Rh,1/.45)}));return t=[e[0],e[1],e[2]],vh([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],t)})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])}},Jh={rgb:function(A,t){var e=t.filter(Wu);if(3===e.length){var i=e.map(wh),n=i[0],r=i[1],s=i[2],o=_h([n/255,r/255,s/255]),a=Lh([o[0],o[1],o[2]]);return[a[0],a[1],a[2],1]}if(4===e.length){var c=e.map(wh),u=(n=c[0],r=c[1],s=c[2],c[3]),h=(o=_h([n/255,r/255,s/255]),Lh([o[0],o[1],o[2]]));return[h[0],h[1],h[2],u]}return[0,0,0,1]},hsl:function(A,t){var e=Uh(0,t),i=e[0],n=e[1],r=e[2],s=e[3],o=_h(kh([i,n,r])),a=Lh([o[0],o[1],o[2]]);return[a[0],a[1],a[2],s]},lab:function(A,t){var e=yh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=Oh([i,n,r]);return[o[0],o[1],o[2],s]},lch:function(A,t){var e=Fh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=Oh(Th([i,n,r]));return[o[0],o[1],o[2],s]},oklab:function(A,t){var e=yh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=Sh([i,n,r]);return[o[0],o[1],o[2],s]},oklch:function(A,t){var e=bh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=Sh(Th([i,n,r]));return[o[0],o[1],o[2],s]}},Xh={srgb:function(A){var t=xh(Mh([A[0],A[1],A[2]]));return[t[0],t[1],t[2],A[3]]},"srgb-linear":function(A){var t=Mh([A[0],A[1],A[2]]),e=t[0],i=t[1],n=t[2];return[ph(Math.round(255*e),0,255),ph(Math.round(255*i),0,255),ph(Math.round(255*n),0,255),A[3]]},"display-p3":function(A){var t,e,i=(e=[A[0],A[1],A[2]],t=vh([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],e),xh(t));return[i[0],i[1],i[2],A[3]]},"a98-rgb":function(A){var t,e,i=(e=[A[0],A[1],A[2]],[(t=vh([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],e).map((function(A){var t=A<0?-1:1,e=Math.abs(A);return t*Math.pow(e,256/563)})))[0],t[1],t[2]]);return[i[0],i[1],i[2],A[3]]},"prophoto-rgb":function(A){var t,e=(t=Eh([A[0],A[1],A[2]]),vh([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],t).map((function(A){return A>1/512?Math.pow(A,1/1.8):16*A})));return[e[0],e[1],e[2],A[3]]},xyz:Kh,"xyz-d50":function(A){var t=Eh([A[0],A[2],A[3]]);return[t[0],t[1],t[2],A[3]]},"xyz-d65":Kh,rec2020:function(A){var t,e=(t=[A[0],A[1],A[2]],vh([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],t).map((function(A){return A>=Nh?Rh*Math.pow(A,.45)-(Rh-1):4.5*A})));return[e[0],e[1],e[2],A[3]]}},Yh={hsl:Ch,hsla:Ch,rgb:Ph,rgba:Ph,lch:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for lch()");var e=Fh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=xh(Mh(Oh(Th([i,n,r]))));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),s)},oklch:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for oklch()");var e=bh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=xh(Mh(Sh(Th([i,n,r]))));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),s)},oklab:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for oklab()");var e=yh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=xh(Mh(Sh([i,n,r])));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),s)},lab:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for lab()");var e=yh(t),i=e[0],n=e[1],r=e[2],s=e[3],o=xh(Mh(Oh([i,n,r])));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),s)},color:function(A,t){var e=t.filter(Wu),i=20===e[0].type?e[0].value:"unknown";if(!gh(e)){var n=Vh[i];if(void 0===n)throw new Error('Attempting to parse an unsupported color space "'.concat(i,'" for color() function'));return n([w=Vu(e[1])?e[1].number:0,g=Vu(e[2])?e[2].number:0,p=Vu(e[3])?e[3].number:0,v=e.length>4&&6===e[4].type&&"/"===e[4].value&&Vu(e[5])?e[5].number:1])}var r=function(A,t){if(Vu(t))return t.number;var e;if(Ju(t))return A["r"===(e=t.value)||"x"===e?0:"g"===e||"y"===e?1:2];var i=function(A){for(var t="(",e=0,n=A.filter(Wu);e<n.length;e++){var r=n[e];t+=18===r.type&&"calc"===r.name?i(r.values):Vu(r)?r.number:6===r.type||Ju(r)?r.value:""}return t+")"};if(18===t.type){var n=t.values.filter(Wu);if("calc"===t.name){var r=i(n).replace(/r|x/,A[0].toString()).replace(/g|y/,A[1].toString()).replace(/b|z/,A[2].toString());return new Function("return "+r)()}}return null},s=18===e[1].type?e[1].name:Ju(e[1])||5===e[1].type?"rgb":"unknown",o=Ju(e[2])?e[2].value:"unknown",a=18===e[1].type?e[1].values:Ju(e[1])?[e[1]]:[];if(Ju(e[1])){if(void 0===Wh[e[1].value.toUpperCase()])throw new Error("Attempting to use unknown color in relative color 'from'");var c=$h(A,e[1].value);a=[{type:17,number:255&c>>24,flags:1},{type:17,number:255&c>>16,flags:1},{type:17,number:255&c>>8,flags:1},{type:17,number:(u=255&c)>1?u/255:u,flags:1}]}else if(5===e[1].type){var u,h=Gh(e[1]);a=[{type:17,number:h[0],flags:1},{type:17,number:h[1],flags:1},{type:17,number:h[2],flags:1},{type:17,number:(u=h[3])>1?u/255:u,flags:1}]}if(0===a.length)throw new Error("Attempting to use unknown color in relative color 'from'");if("unknown"===o)throw new Error("Attempting to use unknown colorspace in relative color 'to'");var l=Jh[s],d=Xh[o],B=Vh[o];if(void 0===l)throw new Error('Attempting to parse an unsupported color space "'.concat(s,'" for color() function'));if(void 0===d)throw new Error('Attempting to parse an unsupported color space "'.concat(o,'" for color() function'));var f=d(l(A,a)),w=r(f,e[3]),g=r(f,e[4]),p=r(f,e[5]),v=e.length>6&&6===e[6].type&&"/"===e[6].value&&Vu(e[7])?e[7].number:1;if(null===w||null===g||null===p)throw new Error("Invalid relative color in color() function");return B([w,g,p,v])}},$h=function(A,t){return jh(A,Gu.create(t).parseComponentValue())},Wh={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Zh={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,t){return t.map((function(A){if(Ju(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},qh={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},zh=function(A,t){var e=jh(A,t[0]),i=t[1];return i&&Ah(i)?{color:e,stop:i}:{color:e,stop:null}},Al=function(A,t){var e=A[0],i=A[A.length-1];null===e.stop&&(e.stop=eh),null===i.stop&&(i.stop=nh);for(var n=[],r=0,s=0;s<A.length;s++){var o=A[s].stop;if(null!==o){var a=sh(o,t);a>r?n.push(a):n.push(r),r=a}else n.push(null)}var c=null;for(s=0;s<n.length;s++){var u=n[s];if(null===u)null===c&&(c=s);else if(null!==c){for(var h=s-c,l=(u-n[c-1])/(h+1),d=1;d<=h;d++)n[c+d-1]=l*d;c=null}}return A.map((function(A,e){return{color:A.color,stop:Math.max(Math.min(1,n[e]/t),0)}}))},tl=function(A,t){return Math.sqrt(A*A+t*t)},el=function(A,t,e,i,n){return[[0,0],[0,t],[A,0],[A,t]].reduce((function(A,t){var r=t[0],s=t[1],o=tl(e-r,i-s);return(n?o<A.optimumDistance:o>A.optimumDistance)?{optimumCorner:t,optimumDistance:o}:A}),{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},il=function(A,t){var e=lh(180),i=[];return Zu(t).forEach((function(t,n){if(0===n){var r=t[0];if(20===r.type&&-1!==["top","left","right","bottom"].indexOf(r.value))return void(e=hh(t));if(uh(r))return void(e=(ch(0,r)+lh(270))%lh(360))}var s=zh(A,t);i.push(s)})),{angle:e,stops:i,type:1}},nl="closest-side",rl="farthest-side",sl="closest-corner",ol="farthest-corner",al="circle",cl="ellipse",ul="cover",hl="contain",ll=function(A,t){var e=0,i=3,n=[],r=[];return Zu(t).forEach((function(t,s){var o=!0;if(0===s?o=t.reduce((function(A,t){if(Ju(t))switch(t.value){case"center":return r.push(ih),!1;case"top":case"left":return r.push(eh),!1;case"right":case"bottom":return r.push(nh),!1}else if(Ah(t)||zu(t))return r.push(t),!1;return A}),o):1===s&&(o=t.reduce((function(A,t){if(Ju(t))switch(t.value){case al:return e=0,!1;case cl:return e=1,!1;case hl:case nl:return i=0,!1;case rl:return i=1,!1;case sl:return i=2,!1;case ul:case ol:return i=3,!1}else if(zu(t)||Ah(t))return Array.isArray(i)||(i=[]),i.push(t),!1;return A}),o)),o){var a=zh(A,t);n.push(a)}})),{size:i,shape:e,stops:n,position:r,type:2}},dl=function(A,t){if(22===t.type){var e={url:t.value,type:0};return A.cache.addImage(t.value),e}if(18===t.type){var i=Bl[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported image function "'.concat(t.name,'"'));return i(A,t.values)}throw new Error("Unsupported image type ".concat(t.type))},Bl={"linear-gradient":function(A,t){var e=lh(180),i=[];return Zu(t).forEach((function(t,n){if(0===n){var r=t[0];if(20===r.type&&"to"===r.value)return void(e=hh(t));if(uh(r))return void(e=ch(0,r))}var s=zh(A,t);i.push(s)})),{angle:e,stops:i,type:1}},"-moz-linear-gradient":il,"-ms-linear-gradient":il,"-o-linear-gradient":il,"-webkit-linear-gradient":il,"radial-gradient":function(A,t){var e=0,i=3,n=[],r=[];return Zu(t).forEach((function(t,s){var o=!0;if(0===s){var a=!1;o=t.reduce((function(A,t){if(a)if(Ju(t))switch(t.value){case"center":return r.push(ih),A;case"top":case"left":return r.push(eh),A;case"right":case"bottom":return r.push(nh),A}else(Ah(t)||zu(t))&&r.push(t);else if(Ju(t))switch(t.value){case al:return e=0,!1;case cl:return e=1,!1;case"at":return a=!0,!1;case nl:return i=0,!1;case ul:case rl:return i=1,!1;case hl:case sl:return i=2,!1;case ol:return i=3,!1}else if(zu(t)||Ah(t))return Array.isArray(i)||(i=[]),i.push(t),!1;return A}),o)}if(o){var c=zh(A,t);n.push(c)}})),{size:i,shape:e,stops:n,position:r,type:2}},"-moz-radial-gradient":ll,"-ms-radial-gradient":ll,"-o-radial-gradient":ll,"-webkit-radial-gradient":ll,"-webkit-gradient":function(A,t){var e=lh(180),i=[],n=1;return Zu(t).forEach((function(t,e){var r=t[0];if(0===e){if(Ju(r)&&"linear"===r.value)return void(n=1);if(Ju(r)&&"radial"===r.value)return void(n=2)}if(18===r.type)if("from"===r.name){var s=jh(A,r.values[0]);i.push({stop:eh,color:s})}else if("to"===r.name)s=jh(A,r.values[0]),i.push({stop:nh,color:s});else if("color-stop"===r.name){var o=r.values.filter(Wu);if(2===o.length){s=jh(A,o[1]);var a=o[0];Vu(a)&&i.push({stop:{type:16,number:100*a.number,flags:a.flags},color:s})}}})),1===n?{angle:(e+lh(180))%lh(360),stops:i,type:n}:{size:3,shape:0,stops:i,position:[],type:n}}},fl={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,t){if(0===t.length)return[];var e=t[0];return 20===e.type&&"none"===e.value?[]:t.filter((function(A){return Wu(A)&&(function(A){return!(20===A.type&&"none"===A.value||18===A.type&&!Bl[A.name])})(A)})).map((function(t){return dl(A,t)}))}},wl={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,t){return t.map((function(A){if(Ju(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},gl={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,t){return Zu(t).map((function(A){return A.filter(Ah)})).map(th)}},pl={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,t){return Zu(t).map((function(A){return A.filter(Ju).map((function(A){return A.value})).join(" ")})).map(vl)}},vl=function(A){switch(A){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};(Uc=Qc||(Qc={})).AUTO="auto",Uc.CONTAIN="contain",Uc.COVER="cover";var ml,Ql,Ul={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,t){return Zu(t).map((function(A){return A.filter(Cl)}))}},Cl=function(A){return Ju(A)||Ah(A)},Fl=function(A){return{name:"border-".concat(A,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},yl=Fl("top"),bl=Fl("right"),El=Fl("bottom"),Il=Fl("left"),Hl=function(A){return{name:"border-radius-".concat(A),initialValue:"0 0",prefix:!1,type:1,parse:function(A,t){return th(t.filter(Ah))}}},kl=Hl("top-left"),Tl=Hl("top-right"),Sl=Hl("bottom-right"),Ol=Hl("bottom-left"),Kl=function(A){return{name:"border-".concat(A,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(A,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Dl=Kl("top"),Ml=Kl("right"),Ll=Kl("bottom"),xl=Kl("left"),_l=function(A){return{name:"border-".concat(A,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(A,t){return Pu(t)?t.number:0}}},Rl=_l("top"),Nl=_l("right"),jl=_l("bottom"),Gl=_l("left"),Pl={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vl={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,t){return"rtl"===t?1:0}},Jl={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).reduce((function(A,t){return A|Xl(t.value)}),0)}},Xl=function(A){switch(A){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Yl={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},$l={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};(Ql=ml||(ml={})).NORMAL="normal",Ql.STRICT="strict";var Wl,Zl,ql={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){return"strict"===t?ml.STRICT:ml.NORMAL}},zl={name:"line-height",initialValue:"normal",prefix:!1,type:4},Ad=function(A,t){return Ju(A)&&"normal"===A.value?1.2*t:17===A.type?t*A.number:Ah(A)?sh(A,t):t},td={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,t){return 20===t.type&&"none"===t.value?null:dl(A,t)}},ed={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,t){return"inside"===t?0:1}},id={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},nd=function(A){return{name:"margin-".concat(A),initialValue:"0",prefix:!1,type:4}},rd=nd("top"),sd=nd("right"),od=nd("bottom"),ad=nd("left"),cd={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).map((function(A){switch(A.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},ud={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){return"break-word"===t?"break-word":"normal"}},hd=function(A){return{name:"padding-".concat(A),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},ld=hd("top"),dd=hd("right"),Bd=hd("bottom"),fd=hd("left"),wd={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},gd={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},pd={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,t){return 1===t.length&&Yu(t[0],"none")?[]:Zu(t).map((function(t){for(var e={color:Wh.TRANSPARENT,offsetX:eh,offsetY:eh,blur:eh},i=0,n=0;n<t.length;n++){var r=t[n];zu(r)?(0===i?e.offsetX=r:1===i?e.offsetY=r:e.blur=r,i++):e.color=jh(A,r)}return e}))}},vd={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},md={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,t){if(20===t.type&&"none"===t.value)return null;if(18===t.type){var e=Qd[t.name];if(void 0===e)throw new Error('Attempting to parse an unsupported transform function "'.concat(t.name,'"'));return e(t.values)}return null}},Qd={matrix:function(A){var t=A.filter((function(A){return 17===A.type})).map((function(A){return A.number}));return 6===t.length?t:null},matrix3d:function(A){var t=A.filter((function(A){return 17===A.type})).map((function(A){return A.number})),e=t[0],i=t[1];t[2],t[3];var n=t[4],r=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var s=t[12],o=t[13];return t[14],t[15],16===t.length?[e,i,n,r,s,o]:null}},Ud={type:16,number:50,flags:4},Cd=[Ud,Ud],Fd={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,t){var e=t.filter(Ah);return 2!==e.length?Cd:[e[0],e[1]]}},yd={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"hidden":return 1;case"collapse":return 2;default:return 0}}};(Zl=Wl||(Wl={})).NORMAL="normal",Zl.BREAK_ALL="break-all",Zl.KEEP_ALL="keep-all";for(var bd={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){switch(t){case"break-all":return Wl.BREAK_ALL;case"keep-all":return Wl.KEEP_ALL;default:return Wl.NORMAL}}},Ed={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,t){if(20===t.type)return{auto:!0,order:0};if(Vu(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},Id=function(A,t){if(15===t.type)switch(t.unit.toLowerCase()){case"s":return 1e3*t.number;case"ms":return t.number}throw new Error("Unsupported time type")},Hd={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,t){return Vu(t)?t.number:1}},kd={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Td={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).map((function(A){switch(A.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0})).filter((function(A){return 0!==A}))}},Sd={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,t){var e=[],i=[];return t.forEach((function(A){switch(A.type){case 20:case 0:e.push(A.value);break;case 17:e.push(A.number.toString());break;case 4:i.push(e.join(" ")),e.length=0}})),e.length&&i.push(e.join(" ")),i.map((function(A){return-1===A.indexOf(" ")?A:"'".concat(A,"'")}))}},Od={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Kd={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,t){return Vu(t)?t.number:Ju(t)&&"bold"===t.value?700:400}},Dd={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,t){return t.filter(Ju).map((function(A){return A.value}))}},Md={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){switch(t){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Ld=function(A,t){return 0!==(A&t)},xd={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,t){if(0===t.length)return[];var e=t[0];return 20===e.type&&"none"===e.value?[]:t}},_d={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,t){if(0===t.length)return null;var e=t[0];if(20===e.type&&"none"===e.value)return null;for(var i=[],n=t.filter($u),r=0;r<n.length;r++){var s=n[r],o=n[r+1];if(20===s.type){var a=o&&Vu(o)?o.number:1;i.push({counter:s.value,increment:a})}}return i}},Rd={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,t){if(0===t.length)return[];for(var e=[],i=t.filter($u),n=0;n<i.length;n++){var r=i[n],s=i[n+1];if(Ju(r)&&"none"!==r.value){var o=s&&Vu(s)?s.number:0;e.push({counter:r.value,reset:o})}}return e}},Nd={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,t){return t.filter(Pu).map((function(A){return Id(0,A)}))}},jd={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,t){if(0===t.length)return null;var e=t[0];if(20===e.type&&"none"===e.value)return null;var i=[],n=t.filter(Xu);if(n.length%2!=0)return null;for(var r=0;r<n.length;r+=2){var s=n[r].value,o=n[r+1].value;i.push({open:s,close:o})}return i}},Gd=function(A,t,e){if(!A)return"";var i=A[Math.min(t,A.length-1)];return i?e?i.open:i.close:""},Pd={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,t){return 1===t.length&&Yu(t[0],"none")?[]:Zu(t).map((function(t){for(var e={color:255,offsetX:eh,offsetY:eh,blur:eh,spread:eh,inset:!1},i=0,n=0;n<t.length;n++){var r=t[n];Yu(r,"inset")?e.inset=!0:zu(r)?(0===i?e.offsetX=r:1===i?e.offsetY=r:2===i?e.blur=r:e.spread=r,i++):e.color=jh(A,r)}return e}))}},Vd={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,t){var e=[];return t.filter(Ju).forEach((function(A){switch(A.value){case"stroke":e.push(1);break;case"fill":e.push(0);break;case"markers":e.push(2)}})),[0,1,2].forEach((function(A){-1===e.indexOf(A)&&e.push(A)})),e}},Jd={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Xd={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,t){return Pu(t)?t.number:0}},Yd={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).reduce((function(A,t){return A|$d(t.value)}),0)}},$d=function(A){switch(A){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},Wd=(function(){function A(A,t){var e,i;this.animationDuration=zd(A,Nd,t.animationDuration),this.backgroundClip=zd(A,Zh,t.backgroundClip),this.backgroundColor=zd(A,qh,t.backgroundColor),this.backgroundImage=zd(A,fl,t.backgroundImage),this.backgroundOrigin=zd(A,wl,t.backgroundOrigin),this.backgroundPosition=zd(A,gl,t.backgroundPosition),this.backgroundRepeat=zd(A,pl,t.backgroundRepeat),this.backgroundSize=zd(A,Ul,t.backgroundSize),this.borderTopColor=zd(A,yl,t.borderTopColor),this.borderRightColor=zd(A,bl,t.borderRightColor),this.borderBottomColor=zd(A,El,t.borderBottomColor),this.borderLeftColor=zd(A,Il,t.borderLeftColor),this.borderTopLeftRadius=zd(A,kl,t.borderTopLeftRadius),this.borderTopRightRadius=zd(A,Tl,t.borderTopRightRadius),this.borderBottomRightRadius=zd(A,Sl,t.borderBottomRightRadius),this.borderBottomLeftRadius=zd(A,Ol,t.borderBottomLeftRadius),this.borderTopStyle=zd(A,Dl,t.borderTopStyle),this.borderRightStyle=zd(A,Ml,t.borderRightStyle),this.borderBottomStyle=zd(A,Ll,t.borderBottomStyle),this.borderLeftStyle=zd(A,xl,t.borderLeftStyle),this.borderTopWidth=zd(A,Rl,t.borderTopWidth),this.borderRightWidth=zd(A,Nl,t.borderRightWidth),this.borderBottomWidth=zd(A,jl,t.borderBottomWidth),this.borderLeftWidth=zd(A,Gl,t.borderLeftWidth),this.boxShadow=zd(A,Pd,t.boxShadow),this.color=zd(A,Pl,t.color),this.direction=zd(A,Vl,t.direction),this.display=zd(A,Jl,t.display),this.float=zd(A,Yl,t.cssFloat),this.fontFamily=zd(A,Sd,t.fontFamily),this.fontSize=zd(A,Od,t.fontSize),this.fontStyle=zd(A,Md,t.fontStyle),this.fontVariant=zd(A,Dd,t.fontVariant),this.fontWeight=zd(A,Kd,t.fontWeight),this.letterSpacing=zd(A,$l,t.letterSpacing),this.lineBreak=zd(A,ql,t.lineBreak),this.lineHeight=zd(A,zl,t.lineHeight),this.listStyleImage=zd(A,td,t.listStyleImage),this.listStylePosition=zd(A,ed,t.listStylePosition),this.listStyleType=zd(A,id,t.listStyleType),this.marginTop=zd(A,rd,t.marginTop),this.marginRight=zd(A,sd,t.marginRight),this.marginBottom=zd(A,od,t.marginBottom),this.marginLeft=zd(A,ad,t.marginLeft),this.opacity=zd(A,Hd,t.opacity);var n=zd(A,cd,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=zd(A,ud,t.overflowWrap),this.paddingTop=zd(A,ld,t.paddingTop),this.paddingRight=zd(A,dd,t.paddingRight),this.paddingBottom=zd(A,Bd,t.paddingBottom),this.paddingLeft=zd(A,fd,t.paddingLeft),this.paintOrder=zd(A,Vd,t.paintOrder),this.position=zd(A,gd,t.position),this.textAlign=zd(A,wd,t.textAlign),this.textDecorationColor=zd(A,kd,null!==(e=t.textDecorationColor)&&void 0!==e?e:t.color),this.textDecorationLine=zd(A,Td,null!==(i=t.textDecorationLine)&&void 0!==i?i:t.textDecoration),this.textShadow=zd(A,pd,t.textShadow),this.textTransform=zd(A,vd,t.textTransform),this.transform=zd(A,md,t.transform),this.transformOrigin=zd(A,Fd,t.transformOrigin),this.visibility=zd(A,yd,t.visibility),this.webkitTextStrokeColor=zd(A,Jd,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=zd(A,Xd,t.webkitTextStrokeWidth),this.wordBreak=zd(A,bd,t.wordBreak),this.zIndex=zd(A,Ed,t.zIndex),this.objectFit=zd(A,Yd,t.objectFit)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},A.prototype.isTransparent=function(){return dh(this.backgroundColor)},A.prototype.isTransformed=function(){return null!==this.transform},A.prototype.isPositioned=function(){return 0!==this.position},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return 0!==this.float},A.prototype.isInlineLevel=function(){return Ld(this.display,4)||Ld(this.display,33554432)||Ld(this.display,268435456)||Ld(this.display,536870912)||Ld(this.display,67108864)||Ld(this.display,134217728)},A})(),Zd=function(A,t){this.content=zd(A,xd,t.content),this.quotes=zd(A,jd,t.quotes)},qd=function(A,t){this.counterIncrement=zd(A,_d,t.counterIncrement),this.counterReset=zd(A,Rd,t.counterReset)},zd=function(A,t,e){var i=new ju,n=null!=e?e.toString():t.initialValue;i.write(n);var r=new Gu(i.read());switch(t.type){case 2:var s=r.parseComponentValue();return t.parse(A,Ju(s)?s.value:t.initialValue);case 0:return t.parse(A,r.parseComponentValue());case 1:return t.parse(A,r.parseComponentValues());case 4:return r.parseComponentValue();case 3:switch(t.format){case"angle":return ch(0,r.parseComponentValue());case"color":return jh(A,r.parseComponentValue());case"image":return dl(A,r.parseComponentValue());case"length":var o=r.parseComponentValue();return zu(o)?o:eh;case"length-percentage":var a=r.parseComponentValue();return Ah(a)?a:eh;case"time":return Id(0,r.parseComponentValue())}}},AB=function(A,t){var e=(function(A){switch(A.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}})(A);return 1===e||t===e},tB=function(A,t){this.context=A,this.textNodes=[],this.elements=[],this.flags=0,AB(t,3),this.styles=new Wd(A,window.getComputedStyle(t,null)),Af(t)&&(this.styles.animationDuration.some((function(A){return A>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=ec(this.context,t),AB(t,4)&&(this.flags|=16)},eB="undefined"==typeof Uint8Array?[]:new Uint8Array(256),iB=0;iB<64;iB++)eB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(iB)]=iB;for(var nB=function(A,t,e){return A.slice?A.slice(t,e):new Uint16Array(Array.prototype.slice.call(A,t,e))},rB=(function(){function A(A,t,e,i,n,r){this.initialValue=A,this.errorValue=t,this.highStart=e,this.highValueIndex=i,this.index=n,this.data=r}return A.prototype.get=function(A){var t;if(A>=0){if(A<55296||A>56319&&A<=65535)return t=((t=this.index[A>>5])<<2)+(31&A),this.data[t];if(A<=65535)return t=((t=this.index[2048+(A-55296>>5)])<<2)+(31&A),this.data[t];if(A<this.highStart)return t=2080+(A>>11),t=this.index[t],t+=A>>5&63,t=((t=this.index[t])<<2)+(31&A),this.data[t];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),sB="undefined"==typeof Uint8Array?[]:new Uint8Array(256),oB=0;oB<64;oB++)sB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(oB)]=oB;var aB,cB,uB=8,hB=9,lB=11,dB=12,BB=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var e=A.length;if(!e)return"";for(var i=[],n=-1,r="";++n<e;){var s=A[n];s<=65535?i.push(s):(s-=65536,i.push(55296+(s>>10),s%1024+56320)),(n+1===e||i.length>16384)&&(r+=String.fromCharCode.apply(String,i),i.length=0)}return r},fB=(function(){var A=(function(A){var t,e,i,n,r,s=19617,o=0;"="===A[26155]&&(s--,"="===A[26154]&&s--);var a="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(s):new Array(s),c=Array.isArray(a)?a:new Uint8Array(a);for(t=0;t<26156;t+=4)e=eB[A.charCodeAt(t)],i=eB[A.charCodeAt(t+1)],n=eB[A.charCodeAt(t+2)],r=eB[A.charCodeAt(t+3)],c[o++]=e<<2|i>>4,c[o++]=(15&i)<<4|n>>2,c[o++]=(3&n)<<6|63&r;return a})("AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA="),t=Array.isArray(A)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=4)e.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return e})(A):new Uint32Array(A),e=Array.isArray(A)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=2)e.push(A[i+1]<<8|A[i]);return e})(A):new Uint16Array(A),i=nB(e,12,t[4]/2),n=2===t[5]?nB(e,(24+t[4])/2):(function(A,t,e){return A.slice?A.slice(t,e):new Uint32Array(Array.prototype.slice.call(A,t,e))})(t,Math.ceil((24+t[4])/4));return new rB(t[0],t[1],t[2],t[3],i,n)})(),wB="\xd7",gB=function(A){return fB.get(A)},pB=function(A,t,e){var i=e-2,n=t[i],r=t[e-1],s=t[e];if(2===r&&3===s)return wB;if(2===r||3===r||4===r)return"\xf7";if(2===s||3===s||4===s)return"\xf7";if(r===uB&&-1!==[uB,hB,lB,dB].indexOf(s))return wB;if(!(r!==lB&&r!==hB||s!==hB&&10!==s))return wB;if((r===dB||10===r)&&10===s)return wB;if(13===s||5===s)return wB;if(7===s)return wB;if(1===r)return wB;if(13===r&&14===s){for(;5===n;)n=t[--i];if(14===n)return wB}if(15===r&&15===s){for(var o=0;15===n;)o++,n=t[--i];if(o%2==0)return wB}return"\xf7"},vB=function(A){var t=(function(A){for(var t=[],e=0,i=A.length;e<i;){var n=A.charCodeAt(e++);if(n>=55296&&n<=56319&&e<i){var r=A.charCodeAt(e++);56320==(64512&r)?t.push(((1023&n)<<10)+(1023&r)+65536):(t.push(n),e--)}else t.push(n)}return t})(A),e=t.length,i=0,n=0,r=t.map(gB);return{next:function(){if(i>=e)return{done:!0,value:null};for(var A=wB;i<e&&(A=pB(0,r,++i))===wB;);if(A!==wB||i===e){var s=BB.apply(null,t.slice(n,i));return n=i,{value:s,done:!1}}return{done:!0,value:null}}}},mB=function(A){return 0===A[0]&&255===A[1]&&0===A[2]&&255===A[3]},QB=function(A,t,e,i,n){var r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),o=document.createElementNS(r,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",t.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",e.toString()),o.setAttributeNS(null,"y",i.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(n),s},UB=function(A){return new Promise((function(t,e){var i=new Image;i.onload=function(){return t(i)},i.onerror=e,i.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent((new XMLSerializer).serializeToString(A)))}))},CB={get SUPPORT_RANGE_BOUNDS(){var A=(function(A){if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var e=A.createElement("boundtest");e.style.height="".concat(123,"px"),e.style.display="block",A.body.appendChild(e),t.selectNode(e);var i=t.getBoundingClientRect(),n=Math.round(i.height);if(A.body.removeChild(e),123===n)return!0}}return!1})(document);return Object.defineProperty(CB,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=CB.SUPPORT_RANGE_BOUNDS&&(function(A){var t=A.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",A.body.appendChild(t);var e=A.createRange();t.innerHTML="function"==typeof"".repeat?"👨".repeat(10):"";var i=t.firstChild,n=ic(i.data).map((function(A){return nc(A)})),r=0,s={},o=n.every((function(A,t){e.setStart(i,r),e.setEnd(i,r+A.length);var n=e.getBoundingClientRect();r+=A.length;var o=n.x>s.x||n.y>s.y;return s=n,0===t||o}));return A.body.removeChild(t),o})(document);return Object.defineProperty(CB,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=(function(A){var t=new Image,e=A.createElement("canvas"),i=e.getContext("2d");if(!i)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(t,0,0),e.toDataURL()}catch(n){return!1}return!0})(document);return Object.defineProperty(CB,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A="function"==typeof Array.from&&"function"==typeof window.fetch?(function(A){var t=A.createElement("canvas"),e=100;t.width=e,t.height=e;var i=t.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,e,e);var n=new Image,r=t.toDataURL();n.src=r;var s=QB(e,e,0,0,n);return i.fillStyle="red",i.fillRect(0,0,e,e),UB(s).then((function(t){i.drawImage(t,0,0);var n=i.getImageData(0,0,e,e).data;i.fillStyle="red",i.fillRect(0,0,e,e);var s=A.createElement("div");return s.style.backgroundImage="url(".concat(r,")"),s.style.height="".concat(e,"px"),mB(n)?UB(QB(e,e,0,0,s)):Promise.reject(!1)})).then((function(A){return i.drawImage(A,0,0),mB(i.getImageData(0,0,e,e).data)})).catch((function(){return!1}))})(document):Promise.resolve(!1);return Object.defineProperty(CB,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=void 0!==(new Image).crossOrigin;return Object.defineProperty(CB,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(CB,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(CB,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(CB,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},FB=function(A,t){this.text=A,this.bounds=t},yB=function(A,t,e){var i=A.ownerDocument;if(!i)throw new Error("Node has no owner document");var n=i.createRange();return n.setStart(A,t),n.setEnd(A,t+e),n},bB=function(A){if(CB.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(A)).map((function(A){return A.segment}))}return(function(A){for(var t,e=vB(A),i=[];!(t=e.next()).done;)t.value&&i.push(t.value.slice());return i})(A)},EB=[32,160,4961,65792,65793,4153,4241],IB=function(A,t,e){this.text=HB(t.data,e.textTransform),this.textBounds=(function(A,t,e,i){var n=(function(A,t){return 0!==t.letterSpacing?bB(A):(function(A,t){if(CB.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(e.segment(A)).map((function(A){return A.segment}))}return(function(A,t){for(var e,i=(function(A,t){var e=ic(A),i=(function(A,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var e=(function(A,t){void 0===t&&(t="strict");var e=[],i=[],n=[];return A.forEach((function(A,r){var s=Wc.get(A);if(s>50?(n.push(!0),s-=50):n.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(A))return i.push(r),e.push(16);if(4===s||11===s){if(0===r)return i.push(r),e.push(Lc);var o=e[r-1];return-1===tu.indexOf(o)?(i.push(i[r-1]),e.push(o)):(i.push(r),e.push(Lc))}return i.push(r),31===s?e.push("strict"===t?kc:jc):s===Jc||29===s?e.push(Lc):43===s?A>=131072&&A<=196605||A>=196608&&A<=262141?e.push(jc):e.push(Lc):void e.push(s)})),[i,e,n]})(A,t.lineBreak),i=e[0],n=e[1],r=e[2];return"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(n=n.map((function(A){return-1!==[Oc,Lc,Jc].indexOf(A)?jc:A}))),[i,n,"keep-all"===t.wordBreak?r.map((function(t,e){return t&&A[e]>=19968&&A[e]<=40959})):void 0]})(e,t),n=i[0],r=i[1],s=i[2],o=e.length,a=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var A=Yc;c<o&&(A=su(e,r,n,++c,s))===Yc;);if(A!==Yc||c===o){var t=new ou(e,A,a,c);return a=c,{value:t,done:!1}}return{done:!0,value:null}}}})(A,{lineBreak:t.lineBreak,wordBreak:"break-word"===t.overflowWrap?"break-word":t.wordBreak}),n=[],r=function(){if(e.value){var A=e.value.slice(),t=ic(A),i="";t.forEach((function(A){-1===EB.indexOf(A)?i+=nc(A):(i.length&&n.push(i),n.push(nc(A)),i="")})),i.length&&n.push(i)}};!(e=i.next()).done;)r();return n})(A,t)})(A,t)})(t,e),r=[],s=0;return n.forEach((function(t){if(e.textDecorationLine.length||t.trim().length>0)if(CB.SUPPORT_RANGE_BOUNDS){var n=yB(i,s,t.length).getClientRects();if(n.length>1){var o=bB(t),a=0;o.forEach((function(t){r.push(new FB(t,tc.fromDOMRectList(A,yB(i,a+s,t.length).getClientRects()))),a+=t.length}))}else r.push(new FB(t,tc.fromDOMRectList(A,n)))}else{var c=i.splitText(t.length);r.push(new FB(t,(function(A,t){var e=t.ownerDocument;if(e){var i=e.createElement("html2canvaswrapper");i.appendChild(t.cloneNode(!0));var n=t.parentNode;if(n){n.replaceChild(i,t);var r=ec(A,i);return i.firstChild&&n.replaceChild(i.firstChild,i),r}}return tc.EMPTY})(A,i))),i=c}else CB.SUPPORT_RANGE_BOUNDS||(i=i.splitText(t.length));s+=t.length})),r})(A,this.text,e,t)},HB=function(A,t){switch(t){case 1:return A.toLowerCase();case 3:return A.replace(kB,TB);case 2:return A.toUpperCase();default:return A}},kB=/(^|\s|:|-|\(|\))([a-z])/g,TB=function(A,t,e){return A.length>0?t+e.toUpperCase():A},SB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.src=e.currentSrc||e.src,i.intrinsicWidth=e.naturalWidth,i.intrinsicHeight=e.naturalHeight,i.context.cache.addImage(i.src),i}return Wa(t,A),t})(tB),OB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.canvas=e,i.intrinsicWidth=e.width,i.intrinsicHeight=e.height,i}return Wa(t,A),t})(tB),KB=(function(A){function t(t,e){var i=A.call(this,t,e)||this,n=new XMLSerializer,r=ec(t,e);return e.setAttribute("width","".concat(r.width,"px")),e.setAttribute("height","".concat(r.height,"px")),i.svg="data:image/svg+xml,".concat(encodeURIComponent(n.serializeToString(e))),i.intrinsicWidth=e.width.baseVal.value,i.intrinsicHeight=e.height.baseVal.value,i.context.cache.addImage(i.svg),i}return Wa(t,A),t})(tB),DB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.value=e.value,i}return Wa(t,A),t})(tB),MB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.start=e.start,i.reversed="boolean"==typeof e.reversed&&!0===e.reversed,i}return Wa(t,A),t})(tB),LB=[{type:15,flags:0,unit:"px",number:3}],xB=[{type:16,flags:0,number:50}],_B="checkbox",RB="radio",NB=707406591,jB=(function(A){function t(t,e){var i,n,r,s=A.call(this,t,e)||this;switch(s.type=e.type.toLowerCase(),s.checked=e.checked,s.value=0===(n="password"===(i=e).type?new Array(i.value.length+1).join("\u2022"):i.value).length?i.placeholder||"":n,s.type!==_B&&s.type!==RB||(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=1,s.styles.backgroundClip=[0],s.styles.backgroundOrigin=[0],s.bounds=(r=s.bounds).width>r.height?new tc(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width<r.height?new tc(r.left,r.top+(r.height-r.width)/2,r.width,r.width):r),s.type){case _B:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=LB;break;case RB:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=xB}return s}return Wa(t,A),t})(tB),GB=(function(A){function t(t,e){var i=A.call(this,t,e)||this,n=e.options[e.selectedIndex||0];return i.value=n&&n.text||"",i}return Wa(t,A),t})(tB),PB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.value=e.value,i}return Wa(t,A),t})(tB),VB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;i.src=e.src,i.width=parseInt(e.width,10)||0,i.height=parseInt(e.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(e.contentWindow&&e.contentWindow.document&&e.contentWindow.document.documentElement){i.tree=$B(t,e.contentWindow.document.documentElement);var n=e.contentWindow.document.documentElement?$h(t,getComputedStyle(e.contentWindow.document.documentElement).backgroundColor):Wh.TRANSPARENT,r=e.contentWindow.document.body?$h(t,getComputedStyle(e.contentWindow.document.body).backgroundColor):Wh.TRANSPARENT;i.backgroundColor=dh(n)?dh(r)?i.styles.backgroundColor:r:n}}catch(s){}return i}return Wa(t,A),t})(tB),JB=["OL","UL","MENU"],XB=function(A,t,e,i){for(var n=t.firstChild,r=void 0;n;n=r)if(r=n.nextSibling,qB(n)&&n.data.length>0)e.textNodes.push(new IB(A,n,e.styles));else if(zB(n))if(ff(n)&&n.assignedNodes)n.assignedNodes().forEach((function(t){return XB(A,t,e,i)}));else{var s=YB(A,n);s.styles.isVisible()&&(WB(n,s,i)?s.flags|=4:ZB(s.styles)&&(s.flags|=2),-1!==JB.indexOf(n.tagName)&&(s.flags|=8),e.elements.push(s),n.slot,n.shadowRoot?XB(A,n.shadowRoot,s,i):df(n)||sf(n)||Bf(n)||XB(A,n,s,i))}},YB=function(A,t){return uf(t)?new SB(A,t):af(t)?new OB(A,t):sf(t)?new KB(A,t):ef(t)?new DB(A,t):nf(t)?new MB(A,t):rf(t)?new jB(A,t):Bf(t)?new GB(A,t):df(t)?new PB(A,t):hf(t)?new VB(A,t):new tB(A,t)},$B=function(A,t){var e=YB(A,t);return e.flags|=4,XB(A,t,e,e),e},WB=function(A,t,e){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||of(A)&&e.styles.isTransparent()},ZB=function(A){return A.isPositioned()||A.isFloating()},qB=function(A){return A.nodeType===Node.TEXT_NODE},zB=function(A){return A.nodeType===Node.ELEMENT_NODE},Af=function(A){return zB(A)&&void 0!==A.style&&!tf(A)},tf=function(A){return"object"==typeof A.className},ef=function(A){return"LI"===A.tagName},nf=function(A){return"OL"===A.tagName},rf=function(A){return"INPUT"===A.tagName},sf=function(A){return"svg"===A.tagName},of=function(A){return"BODY"===A.tagName},af=function(A){return"CANVAS"===A.tagName},cf=function(A){return"VIDEO"===A.tagName},uf=function(A){return"IMG"===A.tagName},hf=function(A){return"IFRAME"===A.tagName},lf=function(A){return"STYLE"===A.tagName},df=function(A){return"TEXTAREA"===A.tagName},Bf=function(A){return"SELECT"===A.tagName},ff=function(A){return"SLOT"===A.tagName},wf=function(A){return A.tagName.indexOf("-")>0},gf=(function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(A){var t=this.counters[A];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(A){return this.counters[A]||[]},A.prototype.pop=function(A){var t=this;A.forEach((function(A){return t.counters[A].pop()}))},A.prototype.parse=function(A){var t=this,e=A.counterIncrement,i=A.counterReset,n=!0;null!==e&&e.forEach((function(A){var e=t.counters[A.counter];e&&0!==A.increment&&(n=!1,e.length||e.push(1),e[Math.max(0,e.length-1)]+=A.increment)}));var r=[];return n&&i.forEach((function(A){var e=t.counters[A.counter];r.push(A.counter),e||(e=t.counters[A.counter]=[]),e.push(A.reset)})),r},A})(),pf={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},vf={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054f","\u054e","\u054d","\u054c","\u054b","\u054a","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053f","\u053e","\u053d","\u053c","\u053b","\u053a","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},mf={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05d9\u05f3","\u05d8\u05f3","\u05d7\u05f3","\u05d6\u05f3","\u05d5\u05f3","\u05d4\u05f3","\u05d3\u05f3","\u05d2\u05f3","\u05d1\u05f3","\u05d0\u05f3","\u05ea","\u05e9","\u05e8","\u05e7","\u05e6","\u05e4","\u05e2","\u05e1","\u05e0","\u05de","\u05dc","\u05db","\u05d9\u05d8","\u05d9\u05d7","\u05d9\u05d6","\u05d8\u05d6","\u05d8\u05d5","\u05d9","\u05d8","\u05d7","\u05d6","\u05d5","\u05d4","\u05d3","\u05d2","\u05d1","\u05d0"]},Qf={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10f5","\u10f0","\u10ef","\u10f4","\u10ee","\u10ed","\u10ec","\u10eb","\u10ea","\u10e9","\u10e8","\u10e7","\u10e6","\u10e5","\u10e4","\u10f3","\u10e2","\u10e1","\u10e0","\u10df","\u10de","\u10dd","\u10f2","\u10dc","\u10db","\u10da","\u10d9","\u10d8","\u10d7","\u10f1","\u10d6","\u10d5","\u10d4","\u10d3","\u10d2","\u10d1","\u10d0"]},Uf=function(A,t,e,i,n,r){return A<t||A>e?Tf(A,n,r.length>0):i.integers.reduce((function(t,e,n){for(;A>=e;)A-=e,t+=i.values[n];return t}),"")+r},Cf=function(A,t,e,i){var n="";do{e||A--,n=i(A)+n,A/=t}while(A*t>=t);return n},Ff=function(A,t,e,i,n){var r=e-t+1;return(A<0?"-":"")+(Cf(Math.abs(A),r,i,(function(A){return nc(Math.floor(A%r)+t)}))+n)},yf=function(A,t,e){void 0===e&&(e=". ");var i=t.length;return Cf(Math.abs(A),i,!1,(function(A){return t[Math.floor(A%i)]}))+e},bf=function(A,t,e,i,n,r){if(A<-9999||A>9999)return Tf(A,4,n.length>0);var s=Math.abs(A),o=n;if(0===s)return t[0]+o;for(var a=0;s>0&&a<=4;a++){var c=s%10;0===c&&Ld(r,1)&&""!==o?o=t[c]+o:c>1||1===c&&0===a||1===c&&1===a&&Ld(r,2)||1===c&&1===a&&Ld(r,4)&&A>100||1===c&&a>1&&Ld(r,8)?o=t[c]+(a>0?e[a-1]:"")+o:1===c&&a>0&&(o=e[a-1]+o),s=Math.floor(s/10)}return(A<0?i:"")+o},Ef="\u5341\u767e\u5343\u842c",If="\u62fe\u4f70\u4edf\u842c",Hf="\u30de\u30a4\u30ca\u30b9",kf="\ub9c8\uc774\ub108\uc2a4",Tf=function(A,t,e){var i=e?". ":"",n=e?"\u3001":"",r=e?", ":"",s=e?" ":"";switch(t){case 0:return"\u2022"+s;case 1:return"\u25e6"+s;case 2:return"\u25fe"+s;case 5:var o=Ff(A,48,57,!0,i);return o.length<4?"0".concat(o):o;case 4:return yf(A,"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d",n);case 6:return Uf(A,1,3999,pf,3,i).toLowerCase();case 7:return Uf(A,1,3999,pf,3,i);case 8:return Ff(A,945,969,!1,i);case 9:return Ff(A,97,122,!1,i);case 10:return Ff(A,65,90,!1,i);case 11:return Ff(A,1632,1641,!0,i);case 12:case 49:return Uf(A,1,9999,vf,3,i);case 35:return Uf(A,1,9999,vf,3,i).toLowerCase();case 13:return Ff(A,2534,2543,!0,i);case 14:case 30:return Ff(A,6112,6121,!0,i);case 15:return yf(A,"\u5b50\u4e11\u5bc5\u536f\u8fb0\u5df3\u5348\u672a\u7533\u9149\u620c\u4ea5",n);case 16:return yf(A,"\u7532\u4e59\u4e19\u4e01\u620a\u5df1\u5e9a\u8f9b\u58ec\u7678",n);case 17:case 48:return bf(A,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d",Ef,"\u8ca0",n,14);case 47:return bf(A,"\u96f6\u58f9\u8cb3\u53c3\u8086\u4f0d\u9678\u67d2\u634c\u7396",If,"\u8ca0",n,15);case 42:return bf(A,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d",Ef,"\u8d1f",n,14);case 41:return bf(A,"\u96f6\u58f9\u8d30\u53c1\u8086\u4f0d\u9646\u67d2\u634c\u7396",If,"\u8d1f",n,15);case 26:return bf(A,"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u4e07",Hf,n,0);case 25:return bf(A,"\u96f6\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d","\u62fe\u767e\u5343\u4e07",Hf,n,7);case 31:return bf(A,"\uc601\uc77c\uc774\uc0bc\uc0ac\uc624\uc721\uce60\ud314\uad6c","\uc2ed\ubc31\ucc9c\ub9cc",kf,r,7);case 33:return bf(A,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u842c",kf,r,0);case 32:return bf(A,"\u96f6\u58f9\u8cb3\u53c3\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u62fe\u767e\u5343",kf,r,7);case 18:return Ff(A,2406,2415,!0,i);case 20:return Uf(A,1,19999,Qf,3,i);case 21:return Ff(A,2790,2799,!0,i);case 22:return Ff(A,2662,2671,!0,i);case 52:return Uf(A,1,10999,mf,3,i);case 23:return yf(A,"\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051\u3053\u3055\u3057\u3059\u305b\u305d\u305f\u3061\u3064\u3066\u3068\u306a\u306b\u306c\u306d\u306e\u306f\u3072\u3075\u3078\u307b\u307e\u307f\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308a\u308b\u308c\u308d\u308f\u3090\u3091\u3092\u3093");case 24:return yf(A,"\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c\u308b\u3092\u308f\u304b\u3088\u305f\u308c\u305d\u3064\u306d\u306a\u3089\u3080\u3046\u3090\u306e\u304a\u304f\u3084\u307e\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304d\u3086\u3081\u307f\u3057\u3091\u3072\u3082\u305b\u3059");case 27:return Ff(A,3302,3311,!0,i);case 28:return yf(A,"\u30a2\u30a4\u30a6\u30a8\u30aa\u30ab\u30ad\u30af\u30b1\u30b3\u30b5\u30b7\u30b9\u30bb\u30bd\u30bf\u30c1\u30c4\u30c6\u30c8\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d2\u30d5\u30d8\u30db\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8\u30e9\u30ea\u30eb\u30ec\u30ed\u30ef\u30f0\u30f1\u30f2\u30f3",n);case 29:return yf(A,"\u30a4\u30ed\u30cf\u30cb\u30db\u30d8\u30c8\u30c1\u30ea\u30cc\u30eb\u30f2\u30ef\u30ab\u30e8\u30bf\u30ec\u30bd\u30c4\u30cd\u30ca\u30e9\u30e0\u30a6\u30f0\u30ce\u30aa\u30af\u30e4\u30de\u30b1\u30d5\u30b3\u30a8\u30c6\u30a2\u30b5\u30ad\u30e6\u30e1\u30df\u30b7\u30f1\u30d2\u30e2\u30bb\u30b9",n);case 34:return Ff(A,3792,3801,!0,i);case 37:return Ff(A,6160,6169,!0,i);case 38:return Ff(A,4160,4169,!0,i);case 39:return Ff(A,2918,2927,!0,i);case 40:return Ff(A,1776,1785,!0,i);case 43:return Ff(A,3046,3055,!0,i);case 44:return Ff(A,3174,3183,!0,i);case 45:return Ff(A,3664,3673,!0,i);case 46:return Ff(A,3872,3881,!0,i);default:return Ff(A,48,57,!0,i)}},Sf="data-html2canvas-ignore",Of=(function(){function A(A,t,e){if(this.context=A,this.options=e,this.scrolledElements=[],this.referenceElement=t,this.counters=new gf,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(A,t){var e=this,i=Mf(A,t);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var n=A.defaultView.pageXOffset,r=A.defaultView.pageYOffset,s=i.contentWindow,o=s.document,a=_f(i).then((function(){return qa(e,void 0,void 0,(function(){var A,e;return za(this,(function(n){switch(n.label){case 0:return this.scrolledElements.forEach(Pf),s&&(s.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||s.scrollY===t.top&&s.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(s.scrollX-t.left,s.scrollY-t.top,0,0))),A=this.options.onclone,void 0===(e=this.clonedReferenceElement)?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:o.fonts&&o.fonts.ready?[4,o.fonts.ready]:[3,2];case 1:n.sent(),n.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,xf(o)]:[3,4];case 3:n.sent(),n.label=4;case 4:return"function"==typeof A?[2,Promise.resolve().then((function(){return A(o,e)})).then((function(){return i}))]:[2,i]}}))}))})),c=o.adoptNode(this.documentElement);return Wf(c,o),o.open(),o.write("".concat(jf(document.doctype),"<html></html>")),Gf(this.referenceElement.ownerDocument,n,r),o.replaceChild(c,o.documentElement),o.close(),a},A.prototype.createElementClone=function(A){if(AB(A,2),af(A))return this.createCanvasClone(A);if(cf(A))return this.createVideoClone(A);if(lf(A))return this.createStyleClone(A);var t=A.cloneNode(!1);return uf(t)&&(uf(A)&&A.currentSrc&&A.currentSrc!==A.src&&(t.src=A.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),wf(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(A){var t=document.createElement("html2canvascustomelement");return Nf(A.style,t),t},A.prototype.createStyleClone=function(A){try{var t=A.sheet;if(t&&t.cssRules){var e=[].slice.call(t.cssRules,0).reduce((function(A,t){return t&&"string"==typeof t.cssText?A+t.cssText:A}),""),i=A.cloneNode(!1);return i.textContent=e,i}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),"SecurityError"!==n.name)throw n}return A.cloneNode(!1)},A.prototype.createCanvasClone=function(A){var t;if(this.options.inlineImages&&A.ownerDocument){var e=A.ownerDocument.createElement("img");try{return e.src=A.toDataURL(),e}catch(a){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",A)}}var i=A.cloneNode(!1);try{i.width=A.width,i.height=A.height;var n=A.getContext("2d"),r=i.getContext("2d",{willReadFrequently:!0});if(r)if(!this.options.allowTaint&&n)r.putImageData(n.getImageData(0,0,A.width,A.height),0,0);else{var s=null!==(t=A.getContext("webgl2"))&&void 0!==t?t:A.getContext("webgl");if(s){var o=s.getContextAttributes();!1===(null==o?void 0:o.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",A)}r.drawImage(A,0,0)}return i}catch(a){this.context.logger.info("Unable to clone canvas as it is tainted",A)}return i},A.prototype.createVideoClone=function(A){var t=A.ownerDocument.createElement("canvas");t.width=A.offsetWidth,t.height=A.offsetHeight;var e=t.getContext("2d");try{return e&&(e.drawImage(A,0,0,t.width,t.height),this.options.allowTaint||e.getImageData(0,0,t.width,t.height)),t}catch(n){this.context.logger.info("Unable to clone video as it is tainted",A)}var i=A.ownerDocument.createElement("canvas");return i.width=A.offsetWidth,i.height=A.offsetHeight,i},A.prototype.appendChildNode=function(A,t,e){zB(t)&&("SCRIPT"===t.tagName||t.hasAttribute(Sf)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&zB(t)&&lf(t)||A.appendChild(this.cloneNode(t,e))},A.prototype.cloneChildNodes=function(A,t,e){for(var i=this,n=A.shadowRoot?A.shadowRoot.firstChild:A.firstChild;n;n=n.nextSibling)if(zB(n)&&ff(n)&&"function"==typeof n.assignedNodes){var r=n.assignedNodes();r.length&&r.forEach((function(A){return i.appendChildNode(t,A,e)}))}else this.appendChildNode(t,n,e)},A.prototype.cloneNode=function(A,t){if(qB(A))return document.createTextNode(A.data);if(!A.ownerDocument)return A.cloneNode(!1);var e=A.ownerDocument.defaultView;if(e&&zB(A)&&(Af(A)||tf(A))){var i=this.createElementClone(A);i.style.transitionProperty="none";var n=e.getComputedStyle(A),r=e.getComputedStyle(A,":before"),s=e.getComputedStyle(A,":after");this.referenceElement===A&&Af(i)&&(this.clonedReferenceElement=i),of(i)&&Yf(i);var o=this.counters.parse(new qd(this.context,n)),a=this.resolvePseudoContent(A,i,r,aB.BEFORE);wf(A)&&(t=!0),cf(A)||this.cloneChildNodes(A,i,t),a&&i.insertBefore(a,i.firstChild);var c=this.resolvePseudoContent(A,i,s,aB.AFTER);return c&&i.appendChild(c),this.counters.pop(o),(n&&(this.options.copyStyles||tf(A))&&!hf(A)||t)&&Nf(n,i),0===A.scrollTop&&0===A.scrollLeft||this.scrolledElements.push([i,A.scrollLeft,A.scrollTop]),(df(A)||Bf(A))&&(df(i)||Bf(i))&&(i.value=A.value),i}return A.cloneNode(!1)},A.prototype.resolvePseudoContent=function(A,t,e,i){var n=this;if(e){var r=e.content,s=t.ownerDocument;if(s&&r&&"none"!==r&&"-moz-alt-content"!==r&&"none"!==e.display){this.counters.parse(new qd(this.context,e));var o=new Zd(this.context,e),a=s.createElement("html2canvaspseudoelement");Nf(e,a),o.content.forEach((function(t){if(0===t.type)a.appendChild(s.createTextNode(t.value));else if(22===t.type){var e=s.createElement("img");e.src=t.value,e.style.opacity="1",a.appendChild(e)}else if(18===t.type){if("attr"===t.name){var i=t.values.filter(Ju);i.length&&a.appendChild(s.createTextNode(A.getAttribute(i[0].value)||""))}else if("counter"===t.name){var r=t.values.filter(Wu),c=r[0],u=r[1];if(c&&Ju(c)){var h=n.counters.getCounterValue(c.value),l=u&&Ju(u)?id.parse(n.context,u.value):3;a.appendChild(s.createTextNode(Tf(h,l,!1)))}}else if("counters"===t.name){var d=t.values.filter(Wu),B=(c=d[0],d[1]);if(u=d[2],c&&Ju(c)){var f=n.counters.getCounterValues(c.value),w=u&&Ju(u)?id.parse(n.context,u.value):3,g=B&&0===B.type?B.value:"",p=f.map((function(A){return Tf(A,w,!1)})).join(g);a.appendChild(s.createTextNode(p))}}}else if(20===t.type)switch(t.value){case"open-quote":a.appendChild(s.createTextNode(Gd(o.quotes,n.quoteDepth++,!0)));break;case"close-quote":a.appendChild(s.createTextNode(Gd(o.quotes,--n.quoteDepth,!1)));break;default:a.appendChild(s.createTextNode(t.value))}})),a.className="".concat(Vf," ").concat(Jf);var c=i===aB.BEFORE?" ".concat(Vf):" ".concat(Jf);return tf(t)?t.className.baseValue+=c:t.className+=c,a}}},A.destroy=function(A){return!!A.parentNode&&(A.parentNode.removeChild(A),!0)},A})();(cB=aB||(aB={}))[cB.BEFORE=0]="BEFORE",cB[cB.AFTER=1]="AFTER";var Kf,Df,Mf=function(A,t){var e=A.createElement("iframe");return e.className="html2canvas-container",e.style.visibility="hidden",e.style.position="fixed",e.style.left="-10000px",e.style.top="0px",e.style.border="0",e.width=t.width.toString(),e.height=t.height.toString(),e.scrolling="no",e.setAttribute(Sf,"true"),A.body.appendChild(e),e},Lf=function(A){return new Promise((function(t){A.complete?t():A.src?(A.onload=t,A.onerror=t):t()}))},xf=function(A){return Promise.all([].slice.call(A.images,0).map(Lf))},_f=function(A){return new Promise((function(t,e){var i=A.contentWindow;if(!i)return e("No window assigned for iframe");var n=i.document;i.onload=A.onload=function(){i.onload=A.onload=null;var e=setInterval((function(){n.body.childNodes.length>0&&"complete"===n.readyState&&(clearInterval(e),t(A))}),50)}}))},Rf=["all","d","content"],Nf=function(A,t){for(var e=A.length-1;e>=0;e--){var i=A.item(e);-1===Rf.indexOf(i)&&t.style.setProperty(i,A.getPropertyValue(i))}return t},jf=function(A){var t="";return A&&(t+="<!DOCTYPE ",A.name&&(t+=A.name),A.internalSubset&&(t+=A.internalSubset),A.publicId&&(t+='"'.concat(A.publicId,'"')),A.systemId&&(t+='"'.concat(A.systemId,'"')),t+=">"),t},Gf=function(A,t,e){A&&A.defaultView&&(t!==A.defaultView.pageXOffset||e!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(t,e)},Pf=function(A){var t=A[0],e=A[1],i=A[2];t.scrollLeft=e,t.scrollTop=i},Vf="___html2canvas___pseudoelement_before",Jf="___html2canvas___pseudoelement_after",Xf='{\n content: "" !important;\n display: none !important;\n}',Yf=function(A){$f(A,".".concat(Vf).concat(":before").concat(Xf,"\n .").concat(Jf).concat(":after").concat(Xf))},$f=function(A,t){var e=A.ownerDocument;if(e){var i=e.createElement("style");i.textContent=t,A.appendChild(i)}},Wf=function(A,t){var e,i=t.createElement("base");i.href=t.baseURI;var n=A.getElementsByTagName("head").item(0);null==n||n.insertBefore(i,null!==(e=null==n?void 0:n.firstChild)&&void 0!==e?e:null)},Zf=(function(){function A(){}return A.getOrigin=function(t){var e=A.SA;return e?(e.href=t,e.href=e.href,e.protocol+e.hostname+e.port):"about:blank"},A.isSameOrigin=function(t){return A.getOrigin(t)===A.OA},A.setContext=function(t){A.SA=t.document.createElement("a"),A.OA=A.getOrigin(t.location.href)},A.OA="about:blank",A})(),qf=(function(){function A(A,t){this.context=A,this.KA=t,this.DA={}}return A.prototype.addImage=function(A){var t=Promise.resolve();return this.has(A)?t:rw(A)||ew(A)?((this.DA[A]=this.loadImage(A)).catch((function(){})),t):t},A.prototype.match=function(A){return this.DA[A]},A.prototype.loadImage=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,r,s=this;return za(this,(function(o){switch(o.label){case 0:return"function"!=typeof this.KA.customIsSameOrigin?[3,2]:[4,this.KA.customIsSameOrigin(A,Zf.isSameOrigin)];case 1:return e=o.sent(),[3,3];case 2:e=Zf.isSameOrigin(A),o.label=3;case 3:return t=e,i=!iw(A)&&!0===this.KA.useCORS&&CB.SUPPORT_CORS_IMAGES&&!t,n=!iw(A)&&!t&&!rw(A)&&"string"==typeof this.KA.proxy&&CB.SUPPORT_CORS_XHR&&!i,t||!1!==this.KA.allowTaint||iw(A)||rw(A)||n||i?(r=A,n?[4,this.proxy(r)]:[3,5]):[2];case 4:r=o.sent(),o.label=5;case 5:return this.context.logger.debug("Added image ".concat(A.substring(0,256))),[4,new Promise((function(A,t){var e=new Image;e.onload=function(){return A(e)},e.onerror=t,(nw(r)||i)&&(e.crossOrigin="anonymous"),e.src=r,!0===e.complete&&setTimeout((function(){return A(e)}),500),s.KA.imageTimeout>0&&setTimeout((function(){return t("Timed out (".concat(s.KA.imageTimeout,"ms) loading image"))}),s.KA.imageTimeout)}))];case 6:return[2,o.sent()]}}))}))},A.prototype.has=function(A){return void 0!==this.DA[A]},A.prototype.keys=function(){return Promise.resolve(Object.keys(this.DA))},A.prototype.proxy=function(A){var t=this,e=this.KA.proxy;if(!e)throw new Error("No proxy defined");var i=A.substring(0,256);return new Promise((function(n,r){var s=CB.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;o.onload=function(){if(200===o.status)if("text"===s)n(o.response);else{var A=new FileReader;A.addEventListener("load",(function(){return n(A.result)}),!1),A.addEventListener("error",(function(A){return r(A)}),!1),A.readAsDataURL(o.response)}else r("Failed to proxy resource ".concat(i," with status code ").concat(o.status))},o.onerror=r;var a=e.indexOf("?")>-1?"&":"?";if(o.open("GET","".concat(e).concat(a,"url=").concat(encodeURIComponent(A),"&responseType=").concat(s)),"text"!==s&&o instanceof XMLHttpRequest&&(o.responseType=s),t.KA.imageTimeout){var c=t.KA.imageTimeout;o.timeout=c,o.ontimeout=function(){return r("Timed out (".concat(c,"ms) proxying ").concat(i))}}o.send()}))},A})(),zf=/^data:image\/svg\+xml/i,Aw=/^data:image\/.*;base64,/i,tw=/^data:image\/.*/i,ew=function(A){return CB.SUPPORT_SVG_DRAWING||!sw(A)},iw=function(A){return tw.test(A)},nw=function(A){return Aw.test(A)},rw=function(A){return"blob"===A.substr(0,4)},sw=function(A){return"svg"===A.substr(-3).toLowerCase()||zf.test(A)},ow=(function(){function A(A,t){this.type=0,this.x=A,this.y=t}return A.prototype.add=function(t,e){return new A(this.x+t,this.y+e)},A})(),aw=function(A,t,e){return new ow(A.x+(t.x-A.x)*e,A.y+(t.y-A.y)*e)},cw=(function(){function A(A,t,e,i){this.type=1,this.start=A,this.startControl=t,this.endControl=e,this.end=i}return A.prototype.subdivide=function(t,e){var i=aw(this.start,this.startControl,t),n=aw(this.startControl,this.endControl,t),r=aw(this.endControl,this.end,t),s=aw(i,n,t),o=aw(n,r,t),a=aw(s,o,t);return e?new A(this.start,i,s,a):new A(a,o,r,this.end)},A.prototype.add=function(t,e){return new A(this.start.add(t,e),this.startControl.add(t,e),this.endControl.add(t,e),this.end.add(t,e))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),uw=function(A){return 1===A.type},hw=function(A){var t=A.styles,e=A.bounds,i=rh(t.borderTopLeftRadius,e.width,e.height),n=i[0],r=i[1],s=rh(t.borderTopRightRadius,e.width,e.height),o=s[0],a=s[1],c=rh(t.borderBottomRightRadius,e.width,e.height),u=c[0],h=c[1],l=rh(t.borderBottomLeftRadius,e.width,e.height),d=l[0],B=l[1],f=[];f.push((n+o)/e.width),f.push((d+u)/e.width),f.push((r+B)/e.height),f.push((a+h)/e.height);var w=Math.max.apply(Math,f);w>1&&(n/=w,r/=w,o/=w,a/=w,u/=w,h/=w,d/=w,B/=w);var g=e.width-o,p=e.height-h,v=e.width-u,m=e.height-B,Q=t.borderTopWidth,U=t.borderRightWidth,C=t.borderBottomWidth,F=t.borderLeftWidth,y=sh(t.paddingTop,A.bounds.width),b=sh(t.paddingRight,A.bounds.width),E=sh(t.paddingBottom,A.bounds.width),I=sh(t.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||r>0?lw(e.left+F/3,e.top+Q/3,n-F/3,r-Q/3,Kf.TOP_LEFT):new ow(e.left+F/3,e.top+Q/3),this.topRightBorderDoubleOuterBox=n>0||r>0?lw(e.left+g,e.top+Q/3,o-U/3,a-Q/3,Kf.TOP_RIGHT):new ow(e.left+e.width-U/3,e.top+Q/3),this.bottomRightBorderDoubleOuterBox=u>0||h>0?lw(e.left+v,e.top+p,u-U/3,h-C/3,Kf.BOTTOM_RIGHT):new ow(e.left+e.width-U/3,e.top+e.height-C/3),this.bottomLeftBorderDoubleOuterBox=d>0||B>0?lw(e.left+F/3,e.top+m,d-F/3,B-C/3,Kf.BOTTOM_LEFT):new ow(e.left+F/3,e.top+e.height-C/3),this.topLeftBorderDoubleInnerBox=n>0||r>0?lw(e.left+2*F/3,e.top+2*Q/3,n-2*F/3,r-2*Q/3,Kf.TOP_LEFT):new ow(e.left+2*F/3,e.top+2*Q/3),this.topRightBorderDoubleInnerBox=n>0||r>0?lw(e.left+g,e.top+2*Q/3,o-2*U/3,a-2*Q/3,Kf.TOP_RIGHT):new ow(e.left+e.width-2*U/3,e.top+2*Q/3),this.bottomRightBorderDoubleInnerBox=u>0||h>0?lw(e.left+v,e.top+p,u-2*U/3,h-2*C/3,Kf.BOTTOM_RIGHT):new ow(e.left+e.width-2*U/3,e.top+e.height-2*C/3),this.bottomLeftBorderDoubleInnerBox=d>0||B>0?lw(e.left+2*F/3,e.top+m,d-2*F/3,B-2*C/3,Kf.BOTTOM_LEFT):new ow(e.left+2*F/3,e.top+e.height-2*C/3),this.topLeftBorderStroke=n>0||r>0?lw(e.left+F/2,e.top+Q/2,n-F/2,r-Q/2,Kf.TOP_LEFT):new ow(e.left+F/2,e.top+Q/2),this.topRightBorderStroke=n>0||r>0?lw(e.left+g,e.top+Q/2,o-U/2,a-Q/2,Kf.TOP_RIGHT):new ow(e.left+e.width-U/2,e.top+Q/2),this.bottomRightBorderStroke=u>0||h>0?lw(e.left+v,e.top+p,u-U/2,h-C/2,Kf.BOTTOM_RIGHT):new ow(e.left+e.width-U/2,e.top+e.height-C/2),this.bottomLeftBorderStroke=d>0||B>0?lw(e.left+F/2,e.top+m,d-F/2,B-C/2,Kf.BOTTOM_LEFT):new ow(e.left+F/2,e.top+e.height-C/2),this.topLeftBorderBox=n>0||r>0?lw(e.left,e.top,n,r,Kf.TOP_LEFT):new ow(e.left,e.top),this.topRightBorderBox=o>0||a>0?lw(e.left+g,e.top,o,a,Kf.TOP_RIGHT):new ow(e.left+e.width,e.top),this.bottomRightBorderBox=u>0||h>0?lw(e.left+v,e.top+p,u,h,Kf.BOTTOM_RIGHT):new ow(e.left+e.width,e.top+e.height),this.bottomLeftBorderBox=d>0||B>0?lw(e.left,e.top+m,d,B,Kf.BOTTOM_LEFT):new ow(e.left,e.top+e.height),this.topLeftPaddingBox=n>0||r>0?lw(e.left+F,e.top+Q,Math.max(0,n-F),Math.max(0,r-Q),Kf.TOP_LEFT):new ow(e.left+F,e.top+Q),this.topRightPaddingBox=o>0||a>0?lw(e.left+Math.min(g,e.width-U),e.top+Q,g>e.width+U?0:Math.max(0,o-U),Math.max(0,a-Q),Kf.TOP_RIGHT):new ow(e.left+e.width-U,e.top+Q),this.bottomRightPaddingBox=u>0||h>0?lw(e.left+Math.min(v,e.width-F),e.top+Math.min(p,e.height-C),Math.max(0,u-U),Math.max(0,h-C),Kf.BOTTOM_RIGHT):new ow(e.left+e.width-U,e.top+e.height-C),this.bottomLeftPaddingBox=d>0||B>0?lw(e.left+F,e.top+Math.min(m,e.height-C),Math.max(0,d-F),Math.max(0,B-C),Kf.BOTTOM_LEFT):new ow(e.left+F,e.top+e.height-C),this.topLeftContentBox=n>0||r>0?lw(e.left+F+I,e.top+Q+y,Math.max(0,n-(F+I)),Math.max(0,r-(Q+y)),Kf.TOP_LEFT):new ow(e.left+F+I,e.top+Q+y),this.topRightContentBox=o>0||a>0?lw(e.left+Math.min(g,e.width+F+I),e.top+Q+y,g>e.width+F+I?0:o-F+I,a-(Q+y),Kf.TOP_RIGHT):new ow(e.left+e.width-(U+b),e.top+Q+y),this.bottomRightContentBox=u>0||h>0?lw(e.left+Math.min(v,e.width-(F+I)),e.top+Math.min(p,e.height+Q+y),Math.max(0,u-(U+b)),h-(C+E),Kf.BOTTOM_RIGHT):new ow(e.left+e.width-(U+b),e.top+e.height-(C+E)),this.bottomLeftContentBox=d>0||B>0?lw(e.left+F+I,e.top+m,Math.max(0,d-(F+I)),B-(C+E),Kf.BOTTOM_LEFT):new ow(e.left+F+I,e.top+e.height-(C+E))};(Df=Kf||(Kf={}))[Df.TOP_LEFT=0]="TOP_LEFT",Df[Df.TOP_RIGHT=1]="TOP_RIGHT",Df[Df.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",Df[Df.BOTTOM_LEFT=3]="BOTTOM_LEFT";var lw=function(A,t,e,i,n){var r=(Math.sqrt(2)-1)/3*4,s=e*r,o=i*r,a=A+e,c=t+i;switch(n){case Kf.TOP_LEFT:return new cw(new ow(A,c),new ow(A,c-o),new ow(a-s,t),new ow(a,t));case Kf.TOP_RIGHT:return new cw(new ow(A,t),new ow(A+s,t),new ow(a,c-o),new ow(a,c));case Kf.BOTTOM_RIGHT:return new cw(new ow(a,t),new ow(a,t+o),new ow(A+s,c),new ow(A,c));case Kf.BOTTOM_LEFT:default:return new cw(new ow(a,c),new ow(a-s,c),new ow(A,t+o),new ow(A,t))}},dw=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Bw=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},fw=function(A,t,e){this.offsetX=A,this.offsetY=t,this.matrix=e,this.type=0,this.target=6},ww=function(A,t){this.path=A,this.target=t,this.type=1},gw=function(A){this.opacity=A,this.type=2,this.target=6},pw=function(A){return 1===A.type},vw=function(A,t){return A.length===t.length&&A.some((function(A,e){return A===t[e]}))},mw=function(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Qw=(function(){function A(A,t){if(this.container=A,this.parent=t,this.effects=[],this.curves=new hw(this.container),this.container.styles.opacity<1&&this.effects.push(new gw(this.container.styles.opacity)),null!==this.container.styles.transform){var e=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new fw(e,i,n))}if(0!==this.container.styles.overflowX){var r=dw(this.curves),s=Bw(this.curves);vw(r,s)?this.effects.push(new ww(r,6)):(this.effects.push(new ww(r,2)),this.effects.push(new ww(s,4)))}}return A.prototype.getEffects=function(A){for(var t=-1===[2,3].indexOf(this.container.styles.position),e=this.parent,i=this.effects.slice(0);e;){var n=e.effects.filter((function(A){return!pw(A)}));if(t||0!==e.container.styles.position||!e.parent){if(t=-1===[2,3].indexOf(e.container.styles.position),0!==e.container.styles.overflowX){var r=dw(e.curves),s=Bw(e.curves);vw(r,s)||i.unshift(new ww(s,6))}i.unshift.apply(i,n)}else i.unshift.apply(i,n);e=e.parent}return i.filter((function(t){return Ld(t.target,A)}))},A})(),Uw=function(A,t,e,i){A.container.elements.forEach((function(n){var r=Ld(n.flags,4),s=Ld(n.flags,2),o=new Qw(n,A);Ld(n.styles.display,2048)&&i.push(o);var a=Ld(n.flags,8)?[]:i;if(r||s){var c=r||n.styles.isPositioned()?e:t,u=new mw(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var l=0;c.negativeZIndex.some((function(A,t){return h>A.element.container.styles.zIndex.order?(l=t,!1):l>0})),c.negativeZIndex.splice(l,0,u)}else if(h>0){var d=0;c.positiveZIndex.some((function(A,t){return h>=A.element.container.styles.zIndex.order?(d=t+1,!1):d>0})),c.positiveZIndex.splice(d,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Uw(o,u,r?u:e,a)}else n.styles.isInlineLevel()?t.inlineLevel.push(o):t.nonInlineLevel.push(o),Uw(o,t,e,a);Ld(n.flags,8)&&Cw(n,a)}))},Cw=function(A,t){for(var e=A instanceof MB?A.start:1,i=A instanceof MB&&A.reversed,n=0;n<t.length;n++){var r=t[n];r.container instanceof DB&&"number"==typeof r.container.value&&0!==r.container.value&&(e=r.container.value),r.listValue=Tf(e,r.container.styles.listStyleType,!0),e+=i?-1:1}},Fw=function(A,t){switch(t){case 0:return bw(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return bw(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return bw(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return bw(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},yw=function(A,t){var e=[];return uw(A)?e.push(A.subdivide(.5,!1)):e.push(A),uw(t)?e.push(t.subdivide(.5,!0)):e.push(t),e},bw=function(A,t,e,i){var n=[];return uw(A)?n.push(A.subdivide(.5,!1)):n.push(A),uw(e)?n.push(e.subdivide(.5,!0)):n.push(e),uw(i)?n.push(i.subdivide(.5,!0).reverse()):n.push(i),uw(t)?n.push(t.subdivide(.5,!1).reverse()):n.push(t),n},Ew=function(A){var t=A.bounds,e=A.styles;return t.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},Iw=function(A){var t=A.styles,e=A.bounds,i=sh(t.paddingLeft,e.width),n=sh(t.paddingRight,e.width),r=sh(t.paddingTop,e.width),s=sh(t.paddingBottom,e.width);return e.add(i+t.borderLeftWidth,r+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+i+n),-(t.borderTopWidth+t.borderBottomWidth+r+s))},Hw=function(A,t,e){var i,n,r=(n=A,0===(i=Ow(A.styles.backgroundOrigin,t))?n.bounds:2===i?Iw(n):Ew(n)),s=(function(A,t){return 0===A?t.bounds:2===A?Iw(t):Ew(t)})(Ow(A.styles.backgroundClip,t),A),o=Sw(Ow(A.styles.backgroundSize,t),e,r),a=o[0],c=o[1],u=rh(Ow(A.styles.backgroundPosition,t),r.width-a,r.height-c);return[Kw(Ow(A.styles.backgroundRepeat,t),u,o,r,s),Math.round(r.left+u[0]),Math.round(r.top+u[1]),a=Math.max(1,a),c=Math.max(1,c)]},kw=function(A){return Ju(A)&&A.value===Qc.AUTO},Tw=function(A){return"number"==typeof A},Sw=function(A,t,e){var i=t[0],n=t[1],r=t[2],s=A[0],o=A[1];if(!s)return[0,0];if(Ah(s)&&o&&Ah(o))return[sh(s,e.width),sh(o,e.height)];var a=Tw(r);if(Ju(s)&&(s.value===Qc.CONTAIN||s.value===Qc.COVER))return Tw(r)?e.width/e.height<r!=(s.value===Qc.COVER)?[e.width,e.width/r]:[e.height*r,e.height]:[e.width,e.height];var c=Tw(i),u=Tw(n),h=c||u;if(kw(s)&&(!o||kw(o)))return c&&u?[i,n]:a||h?h&&a?[c?i:n*r,u?n:i/r]:[c?i:e.width,u?n:e.height]:[e.width,e.height];if(a){var l=0,d=0;return Ah(s)?l=sh(s,e.width):Ah(o)&&(d=sh(o,e.height)),kw(s)?l=d*r:o&&!kw(o)||(d=l/r),[l,d]}var B=null,f=null;if(Ah(s)?B=sh(s,e.width):o&&Ah(o)&&(f=sh(o,e.height)),null===B||o&&!kw(o)||(f=c&&u?B/i*n:e.height),null!==f&&kw(s)&&(B=c&&u?f/n*i:e.width),null!==B&&null!==f)return[B,f];throw new Error("Unable to calculate background-size for element")},Ow=function(A,t){var e=A[t];return void 0===e?A[0]:e},Kw=function(A,t,e,i,n){var r=t[0],s=t[1],o=e[0],a=e[1];switch(A){case 2:return[new ow(Math.round(i.left),Math.round(i.top+s)),new ow(Math.round(i.left+i.width),Math.round(i.top+s)),new ow(Math.round(i.left+i.width),Math.round(a+i.top+s)),new ow(Math.round(i.left),Math.round(a+i.top+s))];case 3:return[new ow(Math.round(i.left+r),Math.round(i.top)),new ow(Math.round(i.left+r+o),Math.round(i.top)),new ow(Math.round(i.left+r+o),Math.round(i.height+i.top)),new ow(Math.round(i.left+r),Math.round(i.height+i.top))];case 1:return[new ow(Math.round(i.left+r),Math.round(i.top+s)),new ow(Math.round(i.left+r+o),Math.round(i.top+s)),new ow(Math.round(i.left+r+o),Math.round(i.top+s+a)),new ow(Math.round(i.left+r),Math.round(i.top+s+a))];default:return[new ow(Math.round(n.left),Math.round(n.top)),new ow(Math.round(n.left+n.width),Math.round(n.top)),new ow(Math.round(n.left+n.width),Math.round(n.height+n.top)),new ow(Math.round(n.left),Math.round(n.height+n.top))]}},Dw="Hidden Text",Mw=(function(){function A(A){this.MA={},this.LA=A}return A.prototype.parseMetrics=function(A,t){var e=this.LA.createElement("div"),i=this.LA.createElement("img"),n=this.LA.createElement("span"),r=this.LA.body;e.style.visibility="hidden",e.style.fontFamily=A,e.style.fontSize=t,e.style.margin="0",e.style.padding="0",e.style.whiteSpace="nowrap",r.appendChild(e),i.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",n.style.fontFamily=A,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this.LA.createTextNode(Dw)),e.appendChild(n),e.appendChild(i);var s=i.offsetTop-n.offsetTop+2;e.removeChild(n),e.appendChild(this.LA.createTextNode(Dw)),e.style.lineHeight="normal",i.style.verticalAlign="super";var o=i.offsetTop-e.offsetTop+2;return r.removeChild(e),{baseline:s,middle:o}},A.prototype.getMetrics=function(A,t){var e="".concat(A," ").concat(t);return void 0===this.MA[e]&&(this.MA[e]=this.parseMetrics(A,t)),this.MA[e]},A})(),Lw=function(A,t){this.context=A,this.options=t},xw=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.xA=[],i.canvas=e.canvas?e.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),e.canvas||(i.canvas.width=Math.floor(e.width*e.scale),i.canvas.height=Math.floor(e.height*e.scale),i.canvas.style.width="".concat(e.width,"px"),i.canvas.style.height="".concat(e.height,"px")),i.fontMetrics=new Mw(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-e.x,-e.y),i.ctx.textBaseline="bottom",i.xA=[],i.context.logger.debug("Canvas renderer initialized (".concat(e.width,"x").concat(e.height,") with scale ").concat(e.scale)),i}return Wa(t,A),t.prototype.applyEffects=function(A){for(var t=this;this.xA.length;)this.popEffect();A.forEach((function(A){return t.applyEffect(A)}))},t.prototype.applyEffect=function(A){this.ctx.save(),(function(A){return 2===A.type})(A)&&(this.ctx.globalAlpha=A.opacity),(function(A){return 0===A.type})(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),pw(A)&&(this.path(A.path),this.ctx.clip()),this.xA.push(A)},t.prototype.popEffect=function(){this.xA.pop(),this.ctx.restore()},t.prototype.renderStack=function(A){return qa(this,void 0,void 0,(function(){return za(this,(function(t){switch(t.label){case 0:return A.element.container.styles.isVisible()?[4,this.renderStackContent(A)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.renderNode=function(A){return qa(this,void 0,void 0,(function(){return za(this,(function(t){switch(t.label){case 0:return Ld(A.container.flags,16),A.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(A)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(A)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype.renderTextWithLetterSpacing=function(A,t,e){var i=this;0===t?-1===navigator.userAgent.indexOf("Firefox")?(this.ctx.textBaseline="ideographic",this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+A.bounds.height)):this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+e):bB(A.text).reduce((function(t,n){return i.ctx.fillText(n,t,A.bounds.top+e),t+i.ctx.measureText(n).width}),A.bounds.left)},t.prototype.createFontStyle=function(A){var t=A.fontVariant.filter((function(A){return"normal"===A||"small-caps"===A})).join(""),e=Gw(A.fontFamily).join(", "),i=Pu(A.fontSize)?"".concat(A.fontSize.number).concat(A.fontSize.unit):"".concat(A.fontSize.number,"px");return[[A.fontStyle,t,A.fontWeight,i,e].join(" "),e,i]},t.prototype.renderTextNode=function(A,t){return qa(this,void 0,void 0,(function(){var e,i,n=this;return za(this,(function(r){return e=this.createFontStyle(t)[0],this.ctx.font=e,this.ctx.direction=1===t.direction?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",i=t.paintOrder,A.textBounds.forEach((function(A){i.forEach((function(e){switch(e){case 0:n.ctx.fillStyle=Bh(t.color),n.renderTextWithLetterSpacing(A,t.letterSpacing,t.fontSize.number);var i=t.textShadow;i.length&&A.text.trim().length&&(i.slice(0).reverse().forEach((function(e){n.ctx.shadowColor=Bh(e.color),n.ctx.shadowOffsetX=e.offsetX.number*n.options.scale,n.ctx.shadowOffsetY=e.offsetY.number*n.options.scale,n.ctx.shadowBlur=e.blur.number,n.renderTextWithLetterSpacing(A,t.letterSpacing,t.fontSize.number)})),n.ctx.shadowColor="",n.ctx.shadowOffsetX=0,n.ctx.shadowOffsetY=0,n.ctx.shadowBlur=0),t.textDecorationLine.length&&(n.ctx.fillStyle=Bh(t.textDecorationColor||t.color),t.textDecorationLine.forEach((function(t){switch(t){case 1:n.ctx.fillRect(A.bounds.left,A.bounds.top+A.bounds.height-1,A.bounds.width,1);break;case 2:n.ctx.fillRect(A.bounds.left,A.bounds.top,A.bounds.width,1);break;case 3:n.ctx.fillRect(A.bounds.left,A.bounds.top+(A.bounds.height/2-.5),A.bounds.width,1)}})));break;case 1:t.webkitTextStrokeWidth&&A.text.trim().length&&(n.ctx.strokeStyle=Bh(t.webkitTextStrokeColor),n.ctx.lineWidth=t.webkitTextStrokeWidth,n.ctx.lineJoin=window.chrome?"miter":"round",n.ctx.strokeText(A.text,A.bounds.left,A.bounds.top+A.bounds.height)),n.ctx.strokeStyle="",n.ctx.lineWidth=0,n.ctx.lineJoin="miter"}}))})),[2]}))}))},t.prototype.renderReplacedElement=function(A,t,e){var i=e.naturalWidth||A.intrinsicWidth,n=e.naturalHeight||A.intrinsicHeight;if(e&&i>0&&n>0){var r=Iw(A),s=Bw(t);this.path(s),this.ctx.save(),this.ctx.clip();var o=0,a=0,c=i,u=n,h=r.left,l=r.top,d=r.width,B=r.height,f=A.styles.objectFit,w=d/B,g=c/u;2===f?g>w?(B=d/g,l+=(r.height-B)/2):(d=B*g,h+=(r.width-d)/2):4===f?g>w?o+=(i-(c=u*w))/2:a+=(n-(u=c/w))/2:8===f?(c>d?(o+=(c-d)/2,c=d):(h+=(d-c)/2,d=c),u>B?(a+=(u-B)/2,u=B):(l+=(B-u)/2,B=u)):16===f&&((g>w?d:B*g)<(c>d?c:d)?g>w?(B=d/g,l+=(r.height-B)/2):(d=B*g,h+=(r.width-d)/2):(c>d?(o+=(c-d)/2,c=d):(h+=(d-c)/2,d=c),u>B?(a+=(u-B)/2,u=B):(l+=(B-u)/2,B=u))),this.ctx.drawImage(e,o,a,c,u,h,l,d,B),this.ctx.restore()}},t.prototype.renderNodeContent=function(A){return qa(this,void 0,void 0,(function(){var e,i,n,r,s,o,a,c,u,h,l,d,B,f,w,g,p,v,m;return za(this,(function(Q){switch(Q.label){case 0:this.applyEffects(A.getEffects(4)),e=A.container,i=A.curves,n=e.styles,r=0,s=e.textNodes,Q.label=1;case 1:return r<s.length?(o=s[r],[4,this.renderTextNode(o,n)]):[3,4];case 2:Q.sent(),Q.label=3;case 3:return r++,[3,1];case 4:if(!(e instanceof SB))return[3,8];Q.label=5;case 5:return Q.trys.push([5,7,,8]),[4,this.context.cache.match(e.src)];case 6:return g=Q.sent(),this.renderReplacedElement(e,i,g),[3,8];case 7:return Q.sent(),this.context.logger.error("Error loading image ".concat(e.src)),[3,8];case 8:if(e instanceof OB&&this.renderReplacedElement(e,i,e.canvas),!(e instanceof KB))return[3,12];Q.label=9;case 9:return Q.trys.push([9,11,,12]),[4,this.context.cache.match(e.svg)];case 10:return g=Q.sent(),this.renderReplacedElement(e,i,g),[3,12];case 11:return Q.sent(),this.context.logger.error("Error loading svg ".concat(e.svg.substring(0,255))),[3,12];case 12:return e instanceof VB&&e.tree?[4,new t(this.context,{scale:this.options.scale,backgroundColor:e.backgroundColor,x:0,y:0,width:e.width,height:e.height}).render(e.tree)]:[3,14];case 13:a=Q.sent(),e.width&&e.height&&this.ctx.drawImage(a,0,0,e.width,e.height,e.bounds.left,e.bounds.top,e.bounds.width,e.bounds.height),Q.label=14;case 14:if(e instanceof jB&&(c=Math.min(e.bounds.width,e.bounds.height),e.type===_B?e.checked&&(this.ctx.save(),this.path([new ow(e.bounds.left+.39363*c,e.bounds.top+.79*c),new ow(e.bounds.left+.16*c,e.bounds.top+.5549*c),new ow(e.bounds.left+.27347*c,e.bounds.top+.44071*c),new ow(e.bounds.left+.39694*c,e.bounds.top+.5649*c),new ow(e.bounds.left+.72983*c,e.bounds.top+.23*c),new ow(e.bounds.left+.84*c,e.bounds.top+.34085*c),new ow(e.bounds.left+.39363*c,e.bounds.top+.79*c)]),this.ctx.fillStyle=Bh(NB),this.ctx.fill(),this.ctx.restore()):e.type===RB&&e.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(e.bounds.left+c/2,e.bounds.top+c/2,c/4,0,2*Math.PI,!0),this.ctx.fillStyle=Bh(NB),this.ctx.fill(),this.ctx.restore())),_w(e)&&e.value.length){switch(u=this.createFontStyle(n),v=u[0],h=u[1],l=u[2],d=this.fontMetrics.getMetrics(h,l).baseline,this.ctx.font=v,this.ctx.fillStyle=Bh(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Nw(e.styles.textAlign),m=Iw(e),B=0,e.styles.textAlign){case 1:B+=m.width/2;break;case 2:B+=m.width}f=m.add(B,0,0,-m.height/2+1),this.ctx.save(),this.path([new ow(m.left,m.top),new ow(m.left+m.width,m.top),new ow(m.left+m.width,m.top+m.height),new ow(m.left,m.top+m.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new FB(e.value,f),n.letterSpacing,d),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ld(e.styles.display,2048))return[3,20];if(null===e.styles.listStyleImage)return[3,19];if(0!==(w=e.styles.listStyleImage).type)return[3,18];g=void 0,p=w.url,Q.label=15;case 15:return Q.trys.push([15,17,,18]),[4,this.context.cache.match(p)];case 16:return g=Q.sent(),this.ctx.drawImage(g,e.bounds.left-(g.width+10),e.bounds.top),[3,18];case 17:return Q.sent(),this.context.logger.error("Error loading list-style-image ".concat(p)),[3,18];case 18:return[3,20];case 19:A.listValue&&-1!==e.styles.listStyleType&&(v=this.createFontStyle(n)[0],this.ctx.font=v,this.ctx.fillStyle=Bh(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",m=new tc(e.bounds.left,e.bounds.top+sh(e.styles.paddingTop,e.bounds.width),e.bounds.width,Ad(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new FB(A.listValue,m),n.letterSpacing,Ad(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),Q.label=20;case 20:return[2]}}))}))},t.prototype.renderStackContent=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,r,s,o,a,c,u,h,l,d,B,f;return za(this,(function(w){switch(w.label){case 0:return Ld(A.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(A.element)];case 1:w.sent(),t=0,e=A.negativeZIndex,w.label=2;case 2:return t<e.length?(f=e[t],[4,this.renderStack(f)]):[3,5];case 3:w.sent(),w.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(A.element)];case 6:w.sent(),i=0,n=A.nonInlineLevel,w.label=7;case 7:return i<n.length?(f=n[i],[4,this.renderNode(f)]):[3,10];case 8:w.sent(),w.label=9;case 9:return i++,[3,7];case 10:r=0,s=A.nonPositionedFloats,w.label=11;case 11:return r<s.length?(f=s[r],[4,this.renderStack(f)]):[3,14];case 12:w.sent(),w.label=13;case 13:return r++,[3,11];case 14:o=0,a=A.nonPositionedInlineLevel,w.label=15;case 15:return o<a.length?(f=a[o],[4,this.renderStack(f)]):[3,18];case 16:w.sent(),w.label=17;case 17:return o++,[3,15];case 18:c=0,u=A.inlineLevel,w.label=19;case 19:return c<u.length?(f=u[c],[4,this.renderNode(f)]):[3,22];case 20:w.sent(),w.label=21;case 21:return c++,[3,19];case 22:h=0,l=A.zeroOrAutoZIndexOrTransformedOrOpacity,w.label=23;case 23:return h<l.length?(f=l[h],[4,this.renderStack(f)]):[3,26];case 24:w.sent(),w.label=25;case 25:return h++,[3,23];case 26:d=0,B=A.positiveZIndex,w.label=27;case 27:return d<B.length?(f=B[d],[4,this.renderStack(f)]):[3,30];case 28:w.sent(),w.label=29;case 29:return d++,[3,27];case 30:return[2]}}))}))},t.prototype.mask=function(A){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(A.slice(0).reverse()),this.ctx.closePath()},t.prototype.path=function(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()},t.prototype.formatPath=function(A){var t=this;A.forEach((function(A,e){var i=uw(A)?A.start:A;0===e?t.ctx.moveTo(i.x,i.y):t.ctx.lineTo(i.x,i.y),uw(A)&&t.ctx.bezierCurveTo(A.startControl.x,A.startControl.y,A.endControl.x,A.endControl.y,A.end.x,A.end.y)}))},t.prototype.renderRepeat=function(A,t,e,i){this.path(A),this.ctx.fillStyle=t,this.ctx.translate(e,i),this.ctx.fill(),this.ctx.translate(-e,-i)},t.prototype.resizeImage=function(A,t,e){var i,n=(null!==(i=this.canvas.ownerDocument)&&void 0!==i?i:document).createElement("canvas");return n.width=Math.max(1,t),n.height=Math.max(1,e),n.getContext("2d").drawImage(A,0,0,A.width,A.height,0,0,t,e),n},t.prototype.renderBackgroundImage=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,r,s;return za(this,(function(o){switch(o.label){case 0:t=A.styles.backgroundImage.length-1,e=function(e){var n,r,s,o,a,c,u,h,l,d,B,f,w,g,p,v,m,Q,U,C,F,y,b,E,I,H,k,T,S,O,K,D,M;return za(this,(function(L){switch(L.label){case 0:if(0!==e.type)return[3,5];n=void 0,r=e.url,L.label=1;case 1:return L.trys.push([1,3,,4]),[4,i.context.cache.match(r)];case 2:return n=L.sent(),[3,4];case 3:return L.sent(),i.context.logger.error("Error loading background-image ".concat(r)),[3,4];case 4:return n&&(s=isNaN(n.width)||0===n.width?1:n.width,o=isNaN(n.height)||0===n.height?1:n.height,a=Hw(A,t,[s,o,s/o]),Q=a[0],E=a[1],I=a[2],F=a[3],y=a[4],v=i.ctx.createPattern(i.resizeImage(n,F,y),"repeat"),i.renderRepeat(Q,v,E,I)),[3,6];case 5:1===e.type?(c=Hw(A,t,[null,null,null]),Q=c[0],E=c[1],I=c[2],F=c[3],y=c[4],u=(function(A,t,e){var i="number"==typeof A?A:(function(A,t,e){var i=t/2,n=e/2,r=sh(A[0],t)-i,s=n-sh(A[1],e);return(Math.atan2(s,r)+2*Math.PI)%(2*Math.PI)})(A,t,e),n=Math.abs(t*Math.sin(i))+Math.abs(e*Math.cos(i)),r=t/2,s=e/2,o=n/2,a=Math.sin(i-Math.PI/2)*o,c=Math.cos(i-Math.PI/2)*o;return[n,r-c,r+c,s-a,s+a]})(e.angle,F,y),h=u[0],l=u[1],d=u[2],B=u[3],f=u[4],(w=document.createElement("canvas")).width=F,w.height=y,g=w.getContext("2d"),p=g.createLinearGradient(l,B,d,f),Al(e.stops,h||1).forEach((function(A){return p.addColorStop(A.stop,Bh(A.color))})),g.fillStyle=p,g.fillRect(0,0,F,y),F>0&&y>0&&(v=i.ctx.createPattern(w,"repeat"),i.renderRepeat(Q,v,E,I))):2===e.type&&(m=Hw(A,t,[null,null,null]),Q=m[0],U=m[1],C=m[2],F=m[3],y=m[4],b=0===e.position.length?[ih]:e.position,E=sh(b[0],F),I=sh(b[b.length-1],y),H=(function(A,t,e,i,n){var r=0,s=0;switch(A.size){case 0:0===A.shape?r=s=Math.min(Math.abs(t),Math.abs(t-i),Math.abs(e),Math.abs(e-n)):1===A.shape&&(r=Math.min(Math.abs(t),Math.abs(t-i)),s=Math.min(Math.abs(e),Math.abs(e-n)));break;case 2:if(0===A.shape)r=s=Math.min(tl(t,e),tl(t,e-n),tl(t-i,e),tl(t-i,e-n));else if(1===A.shape){var o=Math.min(Math.abs(e),Math.abs(e-n))/Math.min(Math.abs(t),Math.abs(t-i)),a=el(i,n,t,e,!0),c=a[0],u=a[1];s=o*(r=tl(c-t,(u-e)/o))}break;case 1:0===A.shape?r=s=Math.max(Math.abs(t),Math.abs(t-i),Math.abs(e),Math.abs(e-n)):1===A.shape&&(r=Math.max(Math.abs(t),Math.abs(t-i)),s=Math.max(Math.abs(e),Math.abs(e-n)));break;case 3:if(0===A.shape)r=s=Math.max(tl(t,e),tl(t,e-n),tl(t-i,e),tl(t-i,e-n));else if(1===A.shape){o=Math.max(Math.abs(e),Math.abs(e-n))/Math.max(Math.abs(t),Math.abs(t-i));var h=el(i,n,t,e,!1);c=h[0],u=h[1],s=o*(r=tl(c-t,(u-e)/o))}}return Array.isArray(A.size)&&(r=sh(A.size[0],i),s=2===A.size.length?sh(A.size[1],n):r),[r,s]})(e,E,I,F,y),k=H[0],T=H[1],k>0&&T>0&&(S=i.ctx.createRadialGradient(U+E,C+I,0,U+E,C+I,k),Al(e.stops,2*k).forEach((function(A){return S.addColorStop(A.stop,Bh(A.color))})),i.path(Q),i.ctx.fillStyle=S,k!==T?(O=A.bounds.left+.5*A.bounds.width,K=A.bounds.top+.5*A.bounds.height,M=1/(D=T/k),i.ctx.save(),i.ctx.translate(O,K),i.ctx.transform(1,0,0,D,0,0),i.ctx.translate(-O,-K),i.ctx.fillRect(U,M*(C-K)+K,F,y*M),i.ctx.restore()):i.ctx.fill())),L.label=6;case 6:return t--,[2]}}))},i=this,n=0,r=A.styles.backgroundImage.slice(0).reverse(),o.label=1;case 1:return n<r.length?(s=r[n],[5,e(s)]):[3,4];case 2:o.sent(),o.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.renderSolidBorder=function(A,t,e){return qa(this,void 0,void 0,(function(){return za(this,(function(i){return this.path(Fw(e,t)),this.ctx.fillStyle=Bh(A),this.ctx.fill(),[2]}))}))},t.prototype.renderDoubleBorder=function(A,t,e,i){return qa(this,void 0,void 0,(function(){var n,r;return za(this,(function(s){switch(s.label){case 0:return t<3?[4,this.renderSolidBorder(A,e,i)]:[3,2];case 1:return s.sent(),[2];case 2:return n=(function(A,t){switch(t){case 0:return bw(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return bw(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return bw(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return bw(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}})(i,e),this.path(n),this.ctx.fillStyle=Bh(A),this.ctx.fill(),r=(function(A,t){switch(t){case 0:return bw(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return bw(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return bw(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return bw(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}})(i,e),this.path(r),this.ctx.fill(),[2]}}))}))},t.prototype.renderNodeBackgroundAndBorders=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,r,s,o,a,c=this;return za(this,(function(u){switch(u.label){case 0:return this.applyEffects(A.getEffects(2)),t=A.container.styles,e=!dh(t.backgroundColor)||t.backgroundImage.length,i=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],n=Rw(Ow(t.backgroundClip,0),A.curves),e||t.boxShadow.length?(this.ctx.save(),this.path(n),this.ctx.clip(),dh(t.backgroundColor)||(this.ctx.fillStyle=Bh(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(A.container)]):[3,2];case 1:u.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach((function(t){c.ctx.save();var e,i,n,r,s,o=dw(A.curves),a=t.inset?0:1e4,u=(e=o,i=-a+(t.inset?1:-1)*t.spread.number,n=(t.inset?1:-1)*t.spread.number,r=t.spread.number*(t.inset?-2:2),s=t.spread.number*(t.inset?-2:2),e.map((function(A,t){switch(t){case 0:return A.add(i,n);case 1:return A.add(i+r,n);case 2:return A.add(i+r,n+s);case 3:return A.add(i,n+s)}return A})));t.inset?(c.path(o),c.ctx.clip(),c.mask(u)):(c.mask(o),c.ctx.clip(),c.path(u)),c.ctx.shadowOffsetX=t.offsetX.number+a,c.ctx.shadowOffsetY=t.offsetY.number,c.ctx.shadowColor=Bh(t.color),c.ctx.shadowBlur=t.blur.number,c.ctx.fillStyle=t.inset?Bh(t.color):"rgba(0,0,0,1)",c.ctx.fill(),c.ctx.restore()})),u.label=2;case 2:r=0,s=0,o=i,u.label=3;case 3:return s<o.length?0!==(a=o[s]).style&&!dh(a.color)&&a.width>0?2!==a.style?[3,5]:[4,this.renderDashedDottedBorder(a.color,a.width,r,A.curves,2)]:[3,11]:[3,13];case 4:return u.sent(),[3,11];case 5:return 3!==a.style?[3,7]:[4,this.renderDashedDottedBorder(a.color,a.width,r,A.curves,3)];case 6:return u.sent(),[3,11];case 7:return 4!==a.style?[3,9]:[4,this.renderDoubleBorder(a.color,a.width,r,A.curves)];case 8:return u.sent(),[3,11];case 9:return[4,this.renderSolidBorder(a.color,r,A.curves)];case 10:u.sent(),u.label=11;case 11:r++,u.label=12;case 12:return s++,[3,3];case 13:return[2]}}))}))},t.prototype.renderDashedDottedBorder=function(A,t,e,i,n){return qa(this,void 0,void 0,(function(){var r,s,o,a,c,u,h,l,d,B,f,w,g,p,v,m;return za(this,(function(Q){return this.ctx.save(),r=(function(A,t){switch(t){case 0:return yw(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return yw(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return yw(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return yw(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}})(i,e),s=Fw(i,e),2===n&&(this.path(s),this.ctx.clip()),uw(s[0])?(o=s[0].start.x,a=s[0].start.y):(o=s[0].x,a=s[0].y),uw(s[1])?(c=s[1].end.x,u=s[1].end.y):(c=s[1].x,u=s[1].y),h=0===e||2===e?Math.abs(o-c):Math.abs(a-u),this.ctx.beginPath(),3===n?this.formatPath(r):this.formatPath(s.slice(0,2)),l=t<3?3*t:2*t,d=t<3?2*t:t,3===n&&(l=t,d=t),B=!0,h<=2*l?B=!1:h<=2*l+d?(l*=f=h/(2*l+d),d*=f):(w=Math.floor((h+d)/(l+d)),g=(h-w*l)/(w-1),d=(p=(h-(w+1)*l)/w)<=0||Math.abs(d-g)<Math.abs(d-p)?g:p),B&&(3===n?this.ctx.setLineDash([0,l+d]):this.ctx.setLineDash([l,d])),3===n?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=2*t+1.1,this.ctx.strokeStyle=Bh(A),this.ctx.stroke(),this.ctx.setLineDash([]),2===n&&(uw(s[0])&&(v=s[3],m=s[0],this.ctx.beginPath(),this.formatPath([new ow(v.end.x,v.end.y),new ow(m.start.x,m.start.y)]),this.ctx.stroke()),uw(s[1])&&(v=s[1],m=s[2],this.ctx.beginPath(),this.formatPath([new ow(v.end.x,v.end.y),new ow(m.start.x,m.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]}))}))},t.prototype.render=function(A){return qa(this,void 0,void 0,(function(){var t;return za(this,(function(e){switch(e.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Bh(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=(function(A){var t=new Qw(A,null),e=new mw(t),i=[];return Uw(t,e,e,i),Cw(t.container,i),e})(A),[4,this.renderStack(t)];case 1:return e.sent(),this.applyEffects([]),[2,this.canvas]}}))}))},t})(Lw),_w=function(A){return A instanceof PB||A instanceof GB||A instanceof jB&&A.type!==RB&&A.type!==_B},Rw=function(A,t){switch(A){case 0:return dw(t);case 2:return(function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]})(t);default:return Bw(t)}},Nw=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},jw=["-apple-system","system-ui"],Gw=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter((function(A){return-1===jw.indexOf(A)})):A},Pw=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.canvas=e.canvas?e.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=e,i.canvas.width=Math.floor(e.width*e.scale),i.canvas.height=Math.floor(e.height*e.scale),i.canvas.style.width="".concat(e.width,"px"),i.canvas.style.height="".concat(e.height,"px"),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-e.x,-e.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(e.width,"x").concat(e.height," at ").concat(e.x,",").concat(e.y,") with scale ").concat(e.scale)),i}return Wa(t,A),t.prototype.render=function(A){return qa(this,void 0,void 0,(function(){var t,e;return za(this,(function(i){switch(i.label){case 0:return t=QB(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),[4,Vw(t)];case 1:return e=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Bh(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(e,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}}))}))},t})(Lw),Vw=function(A){return new Promise((function(t,e){var i=new Image;i.onload=function(){t(i)},i.onerror=e,i.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent((new XMLSerializer).serializeToString(A)))}))},Jw=(function(){function A(A){var t=A.id,e=A.enabled;this.id=t,this.enabled=e,this.start=Date.now()}return A.prototype.debug=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.debug?console.debug.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1)):this.info.apply(this,A))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&"undefined"!=typeof window&&window.console&&"function"==typeof console.info&&console.info.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1))},A.prototype.warn=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.warn?console.warn.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1)):this.info.apply(this,A))},A.prototype.error=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.error?console.error.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1)):this.info.apply(this,A))},A.instances={},A})(),Xw=(function(){function A(t,e){var i;this.windowBounds=e,this.instanceName="#".concat(A.instanceCount++),this.logger=new Jw({id:this.instanceName,enabled:t.logging}),this.cache=null!==(i=t.cache)&&void 0!==i?i:new qf(this,t)}return A.instanceCount=1,A})();"undefined"!=typeof window&&Zf.setContext(window);const Yw=globalThis,$w=Yw.ShadowRoot&&(void 0===Yw.ShadyCSS||Yw.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ww=Symbol(),Zw=new WeakMap;let qw=class{constructor(A,t,e){if(this._A=!0,e!==Ww)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=A,this.t=t}get styleSheet(){let A=this.o;const t=this.t;if($w&&void 0===A){const e=void 0!==t&&1===t.length;e&&(A=Zw.get(t)),void 0===A&&((this.o=A=new CSSStyleSheet).replaceSync(this.cssText),e&&Zw.set(t,A))}return A}toString(){return this.cssText}};const zw=(A,...t)=>{const e=1===A.length?A[0]:t.reduce(((t,e,i)=>t+(A=>{if(!0===A._A)return A.cssText;if("number"==typeof A)return A;throw Error("Value passed to 'css' function must be a 'css' function result: "+A+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+A[i+1]),A[0]);return new qw(e,A,Ww)},Ag=$w?A=>A:A=>A instanceof CSSStyleSheet?(A=>{let t="";for(const e of A.cssRules)t+=e.cssText;return(A=>new qw("string"==typeof A?A:A+"",void 0,Ww))(t)})(A):A,{is:tg,defineProperty:eg,getOwnPropertyDescriptor:ig,getOwnPropertyNames:ng,getOwnPropertySymbols:rg,getPrototypeOf:sg}=Object,og=globalThis,ag=og.trustedTypes,cg=ag?ag.emptyScript:"",ug=og.reactiveElementPolyfillSupport,hg=(A,t)=>A,lg={toAttribute(A,t){switch(t){case Boolean:A=A?cg:null;break;case Object:case Array:A=null==A?A:JSON.stringify(A)}return A},fromAttribute(A,t){let e=A;switch(t){case Boolean:e=null!==A;break;case Number:e=null===A?null:Number(A);break;case Object:case Array:try{e=JSON.parse(A)}catch(i){e=null}}return e}},dg=(A,t)=>!tg(A,t),Bg={attribute:!0,type:String,converter:lg,reflect:!1,useDefault:!1,hasChanged:dg};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),og.litPropertyMetadata??(og.litPropertyMetadata=new WeakMap);let fg=class extends HTMLElement{static addInitializer(A){this.RA(),(this.l??(this.l=[])).push(A)}static get observedAttributes(){return this.finalize(),this.NA&&[...this.NA.keys()]}static createProperty(A,t=Bg){if(t.state&&(t.attribute=!1),this.RA(),this.prototype.hasOwnProperty(A)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(A,t),!t.noAccessor){const e=Symbol(),i=this.getPropertyDescriptor(A,e,t);void 0!==i&&eg(this.prototype,A,i)}}static getPropertyDescriptor(A,t,e){const{get:i,set:n}=ig(this.prototype,A)??{get(){return this[t]},set(A){this[t]=A}};return{get:i,set(t){const r=i?.call(this);n?.call(this,t),this.requestUpdate(A,r,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(A){return this.elementProperties.get(A)??Bg}static RA(){if(this.hasOwnProperty(hg("elementProperties")))return;const A=sg(this);A.finalize(),void 0!==A.l&&(this.l=[...A.l]),this.elementProperties=new Map(A.elementProperties)}static finalize(){if(this.hasOwnProperty(hg("finalized")))return;if(this.finalized=!0,this.RA(),this.hasOwnProperty(hg("properties"))){const A=this.properties,t=[...ng(A),...rg(A)];for(const e of t)this.createProperty(e,A[e])}const A=this[Symbol.metadata];if(null!==A){const t=litPropertyMetadata.get(A);if(void 0!==t)for(const[A,e]of t)this.elementProperties.set(A,e)}this.NA=new Map;for(const[t,e]of this.elementProperties){const A=this.jA(t,e);void 0!==A&&this.NA.set(A,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(A){const t=[];if(Array.isArray(A)){const e=new Set(A.flat(1/0).reverse());for(const A of e)t.unshift(Ag(A))}else void 0!==A&&t.push(Ag(A));return t}static jA(A,t){const e=t.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof A?A.toLowerCase():void 0}constructor(){super(),this.GA=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.PA=null,this.VA()}VA(){this.JA=new Promise((A=>this.enableUpdating=A)),this.XA=new Map,this.YA(),this.requestUpdate(),this.constructor.l?.forEach((A=>A(this)))}addController(A){(this.$A??(this.$A=new Set)).add(A),void 0!==this.renderRoot&&this.isConnected&&A.hostConnected?.()}removeController(A){this.$A?.delete(A)}YA(){const A=new Map,t=this.constructor.elementProperties;for(const e of t.keys())this.hasOwnProperty(e)&&(A.set(e,this[e]),delete this[e]);A.size>0&&(this.GA=A)}createRenderRoot(){const A=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((A,t)=>{if($w)A.adoptedStyleSheets=t.map((A=>A instanceof CSSStyleSheet?A:A.styleSheet));else for(const e of t){const t=document.createElement("style"),i=Yw.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=e.cssText,A.appendChild(t)}})(A,this.constructor.elementStyles),A}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this.$A?.forEach((A=>A.hostConnected?.()))}enableUpdating(A){}disconnectedCallback(){this.$A?.forEach((A=>A.hostDisconnected?.()))}attributeChangedCallback(A,t,e){this.WA(A,e)}ZA(A,t){const e=this.constructor.elementProperties.get(A),i=this.constructor.jA(A,e);if(void 0!==i&&!0===e.reflect){const n=(void 0!==e.converter?.toAttribute?e.converter:lg).toAttribute(t,e.type);this.PA=A,null==n?this.removeAttribute(i):this.setAttribute(i,n),this.PA=null}}WA(A,t){const e=this.constructor,i=e.NA.get(A);if(void 0!==i&&this.PA!==i){const A=e.getPropertyOptions(i),n="function"==typeof A.converter?{fromAttribute:A.converter}:void 0!==A.converter?.fromAttribute?A.converter:lg;this.PA=i,this[i]=n.fromAttribute(t,A.type)??this.qA?.get(i)??null,this.PA=null}}requestUpdate(A,t,e){if(void 0!==A){const i=this.constructor,n=this[A];if(e??(e=i.getPropertyOptions(A)),!((e.hasChanged??dg)(n,t)||e.useDefault&&e.reflect&&n===this.qA?.get(A)&&!this.hasAttribute(i.jA(A,e))))return;this.C(A,t,e)}!1===this.isUpdatePending&&(this.JA=this.zA())}C(A,t,{useDefault:e,reflect:i,wrapped:n},r){e&&!(this.qA??(this.qA=new Map)).has(A)&&(this.qA.set(A,r??t??this[A]),!0!==n||void 0!==r)||(this.XA.has(A)||(this.hasUpdated||e||(t=void 0),this.XA.set(A,t)),!0===i&&this.PA!==A&&(this.At??(this.At=new Set)).add(A))}async zA(){this.isUpdatePending=!0;try{await this.JA}catch(t){Promise.reject(t)}const A=this.scheduleUpdate();return null!=A&&await A,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.GA){for(const[A,t]of this.GA)this[A]=t;this.GA=void 0}const A=this.constructor.elementProperties;if(A.size>0)for(const[t,e]of A){const{wrapped:A}=e,i=this[t];!0!==A||this.XA.has(t)||void 0===i||this.C(t,void 0,e,i)}}let A=!1;const t=this.XA;try{A=this.shouldUpdate(t),A?(this.willUpdate(t),this.$A?.forEach((A=>A.hostUpdate?.())),this.update(t)):this.tt()}catch(e){throw A=!1,this.tt(),e}A&&this.et(t)}willUpdate(A){}et(A){this.$A?.forEach((A=>A.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(A)),this.updated(A)}tt(){this.XA=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.JA}shouldUpdate(A){return!0}update(A){this.At&&(this.At=this.At.forEach((A=>this.ZA(A,this[A])))),this.tt()}updated(A){}firstUpdated(A){}};fg.elementStyles=[],fg.shadowRootOptions={mode:"open"},fg[hg("elementProperties")]=new Map,fg[hg("finalized")]=new Map,ug?.({ReactiveElement:fg}),(og.reactiveElementVersions??(og.reactiveElementVersions=[])).push("2.1.0");const wg=globalThis,gg=wg.trustedTypes,pg=gg?gg.createPolicy("lit-html",{createHTML:A=>A}):void 0,vg="$lit$",mg=`lit$${Math.random().toFixed(9).slice(2)}$`,Qg="?"+mg,Ug=`<${Qg}>`,Cg=document,Fg=()=>Cg.createComment(""),yg=A=>null===A||"object"!=typeof A&&"function"!=typeof A,bg=Array.isArray,Eg="[ \t\n\f\r]",Ig=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hg=/-->/g,kg=/>/g,Tg=RegExp(`>|${Eg}(?:([^\\s"'>=/]+)(${Eg}*=${Eg}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Sg=/'/g,Og=/"/g,Kg=/^(?:script|style|textarea|title)$/i,Dg=A=>(t,...e)=>({it:A,strings:t,values:e}),Mg=Dg(1),Lg=Dg(2),xg=Symbol.for("lit-noChange"),_g=Symbol.for("lit-nothing"),Rg=new WeakMap,Ng=Cg.createTreeWalker(Cg,129);function jg(A,t){if(!bg(A)||!A.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==pg?pg.createHTML(t):t}class Gg{constructor({strings:A,it:t},e){let i;this.parts=[];let n=0,r=0;const s=A.length-1,o=this.parts,[a,c]=((A,t)=>{const e=A.length-1,i=[];let n,r=2===t?"<svg>":3===t?"<math>":"",s=Ig;for(let o=0;o<e;o++){const t=A[o];let e,a,c=-1,u=0;for(;u<t.length&&(s.lastIndex=u,a=s.exec(t),null!==a);)u=s.lastIndex,s===Ig?"!--"===a[1]?s=Hg:void 0!==a[1]?s=kg:void 0!==a[2]?(Kg.test(a[2])&&(n=RegExp("</"+a[2],"g")),s=Tg):void 0!==a[3]&&(s=Tg):s===Tg?">"===a[0]?(s=n??Ig,c=-1):void 0===a[1]?c=-2:(c=s.lastIndex-a[2].length,e=a[1],s=void 0===a[3]?Tg:'"'===a[3]?Og:Sg):s===Og||s===Sg?s=Tg:s===Hg||s===kg?s=Ig:(s=Tg,n=void 0);const h=s===Tg&&A[o+1].startsWith("/>")?" ":"";r+=s===Ig?t+Ug:c>=0?(i.push(e),t.slice(0,c)+vg+t.slice(c)+mg+h):t+mg+(-2===c?o:h)}return[jg(A,r+(A[e]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(A,t);if(this.el=Gg.createElement(a,e),Ng.currentNode=this.el.content,2===t||3===t){const A=this.el.content.firstChild;A.replaceWith(...A.childNodes)}for(;null!==(i=Ng.nextNode())&&o.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(const A of i.getAttributeNames())if(A.endsWith(vg)){const t=c[r++],e=i.getAttribute(A).split(mg),s=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:s[2],strings:e,ctor:"."===s[1]?Yg:"?"===s[1]?$g:"@"===s[1]?Wg:Xg}),i.removeAttribute(A)}else A.startsWith(mg)&&(o.push({type:6,index:n}),i.removeAttribute(A));if(Kg.test(i.tagName)){const A=i.textContent.split(mg),t=A.length-1;if(t>0){i.textContent=gg?gg.emptyScript:"";for(let e=0;e<t;e++)i.append(A[e],Fg()),Ng.nextNode(),o.push({type:2,index:++n});i.append(A[t],Fg())}}}else if(8===i.nodeType)if(i.data===Qg)o.push({type:2,index:n});else{let A=-1;for(;-1!==(A=i.data.indexOf(mg,A+1));)o.push({type:7,index:n}),A+=mg.length-1}n++}}static createElement(A,t){const e=Cg.createElement("template");return e.innerHTML=A,e}}function Pg(A,t,e=A,i){if(t===xg)return t;let n=void 0!==i?e.nt?.[i]:e.st;const r=yg(t)?void 0:t.ot;return n?.constructor!==r&&(n?.ut?.(!1),void 0===r?n=void 0:(n=new r(A),n.dt(A,e,i)),void 0!==i?(e.nt??(e.nt=[]))[i]=n:e.st=n),void 0!==n&&(t=Pg(A,n.Bt(A,t.values),n,i)),t}class Vg{constructor(A,t){this.ft=[],this.wt=void 0,this.vt=A,this.Qt=t}get parentNode(){return this.Qt.parentNode}get Ut(){return this.Qt.Ut}u(A){const{el:{content:t},parts:e}=this.vt,i=(A?.creationScope??Cg).importNode(t,!0);Ng.currentNode=i;let n=Ng.nextNode(),r=0,s=0,o=e[0];for(;void 0!==o;){if(r===o.index){let t;2===o.type?t=new Jg(n,n.nextSibling,this,A):1===o.type?t=new o.ctor(n,o.name,o.strings,this,A):6===o.type&&(t=new Zg(n,this,A)),this.ft.push(t),o=e[++s]}r!==o?.index&&(n=Ng.nextNode(),r++)}return Ng.currentNode=Cg,i}p(A){let t=0;for(const e of this.ft)void 0!==e&&(void 0!==e.strings?(e.Ct(A,e,t),t+=e.strings.length-2):e.Ct(A[t])),t++}}class Jg{get Ut(){return this.Qt?.Ut??this.Ft}constructor(A,t,e,i){this.type=2,this.yt=_g,this.wt=void 0,this.bt=A,this.Et=t,this.Qt=e,this.options=i,this.Ft=i?.isConnected??!0}get parentNode(){let A=this.bt.parentNode;const t=this.Qt;return void 0!==t&&11===A?.nodeType&&(A=t.parentNode),A}get startNode(){return this.bt}get endNode(){return this.Et}Ct(A,t=this){A=Pg(this,A,t),yg(A)?A===_g||null==A||""===A?(this.yt!==_g&&this.It(),this.yt=_g):A!==this.yt&&A!==xg&&this.EA(A):void 0!==A.it?this.$(A):void 0!==A.nodeType?this.T(A):(A=>bg(A)||"function"==typeof A?.[Symbol.iterator])(A)?this.k(A):this.EA(A)}O(A){return this.bt.parentNode.insertBefore(A,this.Et)}T(A){this.yt!==A&&(this.It(),this.yt=this.O(A))}EA(A){this.yt!==_g&&yg(this.yt)?this.bt.nextSibling.data=A:this.T(Cg.createTextNode(A)),this.yt=A}$(A){const{values:t,it:e}=A,i="number"==typeof e?this.Ht(A):(void 0===e.el&&(e.el=Gg.createElement(jg(e.h,e.h[0]),this.options)),e);if(this.yt?.vt===i)this.yt.p(t);else{const A=new Vg(i,this),e=A.u(this.options);A.p(t),this.T(e),this.yt=A}}Ht(A){let t=Rg.get(A.strings);return void 0===t&&Rg.set(A.strings,t=new Gg(A)),t}k(A){bg(this.yt)||(this.yt=[],this.It());const t=this.yt;let e,i=0;for(const n of A)i===t.length?t.push(e=new Jg(this.O(Fg()),this.O(Fg()),this,this.options)):e=t[i],e.Ct(n),i++;i<t.length&&(this.It(e&&e.Et.nextSibling,i),t.length=i)}It(A=this.bt.nextSibling,t){for(this.kt?.(!1,!0,t);A&&A!==this.Et;){const t=A.nextSibling;A.remove(),A=t}}setConnected(A){void 0===this.Qt&&(this.Ft=A,this.kt?.(A))}}class Xg{get tagName(){return this.element.tagName}get Ut(){return this.Qt.Ut}constructor(A,t,e,i,n){this.type=1,this.yt=_g,this.wt=void 0,this.element=A,this.name=t,this.Qt=i,this.options=n,e.length>2||""!==e[0]||""!==e[1]?(this.yt=Array(e.length-1).fill(new String),this.strings=e):this.yt=_g}Ct(A,t=this,e,i){const n=this.strings;let r=!1;if(void 0===n)A=Pg(this,A,t,0),r=!yg(A)||A!==this.yt&&A!==xg,r&&(this.yt=A);else{const i=A;let s,o;for(A=n[0],s=0;s<n.length-1;s++)o=Pg(this,i[e+s],t,s),o===xg&&(o=this.yt[s]),r||(r=!yg(o)||o!==this.yt[s]),o===_g?A=_g:A!==_g&&(A+=(o??"")+n[s+1]),this.yt[s]=o}r&&!i&&this.j(A)}j(A){A===_g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,A??"")}}class Yg extends Xg{constructor(){super(...arguments),this.type=3}j(A){this.element[this.name]=A===_g?void 0:A}}class $g extends Xg{constructor(){super(...arguments),this.type=4}j(A){this.element.toggleAttribute(this.name,!!A&&A!==_g)}}class Wg extends Xg{constructor(A,t,e,i,n){super(A,t,e,i,n),this.type=5}Ct(A,t=this){if((A=Pg(this,A,t,0)??_g)===xg)return;const e=this.yt,i=A===_g&&e!==_g||A.capture!==e.capture||A.once!==e.once||A.passive!==e.passive,n=A!==_g&&(e===_g||i);i&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,A),this.yt=A}handleEvent(A){"function"==typeof this.yt?this.yt.call(this.options?.host??this.element,A):this.yt.handleEvent(A)}}class Zg{constructor(A,t,e){this.element=A,this.type=6,this.wt=void 0,this.Qt=t,this.options=e}get Ut(){return this.Qt.Ut}Ct(A){Pg(this,A)}}const qg=wg.litHtmlPolyfillSupport;qg?.(Gg,Jg),(wg.litHtmlVersions??(wg.litHtmlVersions=[])).push("3.3.0");const zg=globalThis;let Ap=class extends fg{constructor(){super(...arguments),this.renderOptions={host:this},this.Tt=void 0}createRenderRoot(){var A;const t=super.createRenderRoot();return(A=this.renderOptions).renderBefore??(A.renderBefore=t.firstChild),t}update(A){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(A),this.Tt=((A,t,e)=>{const i=e?.renderBefore??t;let n=i.St;if(void 0===n){const A=e?.renderBefore??null;i.St=n=new Jg(t.insertBefore(Fg(),A),A,void 0,e??{})}return n.Ct(A),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.Tt?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.Tt?.setConnected(!1)}render(){return xg}};Ap.Ot=!0,Ap.finalized=!0,zg.litElementHydrateSupport?.({LitElement:Ap});const tp=zg.litElementPolyfillSupport;tp?.({LitElement:Ap}),(zg.litElementVersions??(zg.litElementVersions=[])).push("4.2.0");const ep={attribute:!0,type:String,converter:lg,reflect:!1,hasChanged:dg},ip=(A=ep,t,e)=>{const{kind:i,metadata:n}=e;let r=globalThis.litPropertyMetadata.get(n);if(void 0===r&&globalThis.litPropertyMetadata.set(n,r=new Map),"setter"===i&&((A=Object.create(A)).wrapped=!0),r.set(e.name,A),"accessor"===i){const{name:i}=e;return{set(e){const n=t.get.call(this);t.set.call(this,e),this.requestUpdate(i,n,A)},init(t){return void 0!==t&&this.C(i,void 0,A,t),t}}}if("setter"===i){const{name:i}=e;return function(e){const n=this[i];t.call(this,e),this.requestUpdate(i,n,A)}}throw Error("Unsupported decorator location: "+i)};function np(A){return(t,e)=>"object"==typeof e?ip(A,t,e):((A,t,e)=>{const i=t.hasOwnProperty(e);return t.constructor.createProperty(e,A),i?Object.getOwnPropertyDescriptor(t,e):void 0})(A,t,e)}function rp(A){return np({...A,state:!0,attribute:!1})}const sp="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,op="9.23.0",ap=globalThis;function cp(){return up(ap),ap}function up(A){const t=A.Kt=A.Kt||{};return t.version=t.version||op,t[op]=t[op]||{}}function hp(A,t,e=ap){const i=e.Kt=e.Kt||{},n=i[op]=i[op]||{};return n[A]||(n[A]=t())}const lp=Object.prototype.toString;function dp(A){switch(lp.call(A)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Cp(A,Error)}}function Bp(A,t){return lp.call(A)===`[object ${t}]`}function fp(A){return Bp(A,"ErrorEvent")}function wp(A){return Bp(A,"DOMError")}function gp(A){return Bp(A,"String")}function pp(A){return"object"==typeof A&&null!==A&&"Dt"in A&&"Mt"in A}function vp(A){return null===A||pp(A)||"object"!=typeof A&&"function"!=typeof A}function mp(A){return Bp(A,"Object")}function Qp(A){return"undefined"!=typeof Event&&Cp(A,Event)}function Up(A){return Boolean(A?.then&&"function"==typeof A.then)}function Cp(A,t){try{return A instanceof t}catch(e){return!1}}function Fp(A){return!("object"!=typeof A||null===A||!A.Lt&&!A.xt)}const yp=ap;function bp(A,t={}){if(!A)return"<unknown>";try{let e=A;const i=5,n=[];let r=0,s=0;const o=" > ",a=o.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,h=!Array.isArray(t)&&t.maxStringLength||80;for(;e&&r++<i&&(c=Ep(e,u),!("html"===c||r>1&&s+n.length*a+c.length>=h));)n.push(c),s+=c.length,e=e.parentNode;return n.reverse().join(o)}catch(e){return"<unknown>"}}function Ep(A,t){const e=A,i=[];if(!e?.tagName)return"";if(yp.HTMLElement&&e instanceof HTMLElement&&e.dataset){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}i.push(e.tagName.toLowerCase());const n=t?.length?t.filter((A=>e.getAttribute(A))).map((A=>[A,e.getAttribute(A)])):null;if(n?.length)n.forEach((A=>{i.push(`[${A[0]}="${A[1]}"]`)}));else{e.id&&i.push(`#${e.id}`);const A=e.className;if(A&&gp(A)){const t=A.split(/\s+/);for(const A of t)i.push(`.${A}`)}}const r=["aria-label","type","name","title","alt"];for(const s of r){const A=e.getAttribute(s);A&&i.push(`[${s}="${A}"]`)}return i.join("")}function Ip(){try{return yp.document.location.href}catch(A){return""}}const Hp=["debug","info","warn","error","log","assert","trace"],kp={};function Tp(A){if(!("console"in ap))return A();const t=ap.console,e={},i=Object.keys(kp);i.forEach((A=>{const i=kp[A];e[A]=t[A],t[A]=i}));try{return A()}finally{i.forEach((A=>{t[A]=e[A]}))}}const Sp=hp("logger",(function(){let A=!1;const t={enable:()=>{A=!0},disable:()=>{A=!1},isEnabled:()=>A};return sp?Hp.forEach((e=>{t[e]=(...t)=>{A&&Tp((()=>{ap.console[e](`Sentry Logger [${e}]:`,...t)}))}})):Hp.forEach((A=>{t[A]=()=>{}})),t}));function Op(A,t=0){return"string"!=typeof A||0===t||A.length<=t?A:`${A.slice(0,t)}...`}function Kp(A,t){if(!Array.isArray(A))return"";const e=[];for(let n=0;n<A.length;n++){const t=A[n];try{Fp(t)?e.push("[VueViewModel]"):e.push(String(t))}catch(i){e.push("[value cannot be serialized]")}}return e.join(t)}function Dp(A,t=[],e=!1){return t.some((t=>(function(A,t,e=!1){return!!gp(A)&&(Bp(t,"RegExp")?t.test(A):!!gp(t)&&(e?A===t:A.includes(t)))})(A,t,e)))}function Mp(A,t,e){if(!(t in A))return;const i=A[t];if("function"!=typeof i)return;const n=e(i);"function"==typeof n&&xp(n,i);try{A[t]=n}catch{sp&&Sp.log(`Failed to replace method "${t}" in object`,A)}}function Lp(A,t,e){try{Object.defineProperty(A,t,{value:e,writable:!0,configurable:!0})}catch(i){sp&&Sp.log(`Failed to add non-enumerable property "${t}" to object`,A)}}function xp(A,t){try{const e=t.prototype||{};A.prototype=t.prototype=e,Lp(A,"__sentry_original__",t)}catch(e){}}function _p(A){return A._t}function Rp(A){if(dp(A))return{message:A.message,name:A.name,stack:A.stack,...jp(A)};if(Qp(A)){const t={type:A.type,target:Np(A.target),currentTarget:Np(A.currentTarget),...jp(A)};return"undefined"!=typeof CustomEvent&&Cp(A,CustomEvent)&&(t.detail=A.detail),t}return A}function Np(A){try{return"undefined"!=typeof Element&&Cp(A,Element)?bp(A):Object.prototype.toString.call(A)}catch(t){return"<unknown>"}}function jp(A){if("object"==typeof A&&null!==A){const t={};for(const e in A)Object.prototype.hasOwnProperty.call(A,e)&&(t[e]=A[e]);return t}return{}}function Gp(A=(function(){const A=ap;return A.crypto||A.msCrypto})()){let t=()=>16*Math.random();try{if(A?.randomUUID)return A.randomUUID().replace(/-/g,"");A?.getRandomValues&&(t=()=>{const t=new Uint8Array(1);return A.getRandomValues(t),t[0]})}catch(e){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(A=>(A^(15&t())>>A/4).toString(16)))}function Pp(A){return A.exception?.values?.[0]}function Vp(A){const{message:t,event_id:e}=A;if(t)return t;const i=Pp(A);return i?i.type&&i.value?`${i.type}: ${i.value}`:i.type||i.value||e||"<unknown>":e||"<unknown>"}function Jp(A,t,e){const i=A.exception=A.exception||{},n=i.values=i.values||[],r=n[0]=n[0]||{};r.value||(r.value=t||""),r.type||(r.type=e||"Error")}function Xp(A,t){const e=Pp(A);if(!e)return;const i=e.mechanism;if(e.mechanism={type:"generic",handled:!0,...i,...t},t&&"data"in t){const A={...i?.data,...t.data};e.mechanism.data=A}}function Yp(A){if((function(A){try{return A.Rt}catch{}})(A))return!0;try{Lp(A,"__sentry_captured__",!0)}catch(t){}return!1}function $p(){return Date.now()/1e3}const Wp=(function(){const{performance:A}=ap;if(!A?.now)return $p;const t=Date.now()-A.now(),e=null==A.timeOrigin?t:A.timeOrigin;return()=>(e+A.now())/1e3})();function Zp(A,t={}){if(t.user&&(!A.ipAddress&&t.user.ip_address&&(A.ipAddress=t.user.ip_address),A.did||t.did||(A.did=t.user.id||t.user.email||t.user.username)),A.timestamp=t.timestamp||Wp(),t.abnormal_mechanism&&(A.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(A.ignoreDuration=t.ignoreDuration),t.sid&&(A.sid=32===t.sid.length?t.sid:Gp()),void 0!==t.init&&(A.init=t.init),!A.did&&t.did&&(A.did=`${t.did}`),"number"==typeof t.started&&(A.started=t.started),A.ignoreDuration)A.duration=void 0;else if("number"==typeof t.duration)A.duration=t.duration;else{const t=A.timestamp-A.started;A.duration=t>=0?t:0}t.release&&(A.release=t.release),t.environment&&(A.environment=t.environment),!A.ipAddress&&t.ipAddress&&(A.ipAddress=t.ipAddress),!A.userAgent&&t.userAgent&&(A.userAgent=t.userAgent),"number"==typeof t.errors&&(A.errors=t.errors),t.status&&(A.status=t.status)}function qp(A,t,e=2){if(!t||"object"!=typeof t||e<=0)return t;if(A&&0===Object.keys(t).length)return A;const i={...A};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=qp(i[n],t[n],e-1));return i}const zp="_sentrySpan";function Av(A,t){t?Lp(A,zp,t):delete A[zp]}function tv(A){return A[zp]}function ev(){return Gp()}function iv(){return Gp().substring(16)}class nv{constructor(){this.Nt=!1,this.jt=[],this.Gt=[],this.Pt=[],this.Vt=[],this.Jt={},this.Xt={},this.Yt={},this.$t={},this.Wt={},this.Zt={traceId:ev(),sampleRand:Math.random()}}clone(){const A=new nv;return A.Pt=[...this.Pt],A.Xt={...this.Xt},A.Yt={...this.Yt},A.$t={...this.$t},this.$t.flags&&(A.$t.flags={values:[...this.$t.flags.values]}),A.Jt=this.Jt,A.qt=this.qt,A.zt=this.zt,A.Ae=this.Ae,A.te=this.te,A.Gt=[...this.Gt],A.Vt=[...this.Vt],A.Wt={...this.Wt},A.Zt={...this.Zt},A.ee=this.ee,A.ie=this.ie,Av(A,tv(this)),A}setClient(A){this.ee=A}setLastEventId(A){this.ie=A}getClient(){return this.ee}lastEventId(){return this.ie}addScopeListener(A){this.jt.push(A)}addEventProcessor(A){return this.Gt.push(A),this}setUser(A){return this.Jt=A||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.zt&&Zp(this.zt,{user:A}),this.ne(),this}getUser(){return this.Jt}setTags(A){return this.Xt={...this.Xt,...A},this.ne(),this}setTag(A,t){return this.Xt={...this.Xt,[A]:t},this.ne(),this}setExtras(A){return this.Yt={...this.Yt,...A},this.ne(),this}setExtra(A,t){return this.Yt={...this.Yt,[A]:t},this.ne(),this}setFingerprint(A){return this.te=A,this.ne(),this}setLevel(A){return this.qt=A,this.ne(),this}setTransactionName(A){return this.Ae=A,this.ne(),this}setContext(A,t){return null===t?delete this.$t[A]:this.$t[A]=t,this.ne(),this}setSession(A){return A?this.zt=A:delete this.zt,this.ne(),this}getSession(){return this.zt}update(A){if(!A)return this;const t="function"==typeof A?A(this):A,e=t instanceof nv?t.getScopeData():mp(t)?A:void 0,{tags:i,extra:n,user:r,contexts:s,level:o,fingerprint:a=[],propagationContext:c}=e||{};return this.Xt={...this.Xt,...i},this.Yt={...this.Yt,...n},this.$t={...this.$t,...s},r&&Object.keys(r).length&&(this.Jt=r),o&&(this.qt=o),a.length&&(this.te=a),c&&(this.Zt=c),this}clear(){return this.Pt=[],this.Xt={},this.Yt={},this.Jt={},this.$t={},this.qt=void 0,this.Ae=void 0,this.te=void 0,this.zt=void 0,Av(this,void 0),this.Vt=[],this.setPropagationContext({traceId:ev(),sampleRand:Math.random()}),this.ne(),this}addBreadcrumb(A,t){const e="number"==typeof t?t:100;if(e<=0)return this;const i={timestamp:$p(),...A,message:A.message?Op(A.message,2048):A.message};return this.Pt.push(i),this.Pt.length>e&&(this.Pt=this.Pt.slice(-e),this.ee?.recordDroppedEvent("buffer_overflow","log_item")),this.ne(),this}getLastBreadcrumb(){return this.Pt[this.Pt.length-1]}clearBreadcrumbs(){return this.Pt=[],this.ne(),this}addAttachment(A){return this.Vt.push(A),this}clearAttachments(){return this.Vt=[],this}getScopeData(){return{breadcrumbs:this.Pt,attachments:this.Vt,contexts:this.$t,tags:this.Xt,extra:this.Yt,user:this.Jt,level:this.qt,fingerprint:this.te||[],eventProcessors:this.Gt,propagationContext:this.Zt,sdkProcessingMetadata:this.Wt,transactionName:this.Ae,span:tv(this)}}setSDKProcessingMetadata(A){return this.Wt=qp(this.Wt,A,2),this}setPropagationContext(A){return this.Zt=A,this}getPropagationContext(){return this.Zt}captureException(A,t){const e=t?.event_id||Gp();if(!this.ee)return Sp.warn("No client configured on scope - will not capture exception!"),e;const i=new Error("Sentry syntheticException");return this.ee.captureException(A,{originalException:A,syntheticException:i,...t,event_id:e},this),e}captureMessage(A,t,e){const i=e?.event_id||Gp();if(!this.ee)return Sp.warn("No client configured on scope - will not capture message!"),i;const n=new Error(A);return this.ee.captureMessage(A,t,{originalException:A,syntheticException:n,...e,event_id:i},this),i}captureEvent(A,t){const e=t?.event_id||Gp();return this.ee?(this.ee.captureEvent(A,{...t,event_id:e},this),e):(Sp.warn("No client configured on scope - will not capture event!"),e)}ne(){this.Nt||(this.Nt=!0,this.jt.forEach((A=>{A(this)})),this.Nt=!1)}}class rv{constructor(A,t){let e,i;e=A||new nv,i=t||new nv,this.re=[{scope:e}],this.se=i}withScope(A){const t=this.oe();let e;try{e=A(t)}catch(i){throw this.ae(),i}return Up(e)?e.then((A=>(this.ae(),A)),(A=>{throw this.ae(),A})):(this.ae(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.se}getStackTop(){return this.re[this.re.length-1]}oe(){const A=this.getScope().clone();return this.re.push({client:this.getClient(),scope:A}),A}ae(){return!(this.re.length<=1||!this.re.pop())}}function sv(){const A=up(cp());return A.stack=A.stack||new rv(hp("defaultCurrentScope",(()=>new nv)),hp("defaultIsolationScope",(()=>new nv)))}function ov(A){return sv().withScope(A)}function av(A,t){const e=sv();return e.withScope((()=>(e.getStackTop().scope=A,t(A))))}function cv(A){return sv().withScope((()=>A(sv().getIsolationScope())))}function uv(A){const t=up(A);return t.acs?t.acs:{withIsolationScope:cv,withScope:ov,withSetScope:av,withSetIsolationScope:(A,t)=>cv(t),getCurrentScope:()=>sv().getScope(),getIsolationScope:()=>sv().getIsolationScope()}}function hv(){return uv(cp()).getCurrentScope()}function lv(){return uv(cp()).getIsolationScope()}function dv(...A){const t=uv(cp());if(2===A.length){const[e,i]=A;return e?t.withSetScope(e,i):t.withScope(i)}return t.withScope(A[0])}function Bv(){return hv().getClient()}function fv(A){const t=A.getPropagationContext(),{traceId:e,parentSpanId:i,propagationSpanId:n}=t,r={trace_id:e,span_id:n||iv()};return i&&(r.parent_span_id=i),r}const wv="sentry.profile_id",gv="sentry.exclusive_time";function pv(A){return{scope:A.ce,isolationScope:A.ue}}const vv=/^sentry-/;function mv(A){return A.split(",").map((A=>A.split("=").map((A=>{try{return decodeURIComponent(A.trim())}catch{return}})))).reduce(((A,[t,e])=>(t&&e&&(A[t]=e),A)),{})}let Qv=!1;function Uv(A){const{spanId:t,traceId:e,isRemote:i}=A.spanContext(),n=i?t:bv(A).parent_span_id,r=pv(A).scope;return{parent_span_id:n,span_id:i?r?.getPropagationContext().propagationSpanId||iv():t,trace_id:e}}function Cv(A){return A&&A.length>0?A.map((({context:{spanId:A,traceId:t,traceFlags:e,...i},attributes:n})=>({span_id:A,trace_id:t,sampled:1===e,attributes:n,...i}))):void 0}function Fv(A){return"number"==typeof A?yv(A):Array.isArray(A)?A[0]+A[1]/1e9:A instanceof Date?yv(A.getTime()):Wp()}function yv(A){return A>9999999999?A/1e3:A}function bv(A){if((function(A){return"function"==typeof A.getSpanJSON})(A))return A.getSpanJSON();const{spanId:t,traceId:e}=A.spanContext();if((function(A){const t=A;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)})(A)){const{attributes:i,startTime:n,name:r,endTime:s,status:o,links:a}=A;return{span_id:t,trace_id:e,data:i,description:r,parent_span_id:"parentSpanId"in A?A.parentSpanId:"parentSpanContext"in A?A.parentSpanContext?.spanId:void 0,start_timestamp:Fv(n),timestamp:Fv(s)||void 0,status:Ev(o),op:i["sentry.op"],origin:i["sentry.origin"],links:Cv(a)}}return{span_id:t,trace_id:e,start_timestamp:0,data:{}}}function Ev(A){if(A&&0!==A.code)return 1===A.code?"ok":A.message||"unknown_error"}function Iv(A){return A.he||A}function Hv(){Qv||(Tp((()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")})),Qv=!0)}const kv="?",Tv=/\(error: (.*)\)/,Sv=/captureMessage|captureException/;function Ov(A){return A[A.length-1]||{}}const Kv="<anonymous>";function Dv(A){try{return A&&"function"==typeof A&&A.name||Kv}catch(t){return Kv}}function Mv(A){const t=A.exception;if(t){const A=[];try{return t.values.forEach((t=>{t.stacktrace.frames&&A.push(...t.stacktrace.frames)})),A}catch(e){return}}}const Lv={},xv={};function _v(A,t){Lv[A]=Lv[A]||[],Lv[A].push(t)}function Rv(A,t){if(!xv[A]){xv[A]=!0;try{t()}catch(e){sp&&Sp.error(`Error while instrumenting ${A}`,e)}}}function Nv(A,t){const e=A&&Lv[A];if(e)for(const n of e)try{n(t)}catch(i){sp&&Sp.error(`Error while triggering instrumentation handler.\nType: ${A}\nName: ${Dv(n)}\nError:`,i)}}let jv=null;function Gv(){jv=ap.onerror,ap.onerror=function(A,t,e,i,n){return Nv("error",{column:i,error:n,line:e,msg:A,url:t}),!!jv&&jv.apply(this,arguments)},ap.onerror.le=!0}let Pv=null;function Vv(){Pv=ap.onunhandledrejection,ap.onunhandledrejection=function(A){return Nv("unhandledrejection",A),!Pv||Pv.apply(this,arguments)},ap.onunhandledrejection.le=!0}const Jv="production",Xv=/^o(\d+)\./,Yv=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function $v(A,t=!1){const{host:e,path:i,pass:n,port:r,projectId:s,protocol:o,publicKey:a}=A;return`${o}://${a}${t&&n?`:${n}`:""}@${e}${r?`:${r}`:""}/${i?`${i}/`:i}${s}`}function Wv(A){return{protocol:A.protocol,publicKey:A.publicKey||"",pass:A.pass||"",host:A.host,port:A.port||"",path:A.path||"",projectId:A.projectId}}function Zv(A,t){const e=t.getOptions(),{publicKey:i,host:n}=t.getDsn()||{};let r;e.orgId?r=String(e.orgId):n&&(r=(function(A){const t=A.match(Xv);return t?.[1]})(n));const s={environment:e.environment||Jv,release:e.release,public_key:i,trace_id:A,org_id:r};return t.emit("createDsc",s),s}function qv(A){const t=Bv();if(!t)return{};const e=Iv(A),i=bv(e),n=i.data,r=e.spanContext().traceState,s=r?.get("sentry.sample_rate")??n["sentry.sample_rate"]??n["sentry.previous_trace_sample_rate"];function o(A){return"number"!=typeof s&&"string"!=typeof s||(A.sample_rate=`${s}`),A}const a=e.de;if(a)return o(a);const c=r?.get("sentry.dsc"),u=c&&(function(A){const t=(function(A){if(A&&(gp(A)||Array.isArray(A)))return Array.isArray(A)?A.reduce(((A,t)=>{const e=mv(t);return Object.entries(e).forEach((([t,e])=>{A[t]=e})),A}),{}):mv(A)})(A);if(!t)return;const e=Object.entries(t).reduce(((A,[t,e])=>(t.match(vv)&&(A[t.slice(7)]=e),A)),{});return Object.keys(e).length>0?e:void 0})(c);if(u)return o(u);const h=Zv(A.spanContext().traceId,t),l=n["sentry.source"],d=i.description;return"url"!==l&&d&&(h.transaction=d),(function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const A=Bv()?.getOptions();return!(!A||null==A.tracesSampleRate&&!A.tracesSampler)})()&&(h.sampled=String((function(A){const{traceFlags:t}=A.spanContext();return 1===t})(e)),h.sample_rand=r?.get("sentry.sample_rand")??pv(e).scope?.getPropagationContext().sampleRand.toString()),o(h),t.emit("createDsc",h,e),h}function zv(A,t=100,e=1/0){try{return tm("",A,t,e)}catch(i){return{ERROR:`**non-serializable** (${i})`}}}function Am(A,t=3,e=102400){const i=zv(A,t);return n=i,(function(A){return~-encodeURI(A).split(/%..|./).length})(JSON.stringify(n))>e?Am(A,t-1,e):i;var n}function tm(A,t,e=1/0,i=1/0,n=(function(){const A=new WeakSet;return[function(t){return!!A.has(t)||(A.add(t),!1)},function(t){A.delete(t)}]})()){const[r,s]=n;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const o=(function(A,t){try{if("domain"===A&&t&&"object"==typeof t&&t.B)return"[Domain]";if("domainEmitter"===A)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(Fp(t))return"[VueViewModel]";if(mp(e=t)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Dv(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const i=(function(A){const t=Object.getPrototypeOf(A);return t?.constructor?t.constructor.name:"null prototype"})(t);return/^HTML(\w*)Element$/.test(i)?`[HTMLElement: ${i}]`:`[object ${i}]`}catch(i){return`**non-serializable** (${i})`}var e})(A,t);if(!o.startsWith("[object "))return o;if(t.Be)return t;const a="number"==typeof t.fe?t.fe:e;if(0===a)return o.replace("object ","");if(r(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return tm("",c.toJSON(),a-1,i,n)}catch(d){}const u=Array.isArray(t)?[]:{};let h=0;const l=Rp(t);for(const B in l){if(!Object.prototype.hasOwnProperty.call(l,B))continue;if(h>=i){u[B]="[MaxProperties ~]";break}const A=l[B];u[B]=tm(B,A,a-1,i,n),h++}return s(t),u}function em(A,t=[]){return[A,t]}function im(A,t){const[e,i]=A;return[e,[...i,t]]}function nm(A,t){const e=A[1];for(const i of e)if(t(i,i[0].type))return!0;return!1}function rm(A){const t=up(ap);return t.encodePolyfill?t.encodePolyfill(A):(new TextEncoder).encode(A)}function sm(A){const[t,e]=A;let i=JSON.stringify(t);function n(A){"string"==typeof i?i="string"==typeof A?i+A:[rm(i),A]:i.push("string"==typeof A?rm(A):A)}for(const s of e){const[A,t]=s;if(n(`\n${JSON.stringify(A)}\n`),"string"==typeof t||t instanceof Uint8Array)n(t);else{let A;try{A=JSON.stringify(t)}catch(r){A=JSON.stringify(zv(t))}n(A)}}return"string"==typeof i?i:(function(A){const t=A.reduce(((A,t)=>A+t.length),0),e=new Uint8Array(t);let i=0;for(const n of A)e.set(n,i),i+=n.length;return e})(i)}function om(A){const t="string"==typeof A.data?rm(A.data):A.data;return[{type:"attachment",length:t.length,filename:A.filename,content_type:A.contentType,attachment_type:A.attachmentType},t]}const am={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function cm(A){return am[A]}function um(A){if(!A?.sdk)return;const{name:t,version:e}=A.sdk;return{name:t,version:e}}var hm,lm;function dm(A){return new fm((t=>{t(A)}))}function Bm(A){return new fm(((t,e)=>{e(A)}))}(lm=hm||(hm={}))[lm.PENDING=0]="PENDING",lm[lm.RESOLVED=1]="RESOLVED",lm[lm.REJECTED=2]="REJECTED";class fm{constructor(A){this.we=hm.PENDING,this.ge=[],this.pe(A)}then(A,t){return new fm(((e,i)=>{this.ge.push([!1,t=>{if(A)try{e(A(t))}catch(n){i(n)}else e(t)},A=>{if(t)try{e(t(A))}catch(n){i(n)}else i(A)}]),this.ve()}))}catch(A){return this.then((A=>A),A)}finally(A){return new fm(((t,e)=>{let i,n;return this.then((t=>{n=!1,i=t,A&&A()}),(t=>{n=!0,i=t,A&&A()})).then((()=>{n?e(i):t(i)}))}))}ve(){if(this.we===hm.PENDING)return;const A=this.ge.slice();this.ge=[],A.forEach((A=>{A[0]||(this.we===hm.RESOLVED&&A[1](this.kA),this.we===hm.REJECTED&&A[2](this.kA),A[0]=!0)}))}pe(A){const t=(A,t)=>{this.we===hm.PENDING&&(Up(t)?t.then(e,i):(this.we=A,this.kA=t,this.ve()))},e=A=>{t(hm.RESOLVED,A)},i=A=>{t(hm.REJECTED,A)};try{A(e,i)}catch(n){i(n)}}}function wm(A,t,e,i=0){return new fm(((n,r)=>{const s=A[i];if(null===t||"function"!=typeof s)n(t);else{const o=s({...t},e);sp&&s.id&&null===o&&Sp.log(`Event processor "${s.id}" dropped event`),Up(o)?o.then((t=>wm(A,t,e,i+1).then(n))).then(null,r):wm(A,o,e,i+1).then(n).then(null,r)}}))}let gm,pm,vm;function mm(A,t){const{extra:e,tags:i,user:n,contexts:r,level:s,sdkProcessingMetadata:o,breadcrumbs:a,fingerprint:c,eventProcessors:u,attachments:h,propagationContext:l,transactionName:d,span:B}=t;Qm(A,"extra",e),Qm(A,"tags",i),Qm(A,"user",n),Qm(A,"contexts",r),A.sdkProcessingMetadata=qp(A.sdkProcessingMetadata,o,2),s&&(A.level=s),d&&(A.transactionName=d),B&&(A.span=B),a.length&&(A.breadcrumbs=[...A.breadcrumbs,...a]),c.length&&(A.fingerprint=[...A.fingerprint,...c]),u.length&&(A.eventProcessors=[...A.eventProcessors,...u]),h.length&&(A.attachments=[...A.attachments,...h]),A.propagationContext={...A.propagationContext,...l}}function Qm(A,t,e){A[t]=qp(A[t],e,1)}function Um(A,t,e,i,n,r){const{normalizeDepth:s=3,normalizeMaxBreadth:o=1e3}=A,a={...t,event_id:t.event_id||e.event_id||Gp(),timestamp:t.timestamp||$p()},c=e.integrations||A.integrations.map((A=>A.name));!(function(A,t){const{environment:e,release:i,dist:n,maxValueLength:r=250}=t;A.environment=A.environment||e||Jv,!A.release&&i&&(A.release=i),!A.dist&&n&&(A.dist=n);const s=A.request;s?.url&&(s.url=Op(s.url,r))})(a,A),(function(A,t){t.length>0&&(A.sdk=A.sdk||{},A.sdk.integrations=[...A.sdk.integrations||[],...t])})(a,c),n&&n.emit("applyFrameMetadata",t),void 0===t.type&&(function(A,t){const e=(function(A){const t=ap.me;if(!t)return{};const e=Object.keys(t);return vm&&e.length===pm||(pm=e.length,vm=e.reduce(((e,i)=>{gm||(gm={});const n=gm[i];if(n)e[n[0]]=n[1];else{const n=A(i);for(let A=n.length-1;A>=0;A--){const r=n[A],s=r?.filename,o=t[i];if(s&&o){e[s]=o,gm[i]=[s,o];break}}}return e}),{})),vm})(t);A.exception?.values?.forEach((A=>{A.stacktrace?.frames?.forEach((A=>{A.filename&&(A.debug_id=e[A.filename])}))}))})(a,A.stackParser);const u=(function(A,t){if(!t)return A;const e=A?A.clone():new nv;return e.update(t),e})(i,e.captureContext);e.mechanism&&Xp(a,e.mechanism);const h=n?n.getEventProcessors():[],l=hp("globalScope",(()=>new nv)).getScopeData();r&&mm(l,r.getScopeData()),u&&mm(l,u.getScopeData());const d=[...e.attachments||[],...l.attachments];return d.length&&(e.attachments=d),(function(A,t){const{fingerprint:e,span:i,breadcrumbs:n,sdkProcessingMetadata:r}=t;!(function(A,t){const{extra:e,tags:i,user:n,contexts:r,level:s,transactionName:o}=t;Object.keys(e).length&&(A.extra={...e,...A.extra}),Object.keys(i).length&&(A.tags={...i,...A.tags}),Object.keys(n).length&&(A.user={...n,...A.user}),Object.keys(r).length&&(A.contexts={...r,...A.contexts}),s&&(A.level=s),o&&"transaction"!==A.type&&(A.transaction=o)})(A,t),i&&(function(A,t){A.contexts={trace:Uv(t),...A.contexts},A.sdkProcessingMetadata={dynamicSamplingContext:qv(t),...A.sdkProcessingMetadata};const e=bv(Iv(t)).description;e&&!A.transaction&&"transaction"===A.type&&(A.transaction=e)})(A,i),(function(A,t){A.fingerprint=A.fingerprint?Array.isArray(A.fingerprint)?A.fingerprint:[A.fingerprint]:[],t&&(A.fingerprint=A.fingerprint.concat(t)),A.fingerprint.length||delete A.fingerprint})(A,e),(function(A,t){const e=[...A.breadcrumbs||[],...t];A.breadcrumbs=e.length?e:void 0})(A,n),(function(A,t){A.sdkProcessingMetadata={...A.sdkProcessingMetadata,...t}})(A,r)})(a,l),wm([...h,...l.eventProcessors],a,e).then((A=>(A&&(function(A){const t={};if(A.exception?.values?.forEach((A=>{A.stacktrace?.frames?.forEach((A=>{A.debug_id&&(A.abs_path?t[A.abs_path]=A.debug_id:A.filename&&(t[A.filename]=A.debug_id),delete A.debug_id)}))})),0===Object.keys(t).length)return;A.debug_meta=A.debug_meta||{},A.debug_meta.images=A.debug_meta.images||[];const e=A.debug_meta.images;Object.entries(t).forEach((([A,t])=>{e.push({type:"sourcemap",code_file:A,debug_id:t})}))})(A),"number"==typeof s&&s>0?(function(A,t,e){if(!A)return null;const i={...A,...A.breadcrumbs&&{breadcrumbs:A.breadcrumbs.map((A=>({...A,...A.data&&{data:zv(A.data,t,e)}})))},...A.user&&{user:zv(A.user,t,e)},...A.contexts&&{contexts:zv(A.contexts,t,e)},...A.extra&&{extra:zv(A.extra,t,e)}};return A.contexts?.trace&&i.contexts&&(i.contexts.trace=A.contexts.trace,A.contexts.trace.data&&(i.contexts.trace.data=zv(A.contexts.trace.data,t,e))),A.spans&&(i.spans=A.spans.map((A=>({...A,...A.data&&{data:zv(A.data,t,e)}})))),A.contexts?.flags&&i.contexts&&(i.contexts.flags=zv(A.contexts.flags,3,e)),i})(A,s,o):A)))}function Cm(A,t){return hv().captureEvent(A,t)}function Fm(A){const t=lv(),e=hv(),{userAgent:i}=ap.navigator||{},n=(function(A){const t=Wp(),e={sid:Gp(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>(function(A){return{sid:`${A.sid}`,init:A.init,started:new Date(1e3*A.started).toISOString(),timestamp:new Date(1e3*A.timestamp).toISOString(),status:A.status,errors:A.errors,did:"number"==typeof A.did||"string"==typeof A.did?`${A.did}`:void 0,duration:A.duration,abnormal_mechanism:A.abnormal_mechanism,attrs:{release:A.release,environment:A.environment,ip_address:A.ipAddress,user_agent:A.userAgent}}})(e)};return A&&Zp(e,A),e})({user:e.getUser()||t.getUser(),...i&&{userAgent:i},...A}),r=t.getSession();return"ok"===r?.status&&Zp(r,{status:"exited"}),ym(),t.setSession(n),n}function ym(){const A=lv(),t=hv().getSession()||A.getSession();t&&(function(A){let t={};"ok"===A.status&&(t={status:"exited"}),Zp(A,t)})(t),bm(),A.setSession()}function bm(){const A=lv(),t=Bv(),e=A.getSession();e&&t&&t.captureSession(e)}function Em(A=!1){A?ym():bm()}const Im=[];function Hm(A,t){for(const e of t)e?.afterAllSetup&&e.afterAllSetup(A)}function km(A,t,e){if(e[t.name])sp&&Sp.log(`Integration skipped because it was already installed: ${t.name}`);else{if(e[t.name]=t,-1===Im.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),Im.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(A),"function"==typeof t.preprocessEvent){const e=t.preprocessEvent.bind(t);A.on("preprocessEvent",((t,i)=>e(t,i,A)))}if("function"==typeof t.processEvent){const e=t.processEvent.bind(t),i=Object.assign(((t,i)=>e(t,i,A)),{id:t.name});A.addEventProcessor(i)}sp&&Sp.log(`Integration installed: ${t.name}`)}}function Tm(A){const t=[];A.message&&t.push(A.message);try{const e=A.exception.values[A.exception.values.length-1];e?.value&&(t.push(e.value),e.type&&t.push(`${e.type}: ${e.value}`))}catch(e){}return t}const Sm="Not capturing exception because it's already been captured.",Om="Discarded session because of missing or non-string release",Km=Symbol.for("SentryInternalError"),Dm=Symbol.for("SentryDoNotSendEventError");function Mm(A){return{message:A,[Km]:!0}}function Lm(A){return{message:A,[Dm]:!0}}function xm(A){return!!A&&"object"==typeof A&&Km in A}function _m(A){return!!A&&"object"==typeof A&&Dm in A}class Rm{constructor(A){if(this.KA=A,this.Qe={},this.Ue=0,this.Ce={},this.Fe={},this.Gt=[],A.dsn?this.ye=(function(A){const t="string"==typeof A?(function(A){const t=Yv.exec(A);if(!t)return void Tp((()=>{console.error(`Invalid Sentry Dsn: ${A}`)}));const[e,i,n="",r="",s="",o=""]=t.slice(1);let a="",c=o;const u=c.split("/");if(u.length>1&&(a=u.slice(0,-1).join("/"),c=u.pop()),c){const A=c.match(/^\d+/);A&&(c=A[0])}return Wv({host:r,pass:n,path:a,projectId:c,port:s,protocol:e,publicKey:i})})(A):Wv(A);if(t&&(function(A){if(!sp)return!0;const{port:t,projectId:e,protocol:i}=A;return!(["protocol","publicKey","host","projectId"].find((t=>!A[t]&&(Sp.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(e.match(/^\d+$/)?(function(A){return"http"===A||"https"===A})(i)?t&&isNaN(parseInt(t,10))&&(Sp.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Sp.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),1):(Sp.error(`Invalid Sentry Dsn: Invalid projectId ${e}`),1)))})(t))return t})(A.dsn):sp&&Sp.warn("No DSN provided, client will not send events."),this.ye){const n=(t=this.ye,e=A.tunnel,i=A.be?A.be.sdk:void 0,e||`${(function(A){return`${(function(A){const t=A.protocol?`${A.protocol}:`:"",e=A.port?`:${A.port}`:"";return`${t}//${A.host}${e}${A.path?`/${A.path}`:""}/api/`})(A)}${A.projectId}/envelope/`})(t)}?${(function(A,t){const e={sentry_version:"7"};return A.publicKey&&(e.sentry_key=A.publicKey),t&&(e.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(e).toString()})(t,i)}`);this.Ee=A.transport({tunnel:this.KA.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...A.transportOptions,url:n})}var t,e,i}captureException(A,t,e){const i=Gp();if(Yp(A))return sp&&Sp.log(Sm),i;const n={event_id:i,...t};return this.Ie(this.eventFromException(A,n).then((A=>this.He(A,n,e)))),n.event_id}captureMessage(A,t,e,i){const n={event_id:Gp(),...e},r=pp(A)?A:String(A),s=vp(A)?this.eventFromMessage(r,t,n):this.eventFromException(A,n);return this.Ie(s.then((A=>this.He(A,n,i)))),n.event_id}captureEvent(A,t,e){const i=Gp();if(t?.originalException&&Yp(t.originalException))return sp&&Sp.log(Sm),i;const n={event_id:i,...t},r=A.sdkProcessingMetadata||{},s=r.capturedSpanScope,o=r.capturedSpanIsolationScope;return this.Ie(this.He(A,n,s||e,o)),n.event_id}captureSession(A){this.sendSession(A),Zp(A,{init:!1})}getDsn(){return this.ye}getOptions(){return this.KA}getSdkMetadata(){return this.KA.be}getTransport(){return this.Ee}flush(A){const t=this.Ee;return t?(this.emit("flush"),this.ke(A).then((e=>t.flush(A).then((A=>e&&A))))):dm(!0)}close(A){return this.flush(A).then((A=>(this.getOptions().enabled=!1,this.emit("close"),A)))}getEventProcessors(){return this.Gt}addEventProcessor(A){this.Gt.push(A)}init(){(this.Te()||this.KA.integrations.some((({name:A})=>A.startsWith("Spotlight"))))&&this.Se()}getIntegrationByName(A){return this.Qe[A]}addIntegration(A){const t=this.Qe[A.name];km(this,A,this.Qe),t||Hm(this,[A])}sendEvent(A,t={}){this.emit("beforeSendEvent",A,t);let e=(function(A,t,e,i){const n=um(e),r=A.type&&"replay_event"!==A.type?A.type:"event";!(function(A,t){t&&(A.sdk=A.sdk||{},A.sdk.name=A.sdk.name||t.name,A.sdk.version=A.sdk.version||t.version,A.sdk.integrations=[...A.sdk.integrations||[],...t.integrations||[]],A.sdk.packages=[...A.sdk.packages||[],...t.packages||[]])})(A,e?.sdk);const s=(function(A,t,e,i){const n=A.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:A.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!e&&i&&{dsn:$v(i)},...n&&{trace:n}}})(A,n,i,t);return delete A.sdkProcessingMetadata,em(s,[[{type:r},A]])})(A,this.ye,this.KA.be,this.KA.tunnel);for(const n of t.attachments||[])e=im(e,om(n));const i=this.sendEnvelope(e);i&&i.then((t=>this.emit("afterSendEvent",A,t)),null)}sendSession(A){const{release:t,environment:e=Jv}=this.KA;if("aggregates"in A){const i=A.attrs||{};if(!i.release&&!t)return void(sp&&Sp.warn(Om));i.release=i.release||t,i.environment=i.environment||e,A.attrs=i}else{if(!A.release&&!t)return void(sp&&Sp.warn(Om));A.release=A.release||t,A.environment=A.environment||e}this.emit("beforeSendSession",A);const i=(function(A,t,e,i){const n=um(e);return em({sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!i&&t&&{dsn:$v(t)}},["aggregates"in A?[{type:"sessions"},A]:[{type:"session"},A.toJSON()]])})(A,this.ye,this.KA.be,this.KA.tunnel);this.sendEnvelope(i)}recordDroppedEvent(A,t,e=1){if(this.KA.sendClientReports){const i=`${A}:${t}`;sp&&Sp.log(`Recording outcome: "${i}"${e>1?` (${e} times)`:""}`),this.Ce[i]=(this.Ce[i]||0)+e}}on(A,t){const e=this.Fe[A]=this.Fe[A]||[];return e.push(t),()=>{const A=e.indexOf(t);A>-1&&e.splice(A,1)}}emit(A,...t){const e=this.Fe[A];e&&e.forEach((A=>A(...t)))}sendEnvelope(A){return this.emit("beforeEnvelope",A),this.Te()&&this.Ee?this.Ee.send(A).then(null,(A=>(sp&&Sp.error("Error while sending envelope:",A),A))):(sp&&Sp.error("Transport disabled"),dm({}))}Se(){const{integrations:A}=this.KA;this.Qe=(function(A,t){const e={};return t.forEach((t=>{t&&km(A,t,e)})),e})(this,A),Hm(this,A)}Oe(A,t){let e="fatal"===t.level,i=!1;const n=t.exception?.values;if(n){i=!0;for(const A of n){const t=A.mechanism;if(!1===t?.handled){e=!0;break}}}const r="ok"===A.status;(r&&0===A.errors||r&&e)&&(Zp(A,{...e&&{status:"crashed"},errors:A.errors||Number(i||e)}),this.captureSession(A))}ke(A){return new fm((t=>{let e=0;const i=setInterval((()=>{0==this.Ue?(clearInterval(i),t(!0)):(e+=1,A&&e>=A&&(clearInterval(i),t(!1)))}),1)}))}Te(){return!1!==this.getOptions().enabled&&void 0!==this.Ee}Ke(A,t,e,i){const n=this.getOptions(),r=Object.keys(this.Qe);return!t.integrations&&r?.length&&(t.integrations=r),this.emit("preprocessEvent",A,t),A.type||i.setLastEventId(A.event_id||t.event_id),Um(n,A,t,e,this,i).then((A=>{if(null===A)return A;this.emit("postprocessEvent",A,t),A.contexts={trace:fv(e),...A.contexts};const i=(function(A,t){const e=t.getPropagationContext();return e.dsc||Zv(e.traceId,A)})(this,e);return A.sdkProcessingMetadata={dynamicSamplingContext:i,...A.sdkProcessingMetadata},A}))}He(A,t={},e=hv(),i=lv()){return sp&&Nm(A)&&Sp.log(`Captured error event \`${Tm(A)[0]||"<unknown>"}\``),this.De(A,t,e,i).then((A=>A.event_id),(A=>{sp&&(_m(A)?Sp.log(A.message):xm(A)?Sp.warn(A.message):Sp.warn(A))}))}De(A,t,e,i){const n=this.getOptions(),{sampleRate:r}=n,s=jm(A),o=Nm(A),a=A.type||"error",c=`before send for type \`${a}\``,u=void 0===r?void 0:(function(A){if("boolean"==typeof A)return Number(A);const t="string"==typeof A?parseFloat(A):A;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t})(r);if(o&&"number"==typeof u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),Bm(Lm(`Discarding event because it's not included in the random sample (sampling rate = ${r})`));const h="replay_event"===a?"replay":a;return this.Ke(A,t,e,i).then((A=>{if(null===A)throw this.recordDroppedEvent("event_processor",h),Lm("An event processor returned `null`, will not send event.");if(t.data&&!0===t.data.Me)return A;const e=(function(A,t,e,i){const{beforeSend:n,beforeSendTransaction:r,beforeSendSpan:s}=t;let o=e;if(Nm(o)&&n)return n(o,i);if(jm(o)){if(s){const A=s((function(A){const{trace_id:t,parent_span_id:e,span_id:i,status:n,origin:r,data:s,op:o}=A.contexts?.trace??{};return{data:s??{},description:A.transaction,op:o,parent_span_id:e,span_id:i??"",start_timestamp:A.start_timestamp??0,status:n,timestamp:A.timestamp,trace_id:t??"",origin:r,profile_id:s?.[wv],exclusive_time:s?.[gv],measurements:A.measurements,is_segment:!0}})(o));if(A?o=qp(e,{type:"transaction",timestamp:(a=A).timestamp,start_timestamp:a.start_timestamp,transaction:a.description,contexts:{trace:{trace_id:a.trace_id,span_id:a.span_id,parent_span_id:a.parent_span_id,op:a.op,status:a.status,origin:a.origin,data:{...a.data,...a.profile_id&&{[wv]:a.profile_id},...a.exclusive_time&&{[gv]:a.exclusive_time}}}},measurements:a.measurements}):Hv(),o.spans){const A=[];for(const t of o.spans){const e=s(t);e?A.push(e):(Hv(),A.push(t))}o.spans=A}}if(r){if(o.spans){const A=o.spans.length;o.sdkProcessingMetadata={...e.sdkProcessingMetadata,spanCountBeforeProcessing:A}}return r(o,i)}}var a;return o})(0,n,A,t);return(function(A,t){const e=`${t} must return \`null\` or a valid event.`;if(Up(A))return A.then((A=>{if(!mp(A)&&null!==A)throw Mm(e);return A}),(A=>{throw Mm(`${t} rejected with ${A}`)}));if(!mp(A)&&null!==A)throw Mm(e);return A})(e,c)})).then((n=>{if(null===n){if(this.recordDroppedEvent("before_send",h),s){const t=1+(A.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw Lm(`${c} returned \`null\`, will not send event.`)}const r=e.getSession()||i.getSession();if(o&&r&&this.Oe(r,n),s){const A=(n.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(n.spans?n.spans.length:0);A>0&&this.recordDroppedEvent("before_send","span",A)}const a=n.transaction_info;if(s&&a&&n.transaction!==A.transaction){const A="custom";n.transaction_info={...a,source:A}}return this.sendEvent(n,t),n})).then(null,(A=>{if(_m(A)||xm(A))throw A;throw this.captureException(A,{data:{Me:!0},originalException:A}),Mm(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${A}`)}))}Ie(A){this.Ue++,A.then((A=>(this.Ue--,A)),(A=>(this.Ue--,A)))}Le(){const A=this.Ce;return this.Ce={},Object.entries(A).map((([A,t])=>{const[e,i]=A.split(":");return{reason:e,category:i,quantity:t}}))}xe(){sp&&Sp.log("Flushing outcomes...");const A=this.Le();if(0===A.length)return void(sp&&Sp.log("No outcomes to send"));if(!this.ye)return void(sp&&Sp.log("No dsn provided, will not send outcomes"));sp&&Sp.log("Sending outcomes:",A);const t=(e=A,em((i=this.KA.tunnel&&$v(this.ye))?{dsn:i}:{},[[{type:"client_report"},{timestamp:$p(),discarded_events:e}]]));var e,i;this.sendEnvelope(t)}}function Nm(A){return void 0===A.type}function jm(A){return"transaction"===A.type}function Gm(A,t){const e=t??(function(A){return ap._e?.get(A)})(A)??[];if(0===e.length)return;const i=A.getOptions(),n=(function(A,t,e,i){const n={};return t?.sdk&&(n.sdk={name:t.sdk.name,version:t.sdk.version}),e&&i&&(n.dsn=$v(i)),em(n,[(r=A,[{type:"log",item_count:r.length,content_type:"application/vnd.sentry.items.log+json"},{items:r}])]);var r})(e,i.be,i.tunnel,A.getDsn());ap._e?.set(A,[]),A.emit("flushLogs"),A.sendEnvelope(n)}ap._e=new WeakMap;const Pm=Symbol.for("SentryBufferFullError");function Vm(A){void 0===A.user?.ip_address&&(A.user={...A.user,ip_address:"{{auto}}"})}function Jm(A){"aggregates"in A?void 0===A.attrs?.ip_address&&(A.attrs={...A.attrs,ip_address:"{{auto}}"}):void 0===A.ipAddress&&(A.ipAddress="{{auto}}")}const Xm=100;function Ym(A,t){const e=Bv(),i=lv();if(!e)return;const{beforeBreadcrumb:n=null,maxBreadcrumbs:r=Xm}=e.getOptions();if(r<=0)return;const s={timestamp:$p(),...A},o=n?Tp((()=>n(s,t))):s;null!==o&&(e.emit&&e.emit("beforeAddBreadcrumb",o,t),i.addBreadcrumb(o,r))}let $m;const Wm=new WeakMap,Zm=()=>({name:"FunctionToString",setupOnce(){$m=Function.prototype.toString;try{Function.prototype.toString=function(...A){const t=_p(this),e=Wm.has(Bv())&&void 0!==t?t:this;return $m.apply(e,A)}}catch{}},setup(A){Wm.set(A,!0)}}),qm=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],zm=(A={})=>{let t;return{name:"EventFilters",setup(e){const i=e.getOptions();t=tQ(A,i)},processEvent(e,i,n){if(!t){const e=n.getOptions();t=tQ(A,e)}return(function(A,t){if(A.type){if("transaction"===A.type&&(function(A,t){if(!t?.length)return!1;const e=A.transaction;return!!e&&Dp(e,t)})(A,t.ignoreTransactions))return sp&&Sp.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Vp(A)}`),!0}else{if((function(A,t){return!!t?.length&&Tm(A).some((A=>Dp(A,t)))})(A,t.ignoreErrors))return sp&&Sp.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Vp(A)}`),!0;if((function(A){return!!A.exception?.values?.length&&!A.message&&!A.exception.values.some((A=>A.stacktrace||A.type&&"Error"!==A.type||A.value))})(A))return sp&&Sp.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Vp(A)}`),!0;if((function(A,t){if(!t?.length)return!1;const e=eQ(A);return!!e&&Dp(e,t)})(A,t.denyUrls))return sp&&Sp.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Vp(A)}.\nUrl: ${eQ(A)}`),!0;if(!(function(A,t){if(!t?.length)return!0;const e=eQ(A);return!e||Dp(e,t)})(A,t.allowUrls))return sp&&Sp.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Vp(A)}.\nUrl: ${eQ(A)}`),!0}return!1})(e,t)?null:e}}},AQ=(A={})=>({...zm(A),name:"InboundFilters"});function tQ(A={},t={}){return{allowUrls:[...A.allowUrls||[],...t.allowUrls||[]],denyUrls:[...A.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...A.ignoreErrors||[],...t.ignoreErrors||[],...A.disableErrorDefaults?[]:qm],ignoreTransactions:[...A.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function eQ(A){try{const t=[...A.exception?.values??[]].reverse().find((A=>void 0===A.mechanism?.parent_id&&A.stacktrace?.frames?.length)),e=t?.stacktrace?.frames;return e?(function(A=[]){for(let t=A.length-1;t>=0;t--){const e=A[t];if(e&&"<anonymous>"!==e.filename&&"[native code]"!==e.filename)return e.filename||null}return null})(e):null}catch(t){return sp&&Sp.error(`Cannot extract url for event ${Vp(A)}`),null}}function iQ(A,t,e,i,n,r){if(!n.exception?.values||!r||!Cp(r.originalException,Error))return;const s=n.exception.values.length>0?n.exception.values[n.exception.values.length-1]:void 0;s&&(n.exception.values=nQ(A,t,i,r.originalException,e,n.exception.values,s,0))}function nQ(A,t,e,i,n,r,s,o){if(r.length>=e+1)return r;let a=[...r];if(Cp(i[n],Error)){rQ(s,o);const r=A(t,i[n]),c=a.length;sQ(r,n,c,o),a=nQ(A,t,e,i[n],n,[r,...a],r,c)}return Array.isArray(i.errors)&&i.errors.forEach(((i,r)=>{if(Cp(i,Error)){rQ(s,o);const c=A(t,i),u=a.length;sQ(c,`errors[${r}]`,u,o),a=nQ(A,t,e,i,n,[c,...a],c,u)}})),a}function rQ(A,t){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,..."AggregateError"===A.type&&{is_exception_group:!0},exception_id:t}}function sQ(A,t,e,i){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,type:"chained",source:t,exception_id:e,parent_id:i}}function oQ(){"console"in ap&&Hp.forEach((function(A){A in ap.console&&Mp(ap.console,A,(function(t){return kp[A]=t,function(...t){Nv("console",{args:t,level:A});const e=kp[A];e?.apply(ap.console,t)}}))}))}const aQ=()=>{let A;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if((function(A,t){return!(!t||!(function(A,t){const e=A.message,i=t.message;return!(!e&&!i||e&&!i||!e&&i||e!==i||!uQ(A,t)||!cQ(A,t))})(A,t)&&!(function(A,t){const e=hQ(t),i=hQ(A);return!!(e&&i&&e.type===i.type&&e.value===i.value&&uQ(A,t)&&cQ(A,t))})(A,t))})(t,A))return sp&&Sp.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return A=t}}};function cQ(A,t){let e=Mv(A),i=Mv(t);if(!e&&!i)return!0;if(e&&!i||!e&&i)return!1;if(i.length!==e.length)return!1;for(let n=0;n<i.length;n++){const A=i[n],t=e[n];if(A.filename!==t.filename||A.lineno!==t.lineno||A.colno!==t.colno||A.function!==t.function)return!1}return!0}function uQ(A,t){let e=A.fingerprint,i=t.fingerprint;if(!e&&!i)return!0;if(e&&!i||!e&&i)return!1;try{return!(e.join("")!==i.join(""))}catch(n){return!1}}function hQ(A){return A.exception?.values&&A.exception.values[0]}function lQ(A){if(!A)return{};const t=A.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const e=t[6]||"",i=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:e,hash:i,relative:t[5]+e+i}}function dQ(A){return void 0===A?void 0:A>=400&&A<500?"warning":A>=500?"error":void 0}const BQ=ap;function fQ(A){return A&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(A.toString())}function wQ(A,t){return!!A&&"object"==typeof A&&!!A[t]}function gQ(A){return"string"==typeof A?A:A?wQ(A,"url")?A.url:A.toString?A.toString():"":""}function pQ(A){const[t,e]=A;try{if("object"==typeof e&&null!==e&&"headers"in e&&e.headers)return new Headers(e.headers);if("undefined"!=typeof Request&&Cp(t,Request))return new Headers(t.headers)}catch{}}const vQ=ap;let mQ=0;function QQ(){return mQ>0}function UQ(A,t={}){if("function"!=typeof A)return A;try{const t=A.Re;if(t)return"function"==typeof t?t:A;if(_p(A))return A}catch(i){return A}const e=function(...e){try{const i=e.map((A=>UQ(A,t)));return A.apply(this,i)}catch(i){throw mQ++,setTimeout((()=>{mQ--})),dv((A=>{var n;A.addEventProcessor((A=>(t.mechanism&&(Jp(A,void 0,void 0),Xp(A,t.mechanism)),A.extra={...A.extra,arguments:e},A))),n=i,hv().captureException(n,void 0)})),i}};try{for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t])}catch{}xp(e,A),Lp(A,"__sentry_wrapped__",e);try{Object.getOwnPropertyDescriptor(e,"name").configurable&&Object.defineProperty(e,"name",{get:()=>A.name})}catch{}return e}function CQ(A,t){const e=yQ(A,t),i={type:IQ(t),value:HQ(t)};return e.length&&(i.stacktrace={frames:e}),void 0===i.type&&""===i.value&&(i.value="Unrecoverable error caught"),i}function FQ(A,t){return{exception:{values:[CQ(A,t)]}}}function yQ(A,t){const e=t.stacktrace||t.stack||"",i=(function(A){return A&&bQ.test(A.message)?1:0})(t),n=(function(A){return"number"==typeof A.framesToPop?A.framesToPop:0})(t);try{return A(e,i,n)}catch(r){}return[]}const bQ=/Minified React error #\d+;/i;function EQ(A){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&A instanceof WebAssembly.Exception}function IQ(A){const t=A?.name;return!t&&EQ(A)?A.message&&Array.isArray(A.message)&&2==A.message.length?A.message[0]:"WebAssembly.Exception":t}function HQ(A){const t=A?.message;return EQ(A)?Array.isArray(A.message)&&2==A.message.length?A.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function kQ(A,t,e,i,n){let r;if(fp(t)&&t.error)return FQ(A,t.error);if(wp(t)||Bp(t,"DOMException")){const n=t;if("stack"in t)r=FQ(A,t);else{const t=n.name||(wp(n)?"DOMError":"DOMException"),s=n.message?`${t}: ${n.message}`:t;r=TQ(A,s,e,i),Jp(r,s)}return"code"in n&&(r.tags={...r.tags,"DOMException.code":`${n.code}`}),r}return dp(t)?FQ(A,t):mp(t)||Qp(t)?(r=(function(A,t,e,i){const n=Bv(),r=n?.getOptions().normalizeDepth,s=(function(A){for(const t in A)if(Object.prototype.hasOwnProperty.call(A,t)){const e=A[t];if(e instanceof Error)return e}})(t),o={Ne:Am(t,r)};if(s)return{exception:{values:[CQ(A,s)]},extra:o};const a={exception:{values:[{type:Qp(t)?t.constructor.name:i?"UnhandledRejection":"Error",value:SQ(t,{isUnhandledRejection:i})}]},extra:o};if(e){const t=yQ(A,e);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a})(A,t,e,n),Xp(r,{synthetic:!0}),r):(r=TQ(A,t,e,i),Jp(r,`${t}`,void 0),Xp(r,{synthetic:!0}),r)}function TQ(A,t,e,i){const n={};if(i&&e){const i=yQ(A,e);i.length&&(n.exception={values:[{value:t,stacktrace:{frames:i}}]}),Xp(n,{synthetic:!0})}if(pp(t)){const{Dt:A,Mt:e}=t;return n.logentry={message:A,params:e},n}return n.message=t,n}function SQ(A,{isUnhandledRejection:t}){const e=(function(A,t=40){const e=Object.keys(Rp(A));e.sort();const i=e[0];if(!i)return"[object has no keys]";if(i.length>=t)return Op(i,t);for(let n=e.length;n>0;n--){const A=e.slice(0,n).join(", ");if(!(A.length>t))return n===e.length?A:Op(A,t)}return""})(A),i=t?"promise rejection":"exception";return fp(A)?`Event \`ErrorEvent\` captured as ${i} with message \`${A.message}\``:Qp(A)?`Event \`${(function(A){try{const t=Object.getPrototypeOf(A);return t?t.constructor.name:void 0}catch(t){}})(A)}\` (type=${A.type}) captured as ${i}`:`Object captured as ${i} with keys: ${e}`}class OQ extends Rm{constructor(A){const t=(e=A,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:vQ.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e});var e;!(function(A,t,e=[t],i="npm"){const n=A.be||{};n.sdk||(n.sdk={name:`sentry.javascript.${t}`,packages:e.map((A=>({name:`${i}:@sentry/${A}`,version:op}))),version:op}),A.be=n})(t,"browser",["browser"],vQ.SENTRY_SDK_SOURCE||"npm"),super(t);const{sendDefaultPii:i,sendClientReports:n,je:r}=this.KA,s=r?.enableLogs;vQ.document&&(n||s)&&vQ.document.addEventListener("visibilitychange",(()=>{"hidden"===vQ.document.visibilityState&&(n&&this.xe(),s&&Gm(this))})),s&&(this.on("flush",(()=>{Gm(this)})),this.on("afterCaptureLog",(()=>{this.Ge&&clearTimeout(this.Ge),this.Ge=setTimeout((()=>{Gm(this)}),5e3)}))),i&&(this.on("postprocessEvent",Vm),this.on("beforeSendSession",Jm))}eventFromException(A,t){return(function(A,t,e,i){const n=kQ(A,t,e?.syntheticException||void 0,i);return Xp(n),n.level="error",e?.event_id&&(n.event_id=e.event_id),dm(n)})(this.KA.stackParser,A,t,this.KA.attachStacktrace)}eventFromMessage(A,t="info",e){return(function(A,t,e="info",i,n){const r=TQ(A,t,i?.syntheticException||void 0,n);return r.level=e,i?.event_id&&(r.event_id=i.event_id),dm(r)})(this.KA.stackParser,A,t,e,this.KA.attachStacktrace)}Ke(A,t,e,i){return A.platform=A.platform||"javascript",super.Ke(A,t,e,i)}}const KQ="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,DQ=ap;let MQ,LQ,xQ,_Q;function RQ(){if(!DQ.document)return;const A=Nv.bind(null,"dom"),t=NQ(A,!0);DQ.document.addEventListener("click",t,!1),DQ.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach((t=>{const e=DQ,i=e[t]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(Mp(i,"addEventListener",(function(t){return function(e,i,n){if("click"===e||"keypress"==e)try{const i=this.Pe=this.Pe||{},r=i[e]=i[e]||{refCount:0};if(!r.handler){const i=NQ(A);r.handler=i,t.call(this,e,i,n)}r.refCount++}catch(r){}return t.call(this,e,i,n)}})),Mp(i,"removeEventListener",(function(A){return function(t,e,i){if("click"===t||"keypress"==t)try{const e=this.Pe||{},n=e[t];n&&(n.refCount--,n.refCount<=0&&(A.call(this,t,n.handler,i),n.handler=void 0,delete e[t]),0===Object.keys(e).length&&delete this.Pe)}catch(n){}return A.call(this,t,e,i)}})))}))}function NQ(A,t=!1){return e=>{if(!e||e.Ve)return;const i=(function(A){try{return A.target}catch(t){return null}})(e);if((function(A,t){return"keypress"===A&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)})(e.type,i))return;Lp(e,"_sentryCaptured",!0),i&&!i.Je&&Lp(i,"_sentryId",Gp());const n="keypress"===e.type?"input":e.type;(function(A){if(A.type!==LQ)return!1;try{if(!A.target||A.target.Je!==xQ)return!1}catch(t){}return!0})(e)||(A({event:e,name:n,global:t}),LQ=e.type,xQ=i?i.Je:void 0),clearTimeout(MQ),MQ=DQ.setTimeout((()=>{xQ=void 0,LQ=void 0}),1e3)}}function jQ(A){const t="history";_v(t,A),Rv(t,GQ)}function GQ(){function A(A){return function(...t){const e=t.length>2?t[2]:void 0;if(e){const i=_Q,n=(function(A){try{return new URL(A,DQ.location.origin).toString()}catch{return A}})(String(e));if(_Q=n,i===n)return A.apply(this,t);Nv("history",{from:i,to:n})}return A.apply(this,t)}}DQ.addEventListener("popstate",(()=>{const A=DQ.location.href,t=_Q;_Q=A,t!==A&&Nv("history",{from:t,to:A})})),"history"in BQ&&BQ.history&&(Mp(DQ.history,"pushState",A),Mp(DQ.history,"replaceState",A))}const PQ={};function VQ(A){PQ[A]=void 0}const JQ="__sentry_xhr_v3__";function XQ(){if(!DQ.XMLHttpRequest)return;const A=XMLHttpRequest.prototype;A.open=new Proxy(A.open,{apply(A,t,e){const i=new Error,n=1e3*Wp(),r=gp(e[0])?e[0].toUpperCase():void 0,s=(function(A){if(gp(A))return A;try{return A.toString()}catch{}})(e[1]);if(!r||!s)return A.apply(t,e);t[JQ]={method:r,url:s,request_headers:{}},"POST"===r&&s.match(/sentry_key/)&&(t.Xe=!0);const o=()=>{const A=t[JQ];if(A&&4===t.readyState){try{A.status_code=t.status}catch(e){}Nv("xhr",{endTimestamp:1e3*Wp(),startTimestamp:n,xhr:t,virtualError:i})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(A,t,e)=>(o(),A.apply(t,e))}):t.addEventListener("readystatechange",o),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(A,t,e){const[i,n]=e,r=t[JQ];return r&&gp(i)&&gp(n)&&(r.request_headers[i.toLowerCase()]=n),A.apply(t,e)}}),A.apply(t,e)}}),A.send=new Proxy(A.send,{apply(A,t,e){const i=t[JQ];return i?(void 0!==e[0]&&(i.body=e[0]),Nv("xhr",{startTimestamp:1e3*Wp(),xhr:t}),A.apply(t,e)):A.apply(t,e)}})}function YQ(A,t=(function(A){const t=PQ[A];if(t)return t;let e=DQ[A];if(fQ(e))return PQ[A]=e.bind(DQ);const i=DQ.document;if(i&&"function"==typeof i.createElement)try{const t=i.createElement("iframe");t.hidden=!0,i.head.appendChild(t);const n=t.contentWindow;n?.[A]&&(e=n[A]),i.head.removeChild(t)}catch(n){KQ&&Sp.warn(`Could not create sandbox iframe for ${A} check, bailing to window.${A}: `,n)}return e?PQ[A]=e.bind(DQ):e})("fetch")){let e=0,i=0;return(function(A,t,e=(function(A){const t=[];function e(A){return t.splice(t.indexOf(A),1)[0]||Promise.resolve(void 0)}return{$:t,add:function(i){if(!(void 0===A||t.length<A))return Bm(Pm);const n=i();return-1===t.indexOf(n)&&t.push(n),n.then((()=>e(n))).then(null,(()=>e(n).then(null,(()=>{})))),n},drain:function(A){return new fm(((e,i)=>{let n=t.length;if(!n)return e(!0);const r=setTimeout((()=>{A&&A>0&&e(!1)}),A);t.forEach((A=>{dm(A).then((()=>{--n||(clearTimeout(r),e(!0))}),i)}))}))}}})(A.bufferSize||64)){let i={};return{send:function(n){const r=[];if(nm(n,((t,e)=>{const n=cm(e);!(function(A,t,e=Date.now()){return(function(A,t){return A[t]||A.all||0})(A,t)>e})(i,n)?r.push(t):A.recordDroppedEvent("ratelimit_backoff",n)})),0===r.length)return dm({});const s=em(n[0],r),o=t=>{nm(s,((e,i)=>{A.recordDroppedEvent(t,cm(i))}))};return e.add((()=>t({body:sm(s)}).then((A=>(void 0!==A.statusCode&&(A.statusCode<200||A.statusCode>=300)&&sp&&Sp.warn(`Sentry responded with status code ${A.statusCode} to sent event.`),i=(function(A,{statusCode:t,headers:e},i=Date.now()){const n={...A},r=e?.["x-sentry-rate-limits"],s=e?.["retry-after"];if(r)for(const o of r.trim().split(",")){const[A,t,,,e]=o.split(":",5),r=parseInt(A,10),s=1e3*(isNaN(r)?60:r);if(t)for(const o of t.split(";"))"metric_bucket"===o&&e&&!e.split(";").includes("custom")||(n[o]=i+s);else n.all=i+s}else s?n.all=i+(function(A,t=Date.now()){const e=parseInt(`${A}`,10);if(!isNaN(e))return 1e3*e;const i=Date.parse(`${A}`);return isNaN(i)?6e4:i-t})(s,i):429===t&&(n.all=i+6e4);return n})(i,A),A)),(A=>{throw o("network_error"),sp&&Sp.error("Encountered error running transport request:",A),A})))).then((A=>A),(A=>{if(A===Pm)return sp&&Sp.error("Skipped sending event because buffer is full."),o("queue_overflow"),dm({});throw A}))},flush:A=>e.drain(A)}})(A,(function(n){const r=n.body.length;e+=r,i++;const s={body:n.body,method:"POST",referrerPolicy:"strict-origin",headers:A.headers,keepalive:e<=6e4&&i<15,...A.fetchOptions};if(!t)return VQ("fetch"),Bm("No fetch implementation available");try{return t(A.url,s).then((A=>(e-=r,i--,{statusCode:A.status,headers:{"x-sentry-rate-limits":A.headers.get("X-Sentry-Rate-Limits"),"retry-after":A.headers.get("Retry-After")}})))}catch(o){return VQ("fetch"),e-=r,i--,Bm(o)}}))}function $Q(A,t,e,i){const n={filename:A,function:"<anonymous>"===t?kv:t,in_app:!0};return void 0!==e&&(n.lineno=e),void 0!==i&&(n.colno=i),n}const WQ=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ZQ=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qQ=/\((\S*)(?::(\d+))(?::(\d+))\)/,zQ=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,AU=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tU=(function(...A){const t=A.sort(((A,t)=>A[0]-t[0])).map((A=>A[1]));return(A,e=0,i=0)=>{const n=[],r=A.split("\n");for(let s=e;s<r.length;s++){const A=r[s];if(A.length>1024)continue;const e=Tv.test(A)?A.replace(Tv,"$1"):A;if(!e.match(/\S*Error: /)){for(const A of t){const t=A(e);if(t){n.push(t);break}}if(n.length>=50+i)break}}return(function(A){if(!A.length)return[];const t=Array.from(A);return/sentryWrapped/.test(Ov(t).function||"")&&t.pop(),t.reverse(),Sv.test(Ov(t).function||"")&&(t.pop(),Sv.test(Ov(t).function||"")&&t.pop()),t.slice(0,50).map((A=>({...A,filename:A.filename||Ov(t).filename,function:A.function||kv})))})(n.slice(i))}})([30,A=>{const t=WQ.exec(A);if(t){const[,A,e,i]=t;return $Q(A,kv,+e,+i)}const e=ZQ.exec(A);if(e){if(e[2]&&0===e[2].indexOf("eval")){const A=qQ.exec(e[2]);A&&(e[2]=A[1],e[3]=A[2],e[4]=A[3])}const[A,t]=eU(e[1]||kv,e[2]);return $Q(t,A,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}}],[50,A=>{const t=zQ.exec(A);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const A=AU.exec(t[3]);A&&(t[1]=t[1]||"eval",t[3]=A[1],t[4]=A[2],t[5]="")}let A=t[3],e=t[1]||kv;return[e,A]=eU(e,A),$Q(A,e,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),eU=(A,t)=>{const e=-1!==A.indexOf("safari-extension"),i=-1!==A.indexOf("safari-web-extension");return e||i?[-1!==A.indexOf("@")?A.split("@")[0]:kv,e?`safari-extension:${t}`:`safari-web-extension:${t}`]:[A,t]},iU="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,nU=(A={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...A};return{name:"Breadcrumbs",setup(A){var e;t.console&&(function(A){const t="console";_v(t,A),Rv(t,oQ)})((function(A){return function(t){if(Bv()!==A)return;const e={category:"console",data:{arguments:t.args,logger:"console"},level:(i=t.level,"warn"===i?"warning":["fatal","error","warning","log","info","debug"].includes(i)?i:"log"),message:Kp(t.args," ")};var i;if("assert"===t.level){if(!1!==t.args[0])return;e.message=`Assertion failed: ${Kp(t.args.slice(1)," ")||"console.assert"}`,e.data.arguments=t.args.slice(1)}Ym(e,{input:t.args,level:t.level})}})(A)),t.dom&&(e=(function(A,t){return function(e){if(Bv()!==A)return;let i,n,r="object"==typeof t?t.serializeAttribute:void 0,s="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;s&&s>1024&&(iU&&Sp.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof r&&(r=[r]);try{const A=e.event,t=(function(A){return!!A&&!!A.target})(A)?A.target:A;i=bp(t,{keyAttrs:r,maxStringLength:s}),n=(function(A){if(!yp.HTMLElement)return null;let t=A;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null})(t)}catch(a){i="<unknown>"}if(0===i.length)return;const o={category:`ui.${e.name}`,message:i};n&&(o.data={"ui.component_name":n}),Ym(o,{event:e.event,name:e.name,global:e.global})}})(A,t.dom),_v("dom",e),Rv("dom",RQ)),t.xhr&&(function(A){_v("xhr",A),Rv("xhr",XQ)})((function(A){return function(t){if(Bv()!==A)return;const{startTimestamp:e,endTimestamp:i}=t,n=t.xhr[JQ];if(!e||!i||!n)return;const{method:r,url:s,status_code:o,body:a}=n,c={method:r,url:s,status_code:o},u={xhr:t.xhr,input:a,startTimestamp:e,endTimestamp:i},h={category:"xhr",data:c,type:"http",level:dQ(o)};A.emit("beforeOutgoingRequestBreadcrumb",h,u),Ym(h,u)}})(A)),t.fetch&&(function(A,t){const e="fetch";_v(e,A),Rv(e,(()=>(function(A,t=!1){t&&!(function(){if("string"==typeof EdgeRuntime)return!0;if(!(function(){if(!("fetch"in BQ))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch(A){return!1}})())return!1;if(fQ(BQ.fetch))return!0;let A=!1;const t=BQ.document;if(t&&"function"==typeof t.createElement)try{const e=t.createElement("iframe");e.hidden=!0,t.head.appendChild(e),e.contentWindow?.fetch&&(A=fQ(e.contentWindow.fetch)),t.head.removeChild(e)}catch(e){sp&&Sp.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return A})()||Mp(ap,"fetch",(function(t){return function(...e){const i=new Error,{method:n,url:r}=(function(A){if(0===A.length)return{method:"GET",url:""};if(2===A.length){const[t,e]=A;return{url:gQ(t),method:wQ(e,"method")?String(e.method).toUpperCase():"GET"}}const t=A[0];return{url:gQ(t),method:wQ(t,"method")?String(t.method).toUpperCase():"GET"}})(e),s={args:e,fetchData:{method:n,url:r},startTimestamp:1e3*Wp(),virtualError:i,headers:pQ(e)};return A||Nv("fetch",{...s}),t.apply(ap,e).then((async t=>(A?A(t):Nv("fetch",{...s,endTimestamp:1e3*Wp(),response:t}),t)),(A=>{if(Nv("fetch",{...s,endTimestamp:1e3*Wp(),error:A}),dp(A)&&void 0===A.stack&&(A.stack=i.stack,Lp(A,"framesToPop",1)),A instanceof TypeError&&("Failed to fetch"===A.message||"Load failed"===A.message||"NetworkError when attempting to fetch resource."===A.message))try{const t=new URL(s.fetchData.url);A.message=`${A.message} (${t.host})`}catch{}throw A}))}}))})(void 0,t)))})((function(A){return function(t){if(Bv()!==A)return;const{startTimestamp:e,endTimestamp:i}=t;if(i&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.fetchData.method,t.fetchData.url,t.error){const n=t.fetchData,r={data:t.error,input:t.args,startTimestamp:e,endTimestamp:i},s={category:"fetch",data:n,level:"error",type:"http"};A.emit("beforeOutgoingRequestBreadcrumb",s,r),Ym(s,r)}else{const n=t.response,r={...t.fetchData,status_code:n?.status};t.fetchData.request_body_size,t.fetchData.response_body_size;const s={input:t.args,response:n,startTimestamp:e,endTimestamp:i},o={category:"fetch",data:r,type:"http",level:dQ(r.status_code)};A.emit("beforeOutgoingRequestBreadcrumb",o,s),Ym(o,s)}}})(A)),t.history&&jQ((function(A){return function(t){if(Bv()!==A)return;let e=t.from,i=t.to;const n=lQ(vQ.location.href);let r=e?lQ(e):void 0;const s=lQ(i);r?.path||(r=n),n.protocol===s.protocol&&n.host===s.host&&(i=s.relative),n.protocol===r.protocol&&n.host===r.host&&(e=r.relative),Ym({category:"navigation",data:{from:e,to:i}})}})(A)),t.sentry&&A.on("beforeSendEvent",(function(A){return function(t){Bv()===A&&Ym({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Vp(t)},{event:t})}})(A))}}},rU=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],sU=(A={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...A};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Mp(vQ,"setTimeout",oU),t.setInterval&&Mp(vQ,"setInterval",oU),t.requestAnimationFrame&&Mp(vQ,"requestAnimationFrame",aU),t.XMLHttpRequest&&"XMLHttpRequest"in vQ&&Mp(XMLHttpRequest.prototype,"send",cU);const A=t.eventTarget;A&&(Array.isArray(A)?A:rU).forEach(uU)}}};function oU(A){return function(...t){const e=t[0];return t[0]=UQ(e,{mechanism:{data:{function:Dv(A)},handled:!1,type:"instrument"}}),A.apply(this,t)}}function aU(A){return function(t){return A.apply(this,[UQ(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Dv(A)},handled:!1,type:"instrument"}})])}}function cU(A){return function(...t){const e=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((A=>{A in e&&"function"==typeof e[A]&&Mp(e,A,(function(t){const e={mechanism:{data:{function:A,handler:Dv(t)},handled:!1,type:"instrument"}},i=_p(t);return i&&(e.mechanism.data.handler=Dv(i)),UQ(t,e)}))})),A.apply(this,t)}}function uU(A){const t=vQ,e=t[A]?.prototype;e?.hasOwnProperty?.("addEventListener")&&(Mp(e,"addEventListener",(function(t){return function(e,i,n){try{"function"==typeof i.handleEvent&&(i.handleEvent=UQ(i.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Dv(i),target:A},handled:!1,type:"instrument"}}))}catch{}return t.apply(this,[e,UQ(i,{mechanism:{data:{function:"addEventListener",handler:Dv(i),target:A},handled:!1,type:"instrument"}}),n])}})),Mp(e,"removeEventListener",(function(A){return function(t,e,i){try{const n=e.Re;n&&A.call(this,t,n,i)}catch(n){}return A.call(this,t,e,i)}})))}const hU=(A={})=>{const t={onerror:!0,onunhandledrejection:!0,...A};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(A){t.onerror&&((function(A){!(function(){const t="error";_v(t,(t=>{const{stackParser:e,attachStacktrace:i}=dU();if(Bv()!==A||QQ())return;const{msg:n,url:r,line:s,column:o,error:a}=t,c=(function(A,t,e,i){const n=A.exception=A.exception||{},r=n.values=n.values||[],s=r[0]=r[0]||{},o=s.stacktrace=s.stacktrace||{},a=o.frames=o.frames||[],c=i,u=e,h=gp(t)&&t.length>0?t:Ip();return 0===a.length&&a.push({colno:c,filename:h,function:kv,in_app:!0,lineno:u}),A})(kQ(e,a||n,void 0,i,!1),r,s,o);c.level="error",Cm(c,{originalException:a,mechanism:{handled:!1,type:"onerror"}})})),Rv(t,Gv)})()})(A),lU("onerror")),t.onunhandledrejection&&((function(A){!(function(){const t="unhandledrejection";_v(t,(t=>{const{stackParser:e,attachStacktrace:i}=dU();if(Bv()!==A||QQ())return;const n=(function(A){if(vp(A))return A;try{if("reason"in A)return A.reason;if("detail"in A&&"reason"in A.detail)return A.detail.reason}catch{}return A})(t),r=vp(n)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`}]}}:kQ(e,n,void 0,i,!0);r.level="error",Cm(r,{originalException:n,mechanism:{handled:!1,type:"onunhandledrejection"}})})),Rv(t,Vv)})()})(A),lU("onunhandledrejection"))}}};function lU(A){iU&&Sp.log(`Global Handler attached: ${A}`)}function dU(){const A=Bv();return A?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const BU=(A={})=>{const t=A.limit||5,e=A.key||"cause";return{name:"LinkedErrors",preprocessEvent(A,i,n){iQ(CQ,n.getOptions().stackParser,e,t,A,i)}}};let fU=null,wU={};function gU(A,t){fU||(fU=(function(){const A=[AQ(),Zm(),sU(),nU(),hU(),BU(),aQ(),{name:"HttpContext",preprocessEvent(A){if(!vQ.navigator&&!vQ.location&&!vQ.document)return;const t=(function(){const A=Ip(),{referrer:t}=vQ.document||{},{userAgent:e}=vQ.navigator||{};return{url:A,headers:{...t&&{Referer:t},...e&&{"User-Agent":e}}}})(),e={...t.headers,...A.request?.headers};A.request={...t,...A.request,headers:e}}},{name:"BrowserSession",setupOnce(){void 0!==vQ.document?(Fm({ignoreDuration:!0}),Em(),jQ((({from:A,to:t})=>{void 0!==A&&A!==t&&(Fm({ignoreDuration:!0}),Em())}))):iU&&Sp.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}].filter((A=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers","HttpContext"].includes(A.name))),t=new OQ({dsn:"https://ac54bd10eac67be2dafbc346e704e4d4@o4507251798835200.ingest.us.sentry.io/4509409566392320",environment:"production",transport:YQ,stackParser:tU,integrations:A,beforeSend(A,t){const e=t.originalException;if(e instanceof Error){if(e.message.includes("Failed to fetch")||e.message.includes("Network request failed")||e.message.includes("Load failed"))return null;if(e.message.includes("Permission denied")||e.message.includes("NotAllowedError"))return null}return A},release:process.env.npm_package_version||"0.6.2"}),e=new nv;return e.setClient(t),t.init(),e})()),fU&&dv((e=>{Object.entries(wU).forEach((([A,t])=>{void 0!==t&&e.setTag(A,String(t))})),t&&(Object.entries(t).forEach((([A,t])=>{void 0!==t&&e.setTag(A,String(t))})),(t.userId||t.userEmail)&&e.setUser({id:t.userId,email:t.userEmail,...t.userMetadata}),(t.eventType||t.eventData||t.userJourney)&&e.setContext("eventContext",{eventType:t.eventType,eventData:t.eventData,userJourney:t.userJourney,timestamp:(new Date).toISOString()})),fU.captureException(A)}))}function pU(A,t,e){wU.eventType=A,wU.eventData=t,wU.userJourney||(wU.userJourney=[]);const i=`${(new Date).toISOString()}: ${A}${e?` (${e})`:""}`;wU.userJourney.push(i),wU.userJourney.length>10&&(wU.userJourney=wU.userJourney.slice(-10))}function vU(A){wU={...wU,...A}}function mU(A,t,e){return async(...i)=>{try{pU(`${t}_started`,{componentName:e},e);const n=await A(...i);return pU(`${t}_completed`,{componentName:e},e),n}catch(n){throw gU(n,{...wU,componentName:e,handlerName:t,eventType:`${t}_failed`,eventData:{error:n instanceof Error?n.message:String(n)}}),n}}}function QU(A,t,e){return(...i)=>{try{pU(`${t}_started`,{componentName:e},e);const n=A(...i);return pU(`${t}_completed`,{componentName:e},e),n}catch(n){throw gU(n,{...wU,componentName:e,handlerName:t,eventType:`${t}_failed`,eventData:{error:n instanceof Error?n.message:String(n)}}),n}}}function UU(A){return{trackLifecycle:(t,e)=>{try{pU(`${A}_${t}`,{},A),e()}catch(i){throw gU(i,{componentName:A,lifecycle:t,eventType:`${A}_${t}_failed`}),i}},trackRender:t=>{try{return t()}catch(e){return gU(e,{componentName:A,lifecycle:"render",eventType:`${A}_render_failed`}),Mg`<div>Error rendering ${A}</div>`}},setContext:()=>{vU({componentName:A}),pU(`${A}_initialized`,{},A)}}}const CU="session_data",FU=new class{constructor(A){this.namespace=A}getItem(A){return localStorage.getItem(`${this.namespace}.${A}`)}setItem(A,t){localStorage.setItem(`${this.namespace}.${A}`,t)}removeItem(A){localStorage.removeItem(`${this.namespace}.${A}`)}clear(){for(let A=0;A<localStorage.length;A++){const t=localStorage.key(A);t&&t.startsWith(`${this.namespace}.`)&&localStorage.removeItem(t)}}}("io.obi.widget");var yU=Object.defineProperty,bU=Object.getOwnPropertyDescriptor,EU=(A,t,e,i)=>{for(var n,r=i>1?void 0:i?bU(t,e):t,s=A.length-1;s>=0;s--)(n=A[s])&&(r=(i?n(t,e,r):n(r))||r);return i&&r&&yU(t,e,r),r};class IU extends Ap{constructor(){super(...arguments),this.id="",this.isActive=!1,this.isSpecial=!1}handleClick(A){A.preventDefault(),A.stopPropagation();const t=new CustomEvent("obi-nav-icon-click",{detail:{id:this.id,isActive:!this.isActive},bubbles:!0,composed:!0});this.dispatchEvent(t),this.onClick&&this.onClick(this.id,!this.isActive)}render(){return Mg`
|
|
1
|
+
!(function(A){"use strict";const t="https://app.coragents.ai/api",e=/\{[^{}]+\}/g;function i(A,t,e){if(null==t)return"";if("object"==typeof t)throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${A}=${!0===e?.allowReserved?t:encodeURIComponent(t)}`}function n(A,t,e){if(!t||"object"!=typeof t)return"";const n=[],s={simple:",",label:".",matrix:";"}[e.style]||"&";if("deepObject"!==e.style&&!1===e.explode){for(const A in t)n.push(A,!0===e.allowReserved?t[A]:encodeURIComponent(t[A]));const i=n.join(",");switch(e.style){case"form":return`${A}=${i}`;case"label":return`.${i}`;case"matrix":return`;${A}=${i}`;default:return i}}for(const o in t){const s="deepObject"===e.style?`${A}[${o}]`:o;n.push(i(s,t[o],e))}const r=n.join(s);return"label"===e.style||"matrix"===e.style?`${s}${r}`:r}function s(A,t,e){if(!Array.isArray(t))return"";if(!1===e.explode){const i={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[e.style]||",",n=(!0===e.allowReserved?t:t.map((A=>encodeURIComponent(A)))).join(i);switch(e.style){case"simple":return n;case"label":return`.${n}`;case"matrix":return`;${A}=${n}`;default:return`${A}=${n}`}}const n={simple:",",label:".",matrix:";"}[e.style]||"&",s=[];for(const r of t)"simple"===e.style||"label"===e.style?s.push(!0===e.allowReserved?r:encodeURIComponent(r)):s.push(i(A,r,e));return"label"===e.style||"matrix"===e.style?`${n}${s.join(n)}`:s.join(n)}function r(A){return function(t){const e=[];if(t&&"object"==typeof t)for(const r in t){const o=t[r];if(null!=o)if(Array.isArray(o)){if(0===o.length)continue;e.push(s(r,o,{style:"form",explode:!0,...A?.array,allowReserved:A?.allowReserved||!1}))}else"object"!=typeof o?e.push(i(r,o,A)):e.push(n(r,o,{style:"deepObject",explode:!0,...A?.object,allowReserved:A?.allowReserved||!1}))}return e.join("&")}}function o(A){return A instanceof FormData?A:JSON.stringify(A)}function a(...A){const t=new Headers;for(const e of A){if(!e||"object"!=typeof e)continue;const A=e instanceof Headers?e.entries():Object.entries(e);for(const[e,i]of A)if(null===i)t.delete(e);else if(Array.isArray(i))for(const A of i)t.append(e,A);else void 0!==i&&t.set(e,i)}return t}function c(A){return A.endsWith("/")?A.substring(0,A.length-1):A}class u{constructor(A){this.client=(function(A){let{baseUrl:t="",Request:u=globalThis.Request,fetch:h=globalThis.fetch,querySerializer:l,bodySerializer:d,headers:B,...f}={...A};t=c(t);const w=[];async function g(A,g){const{baseUrl:p,fetch:v=h,Request:m=u,headers:Q,params:C={},parseAs:U="json",querySerializer:F,bodySerializer:y=d??o,body:b,...E}=g||{};p&&(t=c(p));let I="function"==typeof l?l:r(l);F&&(I="function"==typeof F?F:r({..."object"==typeof l?l:{},...F}));const k=void 0===b?void 0:y(b),H=void 0===k||k instanceof FormData?{}:{"Content-Type":"application/json"},S={redirect:"follow",...f,...E,body:k,headers:a(H,B,Q,C.header)};let T,O,K=new u((function(A,t){let r=`${t.baseUrl}${A}`;t.params?.path&&(r=(function(A,t){let r=A;for(const o of A.match(e)??[]){let A=o.substring(1,o.length-1),e=!1,a="simple";if(A.endsWith("*")&&(e=!0,A=A.substring(0,A.length-1)),A.startsWith(".")?(a="label",A=A.substring(1)):A.startsWith(";")&&(a="matrix",A=A.substring(1)),!t||void 0===t[A]||null===t[A])continue;const c=t[A];r=Array.isArray(c)?r.replace(o,s(A,c,{style:a,explode:e})):"object"!=typeof c?"matrix"!==a?r.replace(o,"label"===a?`.${encodeURIComponent(c)}`:encodeURIComponent(c)):r.replace(o,`;${i(A,c)}`):r.replace(o,n(A,c,{style:a,explode:e}))}return r})(r,t.params.path));let o=t.querySerializer(t.params.query??{});return o.startsWith("?")&&(o=o.substring(1)),o&&(r+=`?${o}`),r})(A,{baseUrl:t,params:C,querySerializer:I}),S);for(const t in E)t in K||(K[t]=E[t]);if(w.length){T=Math.random().toString(36).slice(2,11),O=Object.freeze({baseUrl:t,fetch:v,parseAs:U,querySerializer:I,bodySerializer:y});for(const t of w)if(t&&"object"==typeof t&&"function"==typeof t.onRequest){const e=await t.onRequest({request:K,schemaPath:A,params:C,options:O,id:T});if(e){if(!(e instanceof u))throw new Error("onRequest: must return new Request() when modifying the request");K=e}}}let D=await v(K);if(w.length)for(let t=w.length-1;t>=0;t--){const e=w[t];if(e&&"object"==typeof e&&"function"==typeof e.onResponse){const t=await e.onResponse({request:K,response:D,schemaPath:A,params:C,options:O,id:T});if(t){if(!(t instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");D=t}}}if(204===D.status||"0"===D.headers.get("Content-Length"))return D.ok?{data:{},response:D}:{error:{},response:D};if(D.ok)return"stream"===U?{data:D.body,response:D}:{data:await D[U](),response:D};let M=await D.text();try{M=JSON.parse(M)}catch{}return{error:M,response:D}}return{GET:(A,t)=>g(A,{...t,method:"GET"}),PUT:(A,t)=>g(A,{...t,method:"PUT"}),POST:(A,t)=>g(A,{...t,method:"POST"}),DELETE:(A,t)=>g(A,{...t,method:"DELETE"}),OPTIONS:(A,t)=>g(A,{...t,method:"OPTIONS"}),HEAD:(A,t)=>g(A,{...t,method:"HEAD"}),PATCH:(A,t)=>g(A,{...t,method:"PATCH"}),TRACE:(A,t)=>g(A,{...t,method:"TRACE"}),use(...A){for(const t of A)if(t){if("object"!=typeof t||!("onRequest"in t)&&!("onResponse"in t))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");w.push(t)}},eject(...A){for(const t of A){const A=w.indexOf(t);-1!==A&&w.splice(A,1)}}}})({baseUrl:A.baseUrl,headers:A.headers,fetch:A.fetch})}setAuthToken(A){this.client.use({onRequest:({request:t})=>(t.headers.set("Authorization",`Bearer ${A}`),t)})}setApiToken(A){this.client.use({onRequest:({request:t})=>(t.headers.set("Authorization",`Token ${A}`),t)})}async getAuthUrl(A){return await this.client.GET("/auth/{type}",{params:{path:{type:A}}})}async getConnectUrl(A){return await this.client.GET("/connect/{type}",{params:{path:{type:A}}})}async logout(){return await this.client.POST("/logout")}async getCurrentUser(){return await this.client.GET("/me")}async createPresignedUploadUrl(A){return await this.client.POST("/files",{body:A})}async createKnowledgeBlock(A){return await this.client.POST("/knowledge",{body:A})}async listOnboardees(){return await this.client.GET("/onboardees")}async getOnboardeeWhitelistedDomains(A){return await this.client.GET("/onboardees/{id}/whitelisted-domains",{params:{path:{id:A}}})}async listPlans(){return await this.client.GET("/plans")}async createPlan(A){return await this.client.POST("/plans",{body:A})}async getPlan(A){return await this.client.GET("/plans/{id}",{params:{path:{id:A}}})}async replacePlan(A,t){return await this.client.PUT("/plans/{id}",{params:{path:{id:A}},body:t})}async updatePlan(A,t){return await this.client.PATCH("/plans/{id}",{params:{path:{id:A}},body:t})}async getPlanVideoUrl(A){return await this.client.GET("/plans/{id}/video-url",{params:{path:{id:A}}})}async listSessions(A){return await this.client.GET("/sessions",{params:{query:A?{token:A}:{}}})}async createSession(A){return await this.client.POST("/sessions",{body:A})}async getSession(A){return await this.client.GET("/sessions/{id}",{params:{path:{id:A}}})}async startSession(A,t){return await this.client.GET("/sessions/{id}/start-session",{params:{path:{id:A},query:t?{token:t}:{}}})}async getSessionRecording(A){return await this.client.GET("/sessions/{id}/recording",{params:{path:{id:A}}})}async getSessionProductUrl(A){return await this.client.GET("/sessions/{id}/product-url",{params:{path:{id:A}}})}async getJoinToken(A,{skipIntro:t}={}){return await this.client.GET("/join-token",{params:{query:{token:A,...t&&{skip_intro:"true"}}}})}getClient(){return this.client}}function h(A){return A&&A.A&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var l={exports:{}};!(function(A){var t=Object.prototype.hasOwnProperty,e="~";function i(){}function n(A,t,e){this.fn=A,this.context=t,this.once=e||!1}function s(A,t,i,s,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,s||A,r),a=e?e+t:t;return A.B[a]?A.B[a].fn?A.B[a]=[A.B[a],o]:A.B[a].push(o):(A.B[a]=o,A.U++),A}function r(A,t){0===--A.U?A.B=new i:delete A.B[t]}function o(){this.B=new i,this.U=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(e=!1)),o.prototype.eventNames=function(){var A,i,n=[];if(0===this.U)return n;for(i in A=this.B)t.call(A,i)&&n.push(e?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(A)):n},o.prototype.listeners=function(A){var t=e?e+A:A,i=this.B[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,r=new Array(s);n<s;n++)r[n]=i[n].fn;return r},o.prototype.listenerCount=function(A){var t=e?e+A:A,i=this.B[t];return i?i.fn?1:i.length:0},o.prototype.emit=function(A,t,i,n,s,r){var o=e?e+A:A;if(!this.B[o])return!1;var a,c,u=this.B[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(A,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,n),!0;case 5:return u.fn.call(u.context,t,i,n,s),!0;case 6:return u.fn.call(u.context,t,i,n,s,r),!0}for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var l,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(A,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,n);break;default:if(!a)for(l=1,a=new Array(h-1);l<h;l++)a[l-1]=arguments[l];u[c].fn.apply(u[c].context,a)}}return!0},o.prototype.on=function(A,t,e){return s(this,A,t,e,!1)},o.prototype.once=function(A,t,e){return s(this,A,t,e,!0)},o.prototype.removeListener=function(A,t,i,n){var s=e?e+A:A;if(!this.B[s])return this;if(!t)return r(this,s),this;var o=this.B[s];if(o.fn)o.fn!==t||n&&!o.once||i&&o.context!==i||r(this,s);else{for(var a=0,c=[],u=o.length;a<u;a++)(o[a].fn!==t||n&&!o[a].once||i&&o[a].context!==i)&&c.push(o[a]);c.length?this.B[s]=1===c.length?c[0]:c:r(this,s)}return this},o.prototype.removeAllListeners=function(A){var t;return A?(t=e?e+A:A,this.B[t]&&r(this,t)):(this.B=new i,this.U=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,A.exports=o})(l);const d=h(l.exports);function B(A,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(e){if("default"!==e&&!(e in A)){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(A,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})}}))})),Object.freeze(A)}var f=Object.defineProperty,w=(A,t,e)=>((A,t,e)=>t in A?f(A,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):A[t]=e)(A,"symbol"!=typeof t?t+"":t,e);let g=class{constructor(){w(this,"_locking"),w(this,"_locks"),this.F=Promise.resolve(),this.I=0}isLocked(){return this.I>0}lock(){let A;this.I+=1;const t=new Promise((t=>A=()=>{this.I-=1,t()})),e=this.F.then((()=>A));return this.F=this.F.then((()=>t)),e}};function p(A,t){if(!A)throw new Error(t)}function v(A){if("number"!=typeof A)throw new Error("invalid int 32: "+typeof A);if(!Number.isInteger(A)||A>2147483647||A<-2147483648)throw new Error("invalid int 32: "+A)}function m(A){if("number"!=typeof A)throw new Error("invalid uint 32: "+typeof A);if(!Number.isInteger(A)||A>4294967295||A<0)throw new Error("invalid uint 32: "+A)}function Q(A){if("number"!=typeof A)throw new Error("invalid float 32: "+typeof A);if(Number.isFinite(A)&&(A>34028234663852886e22||A<-34028234663852886e22))throw new Error("invalid float 32: "+A)}const C=Symbol("@bufbuild/protobuf/enum-type");function U(A,t,e,i){A[C]=F(t,e.map((t=>({no:t.no,name:t.name,localName:A[t.no]}))))}function F(A,t,e){const i=Object.create(null),n=Object.create(null),s=[];for(const r of t){const A=y(r);s.push(A),i[r.name]=A,n[r.no]=A}return{typeName:A,values:s,findName:A=>i[A],findNumber:A=>n[A]}}function y(A){return"localName"in A?A:Object.assign(Object.assign({},A),{localName:A.name})}class b{equals(A){return this.getType().runtime.util.equals(this.getType(),this,A)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(A,t){const e=this.getType().runtime.bin,i=e.makeReadOptions(t);return e.readMessage(this,i.readerFactory(A),A.byteLength,i),this}fromJson(A,t){const e=this.getType(),i=e.runtime.json,n=i.makeReadOptions(t);return i.readMessage(e,A,n,this),this}fromJsonString(A,t){let e;try{e=JSON.parse(A)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(e,t)}toBinary(A){const t=this.getType().runtime.bin,e=t.makeWriteOptions(A),i=e.writerFactory();return t.writeMessage(this,i,e),i.finish()}toJson(A){const t=this.getType().runtime.json,e=t.makeWriteOptions(A);return t.writeMessage(this,e)}toJsonString(A){var t;const e=this.toJson(A);return JSON.stringify(e,null,null!==(t=null==A?void 0:A.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function E(){let A=0,t=0;for(let i=0;i<28;i+=7){let e=this.buf[this.pos++];if(A|=(127&e)<<i,!(128&e))return this.assertBounds(),[A,t]}let e=this.buf[this.pos++];if(A|=(15&e)<<28,t=(112&e)>>4,!(128&e))return this.assertBounds(),[A,t];for(let i=3;i<=31;i+=7){let e=this.buf[this.pos++];if(t|=(127&e)<<i,!(128&e))return this.assertBounds(),[A,t]}throw new Error("invalid varint")}function I(A,t,e){for(let s=0;s<28;s+=7){const i=A>>>s,n=!(i>>>7==0&&0==t),r=255&(n?128|i:i);if(e.push(r),!n)return}const i=A>>>28&15|(7&t)<<4,n=!!(t>>3);if(e.push(255&(n?128|i:i)),n){for(let A=3;A<31;A+=7){const i=t>>>A,n=!(i>>>7==0),s=255&(n?128|i:i);if(e.push(s),!n)return}e.push(t>>>31&1)}}const k=4294967296;function H(A){const t="-"===A[0];t&&(A=A.slice(1));const e=1e6;let i=0,n=0;function s(t,s){const r=Number(A.slice(t,s));n*=e,i=i*e+r,i>=k&&(n+=i/k|0,i%=k)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),t?O(i,n):T(i,n)}function S(A,t){if(({lo:A,hi:t}=(function(A,t){return{lo:A>>>0,hi:t>>>0}})(A,t)),t<=2097151)return String(k*t+A);const e=16777215&(A>>>24|t<<8),i=t>>16&65535;let n=(16777215&A)+6777216*e+6710656*i,s=e+8147497*i,r=2*i;const o=1e7;return n>=o&&(s+=Math.floor(n/o),n%=o),s>=o&&(r+=Math.floor(s/o),s%=o),r.toString()+K(s)+K(n)}function T(A,t){return{lo:0|A,hi:0|t}}function O(A,t){return t=~t,A?A=1+~A:t+=1,T(A,t)}const K=A=>{const t=String(A);return"0000000".slice(t.length)+t};function D(A,t){if(A>=0){for(;A>127;)t.push(127&A|128),A>>>=7;t.push(A)}else{for(let e=0;e<9;e++)t.push(127&A|128),A>>=7;t.push(1)}}function M(){let A=this.buf[this.pos++],t=127&A;if(!(128&A))return this.assertBounds(),t;if(A=this.buf[this.pos++],t|=(127&A)<<7,!(128&A))return this.assertBounds(),t;if(A=this.buf[this.pos++],t|=(127&A)<<14,!(128&A))return this.assertBounds(),t;if(A=this.buf[this.pos++],t|=(127&A)<<21,!(128&A))return this.assertBounds(),t;A=this.buf[this.pos++],t|=(15&A)<<28;for(let e=5;128&A&&e<10;e++)A=this.buf[this.pos++];if(128&A)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const L=(function(){const A=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof A.getBigInt64&&"function"==typeof A.getBigUint64&&"function"==typeof A.setBigInt64&&"function"==typeof A.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),e=BigInt("9223372036854775807"),i=BigInt("0"),n=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(A){const i="bigint"==typeof A?A:BigInt(A);if(i>e||i<t)throw new Error("int64 invalid: ".concat(A));return i},uParse(A){const t="bigint"==typeof A?A:BigInt(A);if(t>n||t<i)throw new Error("uint64 invalid: ".concat(A));return t},enc(t){return A.setBigInt64(0,this.parse(t),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},uEnc(t){return A.setBigInt64(0,this.uParse(t),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},dec:(t,e)=>(A.setInt32(0,t,!0),A.setInt32(4,e,!0),A.getBigInt64(0,!0)),uDec:(t,e)=>(A.setInt32(0,t,!0),A.setInt32(4,e,!0),A.getBigUint64(0,!0))}}const t=A=>p(/^-?[0-9]+$/.test(A),"int64 invalid: ".concat(A)),e=A=>p(/^[0-9]+$/.test(A),"uint64 invalid: ".concat(A));return{zero:"0",supported:!1,parse:A=>("string"!=typeof A&&(A=A.toString()),t(A),A),uParse:A=>("string"!=typeof A&&(A=A.toString()),e(A),A),enc:A=>("string"!=typeof A&&(A=A.toString()),t(A),H(A)),uEnc:A=>("string"!=typeof A&&(A=A.toString()),e(A),H(A)),dec:(A,t)=>(function(A,t){let e=T(A,t);const i=2147483648&e.hi;i&&(e=O(e.lo,e.hi));const n=S(e.lo,e.hi);return i?"-"+n:n})(A,t),uDec:(A,t)=>S(A,t)}})();var x,_,N,R,j,G;function P(A,t,e){if(t===e)return!0;if(A==x.BYTES){if(!(t instanceof Uint8Array&&e instanceof Uint8Array))return!1;if(t.length!==e.length)return!1;for(let A=0;A<t.length;A++)if(t[A]!==e[A])return!1;return!0}switch(A){case x.UINT64:case x.FIXED64:case x.INT64:case x.SFIXED64:case x.SINT64:return t==e}return!1}function V(A,t){switch(A){case x.BOOL:return!1;case x.UINT64:case x.FIXED64:case x.INT64:case x.SFIXED64:case x.SINT64:return 0==t?L.zero:"0";case x.DOUBLE:case x.FLOAT:return 0;case x.BYTES:return new Uint8Array(0);case x.STRING:return"";default:return 0}}function J(A,t){switch(A){case x.BOOL:return!1===t;case x.STRING:return""===t;case x.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(_=x||(x={}))[_.DOUBLE=1]="DOUBLE",_[_.FLOAT=2]="FLOAT",_[_.INT64=3]="INT64",_[_.UINT64=4]="UINT64",_[_.INT32=5]="INT32",_[_.FIXED64=6]="FIXED64",_[_.FIXED32=7]="FIXED32",_[_.BOOL=8]="BOOL",_[_.STRING=9]="STRING",_[_.BYTES=12]="BYTES",_[_.UINT32=13]="UINT32",_[_.SFIXED32=15]="SFIXED32",_[_.SFIXED64=16]="SFIXED64",_[_.SINT32=17]="SINT32",_[_.SINT64=18]="SINT64",(R=N||(N={}))[R.BIGINT=0]="BIGINT",R[R.STRING=1]="STRING",(G=j||(j={}))[G.Varint=0]="Varint",G[G.Bit64=1]="Bit64",G[G.LengthDelimited=2]="LengthDelimited",G[G.StartGroup=3]="StartGroup",G[G.EndGroup=4]="EndGroup",G[G.Bit32=5]="Bit32";class X{constructor(A){this.stack=[],this.textEncoder=null!=A?A:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let A=0;for(let i=0;i<this.chunks.length;i++)A+=this.chunks[i].length;let t=new Uint8Array(A),e=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],e),e+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let A=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(A.byteLength),this.raw(A)}tag(A,t){return this.uint32((A<<3|t)>>>0)}raw(A){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(A),this}uint32(A){for(m(A);A>127;)this.buf.push(127&A|128),A>>>=7;return this.buf.push(A),this}int32(A){return v(A),D(A,this.buf),this}bool(A){return this.buf.push(A?1:0),this}bytes(A){return this.uint32(A.byteLength),this.raw(A)}string(A){let t=this.textEncoder.encode(A);return this.uint32(t.byteLength),this.raw(t)}float(A){Q(A);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,A,!0),this.raw(t)}double(A){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,A,!0),this.raw(t)}fixed32(A){m(A);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,A,!0),this.raw(t)}sfixed32(A){v(A);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,A,!0),this.raw(t)}sint32(A){return v(A),D(A=(A<<1^A>>31)>>>0,this.buf),this}sfixed64(A){let t=new Uint8Array(8),e=new DataView(t.buffer),i=L.enc(A);return e.setInt32(0,i.lo,!0),e.setInt32(4,i.hi,!0),this.raw(t)}fixed64(A){let t=new Uint8Array(8),e=new DataView(t.buffer),i=L.uEnc(A);return e.setInt32(0,i.lo,!0),e.setInt32(4,i.hi,!0),this.raw(t)}int64(A){let t=L.enc(A);return I(t.lo,t.hi,this.buf),this}sint64(A){let t=L.enc(A),e=t.hi>>31;return I(t.lo<<1^e,(t.hi<<1|t.lo>>>31)^e,this.buf),this}uint64(A){let t=L.uEnc(A);return I(t.lo,t.hi,this.buf),this}}class ${constructor(A,t){this.varint64=E,this.uint32=M,this.buf=A,this.len=A.length,this.pos=0,this.view=new DataView(A.buffer,A.byteOffset,A.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let A=this.uint32(),t=A>>>3,e=7&A;if(t<=0||e<0||e>5)throw new Error("illegal tag: field no "+t+" wire type "+e);return[t,e]}skip(A,t){let e=this.pos;switch(A){case j.Varint:for(;128&this.buf[this.pos++];);break;case j.Bit64:this.pos+=4;case j.Bit32:this.pos+=4;break;case j.LengthDelimited:let e=this.uint32();this.pos+=e;break;case j.StartGroup:for(;;){const[A,e]=this.tag();if(e===j.EndGroup){if(void 0!==t&&A!==t)throw new Error("invalid end group tag");break}this.skip(e,A)}break;default:throw new Error("cant skip wire type "+A)}return this.assertBounds(),this.buf.subarray(e,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let A=this.uint32();return A>>>1^-(1&A)}int64(){return L.dec(...this.varint64())}uint64(){return L.uDec(...this.varint64())}sint64(){let[A,t]=this.varint64(),e=-(1&A);return A=(A>>>1|(1&t)<<31)^e,t=t>>>1^e,L.dec(A,t)}bool(){let[A,t]=this.varint64();return 0!==A||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return L.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return L.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 A=this.uint32(),t=this.pos;return this.pos+=A,this.assertBounds(),this.buf.subarray(t,t+A)}string(){return this.textDecoder.decode(this.bytes())}}function Y(A){const t=A.field.localName,e=Object.create(null);return e[t]=(function(A){const t=A.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return V(t.T,t.L);case"message":const A=t.T,e=new A;return A.fieldWrapper?A.fieldWrapper.unwrapField(e):e;case"map":throw"map fields are not allowed to be extensions"}})(A),[e,()=>e[t]]}let W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Z=[];for(let OU=0;OU<W.length;OU++)Z[W[OU].charCodeAt(0)]=OU;Z["-".charCodeAt(0)]=W.indexOf("+"),Z["_".charCodeAt(0)]=W.indexOf("/");const q={dec(A){let t=3*A.length/4;"="==A[A.length-2]?t-=2:"="==A[A.length-1]&&(t-=1);let e,i=new Uint8Array(t),n=0,s=0,r=0;for(let o=0;o<A.length;o++){if(e=Z[A.charCodeAt(o)],void 0===e)switch(A[o]){case"=":s=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:r=e,s=1;break;case 1:i[n++]=r<<2|(48&e)>>4,r=e,s=2;break;case 2:i[n++]=(15&r)<<4|(60&e)>>2,r=e,s=3;break;case 3:i[n++]=(3&r)<<6|e,s=0}}if(1==s)throw Error("invalid base64 string.");return i.subarray(0,n)},enc(A){let t,e="",i=0,n=0;for(let s=0;s<A.length;s++)switch(t=A[s],i){case 0:e+=W[t>>2],n=(3&t)<<4,i=1;break;case 1:e+=W[n|t>>4],n=(15&t)<<2,i=2;break;case 2:e+=W[n|t>>6],e+=W[63&t],i=0}return i&&(e+=W[n],e+="=",1==i&&(e+="=")),e}};function z(A,t,e){eA(t,A);const i=t.runtime.bin.makeReadOptions(e),n=(function(A,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let e=A.length-1;e>=0;--e)if(A[e].no==t.no)return[A[e]];return[]}return A.filter((A=>A.no===t.no))})(A.getType().runtime.bin.listUnknownFields(A),t.field),[s,r]=Y(t);for(const o of n)t.runtime.bin.readField(s,i.readerFactory(o.data),t.field,o.wireType,i);return r()}function AA(A,t,e,i){eA(t,A);const n=t.runtime.bin.makeReadOptions(i),s=t.runtime.bin.makeWriteOptions(i);if(tA(A,t)){const e=A.getType().runtime.bin.listUnknownFields(A).filter((A=>A.no!=t.field.no));A.getType().runtime.bin.discardUnknownFields(A);for(const t of e)A.getType().runtime.bin.onUnknownField(A,t.no,t.wireType,t.data)}const r=s.writerFactory();let o=t.field;o.opt||o.repeated||"enum"!=o.kind&&"scalar"!=o.kind||(o=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(o,e,r,s);const a=n.readerFactory(r.finish());for(;a.pos<a.len;){const[t,e]=a.tag(),i=a.skip(e,t);A.getType().runtime.bin.onUnknownField(A,t,e,i)}}function tA(A,t){const e=A.getType();return t.extendee.typeName===e.typeName&&!!e.runtime.bin.listUnknownFields(A).find((A=>A.no==t.field.no))}function eA(A,t){p(A.extendee.typeName==t.getType().typeName,"extension ".concat(A.typeName," can only be applied to message ").concat(A.extendee.typeName))}function iA(A,t){const e=A.localName;if(A.repeated)return t[e].length>0;if(A.oneof)return t[A.oneof.localName].case===e;switch(A.kind){case"enum":case"scalar":return A.opt||A.req?void 0!==t[e]:"enum"==A.kind?t[e]!==A.T.values[0].no:!J(A.T,t[e]);case"message":return void 0!==t[e];case"map":return Object.keys(t[e]).length>0}}function nA(A,t){const e=A.localName,i=!A.opt&&!A.req;if(A.repeated)t[e]=[];else if(A.oneof)t[A.oneof.localName]={case:void 0};else switch(A.kind){case"map":t[e]={};break;case"enum":t[e]=i?A.T.values[0].no:void 0;break;case"scalar":t[e]=i?V(A.T,A.L):void 0;break;case"message":t[e]=void 0}}function sA(A,t){if(null===A||"object"!=typeof A)return!1;if(!Object.getOwnPropertyNames(b.prototype).every((t=>t in A&&"function"==typeof A[t])))return!1;const e=A.getType();return null!==e&&"function"==typeof e&&"typeName"in e&&"string"==typeof e.typeName&&(void 0===t||e.typeName==t.typeName)}function rA(A,t){return sA(t)||!A.fieldWrapper?t:A.fieldWrapper.wrapField(t)}x.DOUBLE,x.FLOAT,x.INT64,x.UINT64,x.INT32,x.UINT32,x.BOOL,x.STRING,x.BYTES;const oA={ignoreUnknownFields:!1},aA={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},cA=Symbol(),uA=Symbol();function hA(A){if(null===A)return"null";switch(typeof A){case"object":return Array.isArray(A)?"array":"object";case"string":return A.length>100?"string":'"'.concat(A.split('"').join('\\"'),'"');default:return String(A)}}function lA(A,t,e,i,n){let s=e.localName;if(e.repeated){if(p("map"!=e.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t)));const o=A[s];for(const A of t){if(null===A)throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(A)));switch(e.kind){case"message":o.push(e.T.fromJson(A,i));break;case"enum":const t=fA(e.T,A,i.ignoreUnknownFields,!0);t!==uA&&o.push(t);break;case"scalar":try{o.push(BA(e.T,A,e.L,!0))}catch(r){let t="cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(A));throw r instanceof Error&&r.message.length>0&&(t+=": ".concat(r.message)),new Error(t)}}}}else if("map"==e.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t)));const o=A[s];for(const[A,s]of Object.entries(t)){if(null===s)throw new Error("cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: map value null"));let a;try{a=dA(e.K,A)}catch(r){let A="cannot decode map key for field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t));throw r instanceof Error&&r.message.length>0&&(A+=": ".concat(r.message)),new Error(A)}switch(e.V.kind){case"message":o[a]=e.V.T.fromJson(s,i);break;case"enum":const A=fA(e.V.T,s,i.ignoreUnknownFields,!0);A!==uA&&(o[a]=A);break;case"scalar":try{o[a]=BA(e.V.T,s,N.BIGINT,!0)}catch(r){let A="cannot decode map value for field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t));throw r instanceof Error&&r.message.length>0&&(A+=": ".concat(r.message)),new Error(A)}}}}else switch(e.oneof&&(A=A[e.oneof.localName]={case:s},s="value"),e.kind){case"message":const o=e.T;if(null===t&&"google.protobuf.Value"!=o.typeName)return;let a=A[s];sA(a)?a.fromJson(t,i):(A[s]=a=o.fromJson(t,i),o.fieldWrapper&&!e.oneof&&(A[s]=o.fieldWrapper.unwrapField(a)));break;case"enum":const c=fA(e.T,t,i.ignoreUnknownFields,!1);switch(c){case cA:nA(e,A);break;case uA:break;default:A[s]=c}break;case"scalar":try{const i=BA(e.T,t,e.L,!1);i===cA?nA(e,A):A[s]=i}catch(r){let A="cannot decode field ".concat(n.typeName,".").concat(e.name," from JSON: ").concat(hA(t));throw r instanceof Error&&r.message.length>0&&(A+=": ".concat(r.message)),new Error(A)}}}function dA(A,t){if(A===x.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return BA(A,t,N.BIGINT,!0).toString()}function BA(A,t,e,i){if(null===t)return i?V(A,e):cA;switch(A){case x.DOUBLE:case x.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const i=Number(t);if(Number.isNaN(i))break;if(!Number.isFinite(i))break;return A==x.FLOAT&&Q(i),i;case x.INT32:case x.FIXED32:case x.SFIXED32:case x.SINT32:case x.UINT32:let s;if("number"==typeof t?s=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(s=Number(t)),void 0===s)break;return A==x.UINT32||A==x.FIXED32?m(s):v(s),s;case x.INT64:case x.SFIXED64:case x.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const r=L.parse(t);return e?r.toString():r;case x.FIXED64:case x.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const o=L.uParse(t);return e?o.toString():o;case x.BOOL:if("boolean"!=typeof t)break;return t;case x.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(n){throw new Error("invalid UTF8")}return t;case x.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return q.dec(t)}throw new Error}function fA(A,t,e,i){if(null===t)return"google.protobuf.NullValue"==A.typeName?0:i?A.values[0].no:cA;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const i=A.findName(t);if(void 0!==i)return i.no;if(e)return uA}throw new Error("cannot decode enum ".concat(A.typeName," from JSON: ").concat(hA(t)))}function wA(A){return!(!A.repeated&&"map"!=A.kind&&(A.oneof||"message"==A.kind||A.opt||A.req))}function gA(A,t,e){if("map"==A.kind){p("object"==typeof t&&null!=t);const i={},n=Object.entries(t);switch(A.V.kind){case"scalar":for(const[e,s]of n)i[e.toString()]=vA(A.V.T,s);break;case"message":for(const[A,s]of n)i[A.toString()]=s.toJson(e);break;case"enum":const t=A.V.T;for(const[A,s]of n)i[A.toString()]=pA(t,s,e.enumAsInteger)}return e.emitDefaultValues||n.length>0?i:void 0}if(A.repeated){p(Array.isArray(t));const i=[];switch(A.kind){case"scalar":for(let e=0;e<t.length;e++)i.push(vA(A.T,t[e]));break;case"enum":for(let n=0;n<t.length;n++)i.push(pA(A.T,t[n],e.enumAsInteger));break;case"message":for(let A=0;A<t.length;A++)i.push(t[A].toJson(e))}return e.emitDefaultValues||i.length>0?i:void 0}switch(A.kind){case"scalar":return vA(A.T,t);case"enum":return pA(A.T,t,e.enumAsInteger);case"message":return rA(A.T,t).toJson(e)}}function pA(A,t,e){var i;if(p("number"==typeof t),"google.protobuf.NullValue"==A.typeName)return null;if(e)return t;const n=A.findNumber(t);return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:t}function vA(A,t){switch(A){case x.INT32:case x.SFIXED32:case x.SINT32:case x.FIXED32:case x.UINT32:return p("number"==typeof t),t;case x.FLOAT:case x.DOUBLE:return p("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case x.STRING:return p("string"==typeof t),t;case x.BOOL:return p("boolean"==typeof t),t;case x.UINT64:case x.FIXED64:case x.INT64:case x.SFIXED64:case x.SINT64:return p("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case x.BYTES:return p(t instanceof Uint8Array),q.enc(t)}}const mA=Symbol("@bufbuild/protobuf/unknown-fields"),QA={readUnknownFields:!0,readerFactory:A=>new $(A)},CA={writeUnknownFields:!0,writerFactory:()=>new X};function UA(A,t,e,i,n){let{repeated:s,localName:r}=e;switch(e.oneof&&((A=A[e.oneof.localName]).case!=r&&delete A.value,A.case=r,r="value"),e.kind){case"scalar":case"enum":const o="enum"==e.kind?x.INT32:e.T;let a=bA;if("scalar"==e.kind&&e.L>0&&(a=yA),s){let e=A[r];if(i==j.LengthDelimited&&o!=x.STRING&&o!=x.BYTES){let A=t.uint32()+t.pos;for(;t.pos<A;)e.push(a(t,o))}else e.push(a(t,o))}else A[r]=a(t,o);break;case"message":const c=e.T;s?A[r].push(FA(t,new c,n,e)):sA(A[r])?FA(t,A[r],n,e):(A[r]=FA(t,new c,n,e),!c.fieldWrapper||e.oneof||e.repeated||(A[r]=c.fieldWrapper.unwrapField(A[r])));break;case"map":let[u,h]=(function(A,t,e){const i=t.uint32(),n=t.pos+i;let s,r;for(;t.pos<n;){const[i]=t.tag();switch(i){case 1:s=bA(t,A.K);break;case 2:switch(A.V.kind){case"scalar":r=bA(t,A.V.T);break;case"enum":r=t.int32();break;case"message":r=FA(t,new A.V.T,e,void 0)}}}if(void 0===s&&(s=V(A.K,N.BIGINT)),"string"!=typeof s&&"number"!=typeof s&&(s=s.toString()),void 0===r)switch(A.V.kind){case"scalar":r=V(A.V.T,N.BIGINT);break;case"enum":r=A.V.T.values[0].no;break;case"message":r=new A.V.T}return[s,r]})(e,t,n);A[r][u]=h}}function FA(A,t,e,i){const n=t.getType().runtime.bin,s=null==i?void 0:i.delimited;return n.readMessage(t,A,s?i.no:A.uint32(),e,s),t}function yA(A,t){const e=bA(A,t);return"bigint"==typeof e?e.toString():e}function bA(A,t){switch(t){case x.STRING:return A.string();case x.BOOL:return A.bool();case x.DOUBLE:return A.double();case x.FLOAT:return A.float();case x.INT32:return A.int32();case x.INT64:return A.int64();case x.UINT64:return A.uint64();case x.FIXED64:return A.fixed64();case x.BYTES:return A.bytes();case x.FIXED32:return A.fixed32();case x.SFIXED32:return A.sfixed32();case x.SFIXED64:return A.sfixed64();case x.SINT64:return A.sint64();case x.UINT32:return A.uint32();case x.SINT32:return A.sint32()}}function EA(A,t,e,i){p(void 0!==t);const n=A.repeated;switch(A.kind){case"scalar":case"enum":let s="enum"==A.kind?x.INT32:A.T;if(n)if(p(Array.isArray(t)),A.packed)!(function(A,t,e,i){if(!i.length)return;A.tag(e,j.LengthDelimited).fork();let[,n]=SA(t);for(let s=0;s<i.length;s++)A[n](i[s]);A.join()})(e,s,A.no,t);else for(const i of t)HA(e,s,A.no,i);else HA(e,s,A.no,t);break;case"message":if(n){p(Array.isArray(t));for(const n of t)kA(e,i,A,n)}else kA(e,i,A,t);break;case"map":p("object"==typeof t&&null!=t);for(const[n,r]of Object.entries(t))IA(e,i,A,n,r)}}function IA(A,t,e,i,n){A.tag(e.no,j.LengthDelimited),A.fork();let s=i;switch(e.K){case x.INT32:case x.FIXED32:case x.UINT32:case x.SFIXED32:case x.SINT32:s=Number.parseInt(i);break;case x.BOOL:p("true"==i||"false"==i),s="true"==i}switch(HA(A,e.K,1,s),e.V.kind){case"scalar":HA(A,e.V.T,2,n);break;case"enum":HA(A,x.INT32,2,n);break;case"message":p(void 0!==n),A.tag(2,j.LengthDelimited).bytes(n.toBinary(t))}A.join()}function kA(A,t,e,i){const n=rA(e.T,i);e.delimited?A.tag(e.no,j.StartGroup).raw(n.toBinary(t)).tag(e.no,j.EndGroup):A.tag(e.no,j.LengthDelimited).bytes(n.toBinary(t))}function HA(A,t,e,i){p(void 0!==i);let[n,s]=SA(t);A.tag(e,n)[s](i)}function SA(A){let t=j.Varint;switch(A){case x.BYTES:case x.STRING:t=j.LengthDelimited;break;case x.DOUBLE:case x.FIXED64:case x.SFIXED64:t=j.Bit64;break;case x.FIXED32:case x.SFIXED32:case x.FLOAT:t=j.Bit32}return[t,x[A].toLowerCase()]}function TA(A){if(void 0===A)return A;if(sA(A))return A.clone();if(A instanceof Uint8Array){const t=new Uint8Array(A.byteLength);return t.set(A),t}return A}function OA(A){return A instanceof Uint8Array?A:new Uint8Array(A)}class KA{constructor(A,t){this.H=A,this.S=t}findJsonName(A){if(!this.jsonNames){const A={};for(const t of this.list())A[t.jsonName]=A[t.name]=t;this.jsonNames=A}return this.jsonNames[A]}find(A){if(!this.numbers){const A={};for(const t of this.list())A[t.no]=t;this.numbers=A}return this.numbers[A]}list(){return this.all||(this.all=this.S(this.H)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort(((A,t)=>A.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const A=this.members;let t;for(const e of this.list())e.oneof?e.oneof!==t&&(t=e.oneof,A.push(t)):A.push(e)}return this.members}}function DA(A,t){const e=LA(A);return t?e:jA(RA(e))}const MA=LA;function LA(A){let t=!1;const e=[];for(let i=0;i<A.length;i++){let n=A.charAt(i);switch(n){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":e.push(n),t=!1;break;default:t&&(t=!1,n=n.toUpperCase()),e.push(n)}}return e.join("")}const xA=new Set(["constructor","toString","toJSON","valueOf"]),_A=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),NA=A=>"".concat(A,"$"),RA=A=>_A.has(A)?NA(A):A,jA=A=>xA.has(A)?NA(A):A;class GA{constructor(A){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=A,this.localName=DA(A,!1)}addField(A){p(A.oneof===this,"field ".concat(A.name," not one of ").concat(this.name)),this.fields.push(A)}findField(A){if(!this.D){this.D=Object.create(null);for(let A=0;A<this.fields.length;A++)this.D[this.fields[A].localName]=this.fields[A]}return this.D[A]}}const PA=(VA=A=>new KA(A,(A=>(function(A){var t,e,i,n,s,r;const o=[];let a;for(const c of"function"==typeof A?A():A){const A=c;if(A.localName=DA(c.name,void 0!==c.oneof),A.jsonName=null!==(t=c.jsonName)&&void 0!==t?t:MA(c.name),A.repeated=null!==(e=c.repeated)&&void 0!==e&&e,"scalar"==c.kind&&(A.L=null!==(i=c.L)&&void 0!==i?i:N.BIGINT),A.delimited=null!==(n=c.delimited)&&void 0!==n&&n,A.req=null!==(s=c.req)&&void 0!==s&&s,A.opt=null!==(r=c.opt)&&void 0!==r&&r,void 0===c.packed&&(A.packed="enum"==c.kind||"scalar"==c.kind&&c.T!=x.BYTES&&c.T!=x.STRING),void 0!==c.oneof){const t="string"==typeof c.oneof?c.oneof:c.oneof.name;a&&a.name==t||(a=new GA(t)),A.oneof=a,a.addField(A)}o.push(A)}return o})(A))),JA=A=>{for(const t of A.getType().fields.byMember()){if(t.opt)continue;const e=t.localName,i=A;if(t.repeated)i[e]=[];else switch(t.kind){case"oneof":i[e]={case:void 0};break;case"enum":i[e]=0;break;case"map":i[e]={};break;case"scalar":i[e]=V(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:function(A){return A?Object.assign(Object.assign({},oA),A):oA},makeWriteOptions:function(A){return A?Object.assign(Object.assign({},aA),A):aA},readMessage(A,t,e,i){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(A.typeName," from JSON: ").concat(hA(t)));i=null!=i?i:new A;const n=new Map,s=e.typeRegistry;for(const[r,o]of Object.entries(t)){const t=A.fields.findJsonName(r);if(t){if(t.oneof){if(null===o&&"scalar"==t.kind)continue;const e=n.get(t.oneof);if(void 0!==e)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(e,'", "').concat(r,'"'));n.set(t.oneof,r)}lA(i,o,t,e,A)}else{let t=!1;if((null==s?void 0:s.findExtension)&&r.startsWith("[")&&r.endsWith("]")){const n=s.findExtension(r.substring(1,r.length-1));if(n&&n.extendee.typeName==A.typeName){t=!0;const[A,s]=Y(n);lA(A,o,n.field,e,n),AA(i,n,s(),e)}}if(!t&&!e.ignoreUnknownFields)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: key "').concat(r,'" is unknown'))}}return i},writeMessage(A,t){const e=A.getType(),i={};let n;try{for(n of e.fields.byNumber()){if(!iA(n,A)){if(n.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!wA(n))continue}const e=gA(n,n.oneof?A[n.oneof.localName].value:A[n.localName],t);void 0!==e&&(i[t.useProtoFieldName?n.name:n.jsonName]=e)}const s=t.typeRegistry;if(null==s?void 0:s.findExtensionFor)for(const n of e.runtime.bin.listUnknownFields(A)){const r=s.findExtensionFor(e.typeName,n.no);if(r&&tA(A,r)){const e=z(A,r,t),n=gA(r.field,e,t);void 0!==n&&(i[r.field.jsonName]=n)}}}catch(s){const A=n?"cannot encode field ".concat(e.typeName,".").concat(n.name," to JSON"):"cannot encode message ".concat(e.typeName," to JSON"),t=s instanceof Error?s.message:String(s);throw new Error(A+(t.length>0?": ".concat(t):""))}return i},readScalar:(A,t,e)=>BA(A,t,null!=e?e:N.BIGINT,!0),writeScalar(A,t,e){if(void 0!==t)return e||J(A,t)?vA(A,t):void 0},debug:hA},bin:{makeReadOptions:function(A){return A?Object.assign(Object.assign({},QA),A):QA},makeWriteOptions:function(A){return A?Object.assign(Object.assign({},CA),A):CA},listUnknownFields(A){var t;return null!==(t=A[mA])&&void 0!==t?t:[]},discardUnknownFields(A){delete A[mA]},writeUnknownFields(A,t){const e=A[mA];if(e)for(const i of e)t.tag(i.no,i.wireType).raw(i.data)},onUnknownField(A,t,e,i){const n=A;Array.isArray(n[mA])||(n[mA]=[]),n[mA].push({no:t,wireType:e,data:i})},readMessage(A,t,e,i,n){const s=A.getType(),r=n?t.len:t.pos+e;let o,a;for(;t.pos<r&&([o,a]=t.tag(),!0!==n||a!=j.EndGroup);){const e=s.fields.find(o);if(e)UA(A,t,e,a,i);else{const e=t.skip(a,o);i.readUnknownFields&&this.onUnknownField(A,o,a,e)}}if(n&&(a!=j.EndGroup||o!==e))throw new Error("invalid end group tag")},readField:UA,writeMessage(A,t,e){const i=A.getType();for(const n of i.fields.byNumber())if(iA(n,A))EA(n,n.oneof?A[n.oneof.localName].value:A[n.localName],t,e);else if(n.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(n.name," to binary: required field not set"));return e.writeUnknownFields&&this.writeUnknownFields(A,t),t},writeField(A,t,e,i){void 0!==t&&EA(A,t,e,i)}},util:Object.assign(Object.assign({},{setEnumType:U,initPartial(A,t){if(void 0===A)return;const e=t.getType();for(const i of e.fields.byMember()){const e=i.localName,n=t,s=A;if(null!=s[e])switch(i.kind){case"oneof":const A=s[e].case;if(void 0===A)continue;const t=i.findField(A);let r=s[e].value;t&&"message"==t.kind&&!sA(r,t.T)?r=new t.T(r):t&&"scalar"===t.kind&&t.T===x.BYTES&&(r=OA(r)),n[e]={case:A,value:r};break;case"scalar":case"enum":let o=s[e];i.T===x.BYTES&&(o=i.repeated?o.map(OA):OA(o)),n[e]=o;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===x.BYTES)for(const[t,i]of Object.entries(s[e]))n[e][t]=OA(i);else Object.assign(n[e],s[e]);break;case"message":const A=i.V.T;for(const t of Object.keys(s[e])){let i=s[e][t];A.fieldWrapper||(i=new A(i)),n[e][t]=i}}break;case"message":const a=i.T;if(i.repeated)n[e]=s[e].map((A=>sA(A,a)?A:new a(A)));else{const A=s[e];a.fieldWrapper?"google.protobuf.BytesValue"===a.typeName?n[e]=OA(A):n[e]=A:n[e]=sA(A,a)?A:new a(A)}}}},equals:(A,t,e)=>t===e||!(!t||!e)&&A.fields.byMember().every((A=>{const i=t[A.localName],n=e[A.localName];if(A.repeated){if(i.length!==n.length)return!1;switch(A.kind){case"message":return i.every(((t,e)=>A.T.equals(t,n[e])));case"scalar":return i.every(((t,e)=>P(A.T,t,n[e])));case"enum":return i.every(((A,t)=>P(x.INT32,A,n[t])))}throw new Error("repeated cannot contain ".concat(A.kind))}switch(A.kind){case"message":return A.T.equals(i,n);case"enum":return P(x.INT32,i,n);case"scalar":return P(A.T,i,n);case"oneof":if(i.case!==n.case)return!1;const t=A.findField(i.case);if(void 0===t)return!0;switch(t.kind){case"message":return t.T.equals(i.value,n.value);case"enum":return P(x.INT32,i.value,n.value);case"scalar":return P(t.T,i.value,n.value)}throw new Error("oneof cannot contain ".concat(t.kind));case"map":const e=Object.keys(i).concat(Object.keys(n));switch(A.V.kind){case"message":const t=A.V.T;return e.every((A=>t.equals(i[A],n[A])));case"enum":return e.every((A=>P(x.INT32,i[A],n[A])));case"scalar":const s=A.V.T;return e.every((A=>P(s,i[A],n[A])))}}})),clone(A){const t=A.getType(),e=new t,i=e;for(const n of t.fields.byMember()){const t=A[n.localName];let e;if(n.repeated)e=t.map(TA);else if("map"==n.kind){e=i[n.localName];for(const[A,i]of Object.entries(t))e[A]=TA(i)}else e="oneof"==n.kind?n.findField(t.case)?{case:t.case,value:TA(t.value)}:{case:void 0}:TA(t);i[n.localName]=e}for(const n of t.runtime.bin.listUnknownFields(A))t.runtime.bin.onUnknownField(i,n.no,n.wireType,n.data);return e}}),{newFieldList:VA,initFields:JA}),makeMessageType(A,t,e){return(function(A,t,e,i){var n;const s=null!==(n=null==i?void 0:i.localName)&&void 0!==n?n:t.substring(t.lastIndexOf(".")+1),r={[s]:function(t){A.util.initFields(this),A.util.initPartial(t,this)}}[s];return Object.setPrototypeOf(r.prototype,new b),Object.assign(r,{runtime:A,typeName:t,fields:A.util.newFieldList(e),fromBinary:(A,t)=>(new r).fromBinary(A,t),fromJson:(A,t)=>(new r).fromJson(A,t),fromJsonString:(A,t)=>(new r).fromJsonString(A,t),equals:(t,e)=>A.util.equals(r,t,e)}),r})(this,A,t,e)},makeEnum:function(A,t,e){const i={};for(const n of t){const A=y(n);i[A.localName]=A.no,i[A.no]=A.localName}return U(i,A,t),i},makeEnumType:F,getEnumType:function(A){const t=A[C];return p(t,"missing enum type on enum object"),t},makeExtension(A,t,e){return(function(A,t,e,i){let n;return{typeName:t,extendee:e,get field(){if(!n){const e="function"==typeof i?i():i;e.name=t.split(".").pop(),e.jsonName="[".concat(t,"]"),n=A.util.newFieldList([e]).list()[0]}return n},runtime:A}})(this,A,t,e)}});var VA,JA;class XA extends b{constructor(A){super(),this.seconds=L.zero,this.nanos=0,PA.util.initPartial(A,this)}fromJson(A,t){if("string"!=typeof A)throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(PA.json.debug(A)));const e=A.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(!e)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(e[1]+"-"+e[2]+"-"+e[3]+"T"+e[4]+":"+e[5]+":"+e[6]+(e[8]?e[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>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=L.parse(i/1e3),this.nanos=0,e[7]&&(this.nanos=parseInt("1"+e[7]+"0".repeat(9-e[7].length))-1e9),this}toJson(A){const t=1e3*Number(this.seconds);if(t<Date.parse("0001-01-01T00:00:00Z")||t>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 e="Z";if(this.nanos>0){const A=(this.nanos+1e9).toString().substring(1);e="000000"===A.substring(3)?"."+A.substring(0,3)+"Z":"000"===A.substring(6)?"."+A.substring(0,6)+"Z":"."+A+"Z"}return new Date(t).toISOString().replace(".000Z",e)}toDate(){return new Date(1e3*Number(this.seconds)+Math.ceil(this.nanos/1e6))}static now(){return XA.fromDate(new Date)}static fromDate(A){const t=A.getTime();return new XA({seconds:L.parse(Math.floor(t/1e3)),nanos:t%1e3*1e6})}static fromBinary(A,t){return(new XA).fromBinary(A,t)}static fromJson(A,t){return(new XA).fromJson(A,t)}static fromJsonString(A,t){return(new XA).fromJsonString(A,t)}static equals(A,t){return PA.util.equals(XA,A,t)}}XA.runtime=PA,XA.typeName="google.protobuf.Timestamp",XA.fields=PA.util.newFieldList((()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]));const $A=PA.makeMessageType("livekit.MetricsBatch",(()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:XA},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:YA,repeated:!0},{no:5,name:"events",kind:"message",T:ZA,repeated:!0}])),YA=PA.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:WA,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}])),WA=PA.makeMessageType("livekit.MetricSample",(()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:XA},{no:3,name:"value",kind:"scalar",T:2}])),ZA=PA.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:XA},{no:7,name:"normalized_end_timestamp",kind:"message",T:XA,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}])),qA=PA.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),zA=PA.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),At=PA.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"}]),tt=PA.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),et=PA.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),it=PA.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),nt=PA.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"}]),st=PA.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"}]),rt=PA.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),ot=PA.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"}]),at=PA.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:ct,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:Nt}])),ct=PA.makeMessageType("livekit.Codec",(()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}])),ut=PA.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:PA.getEnumType(At),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}])),ht=PA.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:PA.getEnumType(lt)},{no:4,name:"tracks",kind:"message",T:gt,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:ut},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:PA.getEnumType(dt)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:PA.getEnumType(nt)},{no:18,name:"kind_details",kind:"enum",T:PA.getEnumType(Bt),repeated:!0}])),lt=PA.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),dt=PA.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),Bt=PA.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),ft=PA.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),wt=PA.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:pt,repeated:!0}])),gt=PA.makeMessageType("livekit.TrackInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:PA.getEnumType(zA)},{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:PA.getEnumType(At)},{no:10,name:"layers",kind:"message",T:pt,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:wt,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:PA.getEnumType(ft)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:Nt},{no:19,name:"audio_features",kind:"enum",T:PA.getEnumType(ot),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:PA.getEnumType(qA)}])),pt=PA.makeMessageType("livekit.VideoLayer",(()=>[{no:1,name:"quality",kind:"enum",T:PA.getEnumType(tt)},{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}])),vt=PA.makeMessageType("livekit.DataPacket",(()=>[{no:1,name:"kind",kind:"enum",T:PA.getEnumType(mt)},{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:Ut,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Qt,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:Ft,oneof:"value"},{no:7,name:"transcription",kind:"message",T:yt,oneof:"value"},{no:8,name:"metrics",kind:"message",T:$A,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:Et,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:It,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:kt,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:Ht,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:Pt,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Vt,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Jt,oneof:"value"}])),mt=PA.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),Qt=PA.makeMessageType("livekit.ActiveSpeakerUpdate",(()=>[{no:1,name:"speakers",kind:"message",T:Ct,repeated:!0}])),Ct=PA.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}])),Ut=PA.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}])),Ft=PA.makeMessageType("livekit.SipDTMF",(()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}])),yt=PA.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:bt,repeated:!0}])),bt=PA.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}])),Et=PA.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}])),It=PA.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}])),kt=PA.makeMessageType("livekit.RpcAck",(()=>[{no:1,name:"request_id",kind:"scalar",T:9}])),Ht=PA.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:St,oneof:"value"}])),St=PA.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}])),Tt=PA.makeMessageType("livekit.ParticipantTracks",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}])),Ot=PA.makeMessageType("livekit.ServerInfo",(()=>[{no:1,name:"edition",kind:"enum",T:PA.getEnumType(Kt)},{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}])),Kt=PA.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),Dt=PA.makeMessageType("livekit.ClientInfo",(()=>[{no:1,name:"sdk",kind:"enum",T:PA.getEnumType(Mt)},{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}])),Mt=PA.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"}]),Lt=PA.makeMessageType("livekit.ClientConfiguration",(()=>[{no:1,name:"video",kind:"message",T:xt},{no:2,name:"screen",kind:"message",T:xt},{no:3,name:"resume_connection",kind:"enum",T:PA.getEnumType(it)},{no:4,name:"disabled_codecs",kind:"message",T:_t},{no:5,name:"force_relay",kind:"enum",T:PA.getEnumType(it)}])),xt=PA.makeMessageType("livekit.VideoConfiguration",(()=>[{no:1,name:"hardware_encoder",kind:"enum",T:PA.getEnumType(it)}])),_t=PA.makeMessageType("livekit.DisabledCodecs",(()=>[{no:1,name:"codecs",kind:"message",T:ct,repeated:!0},{no:2,name:"publish",kind:"message",T:ct,repeated:!0}])),Nt=PA.makeMessageType("livekit.TimedVersion",(()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}])),Rt=PA.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),jt=PA.makeMessageType("livekit.DataStream.TextHeader",(()=>[{no:1,name:"operation_type",kind:"enum",T:PA.getEnumType(Rt)},{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"}),Gt=PA.makeMessageType("livekit.DataStream.ByteHeader",(()=>[{no:1,name:"name",kind:"scalar",T:9}]),{localName:"DataStream_ByteHeader"}),Pt=PA.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:PA.getEnumType(ft)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:jt,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:Gt,oneof:"content_header"}]),{localName:"DataStream_Header"}),Vt=PA.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"}),Jt=PA.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"}),Xt=PA.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),$t=PA.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),Yt=PA.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),Wt=PA.makeMessageType("livekit.SignalRequest",(()=>[{no:1,name:"offer",kind:"message",T:re,oneof:"message"},{no:2,name:"answer",kind:"message",T:re,oneof:"message"},{no:3,name:"trickle",kind:"message",T:Ae,oneof:"message"},{no:4,name:"add_track",kind:"message",T:zt,oneof:"message"},{no:5,name:"mute",kind:"message",T:te,oneof:"message"},{no:6,name:"subscription",kind:"message",T:ae,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:ce,oneof:"message"},{no:8,name:"leave",kind:"message",T:le,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:Be,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:Ee,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:He,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Te,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:fe,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:Oe,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:ue,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:he,oneof:"message"}])),Zt=PA.makeMessageType("livekit.SignalResponse",(()=>[{no:1,name:"join",kind:"message",T:ee,oneof:"message"},{no:2,name:"answer",kind:"message",T:re,oneof:"message"},{no:3,name:"offer",kind:"message",T:re,oneof:"message"},{no:4,name:"trickle",kind:"message",T:Ae,oneof:"message"},{no:5,name:"update",kind:"message",T:oe,oneof:"message"},{no:6,name:"track_published",kind:"message",T:ne,oneof:"message"},{no:8,name:"leave",kind:"message",T:le,oneof:"message"},{no:9,name:"mute",kind:"message",T:te,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:ge,oneof:"message"},{no:11,name:"room_update",kind:"message",T:pe,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:me,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:Ce,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:ye,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:Ie,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:se,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:ie,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:Ke,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:Le,oneof:"message"},{no:22,name:"request_response",kind:"message",T:xe,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:Ne,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:ke,oneof:"message"}])),qt=PA.makeMessageType("livekit.SimulcastCodec",(()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}])),zt=PA.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:PA.getEnumType(zA)},{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:PA.getEnumType(At)},{no:9,name:"layers",kind:"message",T:pt,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:qt,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:PA.getEnumType(ft)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:PA.getEnumType(qA)},{no:17,name:"audio_features",kind:"enum",T:PA.getEnumType(ot),repeated:!0}])),Ae=PA.makeMessageType("livekit.TrickleRequest",(()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:PA.getEnumType(Xt)},{no:3,name:"final",kind:"scalar",T:8}])),te=PA.makeMessageType("livekit.MuteTrackRequest",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}])),ee=PA.makeMessageType("livekit.JoinResponse",(()=>[{no:1,name:"room",kind:"message",T:at},{no:2,name:"participant",kind:"message",T:ht},{no:3,name:"other_participants",kind:"message",T:ht,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:we,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:Lt},{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:Ot},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:ct,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}])),ie=PA.makeMessageType("livekit.ReconnectResponse",(()=>[{no:1,name:"ice_servers",kind:"message",T:we,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Lt}])),ne=PA.makeMessageType("livekit.TrackPublishedResponse",(()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:gt}])),se=PA.makeMessageType("livekit.TrackUnpublishedResponse",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9}])),re=PA.makeMessageType("livekit.SessionDescription",(()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9}])),oe=PA.makeMessageType("livekit.ParticipantUpdate",(()=>[{no:1,name:"participants",kind:"message",T:ht,repeated:!0}])),ae=PA.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:Tt,repeated:!0}])),ce=PA.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:PA.getEnumType(tt)},{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}])),ue=PA.makeMessageType("livekit.UpdateLocalAudioTrack",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:PA.getEnumType(ot),repeated:!0}])),he=PA.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}])),le=PA.makeMessageType("livekit.LeaveRequest",(()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:PA.getEnumType(nt)},{no:3,name:"action",kind:"enum",T:PA.getEnumType(de)},{no:4,name:"regions",kind:"message",T:De}])),de=PA.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),Be=PA.makeMessageType("livekit.UpdateVideoLayers",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:pt,repeated:!0}])),fe=PA.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}])),we=PA.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}])),ge=PA.makeMessageType("livekit.SpeakersChanged",(()=>[{no:1,name:"speakers",kind:"message",T:Ct,repeated:!0}])),pe=PA.makeMessageType("livekit.RoomUpdate",(()=>[{no:1,name:"room",kind:"message",T:at}])),ve=PA.makeMessageType("livekit.ConnectionQualityInfo",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:PA.getEnumType(et)},{no:3,name:"score",kind:"scalar",T:2}])),me=PA.makeMessageType("livekit.ConnectionQualityUpdate",(()=>[{no:1,name:"updates",kind:"message",T:ve,repeated:!0}])),Qe=PA.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:PA.getEnumType($t)}])),Ce=PA.makeMessageType("livekit.StreamStateUpdate",(()=>[{no:1,name:"stream_states",kind:"message",T:Qe,repeated:!0}])),Ue=PA.makeMessageType("livekit.SubscribedQuality",(()=>[{no:1,name:"quality",kind:"enum",T:PA.getEnumType(tt)},{no:2,name:"enabled",kind:"scalar",T:8}])),Fe=PA.makeMessageType("livekit.SubscribedCodec",(()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Ue,repeated:!0}])),ye=PA.makeMessageType("livekit.SubscribedQualityUpdate",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Ue,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:Fe,repeated:!0}])),be=PA.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}])),Ee=PA.makeMessageType("livekit.SubscriptionPermission",(()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:be,repeated:!0}])),Ie=PA.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}])),ke=PA.makeMessageType("livekit.RoomMovedResponse",(()=>[{no:1,name:"room",kind:"message",T:at},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:ht},{no:4,name:"other_participants",kind:"message",T:ht,repeated:!0}])),He=PA.makeMessageType("livekit.SyncState",(()=>[{no:1,name:"answer",kind:"message",T:re},{no:2,name:"subscription",kind:"message",T:ae},{no:3,name:"publish_tracks",kind:"message",T:ne,repeated:!0},{no:4,name:"data_channels",kind:"message",T:Se,repeated:!0},{no:5,name:"offer",kind:"message",T:re},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0}])),Se=PA.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:PA.getEnumType(Xt)}])),Te=PA.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:PA.getEnumType(Yt),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"}])),Oe=PA.makeMessageType("livekit.Ping",(()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}])),Ke=PA.makeMessageType("livekit.Pong",(()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}])),De=PA.makeMessageType("livekit.RegionSettings",(()=>[{no:1,name:"regions",kind:"message",T:Me,repeated:!0}])),Me=PA.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}])),Le=PA.makeMessageType("livekit.SubscriptionResponse",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:PA.getEnumType(rt)}])),xe=PA.makeMessageType("livekit.RequestResponse",(()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:PA.getEnumType(_e)},{no:3,name:"message",kind:"scalar",T:9}])),_e=PA.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),Ne=PA.makeMessageType("livekit.TrackSubscribed",(()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]));function Re(A){return A&&A.A&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var je,Ge,Pe,Ve,Je,Xe,$e,Ye,We={exports:{}},Ze=(je||(je=1,Pe=We.exports,Ve=function(){var A=function(){},t="undefined",e=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],n={},s=null;function r(A,t){var e=A[t];if("function"==typeof e.bind)return e.bind(A);try{return Function.prototype.bind.call(e,A)}catch(i){return function(){return Function.prototype.apply.apply(e,[A,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(){for(var e=this.getLevel(),n=0;n<i.length;n++){var s=i[n];this[s]=n<e?A:this.methodFactory(s,e,this.name)}if(this.log=this.debug,typeof console===t&&e<this.levels.SILENT)return"No console available for logging"}function c(A){return function(){typeof console!==t&&(a.call(this),this[A].apply(this,arguments))}}function u(i,n,s){return(function(i){return"debug"===i&&(i="log"),typeof console!==t&&("trace"===i&&e?o:void 0!==console[i]?r(console,i):void 0!==console.log?r(console,"log"):A)})(i)||c.apply(this,arguments)}function h(A,e){var r,o,c,h=this,l="loglevel";function d(){var A;if(typeof window!==t&&l){try{A=window.localStorage[l]}catch(s){}if(typeof A===t)try{var e=window.document.cookie,i=encodeURIComponent(l),n=e.indexOf(i+"=");-1!==n&&(A=/^([^;]+)/.exec(e.slice(n+i.length+1))[1])}catch(s){}return void 0===h.levels[A]&&(A=void 0),A}}function B(A){var t=A;if("string"==typeof t&&void 0!==h.levels[t.toUpperCase()]&&(t=h.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=h.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+A)}"string"==typeof A?l+=":"+A:"symbol"==typeof A&&(l=void 0),h.name=A,h.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},h.methodFactory=e||u,h.getLevel=function(){return null!=c?c:null!=o?o:r},h.setLevel=function(A,e){return c=B(A),!1!==e&&(function(A){var e=(i[A]||"silent").toUpperCase();if(typeof window!==t&&l){try{return void(window.localStorage[l]=e)}catch(n){}try{window.document.cookie=encodeURIComponent(l)+"="+e+";"}catch(n){}}})(c),a.call(h)},h.setDefaultLevel=function(A){o=B(A),d()||h.setLevel(A,!1)},h.resetLevel=function(){c=null,(function(){if(typeof window!==t&&l){try{window.localStorage.removeItem(l)}catch(A){}try{window.document.cookie=encodeURIComponent(l)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(A){}}})(),a.call(h)},h.enableAll=function(A){h.setLevel(h.levels.TRACE,A)},h.disableAll=function(A){h.setLevel(h.levels.SILENT,A)},h.rebuild=function(){if(s!==h&&(r=B(s.getLevel())),a.call(h),s===h)for(var A in n)n[A].rebuild()},r=B(s?s.getLevel():"WARN");var f=d();null!=f&&(c=B(f)),a.call(h)}(s=new h).getLogger=function(A){if("symbol"!=typeof A&&"string"!=typeof A||""===A)throw new TypeError("You must supply a name when creating a logger.");var t=n[A];return t||(t=n[A]=new h(A,s.methodFactory)),t};var l=typeof window!==t?window.log:void 0;return s.noConflict=function(){return typeof window!==t&&window.log===s&&(window.log=l),s},s.getLoggers=function(){return n},s.default=s,s},(Ge=We).exports?Ge.exports=Ve():Pe.log=Ve()),We.exports);(Xe=Je||(Je={}))[Xe.trace=0]="trace",Xe[Xe.debug=1]="debug",Xe[Xe.info=2]="info",Xe[Xe.warn=3]="warn",Xe[Xe.error=4]="error",Xe[Xe.silent=5]="silent",(Ye=$e||($e={})).Default="livekit",Ye.Room="livekit-room",Ye.Participant="livekit-participant",Ye.Track="livekit-track",Ye.Publication="livekit-track-publication",Ye.Engine="livekit-engine",Ye.Signal="livekit-signal",Ye.PCManager="livekit-pc-manager",Ye.PCTransport="livekit-pc-transport",Ye.E2EE="lk-e2ee";let qe=Ze.getLogger("livekit");function ze(A){const t=Ze.getLogger(A);return t.setDefaultLevel(qe.getLevel()),t}Object.values($e).map((A=>Ze.getLogger(A))),qe.setDefaultLevel(Je.info);const Ai=Ze.getLogger("lk-e2ee"),ti=7e3,ei=[0,300,1200,2700,4800,ti,ti,ti,ti,ti];function ii(A,t,e,i){return new(e||(e=Promise))((function(n,s){function r(A){try{a(i.next(A))}catch(t){s(t)}}function o(A){try{a(i.throw(A))}catch(t){s(t)}}function a(A){var t;A.done?n(A.value):(t=A.value,t instanceof e?t:new e((function(A){A(t)}))).then(r,o)}a((i=i.apply(A,t||[])).next())}))}function ni(A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=A[Symbol.asyncIterator];return e?e.call(A):(A=(function(A){var t="function"==typeof Symbol&&Symbol.iterator,e=t&&A[t],i=0;if(e)return e.call(A);if(A&&"number"==typeof A.length)return{next:function(){return A&&i>=A.length&&(A=void 0),{value:A&&A[i++],done:!A}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")})(A),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(e){t[e]=A[e]&&function(t){return new Promise((function(i,n){!(function(A,t,e,i){Promise.resolve(i).then((function(t){A({value:t,done:e})}),t)})(i,n,(t=A[e](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError;var si,ri={exports:{}},oi=(function(){if(si)return ri.exports;si=1;var A,t="object"==typeof Reflect?Reflect:null,e=t&&"function"==typeof t.apply?t.apply:function(A,t,e){return Function.prototype.apply.call(A,t,e)};A=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(A){return Object.getOwnPropertyNames(A).concat(Object.getOwnPropertySymbols(A))}:function(A){return Object.getOwnPropertyNames(A)};var i=Number.isNaN||function(A){return A!=A};function n(){n.init.call(this)}ri.exports=n,ri.exports.once=function(A,t){return new Promise((function(e,i){function n(e){A.removeListener(t,s),i(e)}function s(){"function"==typeof A.removeListener&&A.removeListener("error",n),e([].slice.call(arguments))}B(A,t,s,{once:!0}),"error"!==t&&(function(A,t){"function"==typeof A.on&&B(A,"error",t,{once:!0})})(A,n)}))},n.EventEmitter=n,n.prototype.B=void 0,n.prototype.U=0,n.prototype.M=void 0;var s=10;function r(A){if("function"!=typeof A)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}function o(A){return void 0===A.M?n.defaultMaxListeners:A.M}function a(A,t,e,i){var n,s,a,c;if(r(e),void 0===(s=A.B)?(s=A.B=Object.create(null),A.U=0):(void 0!==s.newListener&&(A.emit("newListener",t,e.listener?e.listener:e),s=A.B),a=s[t]),void 0===a)a=s[t]=e,++A.U;else if("function"==typeof a?a=s[t]=i?[e,a]:[a,e]:i?a.unshift(e):a.push(e),(n=o(A))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=A,u.type=t,u.count=a.length,c=u,console&&console.warn&&console.warn(c)}return A}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(A,t,e){var i={fired:!1,wrapFn:void 0,target:A,type:t,listener:e},n=c.bind(i);return n.listener=e,i.wrapFn=n,n}function h(A,t,e){var i=A.B;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?e?[n.listener||n]:[n]:e?(function(A){for(var t=new Array(A.length),e=0;e<t.length;++e)t[e]=A[e].listener||A[e];return t})(n):d(n,n.length)}function l(A){var t=this.B;if(void 0!==t){var e=t[A];if("function"==typeof e)return 1;if(void 0!==e)return e.length}return 0}function d(A,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=A[i];return e}function B(A,t,e,i){if("function"==typeof A.on)i.once?A.once(t,e):A.on(t,e);else{if("function"!=typeof A.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof A);A.addEventListener(t,(function n(s){i.once&&A.removeEventListener(t,n),e(s)}))}}return Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(A){if("number"!=typeof A||A<0||i(A))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+A+".");s=A}}),n.init=function(){void 0!==this.B&&this.B!==Object.getPrototypeOf(this).B||(this.B=Object.create(null),this.U=0),this.M=this.M||void 0},n.prototype.setMaxListeners=function(A){if("number"!=typeof A||A<0||i(A))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+A+".");return this.M=A,this},n.prototype.getMaxListeners=function(){return o(this)},n.prototype.emit=function(A){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===A,s=this.B;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var r;if(t.length>0&&(r=t[0]),r instanceof Error)throw r;var o=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw o.context=r,o}var a=s[A];if(void 0===a)return!1;if("function"==typeof a)e(a,this,t);else{var c=a.length,u=d(a,c);for(i=0;i<c;++i)e(u[i],this,t)}return!0},n.prototype.addListener=function(A,t){return a(this,A,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(A,t){return a(this,A,t,!0)},n.prototype.once=function(A,t){return r(t),this.on(A,u(this,A,t)),this},n.prototype.prependOnceListener=function(A,t){return r(t),this.prependListener(A,u(this,A,t)),this},n.prototype.removeListener=function(A,t){var e,i,n,s,o;if(r(t),void 0===(i=this.B))return this;if(void 0===(e=i[A]))return this;if(e===t||e.listener===t)0===--this.U?this.B=Object.create(null):(delete i[A],i.removeListener&&this.emit("removeListener",A,e.listener||t));else if("function"!=typeof e){for(n=-1,s=e.length-1;s>=0;s--)if(e[s]===t||e[s].listener===t){o=e[s].listener,n=s;break}if(n<0)return this;0===n?e.shift():(function(A,t){for(;t+1<A.length;t++)A[t]=A[t+1];A.pop()})(e,n),1===e.length&&(i[A]=e[0]),void 0!==i.removeListener&&this.emit("removeListener",A,o||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(A){var t,e,i;if(void 0===(e=this.B))return this;if(void 0===e.removeListener)return 0===arguments.length?(this.B=Object.create(null),this.U=0):void 0!==e[A]&&(0===--this.U?this.B=Object.create(null):delete e[A]),this;if(0===arguments.length){var n,s=Object.keys(e);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this.B=Object.create(null),this.U=0,this}if("function"==typeof(t=e[A]))this.removeListener(A,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(A,t[i]);return this},n.prototype.listeners=function(A){return h(this,A,!0)},n.prototype.rawListeners=function(A){return h(this,A,!1)},n.listenerCount=function(A,t){return"function"==typeof A.listenerCount?A.listenerCount(t):l.call(A,t)},n.prototype.listenerCount=l,n.prototype.eventNames=function(){return this.U>0?A(this.B):[]},ri.exports})();let ai=!0,ci=!0;function ui(A,t,e){const i=A.match(t);return i&&i.length>=e&&parseInt(i[e],10)}function hi(A,t,e){if(!A.RTCPeerConnection)return;const i=A.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(A,i){if(A!==t)return n.apply(this,arguments);const s=A=>{const t=e(A);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._=this._||{},this._[t]||(this._[t]=new Map),this._[t].set(i,s),n.apply(this,[A,s])};const s=i.removeEventListener;i.removeEventListener=function(A,e){if(A!==t||!this._||!this._[t])return s.apply(this,arguments);if(!this._[t].has(e))return s.apply(this,arguments);const i=this._[t].get(e);return this._[t].delete(e),0===this._[t].size&&delete this._[t],0===Object.keys(this._).length&&delete this._,s.apply(this,[A,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(A){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),A&&this.addEventListener(t,this["_on"+t]=A)},enumerable:!0,configurable:!0})}function li(A){return"boolean"!=typeof A?new Error("Argument type: "+typeof A+". Please use a boolean."):(ai=A,A?"adapter.js logging disabled":"adapter.js logging enabled")}function di(A){return"boolean"!=typeof A?new Error("Argument type: "+typeof A+". Please use a boolean."):(ci=!A,"adapter.js deprecation warnings "+(A?"disabled":"enabled"))}function Bi(){if("object"==typeof window){if(ai)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function fi(A,t){ci&&console.warn(A+" is deprecated, please use "+t+" instead.")}function wi(A){return"[object Object]"===Object.prototype.toString.call(A)}function gi(A){return wi(A)?Object.keys(A).reduce((function(t,e){const i=wi(A[e]),n=i?gi(A[e]):A[e],s=i&&!Object.keys(n).length;return void 0===n||s?t:Object.assign(t,{[e]:n})}),{}):A}function pi(A,t,e){t&&!e.has(t.id)&&(e.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?pi(A,A.get(t[i]),e):i.endsWith("Ids")&&t[i].forEach((t=>{pi(A,A.get(t),e)}))})))}function vi(A,t,e){const i=e?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const s=[];return A.forEach((A=>{"track"===A.type&&A.trackIdentifier===t.id&&s.push(A)})),s.forEach((t=>{A.forEach((e=>{e.type===i&&e.trackId===t.id&&pi(A,e,n)}))})),n}const mi=Bi;function Qi(A,t){const e=A&&A.navigator;if(!e.mediaDevices)return;const i=function(A){if("object"!=typeof A||A.mandatory||A.optional)return A;const t={};return Object.keys(A).forEach((e=>{if("require"===e||"advanced"===e||"mediaSource"===e)return;const i="object"==typeof A[e]?A[e]:{ideal:A[e]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(A,t){return A?A+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let A={};"number"==typeof i.ideal?(A[n("min",e)]=i.ideal,t.optional.push(A),A={},A[n("max",e)]=i.ideal,t.optional.push(A)):(A[n("",e)]=i.ideal,t.optional.push(A))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",e)]=i.exact):["min","max"].forEach((A=>{void 0!==i[A]&&(t.mandatory=t.mandatory||{},t.mandatory[n(A,e)]=i[A])}))})),A.advanced&&(t.optional=(t.optional||[]).concat(A.advanced)),t},n=function(A,n){if(t.version>=61)return n(A);if((A=JSON.parse(JSON.stringify(A)))&&"object"==typeof A.audio){const t=function(A,t,e){t in A&&!(e in A)&&(A[e]=A[t],delete A[t])};t((A=JSON.parse(JSON.stringify(A))).audio,"autoGainControl","googAutoGainControl"),t(A.audio,"noiseSuppression","googNoiseSuppression"),A.audio=i(A.audio)}if(A&&"object"==typeof A.video){let s=A.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});const r=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!e.mediaDevices.getSupportedConstraints||!e.mediaDevices.getSupportedConstraints().facingMode||r)){let t;if(delete A.video.facingMode,"environment"===s.exact||"environment"===s.ideal?t=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(t=["front"]),t)return e.mediaDevices.enumerateDevices().then((e=>{let r=(e=e.filter((A=>"videoinput"===A.kind))).find((A=>t.some((t=>A.label.toLowerCase().includes(t)))));return!r&&e.length&&t.includes("back")&&(r=e[e.length-1]),r&&(A.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),A.video=i(A.video),mi("chrome: "+JSON.stringify(A)),n(A)}))}A.video=i(A.video)}return mi("chrome: "+JSON.stringify(A)),n(A)},s=function(A){return t.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}}};if(e.getUserMedia=function(A,t,i){n(A,(A=>{e.webkitGetUserMedia(A,t,(A=>{i&&i(s(A))}))}))}.bind(e),e.mediaDevices.getUserMedia){const A=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(t){return n(t,(t=>A(t).then((A=>{if(t.audio&&!A.getAudioTracks().length||t.video&&!A.getVideoTracks().length)throw A.getTracks().forEach((A=>{A.stop()})),new DOMException("","NotFoundError");return A}),(A=>Promise.reject(s(A))))))}}}function Ci(A){A.MediaStream=A.MediaStream||A.webkitMediaStream}function Ui(A){if("object"==typeof A&&A.RTCPeerConnection&&!("ontrack"in A.RTCPeerConnection.prototype)){Object.defineProperty(A.RTCPeerConnection.prototype,"ontrack",{get(){return this.N},set(A){this.N&&this.removeEventListener("track",this.N),this.addEventListener("track",this.N=A)},enumerable:!0,configurable:!0});const t=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){return this.R||(this.R=t=>{t.stream.addEventListener("addtrack",(e=>{let i;i=A.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((A=>A.track&&A.track.id===e.track.id)):{track:e.track};const n=new Event("track");n.track=e.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((e=>{let i;i=A.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((A=>A.track&&A.track.id===e.id)):{track:e};const n=new Event("track");n.track=e,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this.R)),t.apply(this,arguments)}}else hi(A,"track",(A=>(A.transceiver||Object.defineProperty(A,"transceiver",{value:{receiver:A.receiver}}),A)))}function Fi(A){if("object"==typeof A&&A.RTCPeerConnection&&!("getSenders"in A.RTCPeerConnection.prototype)&&"createDTMFSender"in A.RTCPeerConnection.prototype){const t=function(A,t){return{track:t,get dtmf(){return void 0===this.P&&("audio"===t.kind?this.P=A.createDTMFSender(t):this.P=null),this.P},J:A}};if(!A.RTCPeerConnection.prototype.getSenders){A.RTCPeerConnection.prototype.getSenders=function(){return this.X=this.X||[],this.X.slice()};const e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(A,i){let n=e.apply(this,arguments);return n||(n=t(this,A),this.X.push(n)),n};const i=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(A){i.apply(this,arguments);const t=this.X.indexOf(A);-1!==t&&this.X.splice(t,1)}}const e=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(A){this.X=this.X||[],e.apply(this,[A]),A.getTracks().forEach((A=>{this.X.push(t(this,A))}))};const i=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(A){this.X=this.X||[],i.apply(this,[A]),A.getTracks().forEach((A=>{const t=this.X.find((t=>t.track===A));t&&this.X.splice(this.X.indexOf(t),1)}))}}else if("object"==typeof A&&A.RTCPeerConnection&&"getSenders"in A.RTCPeerConnection.prototype&&"createDTMFSender"in A.RTCPeerConnection.prototype&&A.RTCRtpSender&&!("dtmf"in A.RTCRtpSender.prototype)){const t=A.RTCPeerConnection.prototype.getSenders;A.RTCPeerConnection.prototype.getSenders=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A},Object.defineProperty(A.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this.P&&("audio"===this.track.kind?this.P=this.J.createDTMFSender(this.track):this.P=null),this.P}})}}function yi(A){if(!("object"==typeof A&&A.RTCPeerConnection&&A.RTCRtpSender&&A.RTCRtpReceiver))return;if(!("getStats"in A.RTCRtpSender.prototype)){const t=A.RTCPeerConnection.prototype.getSenders;t&&(A.RTCPeerConnection.prototype.getSenders=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A});const e=A.RTCPeerConnection.prototype.addTrack;e&&(A.RTCPeerConnection.prototype.addTrack=function(){const A=e.apply(this,arguments);return A.J=this,A}),A.RTCRtpSender.prototype.getStats=function(){const A=this;return this.J.getStats().then((t=>vi(t,A.track,!0)))}}if(!("getStats"in A.RTCRtpReceiver.prototype)){const t=A.RTCPeerConnection.prototype.getReceivers;t&&(A.RTCPeerConnection.prototype.getReceivers=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A}),hi(A,"track",(A=>(A.receiver.J=A.srcElement,A))),A.RTCRtpReceiver.prototype.getStats=function(){const A=this;return this.J.getStats().then((t=>vi(t,A.track,!1)))}}if(!("getStats"in A.RTCRtpSender.prototype)||!("getStats"in A.RTCRtpReceiver.prototype))return;const t=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof A.MediaStreamTrack){const A=arguments[0];let t,e,i;return this.getSenders().forEach((e=>{e.track===A&&(t?i=!0:t=e)})),this.getReceivers().forEach((t=>(t.track===A&&(e?i=!0:e=t),t.track===A))),i||t&&e?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():e?e.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function bi(A){A.RTCPeerConnection.prototype.getLocalStreams=function(){return this.Y=this.Y||{},Object.keys(this.Y).map((A=>this.Y[A][0]))};const t=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(A,e){if(!e)return t.apply(this,arguments);this.Y=this.Y||{};const i=t.apply(this,arguments);return this.Y[e.id]?-1===this.Y[e.id].indexOf(i)&&this.Y[e.id].push(i):this.Y[e.id]=[e,i],i};const e=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(A){this.Y=this.Y||{},A.getTracks().forEach((A=>{if(this.getSenders().find((t=>t.track===A)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();e.apply(this,arguments);const i=this.getSenders().filter((A=>-1===t.indexOf(A)));this.Y[A.id]=[A].concat(i)};const i=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(A){return this.Y=this.Y||{},delete this.Y[A.id],i.apply(this,arguments)};const n=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(A){return this.Y=this.Y||{},A&&Object.keys(this.Y).forEach((t=>{const e=this.Y[t].indexOf(A);-1!==e&&this.Y[t].splice(e,1),1===this.Y[t].length&&delete this.Y[t]})),n.apply(this,arguments)}}function Ei(A,t){if(!A.RTCPeerConnection)return;if(A.RTCPeerConnection.prototype.addTrack&&t.version>=65)return bi(A);const e=A.RTCPeerConnection.prototype.getLocalStreams;A.RTCPeerConnection.prototype.getLocalStreams=function(){const A=e.apply(this);return this.W=this.W||{},A.map((A=>this.W[A.id]))};const i=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(t){if(this.Z=this.Z||{},this.W=this.W||{},t.getTracks().forEach((A=>{if(this.getSenders().find((t=>t.track===A)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this.W[t.id]){const e=new A.MediaStream(t.getTracks());this.Z[t.id]=e,this.W[e.id]=t,t=e}i.apply(this,[t])};const n=A.RTCPeerConnection.prototype.removeStream;function s(A,t){let e=t.sdp;return Object.keys(A.W||[]).forEach((t=>{const i=A.W[t],n=A.Z[i.id];e=e.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:e})}A.RTCPeerConnection.prototype.removeStream=function(A){this.Z=this.Z||{},this.W=this.W||{},n.apply(this,[this.Z[A.id]||A]),delete this.W[this.Z[A.id]?this.Z[A.id].id:A.id],delete this.Z[A.id]},A.RTCPeerConnection.prototype.addTrack=function(t,e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((A=>A===t)))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((A=>A.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this.Z=this.Z||{},this.W=this.W||{};const n=this.Z[e.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new A.MediaStream([t]);this.Z[e.id]=i,this.W[i.id]=e,this.addStream(i)}return this.getSenders().find((A=>A.track===t))},["createOffer","createAnswer"].forEach((function(t){const e=A.RTCPeerConnection.prototype[t],i={[t](){const A=arguments;return arguments.length&&"function"==typeof arguments[0]?e.apply(this,[t=>{const e=s(this,t);A[0].apply(null,[e])},t=>{A[1]&&A[1].apply(null,t)},arguments[2]]):e.apply(this,arguments).then((A=>s(this,A)))}};A.RTCPeerConnection.prototype[t]=i[t]}));const r=A.RTCPeerConnection.prototype.setLocalDescription;A.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=(function(A,t){let e=t.sdp;return Object.keys(A.W||[]).forEach((t=>{const i=A.W[t],n=A.Z[i.id];e=e.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:e})})(this,arguments[0]),r.apply(this,arguments)):r.apply(this,arguments)};const o=Object.getOwnPropertyDescriptor(A.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(A.RTCPeerConnection.prototype,"localDescription",{get(){const A=o.get.apply(this);return""===A.type?A:s(this,A)}}),A.RTCPeerConnection.prototype.removeTrack=function(A){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!A.J)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(A.J!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this.Z=this.Z||{},Object.keys(this.Z).forEach((e=>{this.Z[e].getTracks().find((t=>A.track===t))&&(t=this.Z[e])})),t&&(1===t.getTracks().length?this.removeStream(this.W[t.id]):t.removeTrack(A.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ii(A,t){!A.RTCPeerConnection&&A.webkitRTCPeerConnection&&(A.RTCPeerConnection=A.webkitRTCPeerConnection),A.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const e=A.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),e.apply(this,arguments)}};A.RTCPeerConnection.prototype[t]=i[t]}))}function ki(A,t){hi(A,"negotiationneeded",(A=>{const e=A.target;if(!(t.version<72||e.getConfiguration&&"plan-b"===e.getConfiguration().sdpSemantics)||"stable"===e.signalingState)return A}))}var Hi=Object.freeze({__proto__:null,fixNegotiationNeeded:ki,shimAddTrackRemoveTrack:Ei,shimAddTrackRemoveTrackWithNative:bi,shimGetSendersWithDtmf:Fi,shimGetUserMedia:Qi,shimMediaStream:Ci,shimOnTrack:Ui,shimPeerConnection:Ii,shimSenderReceiverGetStats:yi});function Si(A,t){const e=A&&A.navigator,i=A&&A.MediaStreamTrack;if(e.getUserMedia=function(A,t,i){fi("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),e.mediaDevices.getUserMedia(A).then(t,i)},!(t.version>55&&"autoGainControl"in e.mediaDevices.getSupportedConstraints())){const A=function(A,t,e){t in A&&!(e in A)&&(A[e]=A[t],delete A[t])},t=e.mediaDevices.getUserMedia.bind(e.mediaDevices);if(e.mediaDevices.getUserMedia=function(e){return"object"==typeof e&&"object"==typeof e.audio&&(e=JSON.parse(JSON.stringify(e)),A(e.audio,"autoGainControl","mozAutoGainControl"),A(e.audio,"noiseSuppression","mozNoiseSuppression")),t(e)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const e=t.apply(this,arguments);return A(e,"mozAutoGainControl","autoGainControl"),A(e,"mozNoiseSuppression","noiseSuppression"),e}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==typeof e&&(e=JSON.parse(JSON.stringify(e)),A(e,"autoGainControl","mozAutoGainControl"),A(e,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[e])}}}}function Ti(A){"object"==typeof A&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Oi(A,t){if("object"!=typeof A||!A.RTCPeerConnection&&!A.mozRTCPeerConnection)return;!A.RTCPeerConnection&&A.mozRTCPeerConnection&&(A.RTCPeerConnection=A.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const e=A.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),e.apply(this,arguments)}};A.RTCPeerConnection.prototype[t]=i[t]}));const e={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){const[A,n,s]=arguments;return i.apply(this,[A||null]).then((A=>{if(t.version<53&&!n)try{A.forEach((A=>{A.type=e[A.type]||A.type}))}catch(i){if("TypeError"!==i.name)throw i;A.forEach(((t,i)=>{A.set(i,Object.assign({},t,{type:e[t.type]||t.type}))}))}return A})).then(n,s)}}function Ki(A){if("object"!=typeof A||!A.RTCPeerConnection||!A.RTCRtpSender)return;if(A.RTCRtpSender&&"getStats"in A.RTCRtpSender.prototype)return;const t=A.RTCPeerConnection.prototype.getSenders;t&&(A.RTCPeerConnection.prototype.getSenders=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A});const e=A.RTCPeerConnection.prototype.addTrack;e&&(A.RTCPeerConnection.prototype.addTrack=function(){const A=e.apply(this,arguments);return A.J=this,A}),A.RTCRtpSender.prototype.getStats=function(){return this.track?this.J.getStats(this.track):Promise.resolve(new Map)}}function Di(A){if("object"!=typeof A||!A.RTCPeerConnection||!A.RTCRtpSender)return;if(A.RTCRtpSender&&"getStats"in A.RTCRtpReceiver.prototype)return;const t=A.RTCPeerConnection.prototype.getReceivers;t&&(A.RTCPeerConnection.prototype.getReceivers=function(){const A=t.apply(this,[]);return A.forEach((A=>A.J=this)),A}),hi(A,"track",(A=>(A.receiver.J=A.srcElement,A))),A.RTCRtpReceiver.prototype.getStats=function(){return this.J.getStats(this.track)}}function Mi(A){A.RTCPeerConnection&&!("removeStream"in A.RTCPeerConnection.prototype)&&(A.RTCPeerConnection.prototype.removeStream=function(A){fi("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&A.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function Li(A){A.DataChannel&&!A.RTCDataChannel&&(A.RTCDataChannel=A.DataChannel)}function xi(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype.addTransceiver;t&&(A.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let A=arguments[1]&&arguments[1].sendEncodings;void 0===A&&(A=[]),A=[...A];const e=A.length>0;e&&A.forEach((A=>{if("rid"in A&&!/^[a-z0-9]{0,16}$/i.test(A.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in A&&!(parseFloat(A.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in A&&!(parseFloat(A.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const i=t.apply(this,arguments);if(e){const{sender:t}=i,e=t.getParameters();(!("encodings"in e)||1===e.encodings.length&&0===Object.keys(e.encodings[0]).length)&&(e.encodings=A,t.sendEncodings=A,this.setParametersPromises.push(t.setParameters(e).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return i})}function _i(A){if("object"!=typeof A||!A.RTCRtpSender)return;const t=A.RTCRtpSender.prototype.getParameters;t&&(A.RTCRtpSender.prototype.getParameters=function(){const A=t.apply(this,arguments);return"encodings"in A||(A.encodings=[].concat(this.sendEncodings||[{}])),A})}function Ni(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function Ri(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype.createAnswer;A.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var ji=Object.freeze({__proto__:null,shimAddTransceiver:xi,shimCreateAnswer:Ri,shimCreateOffer:Ni,shimGetDisplayMedia:function(A,t){A.navigator.mediaDevices&&"getDisplayMedia"in A.navigator.mediaDevices||A.navigator.mediaDevices&&(A.navigator.mediaDevices.getDisplayMedia=function(e){if(!e||!e.video){const A=new DOMException("getDisplayMedia without video constraints is undefined");return A.name="NotFoundError",A.code=8,Promise.reject(A)}return!0===e.video?e.video={mediaSource:t}:e.video.mediaSource=t,A.navigator.mediaDevices.getUserMedia(e)})},shimGetParameters:_i,shimGetUserMedia:Si,shimOnTrack:Ti,shimPeerConnection:Oi,shimRTCDataChannel:Li,shimReceiverGetStats:Di,shimRemoveStream:Mi,shimSenderGetStats:Ki});function Gi(A){if("object"==typeof A&&A.RTCPeerConnection){if("getLocalStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getLocalStreams=function(){return this.AA||(this.AA=[]),this.AA}),!("addStream"in A.RTCPeerConnection.prototype)){const t=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addStream=function(A){this.AA||(this.AA=[]),this.AA.includes(A)||this.AA.push(A),A.getAudioTracks().forEach((e=>t.call(this,e,A))),A.getVideoTracks().forEach((e=>t.call(this,e,A)))},A.RTCPeerConnection.prototype.addTrack=function(A){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return i&&i.forEach((A=>{this.AA?this.AA.includes(A)||this.AA.push(A):this.AA=[A]})),t.apply(this,arguments)}}"removeStream"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.removeStream=function(A){this.AA||(this.AA=[]);const t=this.AA.indexOf(A);if(-1===t)return;this.AA.splice(t,1);const e=A.getTracks();this.getSenders().forEach((A=>{e.includes(A.track)&&this.removeTrack(A)}))})}}function Pi(A){if("object"==typeof A&&A.RTCPeerConnection&&("getRemoteStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getRemoteStreams=function(){return this.tA?this.tA:[]}),!("onaddstream"in A.RTCPeerConnection.prototype))){Object.defineProperty(A.RTCPeerConnection.prototype,"onaddstream",{get(){return this.eA},set(A){this.eA&&(this.removeEventListener("addstream",this.eA),this.removeEventListener("track",this.iA)),this.addEventListener("addstream",this.eA=A),this.addEventListener("track",this.iA=A=>{A.streams.forEach((A=>{if(this.tA||(this.tA=[]),this.tA.includes(A))return;this.tA.push(A);const t=new Event("addstream");t.stream=A,this.dispatchEvent(t)}))})}});const t=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){const A=this;return this.iA||this.addEventListener("track",this.iA=function(t){t.streams.forEach((t=>{if(A.tA||(A.tA=[]),A.tA.indexOf(t)>=0)return;A.tA.push(t);const e=new Event("addstream");e.stream=t,A.dispatchEvent(e)}))}),t.apply(A,arguments)}}}function Vi(A){if("object"!=typeof A||!A.RTCPeerConnection)return;const t=A.RTCPeerConnection.prototype,e=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,s=t.setRemoteDescription,r=t.addIceCandidate;t.createOffer=function(A,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=e.apply(this,[i]);return t?(n.then(A,t),Promise.resolve()):n},t.createAnswer=function(A,t){const e=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[e]);return t?(n.then(A,t),Promise.resolve()):n};let o=function(A,t,e){const i=n.apply(this,[A]);return e?(i.then(t,e),Promise.resolve()):i};t.setLocalDescription=o,o=function(A,t,e){const i=s.apply(this,[A]);return e?(i.then(t,e),Promise.resolve()):i},t.setRemoteDescription=o,o=function(A,t,e){const i=r.apply(this,[A]);return e?(i.then(t,e),Promise.resolve()):i},t.addIceCandidate=o}function Ji(A){const t=A&&A.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const A=t.mediaDevices,e=A.getUserMedia.bind(A);t.mediaDevices.getUserMedia=A=>e(Xi(A))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(A,e,i){t.mediaDevices.getUserMedia(A).then(e,i)}.bind(t))}function Xi(A){return A&&void 0!==A.video?Object.assign({},A,{video:gi(A.video)}):A}function $i(A){if(!A.RTCPeerConnection)return;const t=A.RTCPeerConnection;A.RTCPeerConnection=function(A,e){if(A&&A.iceServers){const t=[];for(let e=0;e<A.iceServers.length;e++){let i=A.iceServers[e];void 0===i.urls&&i.url?(fi("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(A.iceServers[e])}A.iceServers=t}return new t(A,e)},A.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(A.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Yi(A){"object"==typeof A&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Wi(A){const t=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(A){if(A){void 0!==A.offerToReceiveAudio&&(A.offerToReceiveAudio=!!A.offerToReceiveAudio);const t=this.getTransceivers().find((A=>"audio"===A.receiver.track.kind));!1===A.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==A.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==A.offerToReceiveVideo&&(A.offerToReceiveVideo=!!A.offerToReceiveVideo);const e=this.getTransceivers().find((A=>"video"===A.receiver.track.kind));!1===A.offerToReceiveVideo&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==A.offerToReceiveVideo||e||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Zi(A){"object"!=typeof A||A.AudioContext||(A.AudioContext=A.webkitAudioContext)}var qi,zi=Object.freeze({__proto__:null,shimAudioContext:Zi,shimCallbacksAPI:Vi,shimConstraints:Xi,shimCreateOfferLegacy:Wi,shimGetUserMedia:Ji,shimLocalStreamsAPI:Gi,shimRTCIceServerUrls:$i,shimRemoteStreamsAPI:Pi,shimTrackEventTransceiver:Yi}),An={exports:{}},tn=(qi||(qi=1,(function(A){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(A){return A.trim().split("\n").map((A=>A.trim()))},t.splitSections=function(A){return A.split("\nm=").map(((A,t)=>(t>0?"m="+A:A).trim()+"\r\n"))},t.getDescription=function(A){const e=t.splitSections(A);return e&&e[0]},t.getMediaSections=function(A){const e=t.splitSections(A);return e.shift(),e},t.matchPrefix=function(A,e){return t.splitLines(A).filter((A=>0===A.indexOf(e)))},t.parseCandidate=function(A){let t;t=0===A.indexOf("a=candidate:")?A.substring(12).split(" "):A.substring(10).split(" ");const e={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let i=8;i<t.length;i+=2)switch(t[i]){case"raddr":e.relatedAddress=t[i+1];break;case"rport":e.relatedPort=parseInt(t[i+1],10);break;case"tcptype":e.tcpType=t[i+1];break;case"ufrag":e.ufrag=t[i+1],e.usernameFragment=t[i+1];break;default:void 0===e[t[i]]&&(e[t[i]]=t[i+1])}return e},t.writeCandidate=function(A){const t=[];t.push(A.foundation);const e=A.component;"rtp"===e?t.push(1):"rtcp"===e?t.push(2):t.push(e),t.push(A.protocol.toUpperCase()),t.push(A.priority),t.push(A.address||A.ip),t.push(A.port);const i=A.type;return t.push("typ"),t.push(i),"host"!==i&&A.relatedAddress&&A.relatedPort&&(t.push("raddr"),t.push(A.relatedAddress),t.push("rport"),t.push(A.relatedPort)),A.tcpType&&"tcp"===A.protocol.toLowerCase()&&(t.push("tcptype"),t.push(A.tcpType)),(A.usernameFragment||A.ufrag)&&(t.push("ufrag"),t.push(A.usernameFragment||A.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(A){return A.substring(14).split(" ")},t.parseRtpMap=function(A){let t=A.substring(9).split(" ");const e={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),e.name=t[0],e.clockRate=parseInt(t[1],10),e.channels=3===t.length?parseInt(t[2],10):1,e.numChannels=e.channels,e},t.writeRtpMap=function(A){let t=A.payloadType;void 0!==A.preferredPayloadType&&(t=A.preferredPayloadType);const e=A.channels||A.numChannels||1;return"a=rtpmap:"+t+" "+A.name+"/"+A.clockRate+(1!==e?"/"+e:"")+"\r\n"},t.parseExtmap=function(A){const t=A.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(A){return"a=extmap:"+(A.id||A.preferredId)+(A.direction&&"sendrecv"!==A.direction?"/"+A.direction:"")+" "+A.uri+(A.attributes?" "+A.attributes:"")+"\r\n"},t.parseFmtp=function(A){const t={};let e;const i=A.substring(A.indexOf(" ")+1).split(";");for(let n=0;n<i.length;n++)e=i[n].trim().split("="),t[e[0].trim()]=e[1];return t},t.writeFmtp=function(A){let t="",e=A.payloadType;if(void 0!==A.preferredPayloadType&&(e=A.preferredPayloadType),A.parameters&&Object.keys(A.parameters).length){const i=[];Object.keys(A.parameters).forEach((t=>{void 0!==A.parameters[t]?i.push(t+"="+A.parameters[t]):i.push(t)})),t+="a=fmtp:"+e+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(A){const t=A.substring(A.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(A){let t="",e=A.payloadType;return void 0!==A.preferredPayloadType&&(e=A.preferredPayloadType),A.rtcpFeedback&&A.rtcpFeedback.length&&A.rtcpFeedback.forEach((A=>{t+="a=rtcp-fb:"+e+" "+A.type+(A.parameter&&A.parameter.length?" "+A.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(A){const t=A.indexOf(" "),e={ssrc:parseInt(A.substring(7,t),10)},i=A.indexOf(":",t);return i>-1?(e.attribute=A.substring(t+1,i),e.value=A.substring(i+1)):e.attribute=A.substring(t+1),e},t.parseSsrcGroup=function(A){const t=A.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((A=>parseInt(A,10)))}},t.getMid=function(A){const e=t.matchPrefix(A,"a=mid:")[0];if(e)return e.substring(6)},t.parseFingerprint=function(A){const t=A.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(A,e){return{role:"auto",fingerprints:t.matchPrefix(A+e,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(A,t){let e="a=setup:"+t+"\r\n";return A.fingerprints.forEach((A=>{e+="a=fingerprint:"+A.algorithm+" "+A.value+"\r\n"})),e},t.parseCryptoLine=function(A){const t=A.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(A){return"a=crypto:"+A.tag+" "+A.cryptoSuite+" "+("object"==typeof A.keyParams?t.writeCryptoKeyParams(A.keyParams):A.keyParams)+(A.sessionParams?" "+A.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(A){if(0!==A.indexOf("inline:"))return null;const t=A.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(A){return A.keyMethod+":"+A.keySalt+(A.lifeTime?"|"+A.lifeTime:"")+(A.mkiValue&&A.mkiLength?"|"+A.mkiValue+":"+A.mkiLength:"")},t.getCryptoParameters=function(A,e){return t.matchPrefix(A+e,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(A,e){const i=t.matchPrefix(A+e,"a=ice-ufrag:")[0],n=t.matchPrefix(A+e,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substring(12),password:n.substring(10)}:null},t.writeIceParameters=function(A){let t="a=ice-ufrag:"+A.usernameFragment+"\r\na=ice-pwd:"+A.password+"\r\n";return A.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(A){const e={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(A)[0].split(" ");e.profile=i[2];for(let s=3;s<i.length;s++){const n=i[s],r=t.matchPrefix(A,"a=rtpmap:"+n+" ")[0];if(r){const i=t.parseRtpMap(r),s=t.matchPrefix(A,"a=fmtp:"+n+" ");switch(i.parameters=s.length?t.parseFmtp(s[0]):{},i.rtcpFeedback=t.matchPrefix(A,"a=rtcp-fb:"+n+" ").map(t.parseRtcpFb),e.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":e.fecMechanisms.push(i.name.toUpperCase())}}}t.matchPrefix(A,"a=extmap:").forEach((A=>{e.headerExtensions.push(t.parseExtmap(A))}));const n=t.matchPrefix(A,"a=rtcp-fb:* ").map(t.parseRtcpFb);return e.codecs.forEach((A=>{n.forEach((t=>{A.rtcpFeedback.find((A=>A.type===t.type&&A.parameter===t.parameter))||A.rtcpFeedback.push(t)}))})),e},t.writeRtpDescription=function(A,e){let i="";i+="m="+A+" ",i+=e.codecs.length>0?"9":"0",i+=" "+(e.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=e.codecs.map((A=>void 0!==A.preferredPayloadType?A.preferredPayloadType:A.payloadType)).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",e.codecs.forEach((A=>{i+=t.writeRtpMap(A),i+=t.writeFmtp(A),i+=t.writeRtcpFb(A)}));let n=0;return e.codecs.forEach((A=>{A.maxptime>n&&(n=A.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),e.headerExtensions&&e.headerExtensions.forEach((A=>{i+=t.writeExtmap(A)})),i},t.parseRtpEncodingParameters=function(A){const e=[],i=t.parseRtpParameters(A),n=-1!==i.fecMechanisms.indexOf("RED"),s=-1!==i.fecMechanisms.indexOf("ULPFEC"),r=t.matchPrefix(A,"a=ssrc:").map((A=>t.parseSsrcMedia(A))).filter((A=>"cname"===A.attribute)),o=r.length>0&&r[0].ssrc;let a;const c=t.matchPrefix(A,"a=ssrc-group:FID").map((A=>A.substring(17).split(" ").map((A=>parseInt(A,10)))));c.length>0&&c[0].length>1&&c[0][0]===o&&(a=c[0][1]),i.codecs.forEach((A=>{if("RTX"===A.name.toUpperCase()&&A.parameters.apt){let t={ssrc:o,codecPayloadType:parseInt(A.parameters.apt,10)};o&&a&&(t.rtx={ssrc:a}),e.push(t),n&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:o,mechanism:s?"red+ulpfec":"red"},e.push(t))}})),0===e.length&&o&&e.push({ssrc:o});let u=t.matchPrefix(A,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,e.forEach((A=>{A.maxBitrate=u}))),e},t.parseRtcpParameters=function(A){const e={},i=t.matchPrefix(A,"a=ssrc:").map((A=>t.parseSsrcMedia(A))).filter((A=>"cname"===A.attribute))[0];i&&(e.cname=i.value,e.ssrc=i.ssrc);const n=t.matchPrefix(A,"a=rtcp-rsize");e.reducedSize=n.length>0,e.compound=0===n.length;const s=t.matchPrefix(A,"a=rtcp-mux");return e.mux=s.length>0,e},t.writeRtcpParameters=function(A){let t="";return A.reducedSize&&(t+="a=rtcp-rsize\r\n"),A.mux&&(t+="a=rtcp-mux\r\n"),void 0!==A.ssrc&&A.cname&&(t+="a=ssrc:"+A.ssrc+" cname:"+A.cname+"\r\n"),t},t.parseMsid=function(A){let e;const i=t.matchPrefix(A,"a=msid:");if(1===i.length)return e=i[0].substring(7).split(" "),{stream:e[0],track:e[1]};const n=t.matchPrefix(A,"a=ssrc:").map((A=>t.parseSsrcMedia(A))).filter((A=>"msid"===A.attribute));return n.length>0?(e=n[0].value.split(" "),{stream:e[0],track:e[1]}):void 0},t.parseSctpDescription=function(A){const e=t.parseMLine(A),i=t.matchPrefix(A,"a=max-message-size:");let n;i.length>0&&(n=parseInt(i[0].substring(19),10)),isNaN(n)&&(n=65536);const s=t.matchPrefix(A,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:e.fmt,maxMessageSize:n};const r=t.matchPrefix(A,"a=sctpmap:");if(r.length>0){const A=r[0].substring(10).split(" ");return{port:parseInt(A[0],10),protocol:A[1],maxMessageSize:n}}},t.writeSctpDescription=function(A,t){let e=[];return e="DTLS/SCTP"!==A.protocol?["m="+A.kind+" 9 "+A.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+A.kind+" 9 "+A.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&e.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),e.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(A,e,i){let n;const s=void 0!==e?e:2;return n=A||t.generateSessionId(),"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+s+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(A,e){const i=t.splitLines(A);for(let t=0;t<i.length;t++)switch(i[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[t].substring(2)}return e?t.getDirection(e):"sendrecv"},t.getKind=function(A){return t.splitLines(A)[0].split(" ")[0].substring(2)},t.isRejected=function(A){return"0"===A.split(" ",2)[1]},t.parseMLine=function(A){const e=t.splitLines(A)[0].substring(2).split(" ");return{kind:e[0],port:parseInt(e[1],10),protocol:e[2],fmt:e.slice(3).join(" ")}},t.parseOLine=function(A){const e=t.matchPrefix(A,"o=")[0].substring(2).split(" ");return{username:e[0],sessionId:e[1],sessionVersion:parseInt(e[2],10),netType:e[3],addressType:e[4],address:e[5]}},t.isValidSDP=function(A){if("string"!=typeof A||0===A.length)return!1;const e=t.splitLines(A);for(let t=0;t<e.length;t++)if(e[t].length<2||"="!==e[t].charAt(1))return!1;return!0},A.exports=t})(An)),An.exports),en=Re(tn),nn=B({__proto__:null,default:en},[tn]);function sn(A){if(!A.RTCIceCandidate||A.RTCIceCandidate&&"foundation"in A.RTCIceCandidate.prototype)return;const t=A.RTCIceCandidate;A.RTCIceCandidate=function(A){if("object"==typeof A&&A.candidate&&0===A.candidate.indexOf("a=")&&((A=JSON.parse(JSON.stringify(A))).candidate=A.candidate.substring(2)),A.candidate&&A.candidate.length){const e=new t(A),i=en.parseCandidate(A.candidate);for(const A in i)A in e||Object.defineProperty(e,A,{value:i[A]});return e.toJSON=function(){return{candidate:e.candidate,sdpMid:e.sdpMid,sdpMLineIndex:e.sdpMLineIndex,usernameFragment:e.usernameFragment}},e}return new t(A)},A.RTCIceCandidate.prototype=t.prototype,hi(A,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new A.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function rn(A){!A.RTCIceCandidate||A.RTCIceCandidate&&"relayProtocol"in A.RTCIceCandidate.prototype||hi(A,"icecandidate",(A=>{if(A.candidate){const t=en.parseCandidate(A.candidate.candidate);"relay"===t.type&&(A.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return A}))}function on(A,t){if(!A.RTCPeerConnection)return;"sctp"in A.RTCPeerConnection.prototype||Object.defineProperty(A.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this.nA?null:this.nA}});const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this.nA=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:A}=this.getConfiguration();"plan-b"===A&&Object.defineProperty(this,"sctp",{get(){return void 0===this.nA?null:this.nA},enumerable:!0,configurable:!0})}if((function(A){if(!A||!A.sdp)return!1;const t=en.splitSections(A.sdp);return t.shift(),t.some((A=>{const t=en.parseMLine(A);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))})(arguments[0])){const A=(function(A){const t=A.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const e=parseInt(t[1],10);return e!=e?-1:e})(arguments[0]),e=(function(A){let e=65536;return"firefox"===t.browser&&(e=t.version<57?-1===A?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),e})(A),i=(function(A,e){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=en.matchPrefix(A.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substring(19),10):"firefox"===t.browser&&-1!==e&&(i=2147483637),i})(arguments[0],A);let n;n=0===e&&0===i?Number.POSITIVE_INFINITY:0===e||0===i?Math.max(e,i):Math.min(e,i);const s={};Object.defineProperty(s,"maxMessageSize",{get:()=>n}),this.nA=s}return e.apply(this,arguments)}}function an(A){if(!A.RTCPeerConnection||!("createDataChannel"in A.RTCPeerConnection.prototype))return;function t(A,t){const e=A.send;A.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===A.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return e.apply(A,arguments)}}const e=A.RTCPeerConnection.prototype.createDataChannel;A.RTCPeerConnection.prototype.createDataChannel=function(){const A=e.apply(this,arguments);return t(A,this),A},hi(A,"datachannel",(A=>(t(A.channel,A.target),A)))}function cn(A){if(!A.RTCPeerConnection||"connectionState"in A.RTCPeerConnection.prototype)return;const t=A.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this.sA||null},set(A){this.sA&&(this.removeEventListener("connectionstatechange",this.sA),delete this.sA),A&&this.addEventListener("connectionstatechange",this.sA=A)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((A=>{const e=t[A];t[A]=function(){return this.rA||(this.rA=A=>{const t=A.target;if(t.oA!==t.connectionState){t.oA=t.connectionState;const e=new Event("connectionstatechange",A);t.dispatchEvent(e)}return A},this.addEventListener("iceconnectionstatechange",this.rA)),e.apply(this,arguments)}}))}function un(A,t){if(!A.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const e=t.sdp.split("\n").filter((A=>"a=extmap-allow-mixed"!==A.trim())).join("\n");A.RTCSessionDescription&&t instanceof A.RTCSessionDescription?arguments[0]=new A.RTCSessionDescription({type:t.type,sdp:e}):t.sdp=e}return e.apply(this,arguments)}}function hn(A,t){if(!A.RTCPeerConnection||!A.RTCPeerConnection.prototype)return;const e=A.RTCPeerConnection.prototype.addIceCandidate;e&&0!==e.length&&(A.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ln(A,t){if(!A.RTCPeerConnection||!A.RTCPeerConnection.prototype)return;const e=A.RTCPeerConnection.prototype.setLocalDescription;e&&0!==e.length&&(A.RTCPeerConnection.prototype.setLocalDescription=function(){let A=arguments[0]||{};if("object"!=typeof A||A.type&&A.sdp)return e.apply(this,arguments);if(A={type:A.type,sdp:A.sdp},!A.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":A.type="offer";break;default:A.type="answer"}return A.sdp||"offer"!==A.type&&"answer"!==A.type?e.apply(this,[A]):("offer"===A.type?this.createOffer:this.createAnswer).apply(this).then((A=>e.apply(this,[A])))})}var dn=Object.freeze({__proto__:null,removeExtmapAllowMixed:un,shimAddIceCandidateNullOrEmpty:hn,shimConnectionState:cn,shimMaxMessageSize:on,shimParameterlessSetLocalDescription:ln,shimRTCIceCandidate:sn,shimRTCIceCandidateRelayProtocol:rn,shimSendThrowTypeError:an});!(function(){let{window:A}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const e=Bi,i=(function(A){const t={browser:null,version:null};if(void 0===A||!A.navigator||!A.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:e}=A;if(e.userAgentData&&e.userAgentData.brands){const A=e.userAgentData.brands.find((A=>"Chromium"===A.brand));if(A)return{browser:"chrome",version:parseInt(A.version,10)}}if(e.mozGetUserMedia)t.browser="firefox",t.version=ui(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia||!1===A.isSecureContext&&A.webkitRTCPeerConnection)t.browser="chrome",t.version=ui(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!A.RTCPeerConnection||!e.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=ui(e.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=A.RTCRtpTransceiver&&"currentDirection"in A.RTCRtpTransceiver.prototype}return t})(A),n={browserDetails:i,commonShim:dn,extractVersion:ui,disableLog:li,disableWarnings:di,sdp:nn};switch(i.browser){case"chrome":if(!Hi||!Ii||!t.shimChrome)return e("Chrome shim is not included in this adapter release."),n;if(null===i.version)return e("Chrome shim can not determine version, not shimming."),n;e("adapter.js shimming chrome."),n.browserShim=Hi,hn(A,i),ln(A),Qi(A,i),Ci(A),Ii(A,i),Ui(A),Ei(A,i),Fi(A),yi(A),ki(A,i),sn(A),rn(A),cn(A),on(A,i),an(A),un(A,i);break;case"firefox":if(!ji||!Oi||!t.shimFirefox)return e("Firefox shim is not included in this adapter release."),n;e("adapter.js shimming firefox."),n.browserShim=ji,hn(A,i),ln(A),Si(A,i),Oi(A,i),Ti(A),Mi(A),Ki(A),Di(A),Li(A),xi(A),_i(A),Ni(A),Ri(A),sn(A),cn(A),on(A,i),an(A);break;case"safari":if(!zi||!t.shimSafari)return e("Safari shim is not included in this adapter release."),n;e("adapter.js shimming safari."),n.browserShim=zi,hn(A,i),ln(A),$i(A),Wi(A),Vi(A),Gi(A),Pi(A),Yi(A),Ji(A),Zi(A),sn(A),rn(A),on(A,i),an(A),un(A,i);break;default:e("Unsupported browser!")}})({window:"undefined"==typeof window?void 0:window});const Bn="lk_e2ee";var fn,wn,gn,pn,vn,mn,Qn,Cn,Un,Fn,yn,bn,En,In,kn,Hn,Sn,Tn,On,Kn;function Dn(){return void 0!==window.RTCRtpScriptTransform}(wn=fn||(fn={})).SetKey="setKey",wn.RatchetRequest="ratchetRequest",wn.KeyRatcheted="keyRatcheted",(gn||(gn={})).KeyRatcheted="keyRatcheted",(vn=pn||(pn={})).ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",vn.EncryptionError="encryptionError",(mn||(mn={})).Error="cryptorError",oi.EventEmitter;class Mn extends Error{constructor(A,t){super(t||"an error has occured"),this.name="LiveKitError",this.code=A}}(Cn=Qn||(Qn={}))[Cn.NotAllowed=0]="NotAllowed",Cn[Cn.ServerUnreachable=1]="ServerUnreachable",Cn[Cn.InternalError=2]="InternalError",Cn[Cn.Cancelled=3]="Cancelled",Cn[Cn.LeaveRequest=4]="LeaveRequest";class Ln extends Mn{constructor(A,t,e,i){super(1,A),this.name="ConnectionError",this.status=e,this.reason=t,this.context=i,this.reasonName=Qn[t]}}class xn extends Mn{constructor(A){super(21,null!=A?A:"device is unsupported"),this.name="DeviceUnsupportedError"}}class _n extends Mn{constructor(A){super(20,null!=A?A:"track is invalid"),this.name="TrackInvalidError"}}class Nn extends Mn{constructor(A){super(10,null!=A?A:"unsupported server"),this.name="UnsupportedServer"}}class Rn extends Mn{constructor(A){super(12,null!=A?A:"unexpected connection state"),this.name="UnexpectedConnectionState"}}class jn extends Mn{constructor(A){super(13,null!=A?A:"unable to negotiate"),this.name="NegotiationError"}}class Gn extends Mn{constructor(A,t){super(15,A),this.name="PublishTrackError",this.status=t}}class Pn extends Mn{constructor(A,t){super(15,A),this.reason=t,this.reasonName="string"==typeof t?t:_e[t]}}(Fn=Un||(Un={})).PermissionDenied="PermissionDenied",Fn.NotFound="NotFound",Fn.DeviceInUse="DeviceInUse",Fn.Other="Other",(function(A){A.getFailure=function(t){if(t&&"name"in t)return"NotFoundError"===t.name||"DevicesNotFoundError"===t.name?A.NotFound:"NotAllowedError"===t.name||"PermissionDeniedError"===t.name?A.PermissionDenied:"NotReadableError"===t.name||"TrackStartError"===t.name?A.DeviceInUse:A.Other}})(Un||(Un={})),(bn=yn||(yn={}))[bn.InvalidKey=0]="InvalidKey",bn[bn.MissingKey=1]="MissingKey",bn[bn.InternalError=2]="InternalError",(In=En||(En={})).Connected="connected",In.Reconnecting="reconnecting",In.SignalReconnecting="signalReconnecting",In.Reconnected="reconnected",In.Disconnected="disconnected",In.ConnectionStateChanged="connectionStateChanged",In.Moved="moved",In.MediaDevicesChanged="mediaDevicesChanged",In.ParticipantConnected="participantConnected",In.ParticipantDisconnected="participantDisconnected",In.TrackPublished="trackPublished",In.TrackSubscribed="trackSubscribed",In.TrackSubscriptionFailed="trackSubscriptionFailed",In.TrackUnpublished="trackUnpublished",In.TrackUnsubscribed="trackUnsubscribed",In.TrackMuted="trackMuted",In.TrackUnmuted="trackUnmuted",In.LocalTrackPublished="localTrackPublished",In.LocalTrackUnpublished="localTrackUnpublished",In.LocalAudioSilenceDetected="localAudioSilenceDetected",In.ActiveSpeakersChanged="activeSpeakersChanged",In.ParticipantMetadataChanged="participantMetadataChanged",In.ParticipantNameChanged="participantNameChanged",In.ParticipantAttributesChanged="participantAttributesChanged",In.ParticipantActive="participantActive",In.RoomMetadataChanged="roomMetadataChanged",In.DataReceived="dataReceived",In.SipDTMFReceived="sipDTMFReceived",In.TranscriptionReceived="transcriptionReceived",In.ConnectionQualityChanged="connectionQualityChanged",In.TrackStreamStateChanged="trackStreamStateChanged",In.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",In.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",In.AudioPlaybackStatusChanged="audioPlaybackChanged",In.VideoPlaybackStatusChanged="videoPlaybackChanged",In.MediaDevicesError="mediaDevicesError",In.ParticipantPermissionsChanged="participantPermissionsChanged",In.SignalConnected="signalConnected",In.RecordingStatusChanged="recordingStatusChanged",In.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",In.EncryptionError="encryptionError",In.DCBufferStatusChanged="dcBufferStatusChanged",In.ActiveDeviceChanged="activeDeviceChanged",In.ChatMessage="chatMessage",In.LocalTrackSubscribed="localTrackSubscribed",In.MetricsReceived="metricsReceived",(Hn=kn||(kn={})).TrackPublished="trackPublished",Hn.TrackSubscribed="trackSubscribed",Hn.TrackSubscriptionFailed="trackSubscriptionFailed",Hn.TrackUnpublished="trackUnpublished",Hn.TrackUnsubscribed="trackUnsubscribed",Hn.TrackMuted="trackMuted",Hn.TrackUnmuted="trackUnmuted",Hn.LocalTrackPublished="localTrackPublished",Hn.LocalTrackUnpublished="localTrackUnpublished",Hn.ParticipantMetadataChanged="participantMetadataChanged",Hn.ParticipantNameChanged="participantNameChanged",Hn.DataReceived="dataReceived",Hn.SipDTMFReceived="sipDTMFReceived",Hn.TranscriptionReceived="transcriptionReceived",Hn.IsSpeakingChanged="isSpeakingChanged",Hn.ConnectionQualityChanged="connectionQualityChanged",Hn.TrackStreamStateChanged="trackStreamStateChanged",Hn.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",Hn.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",Hn.MediaDevicesError="mediaDevicesError",Hn.AudioStreamAcquired="audioStreamAcquired",Hn.ParticipantPermissionsChanged="participantPermissionsChanged",Hn.PCTrackAdded="pcTrackAdded",Hn.AttributesChanged="attributesChanged",Hn.LocalTrackSubscribed="localTrackSubscribed",Hn.ChatMessage="chatMessage",Hn.Active="active",(Tn=Sn||(Sn={})).TransportsCreated="transportsCreated",Tn.Connected="connected",Tn.Disconnected="disconnected",Tn.Resuming="resuming",Tn.Resumed="resumed",Tn.Restarting="restarting",Tn.Restarted="restarted",Tn.SignalResumed="signalResumed",Tn.SignalRestarted="signalRestarted",Tn.Closing="closing",Tn.MediaTrackAdded="mediaTrackAdded",Tn.ActiveSpeakersUpdate="activeSpeakersUpdate",Tn.DataPacketReceived="dataPacketReceived",Tn.RTPVideoMapUpdate="rtpVideoMapUpdate",Tn.DCBufferStatusChanged="dcBufferStatusChanged",Tn.ParticipantUpdate="participantUpdate",Tn.RoomUpdate="roomUpdate",Tn.SpeakersChanged="speakersChanged",Tn.StreamStateChanged="streamStateChanged",Tn.ConnectionQualityUpdate="connectionQualityUpdate",Tn.SubscriptionError="subscriptionError",Tn.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",Tn.RemoteMute="remoteMute",Tn.SubscribedQualityUpdate="subscribedQualityUpdate",Tn.LocalTrackUnpublished="localTrackUnpublished",Tn.LocalTrackSubscribed="localTrackSubscribed",Tn.Offline="offline",Tn.SignalRequestResponse="signalRequestResponse",Tn.SignalConnected="signalConnected",Tn.RoomMoved="roomMoved",(Kn=On||(On={})).Message="message",Kn.Muted="muted",Kn.Unmuted="unmuted",Kn.Restarted="restarted",Kn.Ended="ended",Kn.Subscribed="subscribed",Kn.Unsubscribed="unsubscribed",Kn.UpdateSettings="updateSettings",Kn.UpdateSubscription="updateSubscription",Kn.AudioPlaybackStarted="audioPlaybackStarted",Kn.AudioPlaybackFailed="audioPlaybackFailed",Kn.AudioSilenceDetected="audioSilenceDetected",Kn.VisibilityChanged="visibilityChanged",Kn.VideoDimensionsChanged="videoDimensionsChanged",Kn.VideoPlaybackStarted="videoPlaybackStarted",Kn.VideoPlaybackFailed="videoPlaybackFailed",Kn.ElementAttached="elementAttached",Kn.ElementDetached="elementDetached",Kn.UpstreamPaused="upstreamPaused",Kn.UpstreamResumed="upstreamResumed",Kn.SubscriptionPermissionChanged="subscriptionPermissionChanged",Kn.SubscriptionStatusChanged="subscriptionStatusChanged",Kn.SubscriptionFailed="subscriptionFailed",Kn.TrackProcessorUpdate="trackProcessorUpdate",Kn.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",Kn.TranscriptionReceived="transcriptionReceived",Kn.TimeSyncUpdate="timeSyncUpdate";const Vn=/version\/(\d+(\.?_?\d+)+)/i;let Jn;function Xn(A){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===A&&"undefined"==typeof navigator)return;const e=(null!=A?A:navigator.userAgent).toLowerCase();if(void 0===Jn||t){const A=$n.find((A=>{let{test:t}=A;return t.test(e)}));Jn=null==A?void 0:A.describe(e)}return Jn}const $n=[{test:/firefox|iceweasel|fxios/i,describe:A=>({name:"Firefox",version:Yn(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:Wn(A)})},{test:/chrom|crios|crmo/i,describe:A=>({name:"Chrome",version:Yn(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("crios")?"iOS":void 0,osVersion:Wn(A)})},{test:/safari|applewebkit/i,describe:A=>({name:"Safari",version:Yn(Vn,A),os:A.includes("mobile/")?"iOS":"macOS",osVersion:Wn(A)})}];function Yn(A,t){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const i=t.match(A);return i&&i.length>=e&&i[e]||""}function Wn(A){return A.includes("mac os")?Yn(/\(.+?(\d+_\d+(:?_\d+)?)/,A,1).replace(/_/g,"."):void 0}class Zn{}Zn.setTimeout=function(){return setTimeout(...arguments)},Zn.setInterval=function(){return setInterval(...arguments)},Zn.clearTimeout=function(){return clearTimeout(...arguments)},Zn.clearInterval=function(){return clearInterval(...arguments)};const qn=[];var zn,As;(As=zn||(zn={}))[As.LOW=0]="LOW",As[As.MEDIUM=1]="MEDIUM",As[As.HIGH=2]="HIGH";class ts extends oi.EventEmitter{constructor(A,t){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=ts.StreamState.Active,this.isInBackground=!1,this.aA=0,this.log=qe,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),"hidden"===document.visibilityState?this.backgroundTimeout=setTimeout((()=>this.handleAppVisibilityChanged()),5e3):this.handleAppVisibilityChanged()},this.log=ze(null!==(i=e.loggerName)&&void 0!==i?i:$e.Track),this.loggerContextCb=e.loggerContextCb,this.setMaxListeners(100),this.kind=t,this.cA=A,this.uA=A.id,this.source=ts.Source.Unknown}get logContext(){var A;return Object.assign(Object.assign({},null===(A=this.loggerContextCb)||void 0===A?void 0:A.call(this)),ar(this))}get currentBitrate(){return this.aA}get mediaStreamTrack(){return this.cA}get mediaStreamID(){return this.uA}attach(A){let t="audio";this.kind===ts.Kind.Video&&(t="video"),0===this.attachedElements.length&&this.kind===ts.Kind.Video&&this.addAppVisibilityListener(),A||("audio"===t&&(qn.forEach((t=>{null!==t.parentElement||A||(A=t)})),A&&qn.splice(qn.indexOf(A),1)),A||(A=document.createElement(t))),this.attachedElements.includes(A)||this.attachedElements.push(A),es(this.mediaStreamTrack,A);const e=A.srcObject.getTracks(),i=e.some((A=>"audio"===A.kind));return A.play().then((()=>{this.emit(i?On.AudioPlaybackStarted:On.VideoPlaybackStarted)})).catch((t=>{"NotAllowedError"===t.name?this.emit(i?On.AudioPlaybackFailed:On.VideoPlaybackFailed,t):"AbortError"===t.name?qe.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):qe.warn("could not playback ".concat(i?"audio":"video"),t),i&&A&&e.some((A=>"video"===A.kind))&&"NotAllowedError"===t.name&&(A.muted=!0,A.play().catch((()=>{})))})),this.emit(On.ElementAttached,A),A}detach(A){try{if(A){is(this.mediaStreamTrack,A);const t=this.attachedElements.indexOf(A);return t>=0&&(this.attachedElements.splice(t,1),this.recycleElement(A),this.emit(On.ElementDetached,A)),A}const t=[];return this.attachedElements.forEach((A=>{is(this.mediaStreamTrack,A),t.push(A),this.recycleElement(A),this.emit(On.ElementDetached,A)})),this.attachedElements=[],t}finally{0===this.attachedElements.length&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this.cA.stop()}enable(){this.cA.enabled=!0}disable(){this.cA.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(A){A.loggerName&&(this.log=ze(A.loggerName)),A.loggerContextCb&&(this.loggerContextCb=A.loggerContextCb)}recycleElement(A){if(A instanceof HTMLAudioElement){let t=!0;A.pause(),qn.forEach((A=>{A.parentElement||(t=!1)})),t&&qn.push(A)}}handleAppVisibilityChanged(){return ii(this,void 0,void 0,(function*(){this.isInBackground="hidden"===document.visibilityState,this.isInBackground||this.kind!==ts.Kind.Video||setTimeout((()=>this.attachedElements.forEach((A=>A.play().catch((()=>{}))))),0)}))}addAppVisibilityListener(){Fs()?(this.isInBackground="hidden"===document.visibilityState,document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Fs()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function es(A,t){let e,i;e=t.srcObject instanceof MediaStream?t.srcObject:new MediaStream,i="audio"===A.kind?e.getAudioTracks():e.getVideoTracks(),i.includes(A)||(i.forEach((A=>{e.removeTrack(A)})),e.addTrack(A)),Cs()&&t instanceof HTMLVideoElement||(t.autoplay=!0),t.muted=0===e.getAudioTracks().length,t instanceof HTMLVideoElement&&(t.playsInline=!0),t.srcObject!==e&&(t.srcObject=e,(Cs()||Qs())&&t instanceof HTMLVideoElement&&setTimeout((()=>{t.srcObject=e,t.play().catch((()=>{}))}),0))}function is(A,t){if(t.srcObject instanceof MediaStream){const e=t.srcObject;e.removeTrack(A),e.getTracks().length>0?t.srcObject=e:t.srcObject=null}}!(function(A){let t;var e;let i;var n;let s;var r;(e=t=A.Kind||(A.Kind={})).Audio="audio",e.Video="video",e.Unknown="unknown",(n=i=A.Source||(A.Source={})).Camera="camera",n.Microphone="microphone",n.ScreenShare="screen_share",n.ScreenShareAudio="screen_share_audio",n.Unknown="unknown",(r=s=A.StreamState||(A.StreamState={})).Active="active",r.Paused="paused",r.Unknown="unknown",A.kindToProto=function(A){switch(A){case t.Audio:return zA.AUDIO;case t.Video:return zA.VIDEO;default:return zA.DATA}},A.kindFromProto=function(A){switch(A){case zA.AUDIO:return t.Audio;case zA.VIDEO:return t.Video;default:return t.Unknown}},A.sourceToProto=function(A){switch(A){case i.Camera:return At.CAMERA;case i.Microphone:return At.MICROPHONE;case i.ScreenShare:return At.SCREEN_SHARE;case i.ScreenShareAudio:return At.SCREEN_SHARE_AUDIO;default:return At.UNKNOWN}},A.sourceFromProto=function(A){switch(A){case At.CAMERA:return i.Camera;case At.MICROPHONE:return i.Microphone;case At.SCREEN_SHARE:return i.ScreenShare;case At.SCREEN_SHARE_AUDIO:return i.ScreenShareAudio;default:return i.Unknown}},A.streamStateFromProto=function(A){switch(A){case $t.ACTIVE:return s.Active;case $t.PAUSED:return s.Paused;default:return s.Unknown}}})(ts||(ts={}));class ns{constructor(A,t,e,i,n){if("object"==typeof A)this.width=A.width,this.height=A.height,this.aspectRatio=A.aspectRatio,this.encoding={maxBitrate:A.maxBitrate,maxFramerate:A.maxFramerate,priority:A.priority};else{if(void 0===t||void 0===e)throw new TypeError("Unsupported options: provide at least width, height and maxBitrate");this.width=A,this.height=t,this.aspectRatio=A/t,this.encoding={maxBitrate:e,maxFramerate:i,priority:n}}}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const ss=["vp8","h264"],rs=["vp8","h264","vp9","av1"];function os(A){return!!ss.find((t=>t===A))}var as,cs,us,hs;(cs=as||(as={}))[cs.PREFER_REGRESSION=0]="PREFER_REGRESSION",cs[cs.SIMULCAST=1]="SIMULCAST",cs[cs.REGRESSION=2]="REGRESSION",(hs=us||(us={})).telephone={maxBitrate:12e3},hs.speech={maxBitrate:24e3},hs.music={maxBitrate:48e3},hs.musicStereo={maxBitrate:64e3},hs.musicHighQuality={maxBitrate:96e3},hs.musicHighQualityStereo={maxBitrate:128e3};const ls={h90:new ns(160,90,9e4,20),h180:new ns(320,180,16e4,20),h216:new ns(384,216,18e4,20),h360:new ns(640,360,45e4,20),h540:new ns(960,540,8e5,25),h720:new ns(1280,720,17e5,30),h1080:new ns(1920,1080,3e6,30),h1440:new ns(2560,1440,5e6,30),h2160:new ns(3840,2160,8e6,30)},ds={h120:new ns(160,120,7e4,20),h180:new ns(240,180,125e3,20),h240:new ns(320,240,14e4,20),h360:new ns(480,360,33e4,20),h480:new ns(640,480,5e5,20),h540:new ns(720,540,6e5,25),h720:new ns(960,720,13e5,30),h1080:new ns(1440,1080,23e5,30),h1440:new ns(1920,1440,38e5,30)},Bs={h360fps3:new ns(640,360,2e5,3,"medium"),h360fps15:new ns(640,360,4e5,15,"medium"),h720fps5:new ns(1280,720,8e5,5,"medium"),h720fps15:new ns(1280,720,15e5,15,"medium"),h720fps30:new ns(1280,720,2e6,30,"medium"),h1080fps15:new ns(1920,1080,25e5,15,"medium"),h1080fps30:new ns(1920,1080,5e6,30,"medium"),original:new ns(0,0,7e6,30,"medium")},fs="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function ws(A){return ii(this,void 0,void 0,(function*(){return new Promise((t=>Zn.setTimeout(t,A)))}))}function gs(){return"addTransceiver"in RTCPeerConnection.prototype}function ps(){return"addTrack"in RTCPeerConnection.prototype}function vs(A){return"av1"===A||"vp9"===A}function ms(A){return!!document&&(A||(A=document.createElement("audio")),"setSinkId"in A)}function Qs(){var A;return"Firefox"===(null===(A=Xn())||void 0===A?void 0:A.name)}function Cs(){var A;return"Safari"===(null===(A=Xn())||void 0===A?void 0:A.name)}function Us(){var A,t;return!!Fs()&&(null!==(t=null===(A=navigator.userAgentData)||void 0===A?void 0:A.mobile)&&void 0!==t?t:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent))}function Fs(){return"undefined"!=typeof document}function ys(){return"ReactNative"==navigator.product}function bs(A){return A.hostname.endsWith(".livekit.cloud")||A.hostname.endsWith(".livekit.run")}function Es(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Is(){if(!ys())return;let A=Es();return A?A.platform:void 0}function ks(){if(Fs())return window.devicePixelRatio;if(ys()){let A=Es();if(A)return A.devicePixelRatio}return 1}function Hs(A,t){const e=A.split("."),i=t.split("."),n=Math.min(e.length,i.length);for(let s=0;s<n;++s){const A=parseInt(e[s],10),t=parseInt(i[s],10);if(A>t)return 1;if(A<t)return-1;if(s===n-1&&A===t)return 0}return""===A&&""!==t?-1:""===t?1:e.length==i.length?0:e.length<i.length?-1:1}function Ss(A){for(const t of A)t.target.handleResize(t)}function Ts(A){for(const t of A)t.target.handleVisibilityChanged(t)}let Os=null;const Ks=()=>(Os||(Os=new ResizeObserver(Ss)),Os);let Ds=null;const Ms=()=>(Ds||(Ds=new IntersectionObserver(Ts,{root:null,rootMargin:"0px"})),Ds);function Ls(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=document.createElement("canvas");n.width=A,n.height=t;const s=n.getContext("2d");null==s||s.fillRect(0,0,n.width,n.height),i&&s&&(s.beginPath(),s.arc(A/2,t/2,50,0,2*Math.PI,!0),s.closePath(),s.fillStyle="grey",s.fill());const r=n.captureStream(),[o]=r.getTracks();if(!o)throw Error("Could not get empty media stream video track");return o.enabled=e,o}let xs;function _s(){if(!xs){const A=new AudioContext,t=A.createOscillator(),e=A.createGain();e.gain.setValueAtTime(0,0);const i=A.createMediaStreamDestination();if(t.connect(e),e.connect(i),t.start(),[xs]=i.stream.getAudioTracks(),!xs)throw Error("Could not get empty media stream audio track");xs.enabled=!1}return xs.clone()}class Ns{constructor(A,t){this.onFinally=t,this.promise=new Promise(((t,e)=>ii(this,void 0,void 0,(function*(){this.resolve=t,this.reject=e,A&&(yield A(t,e))})))).finally((()=>{var A;return null===(A=this.onFinally)||void 0===A?void 0:A.call(this)}))}}function Rs(A){if("string"==typeof A||"number"==typeof A)return A;if(Array.isArray(A))return A[0];if(A.exact)return Array.isArray(A.exact)?A.exact[0]:A.exact;if(A.ideal)return Array.isArray(A.ideal)?A.ideal[0]:A.ideal;throw Error("could not unwrap constraint")}function js(A){return A.startsWith("ws")?A.replace(/^(ws)/,"http"):A}function Gs(A){switch(A.reason){case Qn.LeaveRequest:return A.context;case Qn.Cancelled:return nt.CLIENT_INITIATED;case Qn.NotAllowed:return nt.USER_REJECTED;case Qn.ServerUnreachable:return nt.JOIN_FAILURE;default:return nt.UNKNOWN_REASON}}function Ps(A){return void 0!==A?Number(A):void 0}function Vs(A){return void 0!==A?BigInt(A):void 0}function Js(A){return!!A&&!(A instanceof MediaStreamTrack)&&A.isLocal}function Xs(A){return!!A&&A.kind==ts.Kind.Audio}function $s(A){return!!A&&A.kind==ts.Kind.Video}function Ys(A){return Js(A)&&$s(A)}function Ws(A){return Js(A)&&Xs(A)}function Zs(A){return!!A&&!A.isLocal}function qs(A){return!!A&&!A.isLocal}function zs(A){return Zs(A)&&$s(A)}function Ar(A,t,e){var i,n,s,r;const{optionsWithoutProcessor:o,audioProcessor:a,videoProcessor:c}=cr(null!=A?A:{}),u=null==t?void 0:t.processor,h=null==e?void 0:e.processor,l=null!=o?o:{};return!0===l.audio&&(l.audio={}),!0===l.video&&(l.video={}),l.audio&&(tr(l.audio,t),null!==(i=(s=l.audio).deviceId)&&void 0!==i||(s.deviceId={ideal:"default"}),(a||u)&&(l.audio.processor=null!=a?a:u)),l.video&&(tr(l.video,e),null!==(n=(r=l.video).deviceId)&&void 0!==n||(r.deviceId={ideal:"default"}),(c||h)&&(l.video.processor=null!=c?c:h)),l}function tr(A,t){return Object.keys(t).forEach((e=>{void 0===A[e]&&(A[e]=t[e])})),A}function er(A){var t,e,i,n;const s={};if(A.video)if("object"==typeof A.video){const e={},n=e,r=A.video;Object.keys(r).forEach((A=>{"resolution"===A?tr(n,r.resolution):n[A]=r[A]})),s.video=e,null!==(t=(i=s.video).deviceId)&&void 0!==t||(i.deviceId={ideal:"default"})}else s.video=!!A.video&&{deviceId:{ideal:"default"}};else s.video=!1;return A.audio?"object"==typeof A.audio?(s.audio=A.audio,null!==(e=(n=s.audio).deviceId)&&void 0!==e||(n.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function ir(){var A;const t="undefined"!=typeof window&&(window.AudioContext||window.webkitAudioContext);if(t){const e=new t({latencyHint:"interactive"});if("suspended"===e.state&&"undefined"!=typeof window&&(null===(A=window.document)||void 0===A?void 0:A.body)){const A=()=>ii(this,void 0,void 0,(function*(){var t;try{"suspended"===e.state&&(yield e.resume())}catch(i){console.warn("Error trying to auto-resume audio context",i)}null===(t=window.document.body)||void 0===t||t.removeEventListener("click",A)}));window.document.body.addEventListener("click",A)}return e}}function nr(A){return"audioinput"===A?ts.Source.Microphone:"videoinput"===A?ts.Source.Camera:ts.Source.Unknown}function sr(A){return A===ts.Source.Microphone?"audioinput":A===ts.Source.Camera?"videoinput":void 0}function rr(A){return A.split("/")[1].toLowerCase()}function or(A){const t=[];return A.forEach((A=>{void 0!==A.track&&t.push(new ne({cid:A.track.mediaStreamID,track:A.trackInfo}))})),t}function ar(A){return"mediaStreamTrack"in A?{trackID:A.sid,source:A.source,muted:A.isMuted,enabled:A.mediaStreamTrack.enabled,kind:A.kind,streamID:A.mediaStreamID,streamTrackID:A.mediaStreamTrack.id}:{trackID:A.trackSid,enabled:A.isEnabled,muted:A.isMuted,trackInfo:Object.assign({mimeType:A.mimeType,name:A.trackName,encrypted:A.isEncrypted,kind:A.kind,source:A.source},A.track?ar(A.track):{})}}function cr(A){const t=Object.assign({},A);let e,i;return"object"==typeof t.audio&&t.audio.processor&&(e=t.audio.processor,t.audio=Object.assign(Object.assign({},t.audio),{processor:void 0})),"object"==typeof t.video&&t.video.processor&&(i=t.video.processor,t.video=Object.assign(Object.assign({},t.video),{processor:void 0})),{audioProcessor:e,videoProcessor:i,optionsWithoutProcessor:(n=t,void 0===n?n:"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n)))};var n}class ur extends oi.EventEmitter{constructor(A){super(),this.onWorkerMessage=A=>{var t,e;const{kind:i,data:n}=A.data;switch(i){case"error":qe.error(n.error.message),this.emit(pn.EncryptionError,n.error);break;case"initAck":n.enabled&&this.keyProvider.getKeys().forEach((A=>{this.postKey(A)}));break;case"enable":if(n.enabled&&this.keyProvider.getKeys().forEach((A=>{this.postKey(A)})),this.encryptionEnabled!==n.enabled&&n.participantIdentity===(null===(t=this.room)||void 0===t?void 0:t.localParticipant.identity))this.emit(pn.ParticipantEncryptionStatusChanged,n.enabled,this.room.localParticipant),this.encryptionEnabled=n.enabled;else if(n.participantIdentity){const A=null===(e=this.room)||void 0===e?void 0:e.getParticipantByIdentity(n.participantIdentity);if(!A)throw TypeError("couldn't set encryption status, participant not found".concat(n.participantIdentity));this.emit(pn.ParticipantEncryptionStatusChanged,n.enabled,A)}break;case"ratchetKey":this.keyProvider.emit(fn.KeyRatcheted,n.ratchetResult,n.participantIdentity,n.keyIndex)}},this.onWorkerError=A=>{qe.error("e2ee worker encountered an error:",{error:A.error}),this.emit(pn.EncryptionError,A.error)},this.keyProvider=A.keyProvider,this.worker=A.worker,this.encryptionEnabled=!1}setup(A){if(!(void 0!==window.RTCRtpSender&&void 0!==window.RTCRtpSender.prototype.createEncodedStreams||Dn()))throw new xn("tried to setup end-to-end encryption on an unsupported browser");if(qe.info("setting up e2ee"),A!==this.room){this.room=A,this.setupEventListeners(A,this.keyProvider);const t={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Ai.getLevel()}};this.worker&&(qe.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(A,t){qe.debug("set e2ee to ".concat(A," for participant ").concat(t)),this.postEnable(A,t)}setSifTrailer(A){A&&0!==A.length?this.postSifTrailer(A):qe.warn("ignoring server sent trailer as it's empty")}setupEngine(A){A.on(Sn.RTPVideoMapUpdate,(A=>{this.postRTPMap(A)}))}setupEventListeners(A,t){A.on(En.TrackPublished,((A,t)=>this.setParticipantCryptorEnabled(A.trackInfo.encryption!==ft.NONE,t.identity))),A.on(En.ConnectionStateChanged,(t=>{t===ko.Connected&&A.remoteParticipants.forEach((A=>{A.trackPublications.forEach((t=>{this.setParticipantCryptorEnabled(t.trackInfo.encryption!==ft.NONE,A.identity)}))}))})).on(En.TrackUnsubscribed,((A,t,e)=>{var i;const n={kind:"removeTransform",data:{participantIdentity:e.identity,trackId:A.mediaStreamID}};null===(i=this.worker)||void 0===i||i.postMessage(n)})).on(En.TrackSubscribed,((A,t,e)=>{this.setupE2EEReceiver(A,e.identity,t.trackInfo)})).on(En.SignalConnected,(()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");t.getKeys().forEach((A=>{this.postKey(A)})),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)})),A.localParticipant.on(kn.LocalTrackPublished,(A=>ii(this,void 0,void 0,(function*(){this.setupE2EESender(A.track,A.track.sender)})))),t.on(fn.SetKey,(A=>this.postKey(A))).on(fn.RatchetRequest,((A,t)=>this.postRatchetRequest(A,t)))}postRatchetRequest(A,t){if(!this.worker)throw Error("could not ratchet key, worker is missing");const e={kind:"ratchetRequest",data:{participantIdentity:A,keyIndex:t}};this.worker.postMessage(e)}postKey(A){let{key:t,participantIdentity:e,keyIndex:i}=A;var n;if(!this.worker)throw Error("could not set key, worker is missing");const s={kind:"setKey",data:{participantIdentity:e,isPublisher:e===(null===(n=this.room)||void 0===n?void 0:n.localParticipant.identity),key:t,keyIndex:i}};this.worker.postMessage(s)}postEnable(A,t){if(!this.worker)throw new ReferenceError("failed to enable e2ee, worker is not ready");{const e={kind:"enable",data:{enabled:A,participantIdentity:t}};this.worker.postMessage(e)}}postRTPMap(A){var t;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(null===(t=this.room)||void 0===t?void 0:t.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const e={kind:"setRTPMap",data:{map:A,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(e)}postSifTrailer(A){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const t={kind:"setSifTrailer",data:{trailer:A}};this.worker.postMessage(t)}setupE2EEReceiver(A,t,e){if(A.receiver){if(!(null==e?void 0:e.mimeType)||""===e.mimeType)throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(A.receiver,A.mediaStreamID,t,"video"===A.kind?rr(e.mimeType):void 0)}}setupE2EESender(A,t){Js(A)&&t?this.handleSender(t,A.mediaStreamID,void 0):t||qe.warn("early return because sender is not ready")}handleReceiver(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(this.worker){if(Dn()){const n={kind:"decode",participantIdentity:e,trackId:t,codec:i};A.transform=new RTCRtpScriptTransform(this.worker,n)}else{if(Bn in A&&i){const A={kind:"updateCodec",data:{trackId:t,codec:i,participantIdentity:e}};return void this.worker.postMessage(A)}let n=A.writableStream,s=A.readableStream;if(!n||!s){const t=A.createEncodedStreams();A.writableStream=t.writable,n=t.writable,A.readableStream=t.readable,s=t.readable}const r={kind:"decode",data:{readableStream:s,writableStream:n,trackId:t,codec:i,participantIdentity:e}};this.worker.postMessage(r,[s,n])}A[Bn]=!0}}))}handleSender(A,t,e){var i;if(!(Bn in A)&&this.worker){if(!(null===(i=this.room)||void 0===i?void 0:i.localParticipant.identity)||""===this.room.localParticipant.identity)throw TypeError("local identity needs to be known in order to set up encrypted sender");if(Dn()){qe.info("initialize script transform");const i={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:t,codec:e};A.transform=new RTCRtpScriptTransform(this.worker,i)}else{qe.info("initialize encoded streams");const i=A.createEncodedStreams(),n={kind:"encode",data:{readableStream:i.readable,writableStream:i.writable,codec:e,trackId:t,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n,[i.readable,i.writable])}A[Bn]=!0}}}const hr="default";class lr{constructor(){this.hA=[]}static getInstance(){return void 0===this.instance&&(this.instance=new lr),this.instance}get previousDevices(){return this.hA}getDevices(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){var i;if((null===(i=lr.userMediaPromiseMap)||void 0===i?void 0:i.size)>0){qe.debug("awaiting getUserMedia promise");try{A?yield lr.userMediaPromiseMap.get(A):yield Promise.all(lr.userMediaPromiseMap.values())}catch(s){qe.warn("error waiting for media permissons")}}let n=yield navigator.mediaDevices.enumerateDevices();if(e&&(!Cs()||!t.hasDeviceInUse(A))&&(0===n.filter((t=>t.kind===A)).length||n.some((t=>{const e=""===t.label,i=!A||t.kind===A;return e&&i})))){const t={video:"audioinput"!==A&&"audiooutput"!==A,audio:"videoinput"!==A&&{deviceId:{ideal:"default"}}},e=yield navigator.mediaDevices.getUserMedia(t);n=yield navigator.mediaDevices.enumerateDevices(),e.getTracks().forEach((A=>{A.stop()}))}return t.hA=n,A&&(n=n.filter((t=>t.kind===A))),n})()}))}normalizeDeviceId(A,t,e){return ii(this,void 0,void 0,(function*(){if(t!==hr)return t;const i=yield this.getDevices(A),n=i.find((A=>A.deviceId===hr));if(!n)return void qe.warn("could not reliably determine default device");const s=i.find((A=>A.deviceId!==hr&&A.groupId===(null!=e?e:n.groupId)));if(s)return null==s?void 0:s.deviceId;qe.warn("could not reliably determine default device")}))}hasDeviceInUse(A){return A?lr.userMediaPromiseMap.has(A):lr.userMediaPromiseMap.size>0}}var dr,Br;lr.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],lr.userMediaPromiseMap=new Map,(Br=dr||(dr={}))[Br.WAITING=0]="WAITING",Br[Br.RUNNING=1]="RUNNING",Br[Br.COMPLETED=2]="COMPLETED";class fr{constructor(){this.pendingTasks=new Map,this.taskMutex=new g,this.nextTaskIndex=0}run(A){return ii(this,void 0,void 0,(function*(){const t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:dr.WAITING};this.pendingTasks.set(t.id,t);const e=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=dr.RUNNING,yield A()}finally{t.status=dr.COMPLETED,this.pendingTasks.delete(t.id),e()}}))}flush(){return ii(this,void 0,void 0,(function*(){return this.run((()=>ii(this,void 0,void 0,(function*(){}))))}))}snapshot(){return Array.from(this.pendingTasks.values())}}function wr(A,t){return A.pathname="".concat((function(A){return A.endsWith("/")?A:"".concat(A,"/")})(A.pathname)).concat(t),A.toString()}const gr=["syncState","trickle","offer","answer","simulate","leave"];var pr,vr;(vr=pr||(pr={}))[vr.CONNECTING=0]="CONNECTING",vr[vr.CONNECTED=1]="CONNECTED",vr[vr.RECONNECTING=2]="RECONNECTING",vr[vr.DISCONNECTING=3]="DISCONNECTING",vr[vr.DISCONNECTED=4]="DISCONNECTED";class mr{get currentState(){return this.state}get isDisconnected(){return this.state===pr.DISCONNECTING||this.state===pr.DISCONNECTED}get isEstablishingConnection(){return this.state===pr.CONNECTING||this.state===pr.RECONNECTING}getNextRequestId(){return this.lA+=1,this.lA}constructor(){let A=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var e;this.rtt=0,this.state=pr.DISCONNECTED,this.log=qe,this.lA=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=ze(null!==(e=t.loggerName)&&void 0!==e?e:$e.Signal),this.loggerContextCb=t.loggerContextCb,this.useJSON=A,this.requestQueue=new fr,this.queuedRequests=[],this.closingLock=new g,this.connectionLock=new g,this.state=pr.DISCONNECTED}get logContext(){var A,t;return null!==(t=null===(A=this.loggerContextCb)||void 0===A?void 0:A.call(this))&&void 0!==t?t:{}}join(A,t,e,i){return ii(this,void 0,void 0,(function*(){return this.state=pr.CONNECTING,this.options=e,yield this.connect(A,t,e,i)}))}reconnect(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(this.options)return this.state=pr.RECONNECTING,this.clearPingInterval(),yield this.connect(A,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:e,reconnectReason:i}));this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext)}))}connect(A,t,e,i){this.connectOptions=e;const n=(function(A,t,e){var i;const n=new URLSearchParams;return n.set("access_token",A),e.reconnect&&(n.set("reconnect","1"),e.sid&&n.set("sid",e.sid)),n.set("auto_subscribe",e.autoSubscribe?"1":"0"),n.set("sdk",ys()?"reactnative":"js"),n.set("version",t.version),n.set("protocol",t.protocol.toString()),t.deviceModel&&n.set("device_model",t.deviceModel),t.os&&n.set("os",t.os),t.osVersion&&n.set("os_version",t.osVersion),t.browser&&n.set("browser",t.browser),t.browserVersion&&n.set("browser_version",t.browserVersion),e.adaptiveStream&&n.set("adaptive_stream","1"),e.reconnectReason&&n.set("reconnect_reason",e.reconnectReason.toString()),(null===(i=navigator.connection)||void 0===i?void 0:i.type)&&n.set("network",navigator.connection.type),n})(t,(function(){var A;const t=new Dt({sdk:Mt.JS,protocol:16,version:"2.13.0"});return ys()&&(t.os=null!==(A=Is())&&void 0!==A?A:""),t})(),e),s=(function(A,t){const e=new URL((function(A){return A.startsWith("http")?A.replace(/^(http)/,"ws"):A})(A));return t.forEach(((A,t)=>{e.searchParams.set(t,A)})),wr(e,"rtc")})(A,n),r=wr(new URL(js(s)),"validate");return new Promise(((A,t)=>ii(this,void 0,void 0,(function*(){const n=yield this.connectionLock.lock();try{const n=()=>ii(this,void 0,void 0,(function*(){this.close(),clearTimeout(o),t(new Ln("room connection has been cancelled (signal)",Qn.Cancelled))})),o=setTimeout((()=>{this.close(),t(new Ln("room connection has timed out (signal)",Qn.ServerUnreachable))}),e.websocketTimeout);(null==i?void 0:i.aborted)&&n(),null==i||i.addEventListener("abort",n);const a=new URL(s);a.searchParams.has("access_token")&&a.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(a),Object.assign({reconnect:e.reconnect,reconnectReason:e.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(s),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(o)},this.ws.onerror=A=>ii(this,void 0,void 0,(function*(){if(this.state===pr.CONNECTED)this.handleWSError(A);else{this.state=pr.DISCONNECTED,clearTimeout(o);try{const e=yield fetch(r);if(e.status.toFixed(0).startsWith("4")){const A=yield e.text();t(new Ln(A,Qn.NotAllowed,e.status))}else t(new Ln("Encountered unknown websocket error during connection: ".concat(A.toString()),Qn.InternalError,e.status))}catch(e){t(new Ln(e instanceof Error?e.message:"server was not reachable",Qn.ServerUnreachable))}}})),this.ws.onmessage=s=>ii(this,void 0,void 0,(function*(){var r,o,a;let c;if("string"==typeof s.data){const A=JSON.parse(s.data);c=Zt.fromJson(A,{ignoreUnknownFields:!0})}else{if(!(s.data instanceof ArrayBuffer))return void this.log.error("could not decode websocket message: ".concat(typeof s.data),this.logContext);c=Zt.fromBinary(new Uint8Array(s.data))}if(this.state!==pr.CONNECTED){let s=!1;if("join"===(null===(r=c.message)||void 0===r?void 0:r.case)?(this.state=pr.CONNECTED,null==i||i.removeEventListener("abort",n),this.pingTimeoutDuration=c.message.value.pingTimeout,this.pingIntervalDuration=c.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()),A(c.message.value)):this.state===pr.RECONNECTING&&"leave"!==c.message.case?(this.state=pr.CONNECTED,null==i||i.removeEventListener("abort",n),this.startPingInterval(),"reconnect"===(null===(o=c.message)||void 0===o?void 0:o.case)?A(c.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),A(void 0),s=!0)):this.isEstablishingConnection&&"leave"===c.message.case?t(new Ln("Received leave request while trying to (re)connect",Qn.LeaveRequest,void 0,c.message.value.reason)):e.reconnect||t(new Ln("did not receive join response, got ".concat(null===(a=c.message)||void 0===a?void 0:a.case," instead"),Qn.InternalError)),!s)return}this.signalLatency&&(yield ws(this.signalLatency)),this.handleSignalResponse(c)})),this.ws.onclose=A=>{this.isEstablishingConnection&&t(new Ln("Websocket got closed during a (re)connection attempt",Qn.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:A.reason,code:A.code,wasClean:A.wasClean,state:this.state})),this.handleOnClose(A.reason)}}finally{n()}}))))}close(){return ii(this,arguments,void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){const e=yield A.closingLock.lock();try{if(A.clearPingInterval(),t&&(A.state=pr.DISCONNECTING),A.ws){A.ws.onmessage=null,A.ws.onopen=null,A.ws.onclose=null;const t=new Promise((t=>{A.ws?A.ws.onclose=()=>{t()}:t()}));A.ws.readyState<A.ws.CLOSING&&(A.ws.close(),yield Promise.race([t,ws(250)])),A.ws=void 0}}finally{t&&(A.state=pr.DISCONNECTED),e()}})()}))}sendOffer(A){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:A.sdp})),this.sendRequest({case:"offer",value:Cr(A)})}sendAnswer(A){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:A.sdp})),this.sendRequest({case:"answer",value:Cr(A)})}sendIceCandidate(A,t){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:A})),this.sendRequest({case:"trickle",value:new Ae({candidateInit:JSON.stringify(A),target:t})})}sendMuteTrack(A,t){return this.sendRequest({case:"mute",value:new te({sid:A,muted:t})})}sendAddTrack(A){return this.sendRequest({case:"addTrack",value:A})}sendUpdateLocalMetadata(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(function*(){const n=e.getNextRequestId();return yield e.sendRequest({case:"updateMetadata",value:new fe({requestId:n,metadata:A,name:t,attributes:i})}),n})()}))}sendUpdateTrackSettings(A){this.sendRequest({case:"trackSetting",value:A})}sendUpdateSubscription(A){return this.sendRequest({case:"subscription",value:A})}sendSyncState(A){return this.sendRequest({case:"syncState",value:A})}sendUpdateVideoLayers(A,t){return this.sendRequest({case:"updateLayers",value:new Be({trackSid:A,layers:t})})}sendUpdateSubscriptionPermissions(A,t){return this.sendRequest({case:"subscriptionPermission",value:new Ee({allParticipants:A,trackPermissions:t})})}sendSimulateScenario(A){return this.sendRequest({case:"simulate",value:A})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:L.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new Oe({timestamp:L.parse(Date.now()),rtt:L.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(A,t){return this.sendRequest({case:"updateAudioTrack",value:new ue({trackSid:A,features:t})})}sendLeave(){return this.sendRequest({case:"leave",value:new le({reason:nt.CLIENT_INITIATED,action:de.DISCONNECT})})}sendRequest(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(function*(){const i=!e&&!(function(A){const t=gr.indexOf(A.case)>=0;return qe.trace("request allowed to bypass queue:",{canPass:t,req:A}),t})(A);if(i&&t.state===pr.RECONNECTING)return void t.queuedRequests.push((()=>ii(t,void 0,void 0,(function*(){yield this.sendRequest(A,!0)}))));if(e||(yield t.requestQueue.flush()),t.signalLatency&&(yield ws(t.signalLatency)),!t.ws||t.ws.readyState!==t.ws.OPEN)return void t.log.error("cannot send signal request before connected, type: ".concat(null==A?void 0:A.case),t.logContext);const n=new Wt({message:A});try{t.useJSON?t.ws.send(n.toJsonString()):t.ws.send(n.toBinary())}catch(s){t.log.error("error sending signal message",Object.assign(Object.assign({},t.logContext),{error:s}))}})()}))}handleSignalResponse(A){var t,e;const i=A.message;if(null==i)return void this.log.debug("received unsupported message",this.logContext);let n=!1;if("answer"===i.case){const A=Qr(i.value);this.onAnswer&&this.onAnswer(A)}else if("offer"===i.case){const A=Qr(i.value);this.onOffer&&this.onOffer(A)}else if("trickle"===i.case){const A=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(A,i.value.target)}else"update"===i.case?this.onParticipantUpdate&&this.onParticipantUpdate(null!==(t=i.value.participants)&&void 0!==t?t:[]):"trackPublished"===i.case?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):"speakersChanged"===i.case?this.onSpeakersChanged&&this.onSpeakersChanged(null!==(e=i.value.speakers)&&void 0!==e?e:[]):"leave"===i.case?this.onLeave&&this.onLeave(i.value):"mute"===i.case?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):"roomUpdate"===i.case?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):"connectionQuality"===i.case?this.onConnectionQuality&&this.onConnectionQuality(i.value):"streamStateUpdate"===i.case?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):"subscribedQualityUpdate"===i.case?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):"subscriptionPermissionUpdate"===i.case?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):"refreshToken"===i.case?this.onTokenRefresh&&this.onTokenRefresh(i.value):"trackUnpublished"===i.case?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):"subscriptionResponse"===i.case?this.onSubscriptionError&&this.onSubscriptionError(i.value):"pong"===i.case||("pongResp"===i.case?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),n=!0):"requestResponse"===i.case?this.onRequestResponse&&this.onRequestResponse(i.value):"trackSubscribed"===i.case?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):"roomMoved"===i.case?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:i.case})));n||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const A=this.queuedRequests.shift();A&&this.requestQueue.run(A)}}handleOnClose(A){return ii(this,void 0,void 0,(function*(){if(this.state===pr.DISCONNECTED)return;const t=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(A),Object.assign(Object.assign({},this.logContext),{reason:A})),t&&t(A)}))}handleWSError(A){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:A}))}resetPingTimeout(){this.clearPingTimeout(),this.pingTimeoutDuration?this.pingTimeout=Zn.setTimeout((()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-1e3*this.pingTimeoutDuration).toUTCString()),this.logContext),this.handleOnClose("ping timeout")}),1e3*this.pingTimeoutDuration):this.log.warn("ping timeout duration not set",this.logContext)}clearPingTimeout(){this.pingTimeout&&Zn.clearTimeout(this.pingTimeout)}startPingInterval(){this.clearPingInterval(),this.resetPingTimeout(),this.pingIntervalDuration?(this.log.debug("start ping interval",this.logContext),this.pingInterval=Zn.setInterval((()=>{this.sendPing()}),1e3*this.pingIntervalDuration)):this.log.warn("ping interval duration not set",this.logContext)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Zn.clearInterval(this.pingInterval)}}function Qr(A){const t={type:"offer",sdp:A.sdp};switch(A.type){case"answer":case"offer":case"pranswer":case"rollback":t.type=A.type}return t}function Cr(A){return new re({sdp:A.sdp,type:A.type})}var Ur,Fr,yr,br,Er,Ir={},kr={},Hr={exports:{}};function Sr(){if(Ur)return Hr.exports;Ur=1;var A=Hr.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(A){return A.encoding?"rtpmap:%d %s/%s/%s":A.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(A){return null!=A.address?"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(A){return null!=A.subtype?"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(A){return"extmap:%d"+(A.direction?"/%s":"%v")+(A["encrypt-uri"]?" %s":"%v")+" %s"+(A.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(A){return null!=A.sessionConfig?"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(A){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=A.raddr?" raddr %s rport %d":"%v%v",t+=null!=A.tcptype?" tcptype %s":"%v",null!=A.generation&&(t+=" generation %d"),(t+=null!=A["network-id"]?" network-id %d":"%v")+(null!=A["network-cost"]?" network-cost %d":"%v")}},{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(A){var t="ssrc:%d";return null!=A.attribute&&(t+=" %s",null!=A.value&&(t+=":%s")),t}},{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(A){return null!=A.maxMessageSize?"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(A){return A.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(A){return"imageattr:%s %s %s"+(A.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(A){return"simulcast:%s %s"+(A.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(A){return"ts-refclk:%s"+(null!=A.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(A){var t="mediaclk:";return t+=null!=A.id?"id=%s %s":"%v%s",t+=null!=A.mediaClockValue?"=%s":"",(t+=null!=A.rateNumerator?" rate=%s":"")+(null!=A.rateDenominator?"/%s":"")}},{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(A).forEach((function(t){A[t].forEach((function(A){A.reg||(A.reg=/(.*)/),A.format||(A.format="%s")}))})),Hr.exports}function Tr(){if(br)return yr;br=1;var A=Sr(),t=/%[sdv%]/g,e=function(A){var e=1,i=arguments,n=i.length;return A.replace(t,(function(A){if(e>=n)return A;var t=i[e];switch(e+=1,A){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}}))},i=function(A,t,i){var n=[A+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var s=0;s<t.names.length;s+=1){var r=t.names[s];t.name?n.push(i[t.name][r]):n.push(i[t.names[s]])}else n.push(i[t.name]);return e.apply(null,n)},n=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return yr=function(t,e){e=e||{},null==t.version&&(t.version=0),null==t.name&&(t.name=" "),t.media.forEach((function(A){null==A.payloads&&(A.payloads="")}));var r=e.outerOrder||n,o=e.innerOrder||s,a=[];return r.forEach((function(e){A[e].forEach((function(A){A.name in t&&null!=t[A.name]?a.push(i(e,A,t)):A.push in t&&null!=t[A.push]&&t[A.push].forEach((function(t){a.push(i(e,A,t))}))}))})),t.media.forEach((function(t){a.push(i("m",A.m[0],t)),o.forEach((function(e){A[e].forEach((function(A){A.name in t&&null!=t[A.name]?a.push(i(e,A,t)):A.push in t&&null!=t[A.push]&&t[A.push].forEach((function(t){a.push(i(e,A,t))}))}))}))})),a.join("\r\n")+"\r\n"}}var Or=(function(){if(Er)return Ir;Er=1;var A=(Fr||(Fr=1,(function(A){var t=function(A){return String(Number(A))===A?Number(A):A},e=function(A,e,i){var n=A.name&&A.names;A.push&&!e[A.push]?e[A.push]=[]:n&&!e[A.name]&&(e[A.name]={});var s=A.push?{}:n?e[A.name]:e;!(function(A,e,i,n){if(n&&!i)e[n]=t(A[1]);else for(var s=0;s<i.length;s+=1)null!=A[s+1]&&(e[i[s]]=t(A[s+1]))})(i.match(A.reg),s,A.names,A.name),A.push&&e[A.push].push(s)},i=Sr(),n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);A.parse=function(A){var t={},s=[],r=t;return A.split(/(\r\n|\r|\n)/).filter(n).forEach((function(A){var t=A[0],n=A.slice(2);"m"===t&&(s.push({rtp:[],fmtp:[]}),r=s[s.length-1]);for(var o=0;o<(i[t]||[]).length;o+=1){var a=i[t][o];if(a.reg.test(n))return e(a,r,n)}})),t.media=s,t};var s=function(A,e){var i=e.split(/=(.+)/,2);return 2===i.length?A[i[0]]=t(i[1]):1===i.length&&e.length>1&&(A[i[0]]=void 0),A};A.parseParams=function(A){return A.split(/;\s?/).reduce(s,{})},A.parseFmtpConfig=A.parseParams,A.parsePayloads=function(A){return A.toString().split(" ").map(Number)},A.parseRemoteCandidates=function(A){for(var e=[],i=A.split(" ").map(t),n=0;n<i.length;n+=3)e.push({component:i[n],ip:i[n+1],port:i[n+2]});return e},A.parseImageAttributes=function(A){return A.split(" ").map((function(A){return A.substring(1,A.length-1).split(",").reduce(s,{})}))},A.parseSimulcastStreamList=function(A){return A.split(";").map((function(A){return A.split(",").map((function(A){var e,i=!1;return"~"!==A[0]?e=t(A):(e=t(A.substring(1,A.length)),i=!0),{scid:e,paused:i}}))}))}})(kr)),kr),t=Tr(),e=Sr();return Ir.grammar=e,Ir.write=t,Ir.parse=A.parse,Ir.parseParams=A.parseParams,Ir.parseFmtpConfig=A.parseFmtpConfig,Ir.parsePayloads=A.parsePayloads,Ir.parseRemoteCandidates=A.parseRemoteCandidates,Ir.parseImageAttributes=A.parseImageAttributes,Ir.parseSimulcastStreamList=A.parseSimulcastStreamList,Ir})();function Kr(A,t,e){var i,n,s;void 0===t&&(t=50),void 0===e&&(e={});var r=null!=(i=e.isImmediate)&&i,o=null!=(n=e.callback)&&n,a=e.maxWait,c=Date.now(),u=[],h=function(){var e=[].slice.call(arguments),i=this;return new Promise((function(n,h){var l=r&&void 0===s;if(void 0!==s&&clearTimeout(s),s=setTimeout((function(){if(s=void 0,c=Date.now(),!r){var t=A.apply(i,e);o&&o(t),u.forEach((function(A){return(0,A.resolve)(t)})),u=[]}}),(function(){if(void 0!==a){var A=Date.now()-c;if(A+t>=a)return a-A}return t})()),l){var d=A.apply(i,e);return o&&o(d),n(d)}u.push({resolve:n,reject:h})}))};return h.cancel=function(A){void 0!==s&&clearTimeout(s),u.forEach((function(t){return(0,t.reject)(A)})),u=[]},h}const Dr="negotiationStarted",Mr="negotiationComplete",Lr="rtpVideoPayloadTypes";class xr extends oi.EventEmitter{get pc(){return this.J||(this.J=this.createPC()),this.J}constructor(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var e;super(),this.log=qe,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=Kr((A=>ii(this,void 0,void 0,(function*(){this.emit(Dr);try{yield this.createAndSendOffer()}catch(t){if(!A)throw t;A(t)}}))),20),this.close=()=>{this.J&&(this.J.close(),this.J.onconnectionstatechange=null,this.J.oniceconnectionstatechange=null,this.J.onicegatheringstatechange=null,this.J.ondatachannel=null,this.J.onnegotiationneeded=null,this.J.onsignalingstatechange=null,this.J.onicecandidate=null,this.J.ondatachannel=null,this.J.ontrack=null,this.J.onconnectionstatechange=null,this.J.oniceconnectionstatechange=null,this.J=null)},this.log=ze(null!==(e=t.loggerName)&&void 0!==e?e:$e.PCTransport),this.loggerOptions=t,this.config=A,this.J=this.createPC()}createPC(){const A=new RTCPeerConnection(this.config);return A.onicecandidate=A=>{var t;A.candidate&&(null===(t=this.onIceCandidate)||void 0===t||t.call(this,A.candidate))},A.onicecandidateerror=A=>{var t;null===(t=this.onIceCandidateError)||void 0===t||t.call(this,A)},A.oniceconnectionstatechange=()=>{var t;null===(t=this.onIceConnectionStateChange)||void 0===t||t.call(this,A.iceConnectionState)},A.onsignalingstatechange=()=>{var t;null===(t=this.onSignalingStatechange)||void 0===t||t.call(this,A.signalingState)},A.onconnectionstatechange=()=>{var t;null===(t=this.onConnectionStateChange)||void 0===t||t.call(this,A.connectionState)},A.ondatachannel=A=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,A)},A.ontrack=A=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,A)},A}get logContext(){var A,t;return Object.assign({},null===(t=(A=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(A))}get isICEConnected(){return null!==this.J&&("connected"===this.pc.iceConnectionState||"completed"===this.pc.iceConnectionState)}addIceCandidate(A){return ii(this,void 0,void 0,(function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(A);this.pendingCandidates.push(A)}))}setRemoteDescription(A){return ii(this,void 0,void 0,(function*(){var t;let e;if("offer"===A.type){let{stereoMids:t,nackMids:e}=(function(A){var t;const e=[],i=[],n=Or.parse(null!==(t=A.sdp)&&void 0!==t?t:"");let s=0;return n.media.forEach((A=>{var t;"audio"===A.type&&(A.rtp.some((A=>"opus"===A.codec&&(s=A.payload,!0))),(null===(t=A.rtcpFb)||void 0===t?void 0:t.some((A=>A.payload===s&&"nack"===A.type)))&&i.push(A.mid),A.fmtp.some((t=>t.payload===s&&(t.config.includes("sprop-stereo=1")&&e.push(A.mid),!0))))})),{stereoMids:e,nackMids:i}})(A);this.remoteStereoMids=t,this.remoteNackMids=e}else if("answer"===A.type){const i=Or.parse(null!==(t=A.sdp)&&void 0!==t?t:"");i.media.forEach((A=>{"audio"===A.type&&this.trackBitrates.some((t=>{if(!t.transceiver||A.mid!=t.transceiver.mid)return!1;let e=0;if(A.rtp.some((A=>A.codec.toUpperCase()===t.codec.toUpperCase()&&(e=A.payload,!0))),0===e)return!0;let i=!1;for(const n of A.fmtp)if(n.payload===e){n.config=n.config.split(";").filter((A=>!A.includes("maxaveragebitrate"))).join(";"),t.maxbr>0&&(n.config+=";maxaveragebitrate=".concat(1e3*t.maxbr)),i=!0;break}return i||t.maxbr>0&&A.fmtp.push({payload:e,config:"maxaveragebitrate=".concat(1e3*t.maxbr)}),!0}))})),e=Or.write(i)}yield this.setMungedSDP(A,e,!0),this.pendingCandidates.forEach((A=>{this.pc.addIceCandidate(A)})),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):"answer"===A.type&&(this.emit(Mr),A.sdp)&&Or.parse(A.sdp).media.forEach((A=>{"video"===A.type&&this.emit(Lr,A.rtp)}))}))}createAndSendOffer(A){return ii(this,void 0,void 0,(function*(){var t;if(void 0===this.onOffer)return;if((null==A?void 0:A.iceRestart)&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this.J&&"have-local-offer"===this.J.signalingState){const t=this.J.remoteDescription;if(!(null==A?void 0:A.iceRestart)||!t)return void(this.renegotiate=!0);yield this.J.setRemoteDescription(t)}else if(!this.J||"closed"===this.J.signalingState)return void this.log.warn("could not createOffer with closed peer connection",this.logContext);this.log.debug("starting to negotiate",this.logContext);const e=yield this.pc.createOffer(A);this.log.debug("original offer",Object.assign({sdp:e.sdp},this.logContext));const i=Or.parse(null!==(t=e.sdp)&&void 0!==t?t:"");i.media.forEach((A=>{Nr(A),"audio"===A.type?_r(A,[],[]):"video"===A.type&&this.trackBitrates.some((t=>{if(!A.msid||!t.cid||!A.msid.includes(t.cid))return!1;let e=0;if(A.rtp.some((A=>A.codec.toUpperCase()===t.codec.toUpperCase()&&(e=A.payload,!0))),0===e)return!0;if(vs(t.codec)&&this.ensureVideoDDExtensionForSVC(A,i),"av1"!==t.codec)return!0;const n=Math.round(.7*t.maxbr);for(const i of A.fmtp)if(i.payload===e){i.config.includes("x-google-start-bitrate")||(i.config+=";x-google-start-bitrate=".concat(n));break}return!0}))})),yield this.setMungedSDP(e,Or.write(i)),this.onOffer(e)}))}createAndSetAnswer(){return ii(this,void 0,void 0,(function*(){var A;const t=yield this.pc.createAnswer(),e=Or.parse(null!==(A=t.sdp)&&void 0!==A?A:"");return e.media.forEach((A=>{Nr(A),"audio"===A.type&&_r(A,this.remoteStereoMids,this.remoteNackMids)})),yield this.setMungedSDP(t,Or.write(e)),t}))}createDataChannel(A,t){return this.pc.createDataChannel(A,t)}addTransceiver(A,t){return this.pc.addTransceiver(A,t)}addTrack(A){if(!this.J)throw new Rn("PC closed, cannot add track");return this.J.addTrack(A)}setTrackCodecBitrate(A){this.trackBitrates.push(A)}setConfiguration(A){var t;if(!this.J)throw new Rn("PC closed, cannot configure");return null===(t=this.J)||void 0===t?void 0:t.setConfiguration(A)}canRemoveTrack(){var A;return!!(null===(A=this.J)||void 0===A?void 0:A.removeTrack)}removeTrack(A){var t;return null===(t=this.J)||void 0===t?void 0:t.removeTrack(A)}getConnectionState(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.connectionState)&&void 0!==t?t:"closed"}getICEConnectionState(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.iceConnectionState)&&void 0!==t?t:"closed"}getSignallingState(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.signalingState)&&void 0!==t?t:"closed"}getTransceivers(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.getTransceivers())&&void 0!==t?t:[]}getSenders(){var A,t;return null!==(t=null===(A=this.J)||void 0===A?void 0:A.getSenders())&&void 0!==t?t:[]}getLocalDescription(){var A;return null===(A=this.J)||void 0===A?void 0:A.localDescription}getRemoteDescription(){var A;return null===(A=this.pc)||void 0===A?void 0:A.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return ii(this,void 0,void 0,(function*(){var A;if(!this.J)return;let t="";const e=new Map,i=new Map;if((yield this.J.getStats()).forEach((A=>{switch(A.type){case"transport":t=A.selectedCandidatePairId;break;case"candidate-pair":""===t&&A.selected&&(t=A.id),e.set(A.id,A);break;case"remote-candidate":i.set(A.id,"".concat(A.address,":").concat(A.port))}})),""===t)return;const n=null===(A=e.get(t))||void 0===A?void 0:A.remoteCandidateId;return void 0!==n?i.get(n):void 0}))}setMungedSDP(A,t,e){return ii(this,void 0,void 0,(function*(){if(t){const n=A.sdp;A.sdp=t;try{return this.log.debug("setting munged ".concat(e?"remote":"local"," description"),this.logContext),void(e?yield this.pc.setRemoteDescription(A):yield this.pc.setLocalDescription(A))}catch(i){this.log.warn("not able to set ".concat(A.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:i,sdp:t})),A.sdp=n}}try{e?yield this.pc.setRemoteDescription(A):yield this.pc.setLocalDescription(A)}catch(i){let t="unknown error";i instanceof Error?t=i.message:"string"==typeof i&&(t=i);const n={error:t,sdp:A.sdp};throw!e&&this.pc.remoteDescription&&(n.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(A.type),Object.assign(Object.assign({},this.logContext),{fields:n})),new jn(t)}}))}ensureVideoDDExtensionForSVC(A,t){var e,i;if(!(null===(e=A.ext)||void 0===e?void 0:e.some((A=>A.uri===fs)))){if(0===this.ddExtID){let A=0;t.media.forEach((t=>{var e;"video"===t.type&&(null===(e=t.ext)||void 0===e||e.forEach((t=>{t.value>A&&(A=t.value)})))})),this.ddExtID=A+1}null===(i=A.ext)||void 0===i||i.push({value:this.ddExtID,uri:fs})}}}function _r(A,t,e){let i=0;A.rtp.some((A=>"opus"===A.codec&&(i=A.payload,!0))),i>0&&(A.rtcpFb||(A.rtcpFb=[]),e.includes(A.mid)&&!A.rtcpFb.some((A=>A.payload===i&&"nack"===A.type))&&A.rtcpFb.push({payload:i,type:"nack"}),t.includes(A.mid)&&A.fmtp.some((A=>A.payload===i&&(A.config.includes("stereo=1")||(A.config+=";stereo=1"),!0))))}function Nr(A){if(A.connection){const t=A.connection.ip.indexOf(":")>=0;(4===A.connection.version&&t||6===A.connection.version&&!t)&&(A.connection.ip="0.0.0.0",A.connection.version=4)}}const Rr="vp8",jr={audioPreset:us.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:Bs.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Rr,backupCodec:!0},Gr={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Pr={deviceId:{ideal:"default"},resolution:ls.h720.resolution},Vr={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new class{constructor(A){this.dA=void 0!==A?[...A]:ei}nextRetryDelayInMs(A){if(A.retryCount>=this.dA.length)return null;const t=this.dA[A.retryCount];return A.retryCount<=1?t:t+1e3*Math.random()}},disconnectOnPageLeave:!0,webAudioMix:!1},Jr={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Xr,$r;($r=Xr||(Xr={}))[$r.NEW=0]="NEW",$r[$r.CONNECTING=1]="CONNECTING",$r[$r.CONNECTED=2]="CONNECTED",$r[$r.FAILED=3]="FAILED",$r[$r.CLOSING=4]="CLOSING",$r[$r.CLOSED=5]="CLOSED";class Yr{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(A,t,e){var i;this.peerConnectionTimeout=Jr.peerConnectionTimeout,this.log=qe,this.updateState=()=>{var A;const t=this.state,e=this.requiredTransports.map((A=>A.getConnectionState()));e.every((A=>"connected"===A))?this.state=Xr.CONNECTED:e.some((A=>"failed"===A))?this.state=Xr.FAILED:e.some((A=>"connecting"===A))?this.state=Xr.CONNECTING:e.every((A=>"closed"===A))?this.state=Xr.CLOSED:e.some((A=>"closed"===A))?this.state=Xr.CLOSING:e.every((A=>"new"===A))&&(this.state=Xr.NEW),t!==this.state&&(this.log.debug("pc state change: from ".concat(Xr[t]," to ").concat(Xr[this.state]),this.logContext),null===(A=this.onStateChange)||void 0===A||A.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=ze(null!==(i=e.loggerName)&&void 0!==i?i:$e.PCManager),this.loggerOptions=e,this.isPublisherConnectionRequired=!t,this.isSubscriberConnectionRequired=t,this.publisher=new xr(A,e),this.subscriber=new xr(A,e),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=A=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,A,Xt.PUBLISHER)},this.subscriber.onIceCandidate=A=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,A,Xt.SUBSCRIBER)},this.subscriber.onDataChannel=A=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,A)},this.subscriber.onTrack=A=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,A)},this.publisher.onOffer=A=>{var t;null===(t=this.onPublisherOffer)||void 0===t||t.call(this,A)},this.state=Xr.NEW,this.connectionLock=new g,this.remoteOfferLock=new g}get logContext(){var A,t;return Object.assign({},null===(t=(A=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(A))}requirePublisher(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isPublisherConnectionRequired=A,this.updateState()}requireSubscriber(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isSubscriberConnectionRequired=A,this.updateState()}createAndSendPublisherOffer(A){return this.publisher.createAndSendOffer(A)}setPublisherAnswer(A){return this.publisher.setRemoteDescription(A)}removeTrack(A){return this.publisher.removeTrack(A)}close(){return ii(this,void 0,void 0,(function*(){if(this.publisher&&"closed"!==this.publisher.getSignallingState()){const t=this.publisher;for(const e of t.getSenders())try{t.canRemoveTrack()&&t.removeTrack(e)}catch(A){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:A}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()}))}triggerIceRestart(){return ii(this,void 0,void 0,(function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))}))}addIceCandidate(A,t){return ii(this,void 0,void 0,(function*(){t===Xt.PUBLISHER?yield this.publisher.addIceCandidate(A):yield this.subscriber.addIceCandidate(A)}))}createSubscriberAnswerFromOffer(A){return ii(this,void 0,void 0,(function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:A.type,sdp:A.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const t=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(A),yield this.subscriber.createAndSetAnswer()}finally{t()}}))}updateConfiguration(A,t){this.publisher.setConfiguration(A),this.subscriber.setConfiguration(A),t&&this.triggerIceRestart()}ensurePCTransportConnection(A,t){return ii(this,void 0,void 0,(function*(){var e;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&"connected"!==this.publisher.getConnectionState()&&"connecting"!==this.publisher.getConnectionState()&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all(null===(e=this.requiredTransports)||void 0===e?void 0:e.map((e=>this.ensureTransportConnected(e,A,t))))}finally{i()}}))}negotiate(A){return ii(this,void 0,void 0,(function*(){return new Promise(((t,e)=>ii(this,void 0,void 0,(function*(){const i=setTimeout((()=>{e("negotiation timed out")}),this.peerConnectionTimeout);A.signal.addEventListener("abort",(()=>{clearTimeout(i),e("negotiation aborted")})),this.publisher.once(Dr,(()=>{A.signal.aborted||this.publisher.once(Mr,(()=>{clearTimeout(i),t()}))})),yield this.publisher.negotiate((A=>{clearTimeout(i),e(A)}))}))))}))}addPublisherTransceiver(A,t){return this.publisher.addTransceiver(A,t)}addPublisherTrack(A){return this.publisher.addTrack(A)}createPublisherDataChannel(A,t){return this.publisher.createDataChannel(A,t)}getConnectedAddress(A){return A===Xt.PUBLISHER||A===Xt.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const A=[];return this.isPublisherConnectionRequired&&A.push(this.publisher),this.isSubscriberConnectionRequired&&A.push(this.subscriber),A}ensureTransportConnected(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.peerConnectionTimeout;return(function*(){if("connected"!==A.getConnectionState())return new Promise(((A,n)=>ii(e,void 0,void 0,(function*(){const e=()=>{this.log.warn("abort transport connection",this.logContext),Zn.clearTimeout(s),n(new Ln("room connection has been cancelled",Qn.Cancelled))};(null==t?void 0:t.signal.aborted)&&e(),null==t||t.signal.addEventListener("abort",e);const s=Zn.setTimeout((()=>{null==t||t.signal.removeEventListener("abort",e),n(new Ln("could not establish pc connection",Qn.InternalError))}),i);for(;this.state!==Xr.CONNECTED;)if(yield ws(50),null==t?void 0:t.signal.aborted)return void n(new Ln("room connection has been cancelled",Qn.Cancelled));Zn.clearTimeout(s),null==t||t.signal.removeEventListener("abort",e),A()}))))})()}))}}class Wr extends Error{constructor(A,t,e){super(t),this.code=A,this.message=qr(t,Wr.MAX_MESSAGE_BYTES),this.data=e?qr(e,Wr.MAX_DATA_BYTES):void 0}static fromProto(A){return new Wr(A.code,A.message,A.data)}toProto(){return new St({code:this.code,message:this.message,data:this.data})}static builtIn(A,t){return new Wr(Wr.ErrorCode[A],Wr.ErrorMessage[A],t)}}function Zr(A){return(new TextEncoder).encode(A).length}function qr(A,t){if(Zr(A)<=t)return A;let e=0,i=A.length;const n=new TextEncoder;for(;e<i;){const s=Math.floor((e+i+1)/2);n.encode(A.slice(0,s)).length<=t?e=s:i=s-1}return A.slice(0,e)}Wr.MAX_MESSAGE_BYTES=256,Wr.MAX_DATA_BYTES=15360,Wr.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},Wr.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 zr=2e3;function Ao(A,t){if(!t)return 0;let e,i;return"bytesReceived"in A?(e=A.bytesReceived,i=t.bytesReceived):"bytesSent"in A&&(e=A.bytesSent,i=t.bytesSent),void 0===e||void 0===i||void 0===A.timestamp||void 0===t.timestamp?0:8*(e-i)*1e3/(A.timestamp-t.timestamp)}class to extends ts{get sender(){return this.BA}set sender(A){this.BA=A}get constraints(){return this.fA}constructor(A,t,e){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(A,t,arguments.length>4?arguments[4]:void 0),this.manuallyStopped=!1,this.wA=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch((()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext))),this.debouncedTrackMuteHandler=Kr((()=>ii(this,void 0,void 0,(function*(){yield this.pauseUpstream()}))),5e3),this.handleTrackUnmuteEvent=()=>ii(this,void 0,void 0,(function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()})),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this.cA.removeEventListener("mute",this.handleTrackMuteEvent),this.cA.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(On.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new g,this.pauseUpstreamLock=new g,this.processorLock=new g,this.restartLock=new g,this.setMediaStreamTrack(A,!0),this.fA=A.getConstraints(),e&&(this.fA=e)}get id(){return this.cA.id}get dimensions(){if(this.kind!==ts.Kind.Video)return;const{width:A,height:t}=this.cA.getSettings();return A&&t?{width:A,height:t}:void 0}get isUpstreamPaused(){return this.wA}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var A,t;return null!==(t=null===(A=this.processor)||void 0===A?void 0:A.processedTrack)&&void 0!==t?t:this.cA}get isLocal(){return!0}getSourceTrackSettings(){return this.cA.getSettings()}setMediaStreamTrack(A,t){return ii(this,void 0,void 0,(function*(){var e;if(A===this.cA&&!t)return;let i;if(this.cA&&(this.attachedElements.forEach((A=>{is(this.cA,A)})),this.debouncedTrackMuteHandler.cancel("new-track"),this.cA.removeEventListener("ended",this.handleEnded),this.cA.removeEventListener("mute",this.handleTrackMuteEvent),this.cA.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([A]),A&&(A.addEventListener("ended",this.handleEnded),A.addEventListener("mute",this.handleTrackMuteEvent),A.addEventListener("unmute",this.handleTrackUnmuteEvent),this.fA=A.getConstraints()),this.processor&&A){const t=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),"unknown"===this.kind)throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(es(A,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:A,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}finally{t()}}this.sender&&"closed"!==(null===(e=this.sender.transport)||void 0===e?void 0:e.state)&&(yield this.sender.replaceTrack(null!=i?i:A)),this.providedByUser||this.cA===A||this.cA.stop(),this.cA=A,A&&(this.cA.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach((t=>{es(null!=i?i:A,t)})))}))}waitForDimensions(){return ii(this,arguments,void 0,(function(){var A=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return(function*(){var e;if(A.kind===ts.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");"iOS"===(null===(e=Xn())||void 0===e?void 0:e.os)&&(yield ws(10));const i=Date.now();for(;Date.now()-i<t;){const t=A.dimensions;if(t)return t;yield ws(50)}throw new _n("unable to get track dimensions after timeout")})()}))}setDeviceId(A){return ii(this,void 0,void 0,(function*(){return this.fA.deviceId===A&&this.cA.getSettings().deviceId===Rs(A)||(this.fA.deviceId=A,!!this.isMuted||(yield this.restartTrack(),Rs(A)===this.cA.getSettings().deviceId))}))}getDeviceId(){return ii(this,arguments,void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){if(A.source===ts.Source.ScreenShare)return;const{deviceId:e,groupId:i}=A.cA.getSettings(),n=A.kind===ts.Kind.Audio?"audioinput":"videoinput";return t?lr.getInstance().normalizeDeviceId(n,e,i):e})()}))}mute(){return ii(this,void 0,void 0,(function*(){return this.setTrackMuted(!0),this}))}unmute(){return ii(this,void 0,void 0,(function*(){return this.setTrackMuted(!1),this}))}replaceTrack(A,t){return ii(this,void 0,void 0,(function*(){if(!this.sender)throw new _n("unable to replace an unpublished track");let e,i;return"boolean"==typeof t?e=t:void 0!==t&&(e=t.userProvidedTrack,i=t.stopProcessor),this.providedByUser=null==e||e,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(A),i&&this.processor&&(yield this.stopProcessor()),this}))}restart(A){return ii(this,void 0,void 0,(function*(){this.manuallyStopped=!1;const t=yield this.restartLock.lock();try{A||(A=this.fA);const{deviceId:t,facingMode:e}=A,i=(function(A,t){var e={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&t.indexOf(i)<0&&(e[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(A);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(A,i[n])&&(e[i[n]]=A[i[n]])}return e})(A,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:A}));const n={audio:!1,video:!1};this.kind===ts.Kind.Video?n.video=!t&&!e||{deviceId:t,facingMode:e}:n.audio=!t||{deviceId:t},this.attachedElements.forEach((A=>{is(this.mediaStreamTrack,A)})),this.cA.removeEventListener("ended",this.handleEnded),this.cA.stop();const s=(yield navigator.mediaDevices.getUserMedia(n)).getTracks()[0];return yield s.applyConstraints(i),s.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(s),this.fA=A,this.emit(On.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{t()}}))}setTrackMuted(A){this.log.debug("setting ".concat(this.kind," track ").concat(A?"muted":"unmuted"),this.logContext),this.isMuted===A&&this.cA.enabled!==A||(this.isMuted=A,this.cA.enabled=!A,this.emit(A?On.Muted:On.Unmuted,this))}get needsReAcquisition(){return"live"!==this.cA.readyState||this.cA.muted||!this.cA.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ii(this,void 0,void 0,(function*(){yield A.handleAppVisibilityChanged.call(this),Us()&&(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 A;this.manuallyStopped=!0,super.stop(),this.cA.removeEventListener("ended",this.handleEnded),this.cA.removeEventListener("mute",this.handleTrackMuteEvent),this.cA.removeEventListener("unmute",this.handleTrackUnmuteEvent),null===(A=this.processor)||void 0===A||A.destroy(),this.processor=void 0}pauseUpstream(){return ii(this,void 0,void 0,(function*(){var A;const t=yield this.pauseUpstreamLock.lock();try{if(!0===this.wA)return;if(!this.sender)return void this.log.warn("unable to pause upstream for an unpublished track",this.logContext);this.wA=!0,this.emit(On.UpstreamPaused,this);const t=Xn();if("Safari"===(null==t?void 0:t.name)&&Hs(t.version,"12.0")<0)throw new xn("pauseUpstream is not supported on Safari < 12.");"closed"!==(null===(A=this.sender.transport)||void 0===A?void 0:A.state)&&(yield this.sender.replaceTrack(null))}finally{t()}}))}resumeUpstream(){return ii(this,void 0,void 0,(function*(){var A;const t=yield this.pauseUpstreamLock.lock();try{if(!1===this.wA)return;if(!this.sender)return void this.log.warn("unable to resume upstream for an unpublished track",this.logContext);this.wA=!1,this.emit(On.UpstreamResumed,this),"closed"!==(null===(A=this.sender.transport)||void 0===A?void 0:A.state)&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{t()}}))}getRTCStatsReport(){return ii(this,void 0,void 0,(function*(){var A;if(null===(A=this.sender)||void 0===A?void 0:A.getStats)return yield this.sender.getStats()}))}setProcessor(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){var i;const n=yield t.processorLock.lock();try{t.log.debug("setting up processor",t.logContext);const n=document.createElement(t.kind),s={kind:t.kind,track:t.cA,element:n,audioContext:t.audioContext};if(yield A.init(s),t.log.debug("processor initialized",t.logContext),t.processor&&(yield t.stopProcessor()),"unknown"===t.kind)throw TypeError("cannot set processor on track of unknown kind");if(es(t.cA,n),n.muted=!0,n.play().catch((A=>t.log.error("failed to play processor element",Object.assign(Object.assign({},t.logContext),{error:A})))),t.processor=A,t.processorElement=n,t.processor.processedTrack){for(const A of t.attachedElements)A!==t.processorElement&&e&&(is(t.cA,A),es(t.processor.processedTrack,A));yield null===(i=t.sender)||void 0===i?void 0:i.replaceTrack(t.processor.processedTrack)}t.emit(On.TrackProcessorUpdate,t.processor)}finally{n()}})()}))}getProcessor(){return this.processor}stopProcessor(){return ii(this,arguments,void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){var e,i;A.processor&&(A.log.debug("stopping processor",A.logContext),null===(e=A.processor.processedTrack)||void 0===e||e.stop(),yield A.processor.destroy(),A.processor=void 0,t||(null===(i=A.processorElement)||void 0===i||i.remove(),A.processorElement=void 0),yield A.cA.applyConstraints(A.fA),yield A.setMediaStreamTrack(A.cA,!0),A.emit(On.TrackProcessorUpdate))})()}))}}class eo extends to{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(A,t){let e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;super(A,ts.Kind.Audio,t,e,n),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>ii(this,void 0,void 0,(function*(){if(!this.sender)return void(this.aA=0);let A;try{A=yield this.getSenderStats()}catch(t){return void this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:t}))}A&&this.prevStats&&(this.aA=Ao(A,this.prevStats)),this.prevStats=A})),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(On.AudioTrackFeatureUpdate,this,ot.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(On.AudioTrackFeatureUpdate,this,ot.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const A=Object.create(null,{mute:{get:()=>super.mute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===ts.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this.cA.stop()),yield A.mute.call(this),this)}finally{t()}}))}unmute(){const A=Object.create(null,{unmute:{get:()=>super.unmute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const t=this.fA.deviceId&&this.cA.getSettings().deviceId!==Rs(this.fA.deviceId);return this.source!==ts.Source.Microphone||!this.stopOnMute&&"ended"!==this.cA.readyState&&!t||this.isUserProvided||(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield A.unmute.call(this),this}finally{t()}}))}restartTrack(A){return ii(this,void 0,void 0,(function*(){let t;if(A){const e=er({audio:A});"boolean"!=typeof e.audio&&(t=e.audio)}yield this.restart(t)}))}restart(A){const t=Object.create(null,{restart:{get:()=>super.restart}});return ii(this,void 0,void 0,(function*(){const e=yield t.restart.call(this,A);return this.checkForSilence(),e}))}startMonitor(){Fs()&&(this.monitorInterval||(this.monitorInterval=setInterval((()=>{this.monitorSender()}),zr)))}setProcessor(A){return ii(this,void 0,void 0,(function*(){var t;const e=yield this.processorLock.lock();try{if(!ys()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const e={kind:this.kind,track:this.cA,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(A.name),this.logContext),yield A.init(e),this.processor=A,this.processor.processedTrack&&(yield null===(t=this.sender)||void 0===t?void 0:t.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(On.TrackProcessorUpdate,this.processor)}finally{e()}}))}setAudioContext(A){this.audioContext=A}getSenderStats(){return ii(this,void 0,void 0,(function*(){var A;if(!(null===(A=this.sender)||void 0===A?void 0:A.getStats))return;let t;return(yield this.sender.getStats()).forEach((A=>{"outbound-rtp"===A.type&&(t={type:"audio",streamId:A.id,packetsSent:A.packetsSent,packetsLost:A.packetsLost,bytesSent:A.bytesSent,timestamp:A.timestamp,roundTripTime:A.roundTripTime,jitter:A.jitter})})),t}))}checkForSilence(){return ii(this,void 0,void 0,(function*(){const A=yield(function(A){return ii(this,arguments,void 0,(function(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return(function*(){const e=ir();if(e){const i=e.createAnalyser();i.fftSize=2048;const n=i.frequencyBinCount,s=new Uint8Array(n);e.createMediaStreamSource(new MediaStream([A.mediaStreamTrack])).connect(i),yield ws(t),i.getByteTimeDomainData(s);const r=s.some((A=>128!==A&&0!==A));return e.close(),!r}return!1})()}))})(this);return A&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(On.AudioSilenceDetected)),A}))}}const io=Object.values(ls),no=Object.values(ds),so=Object.values(Bs),ro=[ls.h180,ls.h360],oo=[ds.h180,ds.h360],ao=["q","h","f"];function co(A,t,e,i){var n,s;let r=null==i?void 0:i.videoEncoding;A&&(r=null==i?void 0:i.screenShareEncoding);const o=null==i?void 0:i.simulcast,a=null==i?void 0:i.scalabilityMode,c=null==i?void 0:i.videoCodec;if(!r&&!o&&!a||!t||!e)return[{}];r||(r=(function(A,t,e,i){const n=(function(A,t,e){if(A)return so;const i=t>e?t/e:e/t;return Math.abs(i-16/9)<Math.abs(i-4/3)?io:no})(A,t,e);let{encoding:s}=n[0];const r=Math.max(t,e);for(let o=0;o<n.length;o+=1){const A=n[o];if(s=A.encoding,A.width>=r)break}if(i)switch(i){case"av1":s=Object.assign({},s),s.maxBitrate=.7*s.maxBitrate;break;case"vp9":s=Object.assign({},s),s.maxBitrate=.85*s.maxBitrate}return s})(A,t,e,c),qe.debug("using video encoding",r));const u=r.maxFramerate,h=new ns(t,e,r.maxBitrate,r.maxFramerate,r.priority);if(a&&vs(c)){const A=new Bo(a),t=[];if(A.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(a));const e=Xn();if(Cs()||ys()||"Chrome"===(null==e?void 0:e.name)&&Hs(null==e?void 0:e.version,"113")<0){const e="h"==A.suffix?2:3;for(let i=0;i<A.spatial;i+=1)t.push({rid:ao[2-i],maxBitrate:r.maxBitrate/Math.pow(e,i),maxFramerate:h.encoding.maxFramerate});t[0].scalabilityMode=a}else t.push({maxBitrate:r.maxBitrate,maxFramerate:h.encoding.maxFramerate,scalabilityMode:a});return h.encoding.priority&&(t[0].priority=h.encoding.priority,t[0].networkPriority=h.encoding.priority),qe.debug("using svc encoding",{encodings:t}),t}if(!o)return[r];let l,d=[];if(d=A?null!==(n=lo(null==i?void 0:i.screenShareSimulcastLayers))&&void 0!==n?n:uo(A,h):null!==(s=lo(null==i?void 0:i.videoSimulcastLayers))&&void 0!==s?s:uo(A,h),d.length>0){const A=d[0];d.length>1&&([,l]=d);const i=Math.max(t,e);if(i>=960&&l)return ho(t,e,[A,l,h],u);if(i>=480)return ho(t,e,[A,h],u)}return ho(t,e,[h])}function uo(A,t){if(A)return[{scaleResolutionDownBy:2,fps:(e=t).encoding.maxFramerate}].map((A=>{var t,i;return new ns(Math.floor(e.width/A.scaleResolutionDownBy),Math.floor(e.height/A.scaleResolutionDownBy),Math.max(15e4,Math.floor(e.encoding.maxBitrate/(Math.pow(A.scaleResolutionDownBy,2)*((null!==(t=e.encoding.maxFramerate)&&void 0!==t?t:30)/(null!==(i=A.fps)&&void 0!==i?i:30))))),A.fps,e.encoding.priority)}));var e;const{width:i,height:n}=t,s=i>n?i/n:n/i;return Math.abs(s-16/9)<Math.abs(s-4/3)?ro:oo}function ho(A,t,e,i){const n=[];if(e.forEach(((e,s)=>{if(s>=ao.length)return;const r=Math.min(A,t),o={rid:ao[s],scaleResolutionDownBy:Math.max(1,r/Math.min(e.width,e.height)),maxBitrate:e.encoding.maxBitrate},a=i&&e.encoding.maxFramerate?Math.min(i,e.encoding.maxFramerate):e.encoding.maxFramerate;a&&(o.maxFramerate=a);const c=Qs()||0===s;e.encoding.priority&&c&&(o.priority=e.encoding.priority,o.networkPriority=e.encoding.priority),n.push(o)})),ys()&&"ios"===Is()){let A;n.forEach((t=>{A?t.maxFramerate&&t.maxFramerate>A&&(A=t.maxFramerate):A=t.maxFramerate}));let t=!0;n.forEach((e=>{var i;e.maxFramerate!=A&&(t&&(t=!1,qe.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),qe.info('Setting framerate of encoding "'.concat(null!==(i=e.rid)&&void 0!==i?i:"",'" to ').concat(A)),e.maxFramerate=A)}))}return n}function lo(A){if(A)return A.sort(((A,t)=>{const{encoding:e}=A,{encoding:i}=t;return e.maxBitrate>i.maxBitrate?1:e.maxBitrate<i.maxBitrate?-1:e.maxBitrate===i.maxBitrate&&e.maxFramerate&&i.maxFramerate?e.maxFramerate>i.maxFramerate?1:-1:0}))}class Bo{constructor(A){const t=A.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw new Error("invalid scalability mode");if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=t[3]}}toString(){var A;return"L".concat(this.spatial,"T").concat(this.temporal).concat(null!==(A=this.suffix)&&void 0!==A?A:"")}}class fo extends to{get sender(){return this.BA}set sender(A){this.BA=A,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(A,t){let e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0;super(A,ts.Kind.Video,t,e,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>ii(this,void 0,void 0,(function*(){if(!this.sender)return void(this.aA=0);let A;try{A=yield this.getSenderStats()}catch(e){return void this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:e}))}const t=new Map(A.map((A=>[A.rid,A])));if(this.prevStats){let A=0;t.forEach(((t,e)=>{var i;const n=null===(i=this.prevStats)||void 0===i?void 0:i.get(e);A+=Ao(t,n)})),this.aA=A}this.prevStats=t})),this.senderLock=new g}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(A){var t;if(this.signalClient=A,!Fs())return;const e=null===(t=this.sender)||void 0===t?void 0:t.getParameters();e&&(this.encodings=e.encodings),this.monitorInterval||(this.monitorInterval=setInterval((()=>{this.monitorSender()}),zr))}stop(){this.cA.getConstraints(),this.simulcastCodecs.forEach((A=>{A.mediaStreamTrack.stop()})),super.stop()}pauseUpstream(){const A=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return ii(this,void 0,void 0,(function*(){var t,e,i,n,s;yield A.pauseUpstream.call(this);try{for(var r,o=!0,a=ni(this.simulcastCodecs.values());!(t=(r=yield a.next()).done);o=!0){n=r.value,o=!1;const A=n;yield null===(s=A.sender)||void 0===s?void 0:s.replaceTrack(null)}}catch(c){e={error:c}}finally{try{o||t||!(i=a.return)||(yield i.call(a))}finally{if(e)throw e.error}}}))}resumeUpstream(){const A=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return ii(this,void 0,void 0,(function*(){var t,e,i,n,s;yield A.resumeUpstream.call(this);try{for(var r,o=!0,a=ni(this.simulcastCodecs.values());!(t=(r=yield a.next()).done);o=!0){n=r.value,o=!1;const A=n;yield null===(s=A.sender)||void 0===s?void 0:s.replaceTrack(A.mediaStreamTrack)}}catch(c){e={error:c}}finally{try{o||t||!(i=a.return)||(yield i.call(a))}finally{if(e)throw e.error}}}))}mute(){const A=Object.create(null,{mute:{get:()=>super.mute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source!==ts.Source.Camera||this.isUserProvided||(this.log.debug("stopping camera track",this.logContext),this.cA.stop()),yield A.mute.call(this),this)}finally{t()}}))}unmute(){const A=Object.create(null,{unmute:{get:()=>super.unmute}});return ii(this,void 0,void 0,(function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.source!==ts.Source.Camera||this.isUserProvided||(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield A.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{t()}}))}setTrackMuted(A){super.setTrackMuted(A);for(const t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!A}getSenderStats(){return ii(this,void 0,void 0,(function*(){var A;if(!(null===(A=this.sender)||void 0===A?void 0:A.getStats))return[];const t=[],e=yield this.sender.getStats();return e.forEach((A=>{var i;if("outbound-rtp"===A.type){const n={type:"video",streamId:A.id,frameHeight:A.frameHeight,frameWidth:A.frameWidth,framesPerSecond:A.framesPerSecond,framesSent:A.framesSent,firCount:A.firCount,pliCount:A.pliCount,nackCount:A.nackCount,packetsSent:A.packetsSent,bytesSent:A.bytesSent,qualityLimitationReason:A.qualityLimitationReason,qualityLimitationDurations:A.qualityLimitationDurations,qualityLimitationResolutionChanges:A.qualityLimitationResolutionChanges,rid:null!==(i=A.rid)&&void 0!==i?i:A.id,retransmittedPacketsSent:A.retransmittedPacketsSent,targetBitrate:A.targetBitrate,timestamp:A.timestamp},s=e.get(A.remoteId);s&&(n.jitter=s.jitter,n.packetsLost=s.packetsLost,n.roundTripTime=s.roundTripTime),t.push(n)}})),t.sort(((A,t)=>{var e,i;return(null!==(e=t.frameWidth)&&void 0!==e?e:0)-(null!==(i=A.frameWidth)&&void 0!==i?i:0)})),t}))}setPublishingQuality(A){const t=[];for(let e=zn.LOW;e<=zn.HIGH;e+=1)t.push(new Ue({quality:e,enabled:e<=A}));this.log.debug("setting publishing quality. max quality ".concat(A),this.logContext),this.setPublishingLayers(t)}restartTrack(A){return ii(this,void 0,void 0,(function*(){var t,e,i,n,s;let r;if(A){const t=er({video:A});"boolean"!=typeof t.video&&(r=t.video)}yield this.restart(r);try{for(var o,a=!0,c=ni(this.simulcastCodecs.values());!(t=(o=yield c.next()).done);a=!0){n=o.value,a=!1;const A=n;A.sender&&"closed"!==(null===(s=A.sender.transport)||void 0===s?void 0:s.state)&&(A.mediaStreamTrack=this.mediaStreamTrack.clone(),yield A.sender.replaceTrack(A.mediaStreamTrack))}}catch(u){e={error:u}}finally{try{a||t||!(i=c.return)||(yield i.call(c))}finally{if(e)throw e.error}}}))}setProcessor(A){const t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return ii(this,arguments,void 0,(function(A){var e=this;let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){var n,s,r,o,a,c;if(yield t.setProcessor.call(e,A,i),null===(a=e.processor)||void 0===a?void 0:a.processedTrack)try{for(var u,h=!0,l=ni(e.simulcastCodecs.values());!(n=(u=yield l.next()).done);h=!0){o=u.value,h=!1;const A=o;yield null===(c=A.sender)||void 0===c?void 0:c.replaceTrack(e.processor.processedTrack)}}catch(d){s={error:d}}finally{try{h||n||!(r=l.return)||(yield r.call(l))}finally{if(s)throw s.error}}})()}))}setDegradationPreference(A){return ii(this,void 0,void 0,(function*(){if(this.degradationPreference=A,this.sender)try{this.log.debug("setting degradationPreference to ".concat(A),this.logContext);const t=this.sender.getParameters();t.degradationPreference=A,this.sender.setParameters(t)}catch(t){this.log.warn("failed to set degradationPreference",Object.assign({error:t},this.logContext))}}))}addSimulcastTrack(A,t){if(this.simulcastCodecs.has(A))return void this.log.error("".concat(A," already added, skipping adding simulcast codec"),this.logContext);const e={codec:A,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(A,e),e}setSimulcastTrackSender(A,t){const e=this.simulcastCodecs.get(A);e&&(e.sender=t,setTimeout((()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)}),5e3))}setPublishingCodecs(A){return ii(this,void 0,void 0,(function*(){var t,e,i,n,s,r,o;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:A,currentCodec:this.codec})),!this.codec&&A.length>0)return yield this.setPublishingLayers(A[0].qualities),[];this.subscribedCodecs=A;const a=[];try{for(t=!0,e=ni(A);!(n=(i=yield e.next()).done);t=!0){o=i.value,t=!1;const A=o;if(this.codec&&this.codec!==A.codec){const t=this.simulcastCodecs.get(A.codec);if(this.log.debug("try setPublishingCodec for ".concat(A.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:t})),t&&t.sender)t.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(A.codec),this.logContext),yield wo(t.sender,t.encodings,A.qualities,this.senderLock,this.log,this.logContext));else for(const e of A.qualities)if(e.enabled){a.push(A.codec);break}}else yield this.setPublishingLayers(A.qualities)}}catch(c){s={error:c}}finally{try{t||n||!(r=e.return)||(yield r.call(e))}finally{if(s)throw s.error}}return a}))}setPublishingLayers(A){return ii(this,void 0,void 0,(function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:A})),this.sender&&this.encodings&&(yield wo(this.sender,this.encodings,A,this.senderLock,this.log,this.logContext))}))}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ii(this,void 0,void 0,(function*(){yield A.handleAppVisibilityChanged.call(this),Us()&&this.isInBackground&&this.source===ts.Source.Camera&&(this.cA.enabled=!1)}))}}function wo(A,t,e,i,n,s){return ii(this,void 0,void 0,(function*(){const r=yield i.lock();n.debug("setPublishingLayersForSender",Object.assign(Object.assign({},s),{sender:A,qualities:e,senderEncodings:t}));try{const i=A.getParameters(),{encodings:r}=i;if(!r)return;if(r.length!==t.length)return void n.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},s),{encodings:r,senderEncodings:t}));let o=!1;const a=Xn();if("Chrome"===(null==a?void 0:a.name)&&Hs(null==a?void 0:a.version,"133")>0&&r[0].scalabilityMode){const A=r[0],i=new Bo(A.scalabilityMode);let n=tt.OFF;if(e.forEach((A=>{A.enabled&&(n===tt.OFF||A.quality>n)&&(n=A.quality)})),n===tt.OFF)A.active&&(A.active=!1,o=!0);else if(!A.active||i.spatial!==n+1){o=!0,A.active=!0;const e=new Bo(t[0].scalabilityMode);i.spatial=n+1,i.suffix=e.suffix,1===i.spatial&&(i.suffix=void 0),A.scalabilityMode=i.toString(),A.scaleResolutionDownBy=Math.pow(2,2-n),t[0].maxBitrate&&(A.maxBitrate=t[0].maxBitrate/(A.scaleResolutionDownBy*A.scaleResolutionDownBy))}}else r.forEach(((A,i)=>{var r;let a=null!==(r=A.rid)&&void 0!==r?r:"";""===a&&(a="q");const c=go(a),u=e.find((A=>A.quality===c));u&&A.active!==u.enabled&&(o=!0,A.active=u.enabled,n.debug("setting layer ".concat(u.quality," to ").concat(A.active?"enabled":"disabled"),s),Qs()&&(u.enabled?(A.scaleResolutionDownBy=t[i].scaleResolutionDownBy,A.maxBitrate=t[i].maxBitrate,A.maxFrameRate=t[i].maxFrameRate):(A.scaleResolutionDownBy=4,A.maxBitrate=10,A.maxFrameRate=2)))}));o&&(i.encodings=r,n.debug("setting encodings",Object.assign(Object.assign({},s),{encodings:i.encodings})),yield A.setParameters(i))}finally{r()}}))}function go(A){switch(A){case"f":default:return zn.HIGH;case"h":return zn.MEDIUM;case"q":return zn.LOW}}function po(A,t,e,i){if(!e)return[new pt({quality:zn.HIGH,width:A,height:t,bitrate:0,ssrc:0})];if(i){const i=e[0].scalabilityMode,n=new Bo(i),s=[],r="h"==n.suffix?1.5:2,o="h"==n.suffix?2:3;for(let a=0;a<n.spatial;a+=1)s.push(new pt({quality:Math.min(zn.HIGH,n.spatial-1)-a,width:Math.ceil(A/Math.pow(r,a)),height:Math.ceil(t/Math.pow(r,a)),bitrate:e[0].maxBitrate?Math.ceil(e[0].maxBitrate/Math.pow(o,a)):0,ssrc:0}));return s}return e.map((e=>{var i,n,s;const r=null!==(i=e.scaleResolutionDownBy)&&void 0!==i?i:1;let o=go(null!==(n=e.rid)&&void 0!==n?n:"");return new pt({quality:o,width:Math.ceil(A/r),height:Math.ceil(t/r),bitrate:null!==(s=e.maxBitrate)&&void 0!==s?s:0,ssrc:0})}))}const vo="_lossy",mo="_reliable",Qo="leave-reconnect";var Co,Uo,Fo,yo,bo,Eo,Io,ko,Ho,So,To;(Uo=Co||(Co={}))[Uo.New=0]="New",Uo[Uo.Connected=1]="Connected",Uo[Uo.Disconnected=2]="Disconnected",Uo[Uo.Reconnecting=3]="Reconnecting",Uo[Uo.Closed=4]="Closed";class Oo extends oi.EventEmitter{get isClosed(){return this.gA}get pendingReconnect(){return!!this.reconnectTimeout}constructor(A){var t;super(),this.options=A,this.rtcConfig={},this.peerConnectionTimeout=Jr.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=Co.New,this.gA=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=qe,this.handleDataChannel=A=>ii(this,[A],void 0,(function(A){var t=this;let{channel:e}=A;return(function*(){if(e){if(e.label===mo)t.reliableDCSub=e;else{if(e.label!==vo)return;t.lossyDCSub=e}t.log.debug("on data channel ".concat(e.id,", ").concat(e.label),t.logContext),e.onmessage=t.handleDataMessage}})()})),this.handleDataMessage=A=>ii(this,void 0,void 0,(function*(){var t,e;const i=yield this.dataProcessLock.lock();try{let i;if(A.data instanceof ArrayBuffer)i=A.data;else{if(!(A.data instanceof Blob))return void this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:A.data}));i=yield A.data.arrayBuffer()}const n=vt.fromBinary(new Uint8Array(i));"speaker"===(null===(t=n.value)||void 0===t?void 0:t.case)?this.emit(Sn.ActiveSpeakersUpdate,n.value.value.speakers):("user"===(null===(e=n.value)||void 0===e?void 0:e.case)&&(function(A,t){const e=A.participantIdentity?A.participantIdentity:t.participantIdentity;A.participantIdentity=e,t.participantIdentity=e;const i=0!==A.destinationIdentities.length?A.destinationIdentities:t.destinationIdentities;A.destinationIdentities=i,t.destinationIdentities=i})(n,n.value.value),this.emit(Sn.DataPacketReceived,n))}finally{i()}})),this.handleDataError=A=>{const t=0===A.currentTarget.maxRetransmits?"lossy":"reliable";if(A instanceof ErrorEvent&&A.error){const{error:e}=A.error;this.log.error("DataChannel error on ".concat(t,": ").concat(A.message),Object.assign(Object.assign({},this.logContext),{error:e}))}else this.log.error("Unknown DataChannel error on ".concat(t),Object.assign(Object.assign({},this.logContext),{event:A}))},this.handleBufferedAmountLow=A=>{const t=0===A.currentTarget.maxRetransmits?mt.LOSSY:mt.RELIABLE;this.updateAndEmitDCBufferStatus(t)},this.handleDisconnect=(A,t)=>{if(this.gA)return;this.log.warn("".concat(A," disconnected"),this.logContext),0===this.reconnectAttempts&&(this.reconnectStart=Date.now());const e=Date.now()-this.reconnectStart;let i=this.getNextRetryDelay({elapsedMs:e,retryCount:this.reconnectAttempts});null!==i?(A===Qo&&(i=0),this.log.debug("reconnecting in ".concat(i,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Zn.setTimeout((()=>this.attemptReconnect(t).finally((()=>this.reconnectTimeout=void 0))),i)):(A=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(A,"ms. giving up"),this.logContext),this.emit(Sn.Disconnected),this.close()})(e)},this.waitForRestarted=()=>new Promise(((A,t)=>{this.pcState===Co.Connected&&A();const e=()=>{this.off(Sn.Disconnected,i),A()},i=()=>{this.off(Sn.Restarted,e),t()};this.once(Sn.Restarted,e),this.once(Sn.Disconnected,i)})),this.updateAndEmitDCBufferStatus=A=>{const t=this.isBufferStatusLow(A);void 0!==t&&t!==this.dcBufferStatus.get(A)&&(this.dcBufferStatus.set(A,t),this.emit(Sn.DCBufferStatusChanged,t,A))},this.isBufferStatusLow=A=>{const t=this.dataChannelForKind(A);if(t)return t.bufferedAmount<=t.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===pr.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(st.RR_SIGNAL_DISCONNECTED))},this.log=ze(null!==(t=A.loggerName)&&void 0!==t?t:$e.Engine),this.loggerOptions={loggerName:A.loggerName,loggerContextCb:()=>this.logContext},this.client=new mr(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new g,this.dataProcessLock=new g,this.dcBufferStatus=new Map([[mt.LOSSY,!0],[mt.RELIABLE,!0]]),this.client.onParticipantUpdate=A=>this.emit(Sn.ParticipantUpdate,A),this.client.onConnectionQuality=A=>this.emit(Sn.ConnectionQualityUpdate,A),this.client.onRoomUpdate=A=>this.emit(Sn.RoomUpdate,A),this.client.onSubscriptionError=A=>this.emit(Sn.SubscriptionError,A),this.client.onSubscriptionPermissionUpdate=A=>this.emit(Sn.SubscriptionPermissionUpdate,A),this.client.onSpeakersChanged=A=>this.emit(Sn.SpeakersChanged,A),this.client.onStreamStateUpdate=A=>this.emit(Sn.StreamStateChanged,A),this.client.onRequestResponse=A=>this.emit(Sn.SignalRequestResponse,A)}get logContext(){var A,t,e,i,n,s,r,o;return{room:null===(t=null===(A=this.latestJoinResponse)||void 0===A?void 0:A.room)||void 0===t?void 0:t.name,roomID:null===(i=null===(e=this.latestJoinResponse)||void 0===e?void 0:e.room)||void 0===i?void 0:i.sid,participant:null===(s=null===(n=this.latestJoinResponse)||void 0===n?void 0:n.participant)||void 0===s?void 0:s.identity,pID:null===(o=null===(r=this.latestJoinResponse)||void 0===r?void 0:r.participant)||void 0===o?void 0:o.sid}}join(A,t,e,i){return ii(this,void 0,void 0,(function*(){this.url=A,this.token=t,this.signalOpts=e,this.maxJoinAttempts=e.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const n=yield this.client.join(A,t,e,i);return this.gA=!1,this.latestJoinResponse=n,this.subscriberPrimary=n.subscriberPrimary,this.pcManager||(yield this.configure(n)),this.subscriberPrimary&&!n.fastPublish||this.negotiate(),this.clientConfiguration=n.clientConfiguration,setTimeout((()=>{this.emit(Sn.SignalConnected)}),10),n}catch(n){if(n instanceof Ln&&n.reason===Qn.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(A,t,e,i);throw n}}))}close(){return ii(this,void 0,void 0,(function*(){const A=yield this.closingLock.lock();if(this.isClosed)A();else try{this.gA=!0,this.joinAttempts=0,this.emit(Sn.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{A()}}))}cleanupPeerConnections(){return ii(this,void 0,void 0,(function*(){var A;yield null===(A=this.pcManager)||void 0===A?void 0:A.close(),this.pcManager=void 0;const t=A=>{A&&(A.close(),A.onbufferedamountlow=null,A.onclose=null,A.onclosing=null,A.onerror=null,A.onmessage=null,A.onopen=null)};t(this.lossyDC),t(this.lossyDCSub),t(this.reliableDC),t(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0}))}cleanupClient(){return ii(this,void 0,void 0,(function*(){yield this.client.close(),this.client.resetCallbacks()}))}addTrack(A){if(this.pendingTrackResolvers[A.cid])throw new _n("a track with the same ID has already been published");return new Promise(((t,e)=>{const i=setTimeout((()=>{delete this.pendingTrackResolvers[A.cid],e(new Ln("publication of local track timed out, no response from server",Qn.InternalError))}),1e4);this.pendingTrackResolvers[A.cid]={resolve:A=>{clearTimeout(i),t(A)},reject:()=>{clearTimeout(i),e(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(A)}))}removeTrack(A){if(A.track&&this.pendingTrackResolvers[A.track.id]){const{reject:t}=this.pendingTrackResolvers[A.track.id];t&&t(),delete this.pendingTrackResolvers[A.track.id]}try{return this.pcManager.removeTrack(A),!0}catch(t){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:t}))}return!1}updateMuteStatus(A,t){this.client.sendMuteTrack(A,t)}get dataSubscriberReadyState(){var A;return null===(A=this.reliableDCSub)||void 0===A?void 0:A.readyState}getConnectedServerAddress(){return ii(this,void 0,void 0,(function*(){var A;return null===(A=this.pcManager)||void 0===A?void 0:A.getConnectedAddress()}))}setRegionUrlProvider(A){this.regionUrlProvider=A}configure(A){return ii(this,void 0,void 0,(function*(){var t,e;if(this.pcManager&&this.pcManager.currentState!==Xr.NEW)return;this.participantSid=null===(t=A.participant)||void 0===t?void 0:t.sid;const i=this.makeRTCConfiguration(A);var n;this.pcManager=new Yr(i,A.subscriberPrimary,this.loggerOptions),this.emit(Sn.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(A,t)=>{this.client.sendIceCandidate(A,t)},this.pcManager.onPublisherOffer=A=>{this.client.sendOffer(A)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(t,e,i)=>ii(this,void 0,void 0,(function*(){if(this.log.debug("primary PC state changed ".concat(t),this.logContext),["closed","disconnected","failed"].includes(e)&&(this.publisherConnectionPromise=void 0),t===Xr.CONNECTED){const t=this.pcState===Co.New;this.pcState=Co.Connected,t&&this.emit(Sn.Connected,A)}else t===Xr.FAILED&&this.pcState===Co.Connected&&(this.pcState=Co.Disconnected,this.handleDisconnect("peerconnection failed","failed"===i?st.RR_SUBSCRIBER_FAILED:st.RR_PUBLISHER_FAILED));const n=this.client.isDisconnected||this.client.currentState===pr.RECONNECTING,s=[Xr.FAILED,Xr.CLOSING,Xr.CLOSED].includes(t);n&&s&&!this.gA&&this.emit(Sn.Offline)})),this.pcManager.onTrack=A=>{this.emit(Sn.MediaTrackAdded,A.track,A.streams[0],A.receiver)},void 0!==(n=null===(e=A.serverInfo)||void 0===e?void 0:e.protocol)&&n>13||this.createDataChannels()}))}setupSignalClientCallbacks(){this.client.onAnswer=A=>ii(this,void 0,void 0,(function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:A.type})),yield this.pcManager.setPublisherAnswer(A))})),this.client.onTrickle=(A,t)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:A,target:t})),this.pcManager.addIceCandidate(A,t))},this.client.onOffer=A=>ii(this,void 0,void 0,(function*(){if(!this.pcManager)return;const t=yield this.pcManager.createSubscriberAnswerFromOffer(A);this.client.sendAnswer(t)})),this.client.onLocalTrackPublished=A=>{var t;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:A.cid,track:null===(t=A.track)||void 0===t?void 0:t.sid})),!this.pendingTrackResolvers[A.cid])return void this.log.error("missing track resolver for ".concat(A.cid),Object.assign(Object.assign({},this.logContext),{cid:A.cid}));const{resolve:e}=this.pendingTrackResolvers[A.cid];delete this.pendingTrackResolvers[A.cid],e(A.track)},this.client.onLocalTrackUnpublished=A=>{this.emit(Sn.LocalTrackUnpublished,A)},this.client.onLocalTrackSubscribed=A=>{this.emit(Sn.LocalTrackSubscribed,A)},this.client.onTokenRefresh=A=>{this.token=A},this.client.onRemoteMuteChanged=(A,t)=>{this.emit(Sn.RemoteMute,A,t)},this.client.onSubscribedQualityUpdate=A=>{this.emit(Sn.SubscribedQualityUpdate,A)},this.client.onRoomMoved=A=>{var t;this.participantSid=null===(t=A.participant)||void 0===t?void 0:t.sid,this.emit(Sn.RoomMoved,A)},this.client.onClose=()=>{this.handleDisconnect("signal",st.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=A=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:null==A?void 0:A.reason})),A.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(A.regions)),A.action){case de.DISCONNECT:this.emit(Sn.Disconnected,null==A?void 0:A.reason),this.close();break;case de.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Qo);break;case de.RESUME:this.handleDisconnect(Qo)}}}makeRTCConfiguration(A){var t;const e=Object.assign({},this.rtcConfig);if((null===(t=this.signalOpts)||void 0===t?void 0:t.e2eeEnabled)&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),e.encodedInsertableStreams=!0),A.iceServers&&!e.iceServers){const t=[];A.iceServers.forEach((A=>{const e={urls:A.urls};A.username&&(e.username=A.username),A.credential&&(e.credential=A.credential),t.push(e)})),e.iceServers=t}return A.clientConfiguration&&A.clientConfiguration.forceRelay===it.ENABLED&&(e.iceTransportPolicy="relay"),e.sdpSemantics="unified-plan",e.continualGatheringPolicy="gather_continually",e}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(vo,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(mo,{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(A,t,e){return ii(this,void 0,void 0,(function*(){if(gs())return yield this.createTransceiverRTCRtpSender(A,t,e);if(ps())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(A.mediaStreamTrack);throw new Rn("Required webRTC APIs not supported on this device")}))}createSimulcastSender(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(gs())return this.createSimulcastTransceiverSender(A,t,e,i);if(ps())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(A.mediaStreamTrack);throw new Rn("Cannot stream on this device")}))}createTransceiverRTCRtpSender(A,t,e){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Rn("publisher is closed");const i=[];A.mediaStream&&i.push(A.mediaStream),$s(A)&&(A.codec=t.videoCodec);const n={direction:"sendonly",streams:i};return e&&(n.sendEncodings=e),(yield this.pcManager.addPublisherTransceiver(A.mediaStreamTrack,n)).sender}))}createSimulcastTransceiverSender(A,t,e,i){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Rn("publisher is closed");const n={direction:"sendonly"};i&&(n.sendEncodings=i);const s=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,n);if(e.videoCodec)return A.setSimulcastTrackSender(e.videoCodec,s.sender),s.sender}))}createRTCRtpSender(A){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Rn("publisher is closed");return this.pcManager.addPublisherTrack(A)}))}attemptReconnect(A){return ii(this,void 0,void 0,(function*(){var t,e,i;if(!this.gA)if(this.attemptingReconnect)qe.warn("already attempting reconnect, returning early",this.logContext);else{(null===(t=this.clientConfiguration)||void 0===t?void 0:t.resumeConnection)!==it.DISABLED&&(null!==(i=null===(e=this.pcManager)||void 0===e?void 0:e.currentState)&&void 0!==i?i:Xr.NEW)!==Xr.NEW||(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(A),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(n){this.reconnectAttempts+=1;let A=!0;n instanceof Rn?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:n})),A=!1):n instanceof Ko||(this.fullReconnectOnNext=!0),A?this.handleDisconnect("reconnect",st.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(Sn.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}}))}getNextRetryDelay(A){try{return this.reconnectPolicy.nextRetryDelayInMs(A)}catch(t){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:t}))}return null}restartConnection(A){return ii(this,void 0,void 0,(function*(){var t,e,i;try{if(!this.url||!this.token)throw new Rn("could not reconnect, url or token not saved");let e;this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(Sn.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Ko;e=yield this.join(null!=A?A:this.url,this.token,this.signalOpts)}catch(n){if(n instanceof Ln&&n.reason===Qn.NotAllowed)throw new Rn("could not reconnect, token might be expired");throw new Ko}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(Sn.SignalRestarted,e),yield this.waitForPCReconnected(),this.client.currentState!==pr.CONNECTED)throw new Ko("Signal connection got severed during reconnect");null===(t=this.regionUrlProvider)||void 0===t||t.resetAttempts(),this.emit(Sn.Restarted)}catch(s){const A=yield null===(e=this.regionUrlProvider)||void 0===e?void 0:e.getNextBestRegionUrl();if(A)return void(yield this.restartConnection(A));throw null===(i=this.regionUrlProvider)||void 0===i||i.resetAttempts(),s}}))}resumeConnection(A){return ii(this,void 0,void 0,(function*(){var t;if(!this.url||!this.token)throw new Rn("could not reconnect, url or token not saved");if(!this.pcManager)throw new Rn("publisher and subscriber connections unset");let e;this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(Sn.Resuming);try{this.setupSignalClientCallbacks(),e=yield this.client.reconnect(this.url,this.token,this.participantSid,A)}catch(i){let A="";if(i instanceof Error&&(A=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof Ln&&i.reason===Qn.NotAllowed)throw new Rn("could not reconnect, token might be expired");if(i instanceof Ln&&i.reason===Qn.LeaveRequest)throw i;throw new Ko(A)}if(this.emit(Sn.SignalResumed),e){const A=this.makeRTCConfiguration(e);this.pcManager.updateConfiguration(A)}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!==pr.CONNECTED)throw new Ko("Signal connection got severed during reconnect");this.client.setReconnected(),"open"===(null===(t=this.reliableDC)||void 0===t?void 0:t.readyState)&&null===this.reliableDC.id&&this.createDataChannels(),this.emit(Sn.Resumed)}))}waitForPCInitialConnection(A,t){return ii(this,void 0,void 0,(function*(){if(!this.pcManager)throw new Rn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(t,A)}))}waitForPCReconnected(){return ii(this,void 0,void 0,(function*(){this.pcState=Co.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield ws(2e3),!this.pcManager)throw new Rn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Co.Connected}catch(A){throw this.pcState=Co.Disconnected,new Ln("could not establish PC connection, ".concat(A.message),Qn.InternalError)}}))}publishRpcResponse(A,t,e,i){return ii(this,void 0,void 0,(function*(){const n=new vt({destinationIdentities:[A],kind:mt.RELIABLE,value:{case:"rpcResponse",value:new Ht({requestId:t,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:null!=e?e:""}})}});yield this.sendDataPacket(n,mt.RELIABLE)}))}publishRpcAck(A,t){return ii(this,void 0,void 0,(function*(){const e=new vt({destinationIdentities:[A],kind:mt.RELIABLE,value:{case:"rpcAck",value:new kt({requestId:t})}});yield this.sendDataPacket(e,mt.RELIABLE)}))}sendDataPacket(A,t){return ii(this,void 0,void 0,(function*(){const e=A.toBinary();yield this.ensurePublisherConnected(t);const i=this.dataChannelForKind(t);i&&i.send(e),this.updateAndEmitDCBufferStatus(t)}))}waitForBufferStatusLow(A){return new Promise(((t,e)=>ii(this,void 0,void 0,(function*(){if(this.isBufferStatusLow(A))t();else{const i=()=>e("Engine closed");for(this.once(Sn.Closing,i);!this.dcBufferStatus.get(A);)yield ws(10);this.off(Sn.Closing,i),t()}}))))}ensureDataTransportConnected(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.subscriberPrimary;return(function*(){var i;if(!t.pcManager)throw new Rn("PC manager is closed");const n=e?t.pcManager.subscriber:t.pcManager.publisher,s=e?"Subscriber":"Publisher";if(!n)throw new Ln("".concat(s," connection not set"),Qn.InternalError);let r=!1;e||t.dataChannelForKind(A,e)||(t.createDataChannels(),r=!0),r||e||t.pcManager.publisher.isICEConnected||"checking"===t.pcManager.publisher.getICEConnectionState()||(r=!0),r&&t.negotiate();const o=t.dataChannelForKind(A,e);if("open"===(null==o?void 0:o.readyState))return;const a=(new Date).getTime()+t.peerConnectionTimeout;for(;(new Date).getTime()<a;){if(n.isICEConnected&&"open"===(null===(i=t.dataChannelForKind(A,e))||void 0===i?void 0:i.readyState))return;yield ws(50)}throw new Ln("could not establish ".concat(s," connection, state: ").concat(n.getICEConnectionState()),Qn.InternalError)})()}))}ensurePublisherConnected(A){return ii(this,void 0,void 0,(function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(A,!1)),yield this.publisherConnectionPromise}))}verifyTransport(){return!!this.pcManager&&this.pcManager.currentState===Xr.CONNECTED&&!(!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return ii(this,void 0,void 0,(function*(){return new Promise(((A,t)=>ii(this,void 0,void 0,(function*(){if(!this.pcManager)return void t(new jn("PC manager is closed"));this.pcManager.requirePublisher(),0!=this.pcManager.publisher.getTransceivers().length||this.lossyDC||this.reliableDC||this.createDataChannels();const e=new AbortController,i=()=>{e.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),A()};this.isClosed&&t("cannot negotiate on closed engine"),this.on(Sn.Closing,i),this.pcManager.publisher.once(Lr,(A=>{const t=new Map;A.forEach((A=>{const e=A.codec.toLowerCase();var i;i=e,rs.includes(i)&&t.set(A.payload,e)})),this.emit(Sn.RTPVideoMapUpdate,t)}));try{yield this.pcManager.negotiate(e),A()}catch(n){n instanceof jn&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",st.RR_UNKNOWN),t(n)}finally{this.off(Sn.Closing,i)}}))))}))}dataChannelForKind(A,t){if(t){if(A===mt.LOSSY)return this.lossyDCSub;if(A===mt.RELIABLE)return this.reliableDCSub}else{if(A===mt.LOSSY)return this.lossyDC;if(A===mt.RELIABLE)return this.reliableDC}}sendSyncState(A,t){var e,i;if(!this.pcManager)return void this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);const n=this.pcManager.subscriber.getLocalDescription(),s=this.pcManager.subscriber.getRemoteDescription(),r=null===(i=null===(e=this.signalOpts)||void 0===e?void 0:e.autoSubscribe)||void 0===i||i,o=new Array,a=new Array;A.forEach((A=>{A.isDesired!==r&&o.push(A.trackSid),A.isEnabled||a.push(A.trackSid)})),this.client.sendSyncState(new He({answer:n?Cr({sdp:n.sdp,type:n.type}):void 0,offer:s?Cr({sdp:s.sdp,type:s.type}):void 0,subscription:new ae({trackSids:o,subscribe:!r,participantTracks:[]}),publishTracks:or(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:a}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const A=[],t=(t,e)=>{void 0!==(null==t?void 0:t.id)&&null!==t.id&&A.push(new Se({label:t.label,id:t.id,target:e}))};return t(this.dataChannelForKind(mt.LOSSY),Xt.PUBLISHER),t(this.dataChannelForKind(mt.RELIABLE),Xt.PUBLISHER),t(this.dataChannelForKind(mt.LOSSY,!0),Xt.SUBSCRIBER),t(this.dataChannelForKind(mt.RELIABLE,!0),Xt.SUBSCRIBER),A}clearReconnectTimeout(){this.reconnectTimeout&&Zn.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Fs()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Fs()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Ko extends Error{}class Do{constructor(A,t){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(A),this.token=t}updateToken(A){this.token=A}isCloud(){return bs(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(A){return ii(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(A));const t=this.regionSettings.regions.filter((A=>!this.attemptedRegions.find((t=>t.url===A.url))));if(t.length>0){const A=t[0];return this.attemptedRegions.push(A),qe.debug("next region: ".concat(A.region)),A.url}return null}))}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(A){return ii(this,void 0,void 0,(function*(){const t=yield fetch("".concat((e=this.serverUrl,"".concat(e.protocol.replace("ws","http"),"//").concat(e.host,"/settings")),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:A});var e;if(t.ok){const A=yield t.json();return this.lastUpdateAt=Date.now(),A}throw new Ln("Could not fetch region settings: ".concat(t.statusText),401===t.status?Qn.NotAllowed:Qn.InternalError,t.status)}))}setServerReportedRegions(A){this.regionSettings=A,this.lastUpdateAt=Date.now()}}class Mo{get info(){return this.pA}constructor(A,t,e){this.reader=t,this.totalByteSize=e,this.pA=A,this.bytesReceived=0}}class Lo extends Mo{handleChunkReceived(A){var t;this.bytesReceived+=A.content.byteLength;const e=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,e)}[Symbol.asyncIterator](){const A=this.reader.getReader();return{next:()=>ii(this,void 0,void 0,(function*(){try{const{done:t,value:e}=yield A.read();return t?{done:!0,value:void 0}:(this.handleChunkReceived(e),{done:!1,value:e.content})}catch(t){return{done:!0,value:void 0}}})),return(){return ii(this,void 0,void 0,(function*(){return A.releaseLock(),{done:!0,value:void 0}}))}}}readAll(){return ii(this,void 0,void 0,(function*(){var A,t,e,i;let n=new Set;try{for(var s,r=!0,o=ni(this);!(A=(s=yield o.next()).done);r=!0){i=s.value,r=!1;const A=i;n.add(A)}}catch(a){t={error:a}}finally{try{r||A||!(e=o.return)||(yield e.call(o))}finally{if(t)throw t.error}}return Array.from(n)}))}}class xo extends Mo{constructor(A,t,e){super(A,t,e),this.receivedChunks=new Map}handleChunkReceived(A){var t;const e=Ps(A.chunkIndex),i=this.receivedChunks.get(e);if(i&&i.version>A.version)return;this.receivedChunks.set(e,A),this.bytesReceived+=A.content.byteLength;const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,n)}[Symbol.asyncIterator](){const A=this.reader.getReader(),t=new TextDecoder;return{next:()=>ii(this,void 0,void 0,(function*(){try{const{done:e,value:i}=yield A.read();return e?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:t.decode(i.content)})}catch(e){return{done:!0,value:void 0}}})),return(){return ii(this,void 0,void 0,(function*(){return A.releaseLock(),{done:!0,value:void 0}}))}}}readAll(){return ii(this,void 0,void 0,(function*(){var A,t,e,i;let n="";try{for(var s,r=!0,o=ni(this);!(A=(s=yield o.next()).done);r=!0)i=s.value,r=!1,n+=i}catch(a){t={error:a}}finally{try{r||A||!(e=o.return)||(yield e.call(o))}finally{if(t)throw t.error}}return n}))}}class _o{constructor(A,t,e){this.writableStream=A,this.defaultWriter=A.getWriter(),this.onClose=e,this.info=t}write(A){return this.defaultWriter.write(A)}close(){return ii(this,void 0,void 0,(function*(){var A;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),null===(A=this.onClose)||void 0===A||A.call(this)}))}}class No extends _o{}class Ro extends _o{}class jo extends ts{constructor(A,t,e,i,n){super(A,e,n),this.sid=t,this.receiver=i}get isLocal(){return!1}setMuted(A){this.isMuted!==A&&(this.isMuted=A,this.cA.enabled=!A,this.emit(A?On.Muted:On.Unmuted,this))}setMediaStream(A){this.mediaStream=A;const t=e=>{e.track===this.cA&&(A.removeEventListener("removetrack",t),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this.aA=0,this.emit(On.Ended,this))};A.addEventListener("removetrack",t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return ii(this,void 0,void 0,(function*(){var A;if(null===(A=this.receiver)||void 0===A?void 0:A.getStats)return yield this.receiver.getStats()}))}setPlayoutDelay(A){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=A: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()),zr)),"undefined"!=typeof RTCRtpReceiver&&"getSynchronizationSources"in RTCRtpReceiver&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const A=()=>{var t;this.timeSyncHandle=requestAnimationFrame((()=>A()));const e=null===(t=this.receiver)||void 0===t?void 0:t.getSynchronizationSources()[0];if(e){const{timestamp:A,rtpTimestamp:t}=e;t&&this.rtpTimestamp!==t&&(this.emit(On.TimeSyncUpdate,{timestamp:A,rtpTimestamp:t}),this.rtpTimestamp=t)}};A()}}class Go extends jo{constructor(A,t,e,i,n,s){super(A,t,ts.Kind.Audio,e,s),this.monitorReceiver=()=>ii(this,void 0,void 0,(function*(){if(!this.receiver)return void(this.aA=0);const A=yield this.getReceiverStats();A&&this.prevStats&&this.receiver&&(this.aA=Ao(A,this.prevStats)),this.prevStats=A})),this.audioContext=i,this.webAudioPluginNodes=[],n&&(this.sinkId=n.deviceId)}setVolume(A){var t;for(const e of this.attachedElements)this.audioContext?null===(t=this.gainNode)||void 0===t||t.gain.setTargetAtTime(A,0,.1):e.volume=A;ys()&&this.cA.vA(A),this.elementVolume=A}getVolume(){if(this.elementVolume)return this.elementVolume;if(ys())return 1;let A=0;return this.attachedElements.forEach((t=>{t.volume>A&&(A=t.volume)})),A}setSinkId(A){return ii(this,void 0,void 0,(function*(){this.sinkId=A,yield Promise.all(this.attachedElements.map((t=>{if(ms(t))return t.setSinkId(A)})))}))}attach(A){const t=0===this.attachedElements.length;return A?super.attach(A):A=super.attach(),this.sinkId&&ms(A)&&A.setSinkId(this.sinkId).catch((A=>{this.log.error("Failed to set sink id on remote audio track",A,this.logContext)})),this.audioContext&&t&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,A),A.volume=0,A.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),A}detach(A){let t;return A?(t=super.detach(A),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}setAudioContext(A){this.audioContext=A,A&&this.attachedElements.length>0?this.connectWebAudio(A,this.attachedElements[0]):A||this.disconnectWebAudio()}setWebAudioPlugins(A){this.webAudioPluginNodes=A,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(A,t){this.disconnectWebAudio(),this.sourceNode=A.createMediaStreamSource(t.srcObject);let e=this.sourceNode;this.webAudioPluginNodes.forEach((A=>{e.connect(A),e=A})),this.gainNode=A.createGain(),e.connect(this.gainNode),this.gainNode.connect(A.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),"running"!==A.state&&A.resume().then((()=>{"running"!==A.state&&this.emit(On.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))})).catch((A=>{this.emit(On.AudioPlaybackFailed,A)}))}disconnectWebAudio(){var A,t;null===(A=this.gainNode)||void 0===A||A.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return ii(this,void 0,void 0,(function*(){if(!this.receiver||!this.receiver.getStats)return;let A;return(yield this.receiver.getStats()).forEach((t=>{"inbound-rtp"===t.type&&(A={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration})})),A}))}}class Po extends jo{constructor(A,t,e,i,n){super(A,t,ts.Kind.Video,e,n),this.elementInfos=[],this.monitorReceiver=()=>ii(this,void 0,void 0,(function*(){if(!this.receiver)return void(this.aA=0);const A=yield this.getReceiverStats();A&&this.prevStats&&this.receiver&&(this.aA=Ao(A,this.prevStats)),this.prevStats=A})),this.debouncedHandleResize=Kr((()=>{this.updateDimensions()}),100),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return void 0!==this.adaptiveStreamSettings}get mediaStreamTrack(){return this.cA}setMuted(A){super.setMuted(A),this.attachedElements.forEach((t=>{A?is(this.cA,t):es(this.cA,t)}))}attach(A){if(A?super.attach(A):A=super.attach(),this.adaptiveStreamSettings&&void 0===this.elementInfos.find((t=>t.element===A))){const t=new Vo(A);this.observeElementInfo(t)}return A}observeElementInfo(A){this.adaptiveStreamSettings&&void 0===this.elementInfos.find((t=>t===A))?(A.handleResize=()=>{this.debouncedHandleResize()},A.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(A),A.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(A){if(!this.isAdaptiveStream)return void this.log.warn("stopObservingElementInfo ignored",this.logContext);const t=this.elementInfos.filter((t=>t===A));for(const e of t)e.stopObserving();this.elementInfos=this.elementInfos.filter((t=>t!==A)),this.updateVisibility(),this.debouncedHandleResize()}detach(A){let t=[];if(A)return this.stopObservingElement(A),super.detach(A);t=super.detach();for(const e of t)this.stopObservingElement(e);return t}getDecoderImplementation(){var A;return null===(A=this.prevStats)||void 0===A?void 0:A.decoderImplementation}getReceiverStats(){return ii(this,void 0,void 0,(function*(){if(!this.receiver||!this.receiver.getStats)return;const A=yield this.receiver.getStats();let t,e="",i=new Map;return A.forEach((A=>{"inbound-rtp"===A.type?(e=A.codecId,t={type:"video",streamId:A.id,framesDecoded:A.framesDecoded,framesDropped:A.framesDropped,framesReceived:A.framesReceived,packetsReceived:A.packetsReceived,packetsLost:A.packetsLost,frameWidth:A.frameWidth,frameHeight:A.frameHeight,pliCount:A.pliCount,firCount:A.firCount,nackCount:A.nackCount,jitter:A.jitter,timestamp:A.timestamp,bytesReceived:A.bytesReceived,decoderImplementation:A.decoderImplementation}):"codec"===A.type&&i.set(A.id,A)})),t&&""!==e&&i.get(e)&&(t.mimeType=i.get(e).mimeType),t}))}stopObservingElement(A){const t=this.elementInfos.filter((t=>t.element===A));for(const e of t)this.stopObservingElementInfo(e)}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ii(this,void 0,void 0,(function*(){yield A.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()}))}updateVisibility(){var A,t;const e=this.elementInfos.reduce(((A,t)=>Math.max(A,t.visibilityChangedAt||0)),0),i=!(null!==(t=null===(A=this.adaptiveStreamSettings)||void 0===A?void 0:A.pauseVideoInBackground)&&void 0!==t&&!t)&&this.isInBackground,n=this.elementInfos.some((A=>A.pictureInPicture)),s=this.elementInfos.some((A=>A.visible))&&!i||n;this.lastVisible!==s&&(!s&&Date.now()-e<100?Zn.setTimeout((()=>{this.updateVisibility()}),100):(this.lastVisible=s,this.emit(On.VisibilityChanged,s,this)))}updateDimensions(){var A,t;let e=0,i=0;const n=this.getPixelDensity();for(const s of this.elementInfos){const A=s.width()*n,t=s.height()*n;A+t>e+i&&(e=A,i=t)}(null===(A=this.lastDimensions)||void 0===A?void 0:A.width)===e&&(null===(t=this.lastDimensions)||void 0===t?void 0:t.height)===i||(this.lastDimensions={width:e,height:i},this.emit(On.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var A;const t=null===(A=this.adaptiveStreamSettings)||void 0===A?void 0:A.pixelDensity;return"screen"===t?ks():t||(ks()>2?2:1)}}class Vo{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(A,t){this.onVisibilityChanged=A=>{var t;const{target:e,isIntersecting:i}=A;e===this.element&&(this.isIntersecting=i,this.isPiP=Jo(this.element),this.visibilityChangedAt=Date.now(),null===(t=this.handleVisibilityChanged)||void 0===t||t.call(this))},this.onEnterPiP=()=>{var A,t,e;null===(t=null===(A=window.documentPictureInPicture)||void 0===A?void 0:A.window)||void 0===t||t.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Jo(this.element),null===(e=this.handleVisibilityChanged)||void 0===e||e.call(this)},this.onLeavePiP=()=>{var A;this.isPiP=Jo(this.element),null===(A=this.handleVisibilityChanged)||void 0===A||A.call(this)},this.element=A,this.isIntersecting=null!=t?t:Xo(A),this.isPiP=Fs()&&Jo(A),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var A,t,e;this.isIntersecting=Xo(this.element),this.isPiP=Jo(this.element),this.element.handleResize=()=>{var A;null===(A=this.handleResize)||void 0===A||A.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Ms().observe(this.element),Ks().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),null===(A=window.documentPictureInPicture)||void 0===A||A.addEventListener("enter",this.onEnterPiP),null===(e=null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)||void 0===e||e.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var A,t,e,i,n;null===(A=Ms())||void 0===A||A.unobserve(this.element),null===(t=Ks())||void 0===t||t.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),null===(e=window.documentPictureInPicture)||void 0===e||e.removeEventListener("enter",this.onEnterPiP),null===(n=null===(i=window.documentPictureInPicture)||void 0===i?void 0:i.window)||void 0===n||n.removeEventListener("pagehide",this.onLeavePiP)}}function Jo(A){var t,e;return document.pictureInPictureElement===A||!!(null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)&&Xo(A,null===(e=window.documentPictureInPicture)||void 0===e?void 0:e.window)}function Xo(A,t){const e=t||window;let i=A.offsetTop,n=A.offsetLeft;const s=A.offsetWidth,r=A.offsetHeight,{hidden:o}=A,{display:a}=getComputedStyle(A);for(;A.offsetParent;)i+=(A=A.offsetParent).offsetTop,n+=A.offsetLeft;return i<e.pageYOffset+e.innerHeight&&n<e.pageXOffset+e.innerWidth&&i+r>e.pageYOffset&&n+s>e.pageXOffset&&!o&&"none"!==a}class $o extends oi.EventEmitter{constructor(A,t,e,i){var n;super(),this.metadataMuted=!1,this.encryption=ft.NONE,this.log=qe,this.handleMuted=()=>{this.emit(On.Muted)},this.handleUnmuted=()=>{this.emit(On.Unmuted)},this.log=ze(null!==(n=null==i?void 0:i.loggerName)&&void 0!==n?n:$e.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=A,this.trackSid=t,this.trackName=e,this.source=ts.Source.Unknown}setTrack(A){this.track&&(this.track.off(On.Muted,this.handleMuted),this.track.off(On.Unmuted,this.handleUnmuted)),this.track=A,A&&(A.on(On.Muted,this.handleMuted),A.on(On.Unmuted,this.handleUnmuted))}get logContext(){var A;return Object.assign(Object.assign({},null===(A=this.loggerContextCb)||void 0===A?void 0:A.call(this)),ar(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return void 0!==this.track}get isEncrypted(){return this.encryption!==ft.NONE}get audioTrack(){if(Xs(this.track))return this.track}get videoTrack(){if($s(this.track))return this.track}updateInfo(A){this.trackSid=A.sid,this.trackName=A.name,this.source=ts.sourceFromProto(A.source),this.mimeType=A.mimeType,this.kind===ts.Kind.Video&&A.width>0&&(this.dimensions={width:A.width,height:A.height},this.simulcasted=A.simulcast),this.encryption=A.encryption,this.trackInfo=A,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:A}))}}(yo=(Fo=$o||($o={})).SubscriptionStatus||(Fo.SubscriptionStatus={})).Desired="desired",yo.Subscribed="subscribed",yo.Unsubscribed="unsubscribed",(bo=Fo.PermissionStatus||(Fo.PermissionStatus={})).Allowed="allowed",bo.NotAllowed="not_allowed";class Yo extends $o{get isUpstreamPaused(){var A;return null===(A=this.track)||void 0===A?void 0:A.isUpstreamPaused}constructor(A,t,e,i){super(A,t.sid,t.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(On.Ended)},this.updateInfo(t),this.setTrack(e)}setTrack(A){this.track&&this.track.off(On.Ended,this.handleTrackEnded),super.setTrack(A),A&&A.on(On.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 ii(this,void 0,void 0,(function*(){var A;return null===(A=this.track)||void 0===A?void 0:A.mute()}))}unmute(){return ii(this,void 0,void 0,(function*(){var A;return null===(A=this.track)||void 0===A?void 0:A.unmute()}))}pauseUpstream(){return ii(this,void 0,void 0,(function*(){var A;yield null===(A=this.track)||void 0===A?void 0:A.pauseUpstream()}))}resumeUpstream(){return ii(this,void 0,void 0,(function*(){var A;yield null===(A=this.track)||void 0===A?void 0:A.resumeUpstream()}))}getTrackFeatures(){var A;if(Xs(this.track)){const t=this.track.getSourceTrackSettings(),e=new Set;return t.autoGainControl&&e.add(ot.TF_AUTO_GAIN_CONTROL),t.echoCancellation&&e.add(ot.TF_ECHO_CANCELLATION),t.noiseSuppression&&e.add(ot.TF_NOISE_SUPPRESSION),t.channelCount&&t.channelCount>1&&e.add(ot.TF_STEREO),(null===(A=this.options)||void 0===A?void 0:A.dtx)||e.add(ot.TF_NO_DTX),this.track.enhancedNoiseCancellation&&e.add(ot.TF_ENHANCED_NOISE_CANCELLATION),Array.from(e.values())}return[]}}function Wo(A,t){return ii(this,void 0,void 0,(function*(){null!=A||(A={});let e=!1;const{audioProcessor:i,videoProcessor:n,optionsWithoutProcessor:s}=cr(A);let r=s.audio,o=s.video;if(i&&"object"==typeof s.audio&&(s.audio.processor=i),n&&"object"==typeof s.video&&(s.video.processor=n),A.audio&&"object"==typeof s.audio&&"string"==typeof s.audio.deviceId){const A=s.audio.deviceId;s.audio.deviceId={exact:A},e=!0,r=Object.assign(Object.assign({},s.audio),{deviceId:{ideal:A}})}if(s.video&&"object"==typeof s.video&&"string"==typeof s.video.deviceId){const A=s.video.deviceId;s.video.deviceId={exact:A},e=!0,o=Object.assign(Object.assign({},s.video),{deviceId:{ideal:A}})}(!0===s.audio||"object"==typeof s.audio&&!s.audio.deviceId)&&(s.audio={deviceId:"default"}),!0===s.video?s.video={deviceId:"default"}:"object"!=typeof s.video||s.video.deviceId||(s.video.deviceId="default");const a=Ar(s,Gr,Pr),c=er(a),u=navigator.mediaDevices.getUserMedia(c);s.audio&&(lr.userMediaPromiseMap.set("audioinput",u),u.catch((()=>lr.userMediaPromiseMap.delete("audioinput")))),s.video&&(lr.userMediaPromiseMap.set("videoinput",u),u.catch((()=>lr.userMediaPromiseMap.delete("videoinput"))));try{const A=yield u;return yield Promise.all(A.getTracks().map((e=>ii(this,void 0,void 0,(function*(){const s="audio"===e.kind;let r,o=s?a.audio:a.video;"boolean"!=typeof o&&o||(o={});const u=s?c.audio:c.video;"boolean"!=typeof u&&(r=u);const h=e.getSettings().deviceId;(null==r?void 0:r.deviceId)&&Rs(r.deviceId)!==h?r.deviceId=h:r||(r={deviceId:h});const l=(function(A,t,e){switch(A.kind){case"audio":return new eo(A,t,!1,void 0,e);case"video":return new fo(A,t,!1,e);default:throw new _n("unsupported track type: ".concat(A.kind))}})(e,r,t);return l.kind===ts.Kind.Video?l.source=ts.Source.Camera:l.kind===ts.Kind.Audio&&(l.source=ts.Source.Microphone),l.mediaStream=A,Xs(l)&&i?yield l.setProcessor(i):$s(l)&&n&&(yield l.setProcessor(n)),l})))))}catch(h){if(!e)throw h;return Wo(Object.assign(Object.assign({},A),{audio:r,video:o}),t)}}))}(Io=Eo||(Eo={})).Excellent="excellent",Io.Good="good",Io.Poor="poor",Io.Lost="lost",Io.Unknown="unknown";class Zo extends oi.EventEmitter{get logContext(){var A,t;return Object.assign({},null===(t=null===(A=this.loggerOptions)||void 0===A?void 0:A.loggerContextCb)||void 0===t?void 0:t.call(A))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every((A=>A.isEncrypted))}get isAgent(){var A;return(null===(A=this.permissions)||void 0===A?void 0:A.agent)||this.kind===dt.AGENT}get isActive(){var A;return(null===(A=this.participantInfo)||void 0===A?void 0:A.state)===lt.ACTIVE}get kind(){return this.mA}get attributes(){return Object.freeze(Object.assign({},this.QA))}constructor(A,t,e,i,n,s){let r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:dt.STANDARD;var o;super(),this.audioLevel=0,this.isSpeaking=!1,this.CA=Eo.Unknown,this.log=qe,this.log=ze(null!==(o=null==s?void 0:s.loggerName)&&void 0!==o?o:$e.Participant),this.loggerOptions=s,this.setMaxListeners(100),this.sid=A,this.identity=t,this.name=e,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.mA=r,this.QA=null!=n?n:{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(A){for(const[,t]of this.trackPublications)if(t.source===A)return t}getTrackPublicationByName(A){for(const[,t]of this.trackPublications)if(t.trackName===A)return t}waitUntilActive(){return this.isActive?Promise.resolve():(this.activeFuture||(this.activeFuture=new Ns,this.once(kn.Active,(()=>{var A,t;null===(t=null===(A=this.activeFuture)||void 0===A?void 0:A.resolve)||void 0===t||t.call(A),this.activeFuture=void 0}))),this.activeFuture.promise)}get connectionQuality(){return this.CA}get isCameraEnabled(){var A;const t=this.getTrackPublication(ts.Source.Camera);return!(null===(A=null==t?void 0:t.isMuted)||void 0===A||A)}get isMicrophoneEnabled(){var A;const t=this.getTrackPublication(ts.Source.Microphone);return!(null===(A=null==t?void 0:t.isMuted)||void 0===A||A)}get isScreenShareEnabled(){return!!this.getTrackPublication(ts.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(1e3*Number.parseInt(this.participantInfo.joinedAt.toString())):new Date}updateInfo(A){var t;return!(this.participantInfo&&this.participantInfo.sid===A.sid&&this.participantInfo.version>A.version||(this.identity=A.identity,this.sid=A.sid,this.UA(A.name),this.FA(A.metadata),this.yA(A.attributes),A.state===lt.ACTIVE&&(null===(t=this.participantInfo)||void 0===t?void 0:t.state)!==lt.ACTIVE&&this.emit(kn.Active),A.permission&&this.setPermissions(A.permission),this.participantInfo=A,0))}FA(A){const t=this.metadata!==A,e=this.metadata;this.metadata=A,t&&this.emit(kn.ParticipantMetadataChanged,e)}UA(A){const t=this.name!==A;this.name=A,t&&this.emit(kn.ParticipantNameChanged,A)}yA(A){const t=(function(A,t){var e;void 0===A&&(A={}),void 0===t&&(t={});const i=[...Object.keys(t),...Object.keys(A)],n={};for(const s of i)A[s]!==t[s]&&(n[s]=null!==(e=t[s])&&void 0!==e?e:"");return n})(this.attributes,A);this.QA=A,Object.keys(t).length>0&&this.emit(kn.AttributesChanged,t)}setPermissions(A){var t,e,i,n,s,r;const o=this.permissions,a=A.canPublish!==(null===(t=this.permissions)||void 0===t?void 0:t.canPublish)||A.canSubscribe!==(null===(e=this.permissions)||void 0===e?void 0:e.canSubscribe)||A.canPublishData!==(null===(i=this.permissions)||void 0===i?void 0:i.canPublishData)||A.hidden!==(null===(n=this.permissions)||void 0===n?void 0:n.hidden)||A.recorder!==(null===(s=this.permissions)||void 0===s?void 0:s.recorder)||A.canPublishSources.length!==this.permissions.canPublishSources.length||A.canPublishSources.some(((A,t)=>{var e;return A!==(null===(e=this.permissions)||void 0===e?void 0:e.canPublishSources[t])}))||A.canSubscribeMetrics!==(null===(r=this.permissions)||void 0===r?void 0:r.canSubscribeMetrics);return this.permissions=A,a&&this.emit(kn.ParticipantPermissionsChanged,o),a}setIsSpeaking(A){A!==this.isSpeaking&&(this.isSpeaking=A,A&&(this.lastSpokeAt=new Date),this.emit(kn.IsSpeakingChanged,A))}setConnectionQuality(A){const t=this.CA;this.CA=(function(A){switch(A){case et.EXCELLENT:return Eo.Excellent;case et.GOOD:return Eo.Good;case et.POOR:return Eo.Poor;case et.LOST:return Eo.Lost;default:return Eo.Unknown}})(A),t!==this.CA&&this.emit(kn.ConnectionQualityChanged,this.CA)}setDisconnected(){var A,t;this.activeFuture&&(null===(t=(A=this.activeFuture).reject)||void 0===t||t.call(A,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(A){this.audioContext=A,this.audioTrackPublications.forEach((t=>Xs(t.track)&&t.track.setAudioContext(A)))}addTrackPublication(A){A.on(On.Muted,(()=>{this.emit(kn.TrackMuted,A)})),A.on(On.Unmuted,(()=>{this.emit(kn.TrackUnmuted,A)}));const t=A;switch(t.track&&(t.track.sid=A.trackSid),this.trackPublications.set(A.trackSid,A),A.kind){case ts.Kind.Audio:this.audioTrackPublications.set(A.trackSid,A);break;case ts.Kind.Video:this.videoTrackPublications.set(A.trackSid,A)}}}class qo extends Zo{constructor(A,t,e,i,n){super(A,t,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=ft.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Ns)},this.handleReconnected=()=>{var A,t;null===(t=null===(A=this.reconnectFuture)||void 0===A?void 0:A.resolve)||void 0===t||t.call(A),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var A,t;this.reconnectFuture&&(this.reconnectFuture.promise.catch((A=>this.log.warn(A.message,this.logContext))),null===(t=null===(A=this.reconnectFuture)||void 0===A?void 0:A.reject)||void 0===t||t.call(A,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=A=>{const{requestId:t,reason:e,message:i}=A,n=this.pendingSignalRequests.get(t);n&&(e!==_e.OK&&n.reject(new Pn(i,e)),this.pendingSignalRequests.delete(t))},this.handleDataPacket=A=>{switch(A.value.case){case"rpcResponse":let t=A.value.value,e=null,i=null;"payload"===t.value.case?e=t.value.value:"error"===t.value.case&&(i=Wr.fromProto(t.value.value)),this.handleIncomingRpcResponse(t.requestId,e,i);break;case"rpcAck":let n=A.value.value;this.handleIncomingRpcAck(n.requestId)}},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((A=>(function(A){var t,e,i;if(!A.participantSid&&!A.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new be({participantIdentity:null!==(t=A.participantIdentity)&&void 0!==t?t:"",participantSid:null!==(e=A.participantSid)&&void 0!==e?e:"",allTracks:null!==(i=A.allowAll)&&void 0!==i&&i,trackSids:A.allowedTrackSids||[]})})(A))))},this.onTrackUnmuted=A=>{this.onTrackMuted(A,A.isUpstreamPaused)},this.onTrackMuted=(A,t)=>{void 0===t&&(t=!0),A.sid?this.engine.updateMuteStatus(A.sid,t):this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),ar(A)))},this.onTrackUpstreamPaused=A=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),ar(A))),this.onTrackMuted(A,!0)},this.onTrackUpstreamResumed=A=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),ar(A))),this.onTrackMuted(A,A.isMuted)},this.onTrackFeatureUpdate=A=>{const t=this.audioTrackPublications.get(A.sid);t?this.engine.client.sendUpdateLocalAudioTrack(t.trackSid,t.getTrackFeatures()):this.log.warn("Could not update local audio track settings, missing publication for track ".concat(A.sid),this.logContext)},this.handleSubscribedQualityUpdate=A=>ii(this,void 0,void 0,(function*(){var t,e,i,n,s,r;if(!(null===(s=this.roomOptions)||void 0===s?void 0:s.dynacast))return;const o=this.videoTrackPublications.get(A.trackSid);if(o)if(A.subscribedCodecs.length>0){if(!o.videoTrack)return;const s=yield o.videoTrack.setPublishingCodecs(A.subscribedCodecs);try{for(var a,c=!0,u=ni(s);!(t=(a=yield u.next()).done);c=!0){n=a.value,c=!1;const A=n;os(A)&&(this.log.debug("publish ".concat(A," for ").concat(o.videoTrack.sid),Object.assign(Object.assign({},this.logContext),ar(o))),yield this.publishAdditionalCodecForTrack(o.videoTrack,A,o.options))}}catch(h){e={error:h}}finally{try{c||t||!(i=u.return)||(yield i.call(u))}finally{if(e)throw e.error}}}else A.subscribedQualities.length>0&&(yield null===(r=o.videoTrack)||void 0===r?void 0:r.setPublishingLayers(A.subscribedQualities));else this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:A.trackSid}))})),this.handleLocalTrackUnpublished=A=>{const t=this.trackPublications.get(A.trackSid);t?this.unpublishTrack(t.track):this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:A.trackSid}))},this.handleTrackEnded=A=>ii(this,void 0,void 0,(function*(){if(A.source===ts.Source.ScreenShare||A.source===ts.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),ar(A))),this.unpublishTrack(A);else if(A.isUserProvided)yield A.mute();else if(Ws(A)||Ys(A))try{if(Fs())try{const t=yield null===navigator||void 0===navigator?void 0:navigator.permissions.query({name:A.source===ts.Source.Camera?"camera":"microphone"});if(t&&"denied"===t.state)throw this.log.warn("user has revoked access to ".concat(A.source),Object.assign(Object.assign({},this.logContext),ar(A))),t.onchange=()=>{"denied"!==t.state&&(A.isMuted||A.restartTrack(),t.onchange=null)},new Error("GetUserMedia Permission denied")}catch(t){}A.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),ar(A))),Ws(A)?yield A.restartTrack({deviceId:"default"}):yield A.restartTrack())}catch(t){this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),ar(A))),yield A.mute()}})),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=e,this.roomOptions=i,this.setupEngine(e),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=n}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==ft.NONE}getTrackPublication(A){const t=super.getTrackPublication(A);if(t)return t}getTrackPublicationByName(A){const t=super.getTrackPublicationByName(A);if(t)return t}setupEngine(A){this.engine=A,this.engine.on(Sn.RemoteMute,((A,t)=>{const e=this.trackPublications.get(A);e&&e.track&&(t?e.mute():e.unmute())})),this.engine.on(Sn.Connected,this.handleReconnected).on(Sn.SignalRestarted,this.handleReconnected).on(Sn.SignalResumed,this.handleReconnected).on(Sn.Restarting,this.handleReconnecting).on(Sn.Resuming,this.handleReconnecting).on(Sn.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(Sn.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(Sn.Disconnected,this.handleDisconnected).on(Sn.SignalRequestResponse,this.handleSignalRequestResponse).on(Sn.DataPacketReceived,this.handleDataPacket)}setMetadata(A){return ii(this,void 0,void 0,(function*(){yield this.requestMetadataUpdate({metadata:A})}))}setName(A){return ii(this,void 0,void 0,(function*(){yield this.requestMetadataUpdate({name:A})}))}setAttributes(A){return ii(this,void 0,void 0,(function*(){yield this.requestMetadataUpdate({attributes:A})}))}requestMetadataUpdate(A){return ii(this,arguments,void 0,(function(A){var t=this;let{metadata:e,name:i,attributes:n}=A;return(function*(){return new Promise(((A,s)=>ii(t,void 0,void 0,(function*(){var t,r;try{let o=!1;const a=yield this.engine.client.sendUpdateLocalMetadata(null!==(t=null!=e?e:this.metadata)&&void 0!==t?t:"",null!==(r=null!=i?i:this.name)&&void 0!==r?r:"",n),c=performance.now();for(this.pendingSignalRequests.set(a,{resolve:A,reject:A=>{s(A),o=!0},values:{name:i,metadata:e,attributes:n}});performance.now()-c<5e3&&!o;){if((!i||this.name===i)&&(!e||this.metadata===e)&&(!n||Object.entries(n).every((A=>{let[t,e]=A;return this.attributes[t]===e||""===e&&!this.attributes[t]}))))return this.pendingSignalRequests.delete(a),void A();yield ws(50)}s(new Pn("Request to update local metadata timed out","TimeoutError"))}catch(o){o instanceof Error&&s(o)}}))))})()}))}setCameraEnabled(A,t,e){return this.setTrackEnabled(ts.Source.Camera,A,t,e)}setMicrophoneEnabled(A,t,e){return this.setTrackEnabled(ts.Source.Microphone,A,t,e)}setScreenShareEnabled(A,t,e){return this.setTrackEnabled(ts.Source.ScreenShare,A,t,e)}setPermissions(A){const t=this.permissions,e=super.setPermissions(A);return e&&t&&this.emit(kn.ParticipantPermissionsChanged,t),e}setE2EEEnabled(A){return ii(this,void 0,void 0,(function*(){this.encryptionType=A?ft.GCM:ft.NONE,yield this.republishAllTracks(void 0,!1)}))}setTrackEnabled(A,t,e,i){return ii(this,void 0,void 0,(function*(){var n,s;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:A,enabled:t})),this.republishPromise&&(yield this.republishPromise);let r=this.getTrackPublication(A);if(t)if(r)yield r.unmute();else{let t;if(this.pendingPublishing.has(A)){const t=yield this.waitForPendingPublicationOfSource(A);return t||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:A})),yield null==t?void 0:t.unmute(),t}this.pendingPublishing.add(A);try{switch(A){case ts.Source.Camera:t=yield this.createTracks({video:null===(n=e)||void 0===n||n});break;case ts.Source.Microphone:t=yield this.createTracks({audio:null===(s=e)||void 0===s||s});break;case ts.Source.ScreenShare:t=yield this.createScreenTracks(Object.assign({},e));break;default:throw new _n(A)}}catch(o){throw null==t||t.forEach((A=>{A.stop()})),o instanceof Error&&this.emit(kn.MediaDevicesError,o),this.pendingPublishing.delete(A),o}try{const A=[];for(const n of t)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),ar(n))),A.push(this.publishTrack(n,i));const e=yield Promise.all(A);[r]=e}catch(o){throw null==t||t.forEach((A=>{A.stop()})),o}finally{this.pendingPublishing.delete(A)}}else if(!(null==r?void 0:r.track)&&this.pendingPublishing.has(A)&&(r=yield this.waitForPendingPublicationOfSource(A),r||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:A}))),r&&r.track)if(A===ts.Source.ScreenShare){r=yield this.unpublishTrack(r.track);const A=this.getTrackPublication(ts.Source.ScreenShareAudio);A&&A.track&&this.unpublishTrack(A.track)}else yield r.mute();return r}))}enableCameraAndMicrophone(){return ii(this,void 0,void 0,(function*(){if(!this.pendingPublishing.has(ts.Source.Camera)&&!this.pendingPublishing.has(ts.Source.Microphone)){this.pendingPublishing.add(ts.Source.Camera),this.pendingPublishing.add(ts.Source.Microphone);try{const A=yield this.createTracks({audio:!0,video:!0});yield Promise.all(A.map((A=>this.publishTrack(A))))}finally{this.pendingPublishing.delete(ts.Source.Camera),this.pendingPublishing.delete(ts.Source.Microphone)}}}))}createTracks(A){return ii(this,void 0,void 0,(function*(){var t,e;null!=A||(A={});const i=Ar(A,null===(t=this.roomOptions)||void 0===t?void 0:t.audioCaptureDefaults,null===(e=this.roomOptions)||void 0===e?void 0:e.videoCaptureDefaults);try{return(yield Wo(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map((A=>(Xs(A)&&(this.microphoneError=void 0,A.setAudioContext(this.audioContext),A.source=ts.Source.Microphone,this.emit(kn.AudioStreamAcquired)),$s(A)&&(this.cameraError=void 0,A.source=ts.Source.Camera),A)))}catch(n){throw n instanceof Error&&(A.audio&&(this.microphoneError=n),A.video&&(this.cameraError=n)),n}}))}createScreenTracks(A){return ii(this,void 0,void 0,(function*(){if(void 0===A&&(A={}),void 0===navigator.mediaDevices.getDisplayMedia)throw new xn("getDisplayMedia not supported");void 0!==A.resolution||(function(){const A=Xn();return"Safari"===(null==A?void 0:A.name)&&A.version.startsWith("17.")})()||(A.resolution=Bs.h1080fps30.resolution);const t=(function(A){var t,e;let i=null===(t=A.video)||void 0===t||t;return A.resolution&&A.resolution.width>0&&A.resolution.height>0&&(i="boolean"==typeof i?{}:i,i=Cs()?Object.assign(Object.assign({},i),{width:{max:A.resolution.width},height:{max:A.resolution.height},frameRate:A.resolution.frameRate}):Object.assign(Object.assign({},i),{width:{ideal:A.resolution.width},height:{ideal:A.resolution.height},frameRate:A.resolution.frameRate})),{audio:null!==(e=A.audio)&&void 0!==e&&e,video:i,controller:A.controller,selfBrowserSurface:A.selfBrowserSurface,surfaceSwitching:A.surfaceSwitching,systemAudio:A.systemAudio,preferCurrentTab:A.preferCurrentTab}})(A),e=yield navigator.mediaDevices.getDisplayMedia(t),i=e.getVideoTracks();if(0===i.length)throw new _n("no video track found");const n=new fo(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});n.source=ts.Source.ScreenShare,A.contentHint&&(n.mediaStreamTrack.contentHint=A.contentHint);const s=[n];if(e.getAudioTracks().length>0){this.emit(kn.AudioStreamAcquired);const A=new eo(e.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});A.source=ts.Source.ScreenShareAudio,s.push(A)}return s}))}publishTrack(A,t){return ii(this,void 0,void 0,(function*(){return this.publishOrRepublishTrack(A,t)}))}publishOrRepublishTrack(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(function*(){var n,s,r,o;let a,c;if(Ws(A)&&A.setAudioContext(e.audioContext),yield null===(n=e.reconnectFuture)||void 0===n?void 0:n.promise,e.republishPromise&&!i&&(yield e.republishPromise),Js(A)&&e.pendingPublishPromises.has(A)&&(yield e.pendingPublishPromises.get(A)),A instanceof MediaStreamTrack)a=A.getConstraints();else{let t;switch(a=A.constraints,A.source){case ts.Source.Microphone:t="audioinput";break;case ts.Source.Camera:t="videoinput"}t&&e.activeDeviceMap.has(t)&&(a=Object.assign(Object.assign({},a),{deviceId:e.activeDeviceMap.get(t)}))}if(A instanceof MediaStreamTrack)switch(A.kind){case"audio":A=new eo(A,a,!0,e.audioContext,{loggerName:e.roomOptions.loggerName,loggerContextCb:()=>e.logContext});break;case"video":A=new fo(A,a,!0,{loggerName:e.roomOptions.loggerName,loggerContextCb:()=>e.logContext});break;default:throw new _n("unsupported MediaStreamTrack kind ".concat(A.kind))}else A.updateLoggerOptions({loggerName:e.roomOptions.loggerName,loggerContextCb:()=>e.logContext});if(e.trackPublications.forEach((t=>{t.track&&t.track===A&&(c=t)})),c)return e.log.warn("track has already been published, skipping",Object.assign(Object.assign({},e.logContext),ar(c))),c;const u="channelCount"in A.mediaStreamTrack.getSettings()&&2===A.mediaStreamTrack.getSettings().channelCount||2===A.mediaStreamTrack.getConstraints().channelCount,h=null!==(s=null==t?void 0:t.forceStereo)&&void 0!==s?s:u;h&&(t||(t={}),void 0===t.dtx&&e.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},e.logContext),ar(A))),void 0===t.red&&e.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),null!==(r=t.dtx)&&void 0!==r||(t.dtx=!1),null!==(o=t.red)&&void 0!==o||(t.red=!1));const l=Object.assign(Object.assign({},e.roomOptions.publishDefaults),t);!(function(){const A=Xn(),t="17.2";if(A)return"Safari"!==A.name&&"iOS"!==A.os||!!("iOS"===A.os&&A.osVersion&&Hs(t,A.osVersion)>=0)||"Safari"===A.name&&Hs(t,A.version)>=0})()&&e.roomOptions.e2ee&&(e.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({},e.logContext)),l.simulcast=!1),l.source&&(A.source=l.source);const d=new Promise(((t,i)=>ii(e,void 0,void 0,(function*(){try{if(this.engine.client.currentState!==pr.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:ar(A)}));const e=()=>ii(this,void 0,void 0,(function*(){try{const e=yield this.publish(A,l,h);t(e)}catch(e){i(e)}}));setTimeout((()=>{this.engine.off(Sn.SignalConnected,e),i(new Gn("publishing rejected as engine not connected within timeout",408))}),15e3),this.engine.once(Sn.SignalConnected,e),this.engine.on(Sn.Closing,(()=>{this.engine.off(Sn.SignalConnected,e),i(new Gn("publishing rejected as engine closed",499))}))}else try{const e=yield this.publish(A,l,h);t(e)}catch(e){i(e)}}catch(e){i(e)}}))));e.pendingPublishPromises.set(A,d);try{return yield d}catch(B){throw B}finally{e.pendingPublishPromises.delete(A)}})()}))}hasPermissionsToPublish(A){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),ar(A))),!1;const{canPublish:t,canPublishSources:e}=this.permissions;return!(!t||0!==e.length&&!e.map((A=>(function(A){switch(A){case At.CAMERA:return ts.Source.Camera;case At.MICROPHONE:return ts.Source.Microphone;case At.SCREEN_SHARE:return ts.Source.ScreenShare;case At.SCREEN_SHARE_AUDIO:return ts.Source.ScreenShareAudio;default:return ts.Source.Unknown}})(A))).includes(A.source))||(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),ar(A))),!1)}publish(A,t,e){return ii(this,void 0,void 0,(function*(){var i,n,s,r,o,a,c,u,h,l;if(!this.hasPermissionsToPublish(A))throw new Gn("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find((t=>Js(A)&&t.source===A.source))&&A.source!==ts.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(A.source),Object.assign(Object.assign({},this.logContext),ar(A))),t.stopMicTrackOnMute&&Xs(A)&&(A.stopOnMute=!0),A.source===ts.Source.ScreenShare&&Qs()&&(t.simulcast=!1),"av1"!==t.videoCodec||(function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(Cs())return!1;const A=RTCRtpSender.getCapabilities("video");let t=!1;if(A)for(const e of A.codecs)if("video/AV1"===e.mimeType){t=!0;break}return t})()||(t.videoCodec=void 0),"vp9"!==t.videoCodec||(function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(Qs())return!1;if(Cs()){const A=Xn();if((null==A?void 0:A.version)&&Hs(A.version,"16")<0)return!1}const A=RTCRtpSender.getCapabilities("video");let t=!1;if(A)for(const e of A.codecs)if("video/VP9"===e.mimeType){t=!0;break}return t})()||(t.videoCodec=void 0),void 0===t.videoCodec&&(t.videoCodec=Rr),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some((A=>t.videoCodec===rr(A.mime)))||(t.videoCodec=rr(this.enabledPublishVideoCodecs[0].mime)));const d=t.videoCodec;A.on(On.Muted,this.onTrackMuted),A.on(On.Unmuted,this.onTrackUnmuted),A.on(On.Ended,this.handleTrackEnded),A.on(On.UpstreamPaused,this.onTrackUpstreamPaused),A.on(On.UpstreamResumed,this.onTrackUpstreamResumed),A.on(On.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const B=new zt({cid:A.mediaStreamTrack.id,name:t.name,type:ts.kindToProto(A.kind),muted:A.isMuted,source:ts.sourceToProto(A.source),disableDtx:!(null===(i=t.dtx)||void 0===i||i),encryption:this.encryptionType,stereo:e,disableRed:this.isE2EEEnabled||!(null===(n=t.red)||void 0===n||n),stream:null==t?void 0:t.stream,backupCodecPolicy:null==t?void 0:t.backupCodecPolicy});let f;if(A.kind===ts.Kind.Video){let e={width:0,height:0};try{e=yield A.waitForDimensions()}catch(v){const t=null!==(r=null===(s=this.roomOptions.videoCaptureDefaults)||void 0===s?void 0:s.resolution)&&void 0!==r?r:ls.h720.resolution;e={width:t.width,height:t.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),ar(A)),{dims:e}))}B.width=e.width,B.height=e.height,Ys(A)&&(vs(d)&&(A.source===ts.Source.ScreenShare&&(t.scalabilityMode="L1T3","contentHint"in A.mediaStreamTrack&&(A.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),ar(A))))),t.scalabilityMode=null!==(o=t.scalabilityMode)&&void 0!==o?o:"L3T3_KEY"),B.simulcastCodecs=[new qt({codec:d,cid:A.mediaStreamTrack.id})],!0===t.backupCodec&&(t.backupCodec={codec:Rr}),t.backupCodec&&d!==t.backupCodec.codec&&B.encryption===ft.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),B.simulcastCodecs.push(new qt({codec:t.backupCodec.codec,cid:""})))),f=co(A.source===ts.Source.ScreenShare,B.width,B.height,t),B.layers=po(B.width,B.height,f,vs(t.videoCodec))}else A.kind===ts.Kind.Audio&&(f=[{maxBitrate:null===(a=t.audioPreset)||void 0===a?void 0:a.maxBitrate,priority:null!==(u=null===(c=t.audioPreset)||void 0===c?void 0:c.priority)&&void 0!==u?u:"high",networkPriority:null!==(l=null===(h=t.audioPreset)||void 0===h?void 0:h.priority)&&void 0!==l?l:"high"}]);if(!this.engine||this.engine.isClosed)throw new Rn("cannot publish track when not connected");const w=()=>ii(this,void 0,void 0,(function*(){var e,i,n;if(!this.engine.pcManager)throw new Rn("pcManager is not ready");if(A.sender=yield this.engine.createSender(A,t,f),Ys(A)&&(null!==(e=t.degradationPreference)&&void 0!==e||(t.degradationPreference=(function(A){return A.source===ts.Source.ScreenShare||A.constraints.height&&Rs(A.constraints.height)>=1080?"maintain-resolution":"balanced"})(A)),A.setDegradationPreference(t.degradationPreference)),f)if(Qs()&&A.kind===ts.Kind.Audio){let t;for(const e of this.engine.pcManager.publisher.getTransceivers())if(e.sender===A.sender){t=e;break}t&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:t,codec:"opus",maxbr:(null===(i=f[0])||void 0===i?void 0:i.maxBitrate)?f[0].maxBitrate/1e3:0})}else A.codec&&vs(A.codec)&&(null===(n=f[0])||void 0===n?void 0:n.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:B.cid,codec:A.codec,maxbr:f[0].maxBitrate/1e3});yield this.engine.negotiate()}));let g;if(this.enabledPublishVideoCodecs.length>0)g=(yield Promise.all([this.engine.addTrack(B),w()]))[0];else{let e;if(g=yield this.engine.addTrack(B),g.codecs.forEach((A=>{void 0===e&&(e=A.mimeType)})),e&&A.kind===ts.Kind.Video){const i=rr(e);i!==d&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),ar(A)),{codec:i})),t.videoCodec=i,f=co(A.source===ts.Source.ScreenShare,B.width,B.height,t))}yield w()}const p=new Yo(A.kind,g,A,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return p.options=t,A.sid=g.sid,this.log.debug("publishing ".concat(A.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:f,trackInfo:g})),Ys(A)?A.startMonitor(this.engine.client):Ws(A)&&A.startMonitor(),this.addTrackPublication(p),this.emit(kn.LocalTrackPublished,p),p}))}get isLocal(){return!0}publishAdditionalCodecForTrack(A,t,e){return ii(this,void 0,void 0,(function*(){var i;if(this.encryptionType!==ft.NONE)return;let n;if(this.trackPublications.forEach((t=>{t.track&&t.track===A&&(n=t)})),!n)throw new _n("track is not published");if(!Ys(A))throw new _n("track is not a video track");const s=Object.assign(Object.assign({},null===(i=this.roomOptions)||void 0===i?void 0:i.publishDefaults),e),r=(function(A,t,e){var i,n,s,r;if(!e.backupCodec||!0===e.backupCodec||e.backupCodec.codec===e.videoCodec)return;t!==e.backupCodec.codec&&qe.warn("requested a different codec than specified as backup",{serverRequested:t,backup:e.backupCodec.codec}),e.videoCodec=t,e.videoEncoding=e.backupCodec.encoding;const o=A.mediaStreamTrack.getSettings(),a=null!==(i=o.width)&&void 0!==i?i:null===(n=A.dimensions)||void 0===n?void 0:n.width,c=null!==(s=o.height)&&void 0!==s?s:null===(r=A.dimensions)||void 0===r?void 0:r.height;return A.source===ts.Source.ScreenShare&&e.simulcast&&(e.simulcast=!1),co(A.source===ts.Source.ScreenShare,a,c,e)})(A,t,s);if(!r)return void this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),ar(A)));const o=A.addSimulcastTrack(t,r);if(!o)return;const a=new zt({cid:o.mediaStreamTrack.id,type:ts.kindToProto(A.kind),muted:A.isMuted,source:ts.sourceToProto(A.source),sid:A.sid,simulcastCodecs:[{codec:s.videoCodec,cid:o.mediaStreamTrack.id}]});if(a.layers=po(a.width,a.height,r),!this.engine||this.engine.isClosed)throw new Rn("cannot publish track when not connected");const c=(yield Promise.all([this.engine.addTrack(a),(()=>ii(this,void 0,void 0,(function*(){yield this.engine.createSimulcastSender(A,o,s,r),yield this.engine.negotiate()})))()]))[0];this.log.debug("published ".concat(t," for track ").concat(A.sid),Object.assign(Object.assign({},this.logContext),{encodings:r,trackInfo:c}))}))}unpublishTrack(A,t){return ii(this,void 0,void 0,(function*(){var e,i;if(Js(A)){const t=this.pendingPublishPromises.get(A);t&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),ar(A))),yield t)}const n=this.getPublicationForTrack(A),s=n?ar(n):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),s)),!n||!n.track)return void this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),s));(A=n.track).off(On.Muted,this.onTrackMuted),A.off(On.Unmuted,this.onTrackUnmuted),A.off(On.Ended,this.handleTrackEnded),A.off(On.UpstreamPaused,this.onTrackUpstreamPaused),A.off(On.UpstreamResumed,this.onTrackUpstreamResumed),A.off(On.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),void 0===t&&(t=null===(i=null===(e=this.roomOptions)||void 0===e?void 0:e.stopLocalTrackOnUnpublish)||void 0===i||i),t?A.stop():A.stopMonitor();let r=!1;const o=A.sender;if(A.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Xr.FAILED&&o)try{for(const A of this.engine.pcManager.publisher.getTransceivers())A.sender===o&&(A.direction="inactive",r=!0);if(this.engine.removeTrack(o)&&(r=!0),Ys(A)){for(const[,t]of A.simulcastCodecs)t.sender&&(this.engine.removeTrack(t.sender)&&(r=!0),t.sender=void 0);A.simulcastCodecs.clear()}}catch(a){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),s),{error:a}))}switch(this.trackPublications.delete(n.trackSid),n.kind){case ts.Kind.Audio:this.audioTrackPublications.delete(n.trackSid);break;case ts.Kind.Video:this.videoTrackPublications.delete(n.trackSid)}return this.emit(kn.LocalTrackUnpublished,n),n.setTrack(void 0),r&&(yield this.engine.negotiate()),n}))}unpublishTracks(A){return ii(this,void 0,void 0,(function*(){return(yield Promise.all(A.map((A=>this.unpublishTrack(A))))).filter((A=>!!A))}))}republishAllTracks(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(function*(){t.republishPromise&&(yield t.republishPromise),t.republishPromise=new Promise(((i,n)=>ii(t,void 0,void 0,(function*(){try{const t=[];this.trackPublications.forEach((e=>{e.track&&(A&&(e.options=Object.assign(Object.assign({},e.options),A)),t.push(e))})),yield Promise.all(t.map((A=>ii(this,void 0,void 0,(function*(){const t=A.track;yield this.unpublishTrack(t,!1),!e||t.isMuted||t.source===ts.Source.ScreenShare||t.source===ts.Source.ScreenShareAudio||!Ws(t)&&!Ys(t)||t.isUserProvided||(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:A.trackSid})),yield t.restartTrack()),yield this.publishOrRepublishTrack(t,A.options,!0)}))))),i()}catch(t){n(t)}finally{this.republishPromise=void 0}})))),yield t.republishPromise})()}))}publishData(A){return ii(this,arguments,void 0,(function(A){var t=this;let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(function*(){const i=e.reliable?mt.RELIABLE:mt.LOSSY,n=e.destinationIdentities,s=e.topic,r=new vt({kind:i,value:{case:"user",value:new Ut({participantIdentity:t.identity,payload:A,destinationIdentities:n,topic:s})}});yield t.engine.sendDataPacket(r,i)})()}))}publishDtmf(A,t){return ii(this,void 0,void 0,(function*(){const e=new vt({kind:mt.RELIABLE,value:{case:"sipDtmf",value:new Ft({code:A,digit:t})}});yield this.engine.sendDataPacket(e,mt.RELIABLE)}))}sendChatMessage(A,t){return ii(this,void 0,void 0,(function*(){const e={id:crypto.randomUUID(),message:A,timestamp:Date.now(),attachedFiles:null==t?void 0:t.attachments},i=new vt({value:{case:"chatMessage",value:new Et(Object.assign(Object.assign({},e),{timestamp:L.parse(e.timestamp)}))}});return yield this.engine.sendDataPacket(i,mt.RELIABLE),this.emit(kn.ChatMessage,e),e}))}editChatMessage(A,t){return ii(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},t),{message:A,editTimestamp:Date.now()}),i=new vt({value:{case:"chatMessage",value:new Et(Object.assign(Object.assign({},e),{timestamp:L.parse(e.timestamp),editTimestamp:L.parse(e.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,mt.RELIABLE),this.emit(kn.ChatMessage,e),e}))}sendText(A,t){return ii(this,void 0,void 0,(function*(){var e;const i=crypto.randomUUID(),n=(new TextEncoder).encode(A).byteLength,s=null===(e=null==t?void 0:t.attachments)||void 0===e?void 0:e.map((()=>crypto.randomUUID())),r=new Array(s?s.length+1:1).fill(0),o=(A,e)=>{var i;r[e]=A;const n=r.reduce(((A,t)=>A+t),0);null===(i=null==t?void 0:t.onProgress)||void 0===i||i.call(t,n)},a=yield this.streamText({streamId:i,totalSize:n,destinationIdentities:null==t?void 0:t.destinationIdentities,topic:null==t?void 0:t.topic,attachedStreamIds:s,attributes:null==t?void 0:t.attributes});return yield a.write(A),o(1,0),yield a.close(),(null==t?void 0:t.attachments)&&s&&(yield Promise.all(t.attachments.map(((A,e)=>ii(this,void 0,void 0,(function*(){return this.bA(s[e],A,{topic:t.topic,mimeType:A.type,onProgress:A=>{o(A,e+1)}})})))))),a.info}))}streamText(A){return ii(this,void 0,void 0,(function*(){var t,e;const i=null!==(t=null==A?void 0:A.streamId)&&void 0!==t?t:crypto.randomUUID(),n={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:null!==(e=null==A?void 0:A.topic)&&void 0!==e?e:"",size:null==A?void 0:A.totalSize,attributes:null==A?void 0:A.attributes},s=new Pt({streamId:i,mimeType:n.mimeType,topic:n.topic,timestamp:Vs(n.timestamp),totalLength:Vs(null==A?void 0:A.totalSize),attributes:n.attributes,contentHeader:{case:"textHeader",value:new jt({version:null==A?void 0:A.version,attachedStreamIds:null==A?void 0:A.attachedStreamIds,replyToStreamId:null==A?void 0:A.replyToStreamId,operationType:"update"===(null==A?void 0:A.type)?Rt.UPDATE:Rt.CREATE})}}),r=null==A?void 0:A.destinationIdentities,o=new vt({destinationIdentities:r,value:{case:"streamHeader",value:s}});yield this.engine.sendDataPacket(o,mt.RELIABLE);let a=0;const c=this,u=new WritableStream({write(A){return ii(this,void 0,void 0,(function*(){for(const t of(function(A){const t=[];let e=(new TextEncoder).encode(A);for(;e.length>15e3;){let A=15e3;for(;A>0;){const t=e[A];if(void 0!==t&&128!=(192&t))break;A--}t.push(e.slice(0,A)),e=e.slice(A)}return e.length>0&&t.push(e),t})(A)){yield c.engine.waitForBufferStatusLow(mt.RELIABLE);const A=new Vt({content:t,streamId:i,chunkIndex:Vs(a)}),e=new vt({destinationIdentities:r,value:{case:"streamChunk",value:A}});yield c.engine.sendDataPacket(e,mt.RELIABLE),a+=1}}))},close(){return ii(this,void 0,void 0,(function*(){const A=new Jt({streamId:i}),t=new vt({destinationIdentities:r,value:{case:"streamTrailer",value:A}});yield c.engine.sendDataPacket(t,mt.RELIABLE)}))},abort(A){console.log("Sink error:",A)}});let h=()=>ii(this,void 0,void 0,(function*(){yield l.close()}));c.engine.once(Sn.Closing,h);const l=new No(u,n,(()=>this.engine.off(Sn.Closing,h)));return l}))}sendFile(A,t){return ii(this,void 0,void 0,(function*(){const e=crypto.randomUUID();return yield this.bA(e,A,t),{id:e}}))}bA(A,t,e){return ii(this,void 0,void 0,(function*(){var i;const n=yield this.streamBytes({streamId:A,totalSize:t.size,name:t.name,mimeType:null!==(i=null==e?void 0:e.mimeType)&&void 0!==i?i:t.type,topic:null==e?void 0:e.topic,destinationIdentities:null==e?void 0:e.destinationIdentities}),s=t.stream().getReader();for(;;){const{done:A,value:t}=yield s.read();if(A)break;yield n.write(t)}return yield n.close(),n.info}))}streamBytes(A){return ii(this,void 0,void 0,(function*(){var t,e,i,n,s;const r=null!==(t=null==A?void 0:A.streamId)&&void 0!==t?t:crypto.randomUUID(),o=null==A?void 0:A.destinationIdentities,a={id:r,mimeType:null!==(e=null==A?void 0:A.mimeType)&&void 0!==e?e:"application/octet-stream",topic:null!==(i=null==A?void 0:A.topic)&&void 0!==i?i:"",timestamp:Date.now(),attributes:null==A?void 0:A.attributes,size:null==A?void 0:A.totalSize,name:null!==(n=null==A?void 0:A.name)&&void 0!==n?n:"unknown"},c=new Pt({totalLength:Vs(null!==(s=a.size)&&void 0!==s?s:0),mimeType:a.mimeType,streamId:r,topic:a.topic,timestamp:Vs(Date.now()),attributes:a.attributes,contentHeader:{case:"byteHeader",value:new Gt({name:a.name})}}),u=new vt({destinationIdentities:o,value:{case:"streamHeader",value:c}});yield this.engine.sendDataPacket(u,mt.RELIABLE);let h=0;const l=new g,d=this.engine,B=this.log,f=new WritableStream({write(A){return ii(this,void 0,void 0,(function*(){const t=yield l.lock();let e=0;try{for(;e<A.byteLength;){const t=A.slice(e,e+15e3);yield d.waitForBufferStatusLow(mt.RELIABLE);const i=new vt({destinationIdentities:o,value:{case:"streamChunk",value:new Vt({content:t,streamId:r,chunkIndex:Vs(h)})}});yield d.sendDataPacket(i,mt.RELIABLE),h+=1,e+=t.byteLength}}finally{t()}}))},close(){return ii(this,void 0,void 0,(function*(){const A=new Jt({streamId:r}),t=new vt({destinationIdentities:o,value:{case:"streamTrailer",value:A}});yield d.sendDataPacket(t,mt.RELIABLE)}))},abort(A){B.error("Sink error:",A)}});return new Ro(f,a)}))}performRpc(A){return ii(this,arguments,void 0,(function(A){var t=this;let{destinationIdentity:e,method:i,payload:n,responseTimeout:s=1e4}=A;return(function*(){return new Promise(((A,r)=>ii(t,void 0,void 0,(function*(){var t,o,a,c;if(Zr(n)>15360)return void r(Wr.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));if((null===(o=null===(t=this.engine.latestJoinResponse)||void 0===t?void 0:t.serverInfo)||void 0===o?void 0:o.version)&&Hs(null===(c=null===(a=this.engine.latestJoinResponse)||void 0===a?void 0:a.serverInfo)||void 0===c?void 0:c.version,"1.8.0")<0)return void r(Wr.builtIn("UNSUPPORTED_SERVER"));const u=crypto.randomUUID();yield this.publishRpcRequest(e,u,i,n,s-2e3);const h=setTimeout((()=>{this.pendingAcks.delete(u),r(Wr.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(u),clearTimeout(l)}),2e3);this.pendingAcks.set(u,{resolve:()=>{clearTimeout(h)},participantIdentity:e});const l=setTimeout((()=>{this.pendingResponses.delete(u),r(Wr.builtIn("RESPONSE_TIMEOUT"))}),s);this.pendingResponses.set(u,{resolve:(t,e)=>{clearTimeout(l),this.pendingAcks.has(u)&&(console.warn("RPC response received before ack",u),this.pendingAcks.delete(u),clearTimeout(h)),e?r(e):A(null!=t?t:"")},participantIdentity:e})}))))})()}))}registerRpcMethod(A,t){this.rpcHandlers.has(A)&&this.log.warn("you're overriding the RPC handler for method ".concat(A,", in the future this will throw an error")),this.rpcHandlers.set(A,t)}unregisterRpcMethod(A){this.rpcHandlers.delete(A)}setTrackSubscriptionPermissions(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=A,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(A){const t=this.pendingAcks.get(A);t?(t.resolve(),this.pendingAcks.delete(A)):console.error("Ack received for unexpected RPC request",A)}handleIncomingRpcResponse(A,t,e){const i=this.pendingResponses.get(A);i?(i.resolve(t,e),this.pendingResponses.delete(A)):console.error("Response received for unexpected RPC request",A)}publishRpcRequest(A,t,e,i,n){return ii(this,void 0,void 0,(function*(){const s=new vt({destinationIdentities:[A],kind:mt.RELIABLE,value:{case:"rpcRequest",value:new It({id:t,method:e,payload:i,responseTimeoutMs:n,version:1})}});yield this.engine.sendDataPacket(s,mt.RELIABLE)}))}handleParticipantDisconnected(A){for(const[t,{participantIdentity:e}]of this.pendingAcks)e===A&&this.pendingAcks.delete(t);for(const[t,{participantIdentity:e,resolve:i}]of this.pendingResponses)e===A&&(i(null,Wr.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(t))}setEnabledPublishCodecs(A){this.enabledPublishVideoCodecs=A.filter((A=>"video"===A.mime.split("/")[0].toLowerCase()))}updateInfo(A){return!!super.updateInfo(A)&&(A.tracks.forEach((A=>{var t,e;const i=this.trackPublications.get(A.sid);if(i){const n=i.isMuted||null!==(e=null===(t=i.track)||void 0===t?void 0:t.isUpstreamPaused)&&void 0!==e&&e;n!==A.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),ar(i)),{mutedOnServer:n})),this.engine.client.sendMuteTrack(A.sid,n))}})),!0)}getPublicationForTrack(A){let t;return this.trackPublications.forEach((e=>{const i=e.track;i&&(A instanceof MediaStreamTrack?(Ws(i)||Ys(i))&&i.mediaStreamTrack===A&&(t=e):A===i&&(t=e))})),t}waitForPendingPublicationOfSource(A){return ii(this,void 0,void 0,(function*(){const t=Date.now();for(;Date.now()<t+1e4;){const t=Array.from(this.pendingPublishPromises.entries()).find((t=>{let[e]=t;return e.source===A}));if(t)return t[1];yield ws(20)}}))}}class zo extends $o{constructor(A,t,e,i){super(A,t.sid,t.name,i),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=zn.HIGH,this.handleEnded=A=>{this.setTrack(void 0),this.emit(On.Ended,A)},this.handleVisibilityChange=A=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(A),this.logContext),this.disabled=!A,this.emitTrackUpdate()},this.handleVideoDimensionsChange=A=>{this.log.debug("adaptivestream video dimensions ".concat(A.width,"x").concat(A.height),this.logContext),this.videoDimensions=A,this.emitTrackUpdate()},this.subscribed=e,this.updateInfo(t)}setSubscribed(A){const t=this.subscriptionStatus,e=this.permissionStatus;this.subscribed=A,A&&(this.allowed=!0);const i=new ae({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new Tt({participantSid:"",trackSids:[this.trackSid]})]});this.emit(On.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(e)}get subscriptionStatus(){return!1===this.subscribed?$o.SubscriptionStatus.Unsubscribed:super.isSubscribed?$o.SubscriptionStatus.Subscribed:$o.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?$o.PermissionStatus.Allowed:$o.PermissionStatus.NotAllowed}get isSubscribed(){return!1!==this.subscribed&&super.isSubscribed}get isDesired(){return!1!==this.subscribed}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(A){this.isManualOperationAllowed()&&this.disabled!==!A&&(this.disabled=!A,this.emitTrackUpdate())}setVideoQuality(A){this.isManualOperationAllowed()&&this.currentVideoQuality!==A&&(this.currentVideoQuality=A,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(A){var t,e;this.isManualOperationAllowed()&&((null===(t=this.videoDimensions)||void 0===t?void 0:t.width)===A.width&&(null===(e=this.videoDimensions)||void 0===e?void 0:e.height)===A.height||(zs(this.track)&&(this.videoDimensions=A),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(A){this.isManualOperationAllowed()&&zs(this.track)&&this.fps!==A&&(this.fps=A,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(A){const t=this.subscriptionStatus,e=this.permissionStatus,i=this.track;i!==A&&(i&&(i.off(On.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(On.VisibilityChanged,this.handleVisibilityChange),i.off(On.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(On.Unsubscribed,i)),super.setTrack(A),A&&(A.sid=this.trackSid,A.on(On.VideoDimensionsChanged,this.handleVideoDimensionsChange),A.on(On.VisibilityChanged,this.handleVisibilityChange),A.on(On.Ended,this.handleEnded),this.emit(On.Subscribed,A)),this.emitPermissionUpdateIfChanged(e),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(A){const t=this.subscriptionStatus,e=this.permissionStatus;this.allowed=A,this.emitPermissionUpdateIfChanged(e),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(A){this.emit(On.SubscriptionFailed,A)}updateInfo(A){super.updateInfo(A);const t=this.metadataMuted;this.metadataMuted=A.muted,this.track?this.track.setMuted(A.muted):t!==A.muted&&this.emit(A.muted?On.Muted:On.Unmuted)}emitSubscriptionUpdateIfChanged(A){const t=this.subscriptionStatus;A!==t&&this.emit(On.SubscriptionStatusChanged,t,A)}emitPermissionUpdateIfChanged(A){this.permissionStatus!==A&&this.emit(On.SubscriptionPermissionChanged,this.permissionStatus,A)}isManualOperationAllowed(){return this.kind===ts.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):!!this.isDesired||(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return zs(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const A=new ce({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(A.width=Math.ceil(this.videoDimensions.width),A.height=Math.ceil(this.videoDimensions.height)):void 0!==this.currentVideoQuality?A.quality=this.currentVideoQuality:A.quality=zn.HIGH,this.emit(On.UpdateSettings,A)}}class Aa extends Zo{static fromParticipantInfo(A,t,e){return new Aa(A,t.sid,t.identity,t.name,t.metadata,t.attributes,e,t.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(A,t,e,i,n,s,r){super(t,e||"",i,n,s,r,arguments.length>7&&void 0!==arguments[7]?arguments[7]:dt.STANDARD),this.signalClient=A,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(A){super.addTrackPublication(A),A.on(On.UpdateSettings,(t=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),ar(A))),this.signalClient.sendUpdateTrackSettings(t)})),A.on(On.UpdateSubscription,(A=>{A.participantTracks.forEach((A=>{A.participantSid=this.sid})),this.signalClient.sendUpdateSubscription(A)})),A.on(On.SubscriptionPermissionChanged,(t=>{this.emit(kn.TrackSubscriptionPermissionChanged,A,t)})),A.on(On.SubscriptionStatusChanged,(t=>{this.emit(kn.TrackSubscriptionStatusChanged,A,t)})),A.on(On.Subscribed,(t=>{this.emit(kn.TrackSubscribed,t,A)})),A.on(On.Unsubscribed,(t=>{this.emit(kn.TrackUnsubscribed,t,A)})),A.on(On.SubscriptionFailed,(t=>{this.emit(kn.TrackSubscriptionFailed,A.trackSid,t)}))}getTrackPublication(A){const t=super.getTrackPublication(A);if(t)return t}getTrackPublicationByName(A){const t=super.getTrackPublicationByName(A);if(t)return t}setVolume(A){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ts.Source.Microphone;this.volumeMap.set(t,A);const e=this.getTrackPublication(t);e&&e.track&&e.track.setVolume(A)}getVolume(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ts.Source.Microphone;const t=this.getTrackPublication(A);return t&&t.track?t.track.getVolume():this.volumeMap.get(A)}addSubscribedMediaTrack(A,t,e,i,n,s){let r,o=this.getTrackPublicationBySid(t);return o||t.startsWith("TR")||this.trackPublications.forEach((t=>{o||A.kind!==t.kind.toString()||(o=t)})),o?"ended"===A.readyState?(this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),ar(o))),void this.emit(kn.TrackSubscriptionFailed,t)):(r="video"===A.kind?new Po(A,t,i,n):new Go(A,t,i,this.audioContext,this.audioOutput),r.source=o.source,r.isMuted=o.isMuted,r.setMediaStream(e),r.start(),o.setTrack(r),this.volumeMap.has(o.source)&&Zs(r)&&Xs(r)&&r.setVolume(this.volumeMap.get(o.source)),o):0===s?(this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:t})),void this.emit(kn.TrackSubscriptionFailed,t)):(void 0===s&&(s=20),void setTimeout((()=>{this.addSubscribedMediaTrack(A,t,e,i,n,s-1)}),150))}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(A){return this.trackPublications.get(A)}updateInfo(A){if(!super.updateInfo(A))return!1;const t=new Map,e=new Map;return A.tracks.forEach((A=>{var i,n;let s=this.getTrackPublicationBySid(A.sid);if(s)s.updateInfo(A);else{const t=ts.kindFromProto(A.type);if(!t)return;s=new zo(t,A,null===(i=this.signalClient.connectOptions)||void 0===i?void 0:i.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:null===(n=this.loggerOptions)||void 0===n?void 0:n.loggerName}),s.updateInfo(A),e.set(A.sid,s);const r=Array.from(this.trackPublications.values()).find((A=>A.source===(null==s?void 0:s.source)));r&&s.source!==ts.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(s.source),Object.assign(Object.assign({},this.logContext),{oldTrack:ar(r),newTrack:ar(s)})),this.addTrackPublication(s)}t.set(A.sid,s)})),this.trackPublications.forEach((A=>{t.has(A.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),ar(A))),this.unpublishTrack(A.trackSid,!0))})),e.forEach((A=>{this.emit(kn.TrackPublished,A)})),!0}unpublishTrack(A,t){const e=this.trackPublications.get(A);if(!e)return;const{track:i}=e;switch(i&&(i.stop(),e.setTrack(void 0)),this.trackPublications.delete(A),e.kind){case ts.Kind.Audio:this.audioTrackPublications.delete(A);break;case ts.Kind.Video:this.videoTrackPublications.delete(A)}t&&this.emit(kn.TrackUnpublished,e)}setAudioOutput(A){return ii(this,void 0,void 0,(function*(){this.audioOutput=A;const t=[];this.audioTrackPublications.forEach((e=>{var i;Xs(e.track)&&Zs(e.track)&&t.push(e.track.setSinkId(null!==(i=A.deviceId)&&void 0!==i?i:"default"))})),yield Promise.all(t)}))}emit(A){for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:A,args:e})),super.emit(A,...e)}}(Ho=ko||(ko={})).Disconnected="disconnected",Ho.Connecting="connecting",Ho.Connected="connected",Ho.Reconnecting="reconnecting",Ho.SignalReconnecting="signalReconnecting";class ta extends oi.EventEmitter{constructor(A){var t,e,i,n;if(super(),t=this,this.state=ko.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=qe,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=(A,t,e)=>ii(this,void 0,void 0,(function*(){var i;if("undefined"==typeof RTCPeerConnection||!gs()&&!ps())throw ys()?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 n=yield this.disconnectLock.lock();if(this.state===ko.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),n(),Promise.resolve();if(this.connectFuture)return n(),this.connectFuture.promise;this.setAndEmitConnectionState(ko.Connecting),(null===(i=this.regionUrlProvider)||void 0===i?void 0:i.getServerUrl().toString())!==A&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),bs(new URL(A))&&(void 0===this.regionUrlProvider?this.regionUrlProvider=new Do(A,t):this.regionUrlProvider.updateToken(t),this.regionUrlProvider.fetchRegionSettings().then((A=>{var t;null===(t=this.regionUrlProvider)||void 0===t||t.setServerReportedRegions(A)})).catch((A=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:A}))})));const s=(i,r,o)=>ii(this,void 0,void 0,(function*(){var a,c;this.abortController&&this.abortController.abort();const u=new AbortController;this.abortController=u,null==n||n();try{yield this.attemptConnection(null!=o?o:A,t,e,u),this.abortController=void 0,i()}catch(h){if(this.regionUrlProvider&&h instanceof Ln&&h.reason!==Qn.Cancelled&&h.reason!==Qn.NotAllowed){let A=null;try{A=yield this.regionUrlProvider.getNextBestRegionUrl(null===(a=this.abortController)||void 0===a?void 0:a.signal)}catch(l){if(l instanceof Ln&&(401===l.status||l.reason===Qn.Cancelled))return this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),void r(l)}A&&!(null===(c=this.abortController)||void 0===c?void 0:c.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(h.message,". Retrying with another region: ").concat(A),this.logContext),this.recreateEngine(),yield s(i,r,A)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Gs(h)),r(h))}else{let A=nt.UNKNOWN_REASON;h instanceof Ln&&(A=Gs(h)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,A),r(h)}}})),r=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Ns(((A,t)=>{s(A,t,r)}),(()=>{this.clearConnectionFutures()})),this.connectFuture.promise})),this.connectSignal=(A,t,e,i,n,s)=>ii(this,void 0,void 0,(function*(){var r,o,a;const c=yield e.join(A,t,{autoSubscribe:i.autoSubscribe,adaptiveStream:"object"==typeof n.adaptiveStream||n.adaptiveStream,maxRetries:i.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:i.websocketTimeout},s.signal);let u=c.serverInfo;if(u||(u={version:c.serverVersion,region:c.serverRegion}),this.serverInfo=u,this.log.debug("connected to Livekit Server ".concat(Object.entries(u).map((A=>{let[t,e]=A;return"".concat(t,": ").concat(e)})).join(", ")),{room:null===(r=c.room)||void 0===r?void 0:r.name,roomSid:null===(o=c.room)||void 0===o?void 0:o.sid,identity:null===(a=c.participant)||void 0===a?void 0:a.identity}),!u.version)throw new Nn("unknown server version");return"0.15.1"===u.version&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),n.dynacast=!1),c})),this.applyJoinResponse=A=>{const t=A.participant;if(this.localParticipant.sid=t.sid,this.localParticipant.identity=t.identity,this.localParticipant.setEnabledPublishCodecs(A.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(A.sifTrailer)}catch(e){this.log.error(e instanceof Error?e.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:e}))}this.handleParticipantUpdates([t,...A.otherParticipants]),A.room&&this.handleRoomUpdate(A.room)},this.attemptConnection=(A,t,e,i)=>ii(this,void 0,void 0,(function*(){var n,s;this.state===ko.Reconnecting||this.isResuming||(null===(n=this.engine)||void 0===n?void 0:n.pendingReconnect)?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),(null===(s=this.regionUrlProvider)||void 0===s?void 0:s.isCloud())&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Jr),e),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const e=yield this.connectSignal(A,t,this.engine,this.connOptions,this.options,i);this.applyJoinResponse(e),this.setupLocalParticipantEvents(),this.emit(En.SignalConnected)}catch(r){yield this.engine.close(),this.recreateEngine();const A=new Ln("could not establish signal connection",Qn.ServerUnreachable);throw r instanceof Error&&(A.message="".concat(A.message,": ").concat(r.message)),r instanceof Ln&&(A.reason=r.reason,A.status=r.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:r})),A}if(i.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ln("Connection attempt aborted",Qn.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,i)}catch(o){throw yield this.engine.close(),this.recreateEngine(),o}Fs()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Fs()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(ko.Connected),this.emit(En.Connected),this.registerConnectionReconcile()})),this.disconnect=function(){for(var A=arguments.length,e=new Array(A),i=0;i<A;i++)e[i]=arguments[i];return ii(t,[...e],void 0,(function(){var A=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(function*(){var e,i,n,s;const r=yield A.disconnectLock.lock();try{if(A.state===ko.Disconnected)return void A.log.debug("already disconnected",A.logContext);A.log.info("disconnect from room",Object.assign({},A.logContext)),(A.state===ko.Connecting||A.state===ko.Reconnecting||A.isResuming)&&(A.log.warn("abort connection attempt",A.logContext),null===(e=A.abortController)||void 0===e||e.abort(),null===(n=null===(i=A.connectFuture)||void 0===i?void 0:i.reject)||void 0===n||n.call(i,new Ln("Client initiated disconnect",Qn.Cancelled)),A.connectFuture=void 0),(null===(s=A.engine)||void 0===s?void 0:s.client.isDisconnected)||(yield A.engine.client.sendLeave()),A.engine&&(yield A.engine.close()),A.handleDisconnect(t,nt.CLIENT_INITIATED),A.engine=void 0}finally{r()}})()}))},this.onPageLeave=()=>ii(this,void 0,void 0,(function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()})),this.startAudio=()=>ii(this,void 0,void 0,(function*(){const A=[],t=Xn();if(t&&"iOS"===t.os){const t="livekit-dummy-audio-el";let e=document.getElementById(t);if(!e){e=document.createElement("audio"),e.id=t,e.autoplay=!0,e.hidden=!0;const A=_s();A.enabled=!0;const i=new MediaStream([A]);e.srcObject=i,document.addEventListener("visibilitychange",(()=>{e&&(e.srcObject=document.hidden?null:i,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))})),document.body.append(e),this.once(En.Disconnected,(()=>{null==e||e.remove(),e=null}))}A.push(e)}this.remoteParticipants.forEach((t=>{t.audioTrackPublications.forEach((t=>{t.track&&t.track.attachedElements.forEach((t=>{A.push(t)}))}))}));try{yield Promise.all([this.acquireAudioContext(),...A.map((A=>(A.muted=!1,A.play())))]),this.handleAudioPlaybackStarted()}catch(e){throw this.handleAudioPlaybackFailed(e),e}})),this.startVideo=()=>ii(this,void 0,void 0,(function*(){const A=[];for(const t of this.remoteParticipants.values())t.videoTrackPublications.forEach((t=>{var e;null===(e=t.track)||void 0===e||e.attachedElements.forEach((t=>{A.includes(t)||A.push(t)}))}));yield Promise.all(A.map((A=>A.play()))).then((()=>{this.handleVideoPlaybackStarted()})).catch((A=>{"NotAllowedError"===A.name?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 A of this.remoteParticipants.values())this.handleParticipantDisconnected(A.identity,A);this.setAndEmitConnectionState(ko.Reconnecting)&&this.emit(En.Reconnecting)},this.handleSignalRestarted=A=>ii(this,void 0,void 0,(function*(){this.log.debug("signal reconnected to server, region ".concat(A.serverRegion),Object.assign(Object.assign({},this.logContext),{region:A.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(A);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(t){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:t}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:A.serverRegion}))}catch(e){return}this.setAndEmitConnectionState(ko.Connected),this.emit(En.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()})),this.handleParticipantUpdates=A=>{A.forEach((A=>{var t;if(A.identity===this.localParticipant.identity)return void this.localParticipant.updateInfo(A);""===A.identity&&(A.identity=null!==(t=this.sidToIdentity.get(A.sid))&&void 0!==t?t:"");let e=this.remoteParticipants.get(A.identity);A.state===lt.DISCONNECTED?this.handleParticipantDisconnected(A.identity,e):e=this.getOrCreateParticipant(A.identity,A)}))},this.handleActiveSpeakersUpdate=A=>{const t=[],e={};A.forEach((A=>{if(e[A.sid]=!0,A.sid===this.localParticipant.sid)this.localParticipant.audioLevel=A.level,this.localParticipant.setIsSpeaking(!0),t.push(this.localParticipant);else{const e=this.getRemoteParticipantBySid(A.sid);e&&(e.audioLevel=A.level,e.setIsSpeaking(!0),t.push(e))}})),e[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach((A=>{e[A.sid]||(A.audioLevel=0,A.setIsSpeaking(!1))})),this.activeSpeakers=t,this.emitWhenConnected(En.ActiveSpeakersChanged,t)},this.handleSpeakersChanged=A=>{const t=new Map;this.activeSpeakers.forEach((A=>{const e=this.remoteParticipants.get(A.identity);e&&e.sid!==A.sid||t.set(A.sid,A)})),A.forEach((A=>{let e=this.getRemoteParticipantBySid(A.sid);A.sid===this.localParticipant.sid&&(e=this.localParticipant),e&&(e.audioLevel=A.level,e.setIsSpeaking(A.active),A.active?t.set(A.sid,e):t.delete(A.sid))}));const e=Array.from(t.values());e.sort(((A,t)=>t.audioLevel-A.audioLevel)),this.activeSpeakers=e,this.emitWhenConnected(En.ActiveSpeakersChanged,e)},this.handleStreamStateUpdate=A=>{A.streamStates.forEach((A=>{const t=this.getRemoteParticipantBySid(A.participantSid);if(!t)return;const e=t.getTrackPublicationBySid(A.trackSid);if(!e||!e.track)return;const i=ts.streamStateFromProto(A.state);i!==e.track.streamState&&(e.track.streamState=i,t.emit(kn.TrackStreamStateChanged,e,e.track.streamState),this.emitWhenConnected(En.TrackStreamStateChanged,e,e.track.streamState,t))}))},this.handleSubscriptionPermissionUpdate=A=>{const t=this.getRemoteParticipantBySid(A.participantSid);if(!t)return;const e=t.getTrackPublicationBySid(A.trackSid);e&&e.setAllowed(A.allowed)},this.handleSubscriptionError=A=>{const t=Array.from(this.remoteParticipants.values()).find((t=>t.trackPublications.has(A.trackSid)));if(!t)return;const e=t.getTrackPublicationBySid(A.trackSid);e&&e.setSubscriptionError(A.err)},this.handleDataPacket=A=>{const t=this.remoteParticipants.get(A.participantIdentity);if("user"===A.value.case)this.handleUserPacket(t,A.value.value,A.kind);else if("transcription"===A.value.case)this.handleTranscription(t,A.value.value);else if("sipDtmf"===A.value.case)this.handleSipDtmf(t,A.value.value);else if("chatMessage"===A.value.case)this.handleChatMessage(t,A.value.value);else if("metrics"===A.value.case)this.handleMetrics(A.value.value,t);else if("streamHeader"===A.value.case)this.handleStreamHeader(A.value.value,A.participantIdentity);else if("streamChunk"===A.value.case)this.handleStreamChunk(A.value.value);else if("streamTrailer"===A.value.case)this.handleStreamTrailer(A.value.value);else if("rpcRequest"===A.value.case){const t=A.value.value;this.handleIncomingRpcRequest(A.participantIdentity,t.id,t.method,t.payload,t.responseTimeoutMs,t.version)}},this.handleUserPacket=(A,t,e)=>{this.emit(En.DataReceived,t.payload,A,e,t.topic),null==A||A.emit(kn.DataReceived,t.payload,e)},this.handleSipDtmf=(A,t)=>{this.emit(En.SipDTMFReceived,t,A),null==A||A.emit(kn.SipDTMFReceived,t)},this.bufferedSegments=new Map,this.handleTranscription=(A,t)=>{const e=t.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(t.transcribedParticipantIdentity),i=null==e?void 0:e.trackPublications.get(t.trackId),n=(function(A,t){return A.segments.map((A=>{let{id:e,text:i,language:n,startTime:s,endTime:r,final:o}=A;var a;const c=null!==(a=t.get(e))&&void 0!==a?a:Date.now(),u=Date.now();return o?t.delete(e):t.set(e,c),{id:e,text:i,startTime:Number.parseInt(s.toString()),endTime:Number.parseInt(r.toString()),final:o,language:n,firstReceivedTime:c,lastReceivedTime:u}}))})(t,this.transcriptionReceivedTimes);null==i||i.emit(On.TranscriptionReceived,n),null==e||e.emit(kn.TranscriptionReceived,n,i),this.emit(En.TranscriptionReceived,n,e,i)},this.handleChatMessage=(A,t)=>{const e=(function(A){const{id:t,timestamp:e,message:i,editTimestamp:n}=A;return{id:t,timestamp:Number.parseInt(e.toString()),editTimestamp:n?Number.parseInt(n.toString()):void 0,message:i}})(t);this.emit(En.ChatMessage,e,A)},this.handleMetrics=(A,t)=>{this.emit(En.MetricsReceived,A,t)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(En.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=A=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:A})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(En.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(En.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(En.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>ii(this,void 0,void 0,(function*(){var A,t,e;const i=lr.getInstance().previousDevices,n=yield lr.getInstance().getDevices(void 0,!1),s=Xn();if("Chrome"===(null==s?void 0:s.name)&&"iOS"!==s.os)for(let o of n){const A=i.find((A=>A.deviceId===o.deviceId));A&&""!==A.label&&A.kind===o.kind&&A.label!==o.label&&"default"===this.getActiveDevice(o.kind)&&this.emit(En.ActiveDeviceChanged,o.kind,o.deviceId)}const r=["audiooutput","audioinput","videoinput"];for(let o of r){const s=nr(o),r=this.localParticipant.getTrackPublication(s);if(r&&(null===(A=r.track)||void 0===A?void 0:A.isUserProvided))continue;const a=n.filter((A=>A.kind===o)),c=this.getActiveDevice(o);c===(null===(t=i.filter((A=>A.kind===o))[0])||void 0===t?void 0:t.deviceId)&&a.length>0&&(null===(e=a[0])||void 0===e?void 0:e.deviceId)!==c?yield this.switchActiveDevice(o,a[0].deviceId):"audioinput"===o&&!Cs()||"videoinput"===o||a.length>0&&!a.find((A=>A.deviceId===this.getActiveDevice(o)))&&(yield this.switchActiveDevice(o,a[0].deviceId))}this.emit(En.MediaDevicesChanged)})),this.handleRoomUpdate=A=>{const t=this.roomInfo;this.roomInfo=A,t&&t.metadata!==A.metadata&&this.emitWhenConnected(En.RoomMetadataChanged,A.metadata),(null==t?void 0:t.activeRecording)!==A.activeRecording&&this.emitWhenConnected(En.RecordingStatusChanged,A.activeRecording)},this.handleConnectionQualityUpdate=A=>{A.updates.forEach((A=>{if(A.participantSid===this.localParticipant.sid)return void this.localParticipant.setConnectionQuality(A.quality);const t=this.getRemoteParticipantBySid(A.participantSid);t&&t.setConnectionQuality(A.quality)}))},this.onLocalParticipantMetadataChanged=A=>{this.emit(En.ParticipantMetadataChanged,A,this.localParticipant)},this.onLocalParticipantNameChanged=A=>{this.emit(En.ParticipantNameChanged,A,this.localParticipant)},this.onLocalAttributesChanged=A=>{this.emit(En.ParticipantAttributesChanged,A,this.localParticipant)},this.onLocalTrackMuted=A=>{this.emit(En.TrackMuted,A,this.localParticipant)},this.onLocalTrackUnmuted=A=>{this.emit(En.TrackUnmuted,A,this.localParticipant)},this.onTrackProcessorUpdate=A=>{var t;null===(t=null==A?void 0:A.onPublish)||void 0===t||t.call(A,this)},this.onLocalTrackPublished=A=>ii(this,void 0,void 0,(function*(){var t,e,i,n,s,r;null===(t=A.track)||void 0===t||t.on(On.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(e=A.track)||void 0===e||e.on(On.Restarted,this.onLocalTrackRestarted),null===(s=null===(n=null===(i=A.track)||void 0===i?void 0:i.getProcessor())||void 0===n?void 0:n.onPublish)||void 0===s||s.call(n,this),this.emit(En.LocalTrackPublished,A,this.localParticipant),Ws(A.track)&&(yield A.track.checkForSilence())&&this.emit(En.LocalAudioSilenceDetected,A);const o=yield null===(r=A.track)||void 0===r?void 0:r.getDeviceId(!1),a=sr(A.source);a&&o&&o!==this.localParticipant.activeDeviceMap.get(a)&&(this.localParticipant.activeDeviceMap.set(a,o),this.emit(En.ActiveDeviceChanged,a,o))})),this.onLocalTrackUnpublished=A=>{var t,e;null===(t=A.track)||void 0===t||t.off(On.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(e=A.track)||void 0===e||e.off(On.Restarted,this.onLocalTrackRestarted),this.emit(En.LocalTrackUnpublished,A,this.localParticipant)},this.onLocalTrackRestarted=A=>ii(this,void 0,void 0,(function*(){const t=yield A.getDeviceId(!1),e=sr(A.source);e&&t&&t!==this.localParticipant.activeDeviceMap.get(e)&&(this.log.debug("local track restarted, setting ".concat(e," ").concat(t," active"),this.logContext),this.localParticipant.activeDeviceMap.set(e,t),this.emit(En.ActiveDeviceChanged,e,t))})),this.onLocalConnectionQualityChanged=A=>{this.emit(En.ConnectionQualityChanged,A,this.localParticipant)},this.onMediaDevicesError=A=>{this.emit(En.MediaDevicesError,A)},this.onLocalParticipantPermissionsChanged=A=>{this.emit(En.ParticipantPermissionsChanged,A,this.localParticipant)},this.onLocalChatMessageSent=A=>{this.emit(En.ChatMessage,A,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},Vr),A),this.log=ze(null!==(e=this.options.loggerName)&&void 0!==e?e:$e.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Gr),null==A?void 0:A.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Pr),null==A?void 0:A.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},jr),null==A?void 0:A.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new g,this.localParticipant=new qo("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Rs(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Rs(this.options.audioCaptureDefaults.deviceId)),(null===(i=this.options.audioOutput)||void 0===i?void 0:i.deviceId)&&this.switchActiveDevice("audiooutput",Rs(this.options.audioOutput.deviceId)).catch((A=>this.log.warn("Could not set audio output: ".concat(A.message),this.logContext))),this.options.e2ee&&this.setupE2EE(),Fs()){const A=new AbortController;null===(n=navigator.mediaDevices)||void 0===n||n.addEventListener("devicechange",this.handleDeviceChange,{signal:A.signal}),ta.cleanupRegistry&&ta.cleanupRegistry.register(this,(()=>{A.abort()}))}}registerTextStreamHandler(A,t){if(this.textStreamHandlers.has(A))throw new TypeError('A text stream handler for topic "'.concat(A,'" has already been set.'));this.textStreamHandlers.set(A,t)}unregisterTextStreamHandler(A){this.textStreamHandlers.delete(A)}registerByteStreamHandler(A,t){if(this.byteStreamHandlers.has(A))throw new TypeError('A byte stream handler for topic "'.concat(A,'" has already been set.'));this.byteStreamHandlers.set(A,t)}unregisterByteStreamHandler(A){this.byteStreamHandlers.delete(A)}registerRpcMethod(A,t){if(this.rpcHandlers.has(A))throw Error("RPC handler already registered for method ".concat(A,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(A,t)}unregisterRpcMethod(A){this.rpcHandlers.delete(A)}handleIncomingRpcRequest(A,t,e,i,n,s){return ii(this,void 0,void 0,(function*(){if(yield this.engine.publishRpcAck(A,t),1!==s)return void(yield this.engine.publishRpcResponse(A,t,null,Wr.builtIn("UNSUPPORTED_VERSION")));const r=this.rpcHandlers.get(e);if(!r)return void(yield this.engine.publishRpcResponse(A,t,null,Wr.builtIn("UNSUPPORTED_METHOD")));let o=null,a=null;try{const s=yield r({requestId:t,callerIdentity:A,payload:i,responseTimeout:n});Zr(s)>15360?(o=Wr.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(e))):a=s}catch(c){c instanceof Wr?o=c:(console.warn("Uncaught error returned by RPC handler for ".concat(e,". Returning APPLICATION_ERROR instead."),c),o=Wr.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(A,t,a,o)}))}setE2EEEnabled(A){return ii(this,void 0,void 0,(function*(){if(!this.e2eeManager)throw Error("e2ee not configured, please set e2ee settings within the room options");yield Promise.all([this.localParticipant.setE2EEEnabled(A)]),""!==this.localParticipant.identity&&this.e2eeManager.setParticipantCryptorEnabled(A,this.localParticipant.identity)}))}setupE2EE(){var A;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new ur(this.options.e2ee),this.e2eeManager.on(pn.ParticipantEncryptionStatusChanged,((A,t)=>{t.isLocal&&(this.isE2EEEnabled=A),this.emit(En.ParticipantEncryptionStatusChanged,A,t)})),this.e2eeManager.on(pn.EncryptionError,(A=>this.emit(En.EncryptionError,A))),null===(A=this.e2eeManager)||void 0===A||A.setup(this))}get logContext(){var A;return{room:this.name,roomID:null===(A=this.roomInfo)||void 0===A?void 0:A.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.activeRecording)&&void 0!==t&&t}getSid(){return ii(this,void 0,void 0,(function*(){return this.state===ko.Disconnected?"":this.roomInfo&&""!==this.roomInfo.sid?this.roomInfo.sid:new Promise(((A,t)=>{const e=t=>{""!==t.sid&&(this.engine.off(Sn.RoomUpdate,e),A(t.sid))};this.engine.on(Sn.RoomUpdate,e),this.once(En.Disconnected,(()=>{this.engine.off(Sn.RoomUpdate,e),t("Room disconnected before room server id was available")}))}))}))}get name(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.name)&&void 0!==t?t:""}get metadata(){var A;return null===(A=this.roomInfo)||void 0===A?void 0:A.metadata}get numParticipants(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.numParticipants)&&void 0!==t?t:0}get numPublishers(){var A,t;return null!==(t=null===(A=this.roomInfo)||void 0===A?void 0:A.numPublishers)&&void 0!==t?t:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Oo(this.options),this.engine.on(Sn.ParticipantUpdate,this.handleParticipantUpdates).on(Sn.RoomUpdate,this.handleRoomUpdate).on(Sn.SpeakersChanged,this.handleSpeakersChanged).on(Sn.StreamStateChanged,this.handleStreamStateUpdate).on(Sn.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(Sn.SubscriptionError,this.handleSubscriptionError).on(Sn.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(Sn.MediaTrackAdded,((A,t,e)=>{this.onTrackAdded(A,t,e)})).on(Sn.Disconnected,(A=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,A)})).on(Sn.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(Sn.DataPacketReceived,this.handleDataPacket).on(Sn.Resuming,(()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(ko.SignalReconnecting)&&this.emit(En.SignalReconnecting)})).on(Sn.Resumed,(()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(ko.Connected)&&this.emit(En.Reconnected)})).on(Sn.SignalResumed,(()=>{this.bufferedEvents=[],(this.state===ko.Reconnecting||this.isResuming)&&this.sendSyncState()})).on(Sn.Restarting,this.handleRestarting).on(Sn.SignalRestarted,this.handleSignalRestarted).on(Sn.Offline,(()=>{this.setAndEmitConnectionState(ko.Reconnecting)&&this.emit(En.Reconnecting)})).on(Sn.DCBufferStatusChanged,((A,t)=>{this.emit(En.DCBufferStatusChanged,A,t)})).on(Sn.LocalTrackSubscribed,(A=>{const t=this.localParticipant.getTrackPublications().find((t=>{let{trackSid:e}=t;return e===A}));t?(this.localParticipant.emit(kn.LocalTrackSubscribed,t),this.emitWhenConnected(En.LocalTrackSubscribed,t,this.localParticipant)):this.log.warn("could not find local track subscription for subscribed event",this.logContext)})).on(Sn.RoomMoved,(A=>{this.log.debug("room moved",A),A.room&&this.handleRoomUpdate(A.room),this.remoteParticipants.forEach(((A,t)=>{this.handleParticipantDisconnected(t,A)})),this.emit(En.Moved,A.room.name,A.token),A.participant?this.handleParticipantUpdates([A.participant,...A.otherParticipants]):this.handleParticipantUpdates(A.otherParticipants)})),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(A){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return lr.getInstance().getDevices(A,t)}prepareConnection(A,t){return ii(this,void 0,void 0,(function*(){if(this.state===ko.Disconnected){this.log.debug("prepareConnection to ".concat(A),this.logContext);try{if(bs(new URL(A))&&t){this.regionUrlProvider=new Do(A,t);const e=yield this.regionUrlProvider.getNextBestRegionUrl();e&&this.state===ko.Disconnected&&(this.regionUrl=e,yield fetch(js(e),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(e),this.logContext))}else yield fetch(js(A),{method:"HEAD"})}catch(e){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:e}))}}}))}getParticipantByIdentity(A){return this.localParticipant.identity===A?this.localParticipant:this.remoteParticipants.get(A)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(A,t){return ii(this,void 0,void 0,(function*(){let e,i=()=>{};switch(A){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":e=new Te({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":e=new Te({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":e=new Te({scenario:{case:"serverLeave",value:!0}});break;case"migration":e=new Te({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=()=>ii(this,void 0,void 0,(function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")})),e=new Te({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>ii(this,void 0,void 0,(function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")})),e=new Te({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":e=new Te({scenario:{case:"switchCandidateProtocol",value:"force-tls"===A?2:1}}),i=()=>ii(this,void 0,void 0,(function*(){const A=this.engine.client.onLeave;A&&A(new le({reason:nt.CLIENT_INITIATED,action:de.RECONNECT}))}));break;case"subscriber-bandwidth":if(void 0===t||"number"!=typeof t)throw new Error("subscriber-bandwidth requires a number as argument");e=new Te({scenario:{case:"subscriberBandwidth",value:Vs(t)}});break;case"leave-full-reconnect":e=new Te({scenario:{case:"leaveRequestFullReconnect",value:!0}})}e&&(yield this.engine.client.sendSimulateScenario(e),yield i())}))}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(A){return this.localParticipant.activeDeviceMap.get(A)}switchActiveDevice(A,t){return ii(this,arguments,void 0,(function(A,t){var e=this;let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(function*(){var n,s,r,o,a,c,u,h;let l=!0,d=!1;const B=i?{exact:t}:t;if("audioinput"===A){d=0===e.localParticipant.audioTrackPublications.size;const t=null!==(n=e.getActiveDevice(A))&&void 0!==n?n:e.options.audioCaptureDefaults.deviceId;e.options.audioCaptureDefaults.deviceId=B;const i=Array.from(e.localParticipant.audioTrackPublications.values()).filter((A=>A.source===ts.Source.Microphone));try{l=(yield Promise.all(i.map((A=>{var t;return null===(t=A.audioTrack)||void 0===t?void 0:t.setDeviceId(B)})))).every((A=>!0===A))}catch(f){throw e.options.audioCaptureDefaults.deviceId=t,f}}else if("videoinput"===A){d=0===e.localParticipant.videoTrackPublications.size;const t=null!==(s=e.getActiveDevice(A))&&void 0!==s?s:e.options.videoCaptureDefaults.deviceId;e.options.videoCaptureDefaults.deviceId=B;const i=Array.from(e.localParticipant.videoTrackPublications.values()).filter((A=>A.source===ts.Source.Camera));try{l=(yield Promise.all(i.map((A=>{var t;return null===(t=A.videoTrack)||void 0===t?void 0:t.setDeviceId(B)})))).every((A=>!0===A))}catch(f){throw e.options.videoCaptureDefaults.deviceId=t,f}}else if("audiooutput"===A){if(!ms()&&!e.options.webAudioMix||e.options.webAudioMix&&e.audioContext&&!("setSinkId"in e.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");e.options.webAudioMix&&(t=null!==(r=yield lr.getInstance().normalizeDeviceId("audiooutput",t))&&void 0!==r?r:""),null!==(o=(h=e.options).audioOutput)&&void 0!==o||(h.audioOutput={});const i=null!==(a=e.getActiveDevice(A))&&void 0!==a?a:e.options.audioOutput.deviceId;e.options.audioOutput.deviceId=t;try{e.options.webAudioMix&&(null===(c=e.audioContext)||void 0===c||c.setSinkId(t)),yield Promise.all(Array.from(e.remoteParticipants.values()).map((A=>A.setAudioOutput({deviceId:t}))))}catch(f){throw e.options.audioOutput.deviceId=i,f}}return(d||"audiooutput"===A)&&(e.localParticipant.activeDeviceMap.set(A,"audiooutput"===A&&(null===(u=e.options.audioOutput)||void 0===u?void 0:u.deviceId)||t),e.emit(En.ActiveDeviceChanged,A,t)),l})()}))}setupLocalParticipantEvents(){this.localParticipant.on(kn.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(kn.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(kn.AttributesChanged,this.onLocalAttributesChanged).on(kn.TrackMuted,this.onLocalTrackMuted).on(kn.TrackUnmuted,this.onLocalTrackUnmuted).on(kn.LocalTrackPublished,this.onLocalTrackPublished).on(kn.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(kn.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(kn.MediaDevicesError,this.onMediaDevicesError).on(kn.AudioStreamAcquired,this.startAudio).on(kn.ChatMessage,this.onLocalChatMessageSent).on(kn.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var A;null===(A=this.engine)||void 0===A||A.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(A,t,e){if(this.state===ko.Connecting||this.state===ko.Reconnecting){const i=()=>{this.onTrackAdded(A,t,e),n()},n=()=>{this.off(En.Reconnected,i),this.off(En.Connected,i),this.off(En.Disconnected,n)};return this.once(En.Reconnected,i),this.once(En.Connected,i),void this.once(En.Disconnected,n)}if(this.state===ko.Disconnected)return void this.log.warn("skipping incoming track after Room disconnected",this.logContext);if("ended"===A.readyState)return void this.log.info("skipping incoming track as it already ended",this.logContext);const i=(function(A){const t=A.split("|");return t.length>1?[t[0],A.substr(t[0].length+1)]:[A,""]})(t.id),n=i[0];let s=i[1],r=A.id;if(s&&s.startsWith("TR")&&(r=s),n===this.localParticipant.sid)return void this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);const o=Array.from(this.remoteParticipants.values()).find((A=>A.sid===n));if(!o)return void this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(n),this.logContext);let a;this.options.adaptiveStream&&(a="object"==typeof this.options.adaptiveStream?this.options.adaptiveStream:{}),o.addSubscribedMediaTrack(A,r,t,e,a)}handleDisconnect(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;var e;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==ko.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach((A=>{A.trackPublications.forEach((t=>{A.unpublishTrack(t.trackSid)}))})),this.localParticipant.trackPublications.forEach((t=>{var e,i,n;t.track&&this.localParticipant.unpublishTrack(t.track,A),A?(null===(e=t.track)||void 0===e||e.detach(),null===(i=t.track)||void 0===i||i.stop()):null===(n=t.track)||void 0===n||n.stopMonitor()})),this.localParticipant.off(kn.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(kn.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(kn.AttributesChanged,this.onLocalAttributesChanged).off(kn.TrackMuted,this.onLocalTrackMuted).off(kn.TrackUnmuted,this.onLocalTrackUnmuted).off(kn.LocalTrackPublished,this.onLocalTrackPublished).off(kn.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(kn.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(kn.MediaDevicesError,this.onMediaDevicesError).off(kn.AudioStreamAcquired,this.startAudio).off(kn.ChatMessage,this.onLocalChatMessageSent).off(kn.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&&"boolean"==typeof this.options.webAudioMix&&(this.audioContext.close(),this.audioContext=void 0),Fs()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),null===(e=navigator.mediaDevices)||void 0===e||e.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(ko.Disconnected),this.emit(En.Disconnected,t)}}}handleParticipantDisconnected(A,t){var e;this.remoteParticipants.delete(A),t&&(t.trackPublications.forEach((A=>{t.unpublishTrack(A.trackSid,!0)})),this.emit(En.ParticipantDisconnected,t),t.setDisconnected(),null===(e=this.localParticipant)||void 0===e||e.handleParticipantDisconnected(t.identity))}handleStreamHeader(A,t){return ii(this,void 0,void 0,(function*(){var e;if("byteHeader"===A.contentHeader.case){const i=this.byteStreamHandlers.get(A.topic);if(!i)return void this.log.debug("ignoring incoming byte stream due to no handler for topic",A.topic);let n;const s={id:A.streamId,name:null!==(e=A.contentHeader.value.name)&&void 0!==e?e:"unknown",mimeType:A.mimeType,size:A.totalLength?Number(A.totalLength):void 0,topic:A.topic,timestamp:Ps(A.timestamp),attributes:A.attributes},r=new ReadableStream({start:t=>{n=t,this.byteStreamControllers.set(A.streamId,{info:s,controller:n,startTime:Date.now()})}});i(new Lo(s,r,Ps(A.totalLength)),{identity:t})}else if("textHeader"===A.contentHeader.case){const e=this.textStreamHandlers.get(A.topic);if(!e)return void this.log.debug("ignoring incoming text stream due to no handler for topic",A.topic);let i;const n={id:A.streamId,mimeType:A.mimeType,size:A.totalLength?Number(A.totalLength):void 0,topic:A.topic,timestamp:Number(A.timestamp),attributes:A.attributes},s=new ReadableStream({start:t=>{i=t,this.textStreamControllers.set(A.streamId,{info:n,controller:i,startTime:Date.now()})}});e(new xo(n,s,Ps(A.totalLength)),{identity:t})}}))}handleStreamChunk(A){const t=this.byteStreamControllers.get(A.streamId);t&&A.content.length>0&&t.controller.enqueue(A);const e=this.textStreamControllers.get(A.streamId);e&&A.content.length>0&&e.controller.enqueue(A)}handleStreamTrailer(A){const t=this.textStreamControllers.get(A.streamId);t&&(t.info.attributes=Object.assign(Object.assign({},t.info.attributes),A.attributes),t.controller.close(),this.textStreamControllers.delete(A.streamId));const e=this.byteStreamControllers.get(A.streamId);e&&(e.info.attributes=Object.assign(Object.assign({},e.info.attributes),A.attributes),e.controller.close(),this.byteStreamControllers.delete(A.streamId))}acquireAudioContext(){return ii(this,void 0,void 0,(function*(){var A,t;if("boolean"!=typeof this.options.webAudioMix&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:this.audioContext&&"closed"!==this.audioContext.state||(this.audioContext=null!==(A=ir())&&void 0!==A?A:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach((A=>A.setAudioContext(this.audioContext))),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&"suspended"===this.audioContext.state)try{yield Promise.race([this.audioContext.resume(),ws(200)])}catch(i){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:i}))}const e="running"===(null===(t=this.audioContext)||void 0===t?void 0:t.state);e!==this.canPlaybackAudio&&(this.audioEnabled=e,this.emit(En.AudioPlaybackStatusChanged,e))}))}createParticipant(A,t){var e;let i;return i=t?Aa.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):new Aa(this.engine.client,"",A,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),(null===(e=this.options.audioOutput)||void 0===e?void 0:e.deviceId)&&i.setAudioOutput(this.options.audioOutput).catch((A=>this.log.warn("Could not set audio output: ".concat(A.message),this.logContext))),i}getOrCreateParticipant(A,t){if(this.remoteParticipants.has(A)){const e=this.remoteParticipants.get(A);return t&&e.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),e}const e=this.createParticipant(A,t);return this.remoteParticipants.set(A,e),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(En.ParticipantConnected,e),e.on(kn.TrackPublished,(A=>{this.emitWhenConnected(En.TrackPublished,A,e)})).on(kn.TrackSubscribed,((A,t)=>{A.kind===ts.Kind.Audio?(A.on(On.AudioPlaybackStarted,this.handleAudioPlaybackStarted),A.on(On.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):A.kind===ts.Kind.Video&&(A.on(On.VideoPlaybackFailed,this.handleVideoPlaybackFailed),A.on(On.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(En.TrackSubscribed,A,t,e)})).on(kn.TrackUnpublished,(A=>{this.emit(En.TrackUnpublished,A,e)})).on(kn.TrackUnsubscribed,((A,t)=>{this.emit(En.TrackUnsubscribed,A,t,e)})).on(kn.TrackMuted,(A=>{this.emitWhenConnected(En.TrackMuted,A,e)})).on(kn.TrackUnmuted,(A=>{this.emitWhenConnected(En.TrackUnmuted,A,e)})).on(kn.ParticipantMetadataChanged,(A=>{this.emitWhenConnected(En.ParticipantMetadataChanged,A,e)})).on(kn.ParticipantNameChanged,(A=>{this.emitWhenConnected(En.ParticipantNameChanged,A,e)})).on(kn.AttributesChanged,(A=>{this.emitWhenConnected(En.ParticipantAttributesChanged,A,e)})).on(kn.ConnectionQualityChanged,(A=>{this.emitWhenConnected(En.ConnectionQualityChanged,A,e)})).on(kn.ParticipantPermissionsChanged,(A=>{this.emitWhenConnected(En.ParticipantPermissionsChanged,A,e)})).on(kn.TrackSubscriptionStatusChanged,((A,t)=>{this.emitWhenConnected(En.TrackSubscriptionStatusChanged,A,t,e)})).on(kn.TrackSubscriptionFailed,((A,t)=>{this.emit(En.TrackSubscriptionFailed,A,e,t)})).on(kn.TrackSubscriptionPermissionChanged,((A,t)=>{this.emitWhenConnected(En.TrackSubscriptionPermissionChanged,A,t,e)})).on(kn.Active,(()=>{this.emitWhenConnected(En.ParticipantActive,e)})),t&&e.updateInfo(t),e}sendSyncState(){const A=Array.from(this.remoteParticipants.values()).reduce(((A,t)=>(A.push(...t.getTrackPublications()),A)),[]),t=this.localParticipant.getTrackPublications();this.engine.sendSyncState(A,t)}updateSubscriptions(){for(const A of this.remoteParticipants.values())for(const t of A.videoTrackPublications.values())t.isSubscribed&&qs(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(A){const t=this.sidToIdentity.get(A);if(t)return this.remoteParticipants.get(t)}registerConnectionReconcile(){this.clearConnectionReconcile();let A=0;this.connectionReconcileInterval=Zn.setInterval((()=>{this.engine&&!this.engine.isClosed&&this.engine.verifyTransport()?A=0:(A++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:A,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),A>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,nt.STATE_MISMATCH)))}),4e3)}clearConnectionReconcile(){this.connectionReconcileInterval&&Zn.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(A){return A!==this.state&&(this.state=A,this.emit(En.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach((A=>{let[t,e]=A;this.emit(t,...e)})),this.bufferedEvents=[]}emitWhenConnected(A){for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];if(this.state===ko.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([A,e]);else if(this.state===ko.Connected)return this.emit(A,...e);return!1}simulateParticipants(A){return ii(this,void 0,void 0,(function*(){var t,e;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},A.publish),n=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},A.participants);if(this.handleDisconnect(),this.roomInfo=new at({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:L.parse((new Date).getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new ht({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(En.SignalConnected),this.emit(En.Connected),this.setAndEmitConnectionState(ko.Connected),i.video){const A=new Yo(ts.Kind.Video,new gt({source:At.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO,name:"video-dummy"}),new fo(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:Ls(160*(null!==(t=n.aspectRatios[0])&&void 0!==t?t:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(A),this.localParticipant.emit(kn.LocalTrackPublished,A)}if(i.audio){const A=new Yo(ts.Kind.Audio,new gt({source:At.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO}),new eo(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:_s(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(A),this.localParticipant.emit(kn.LocalTrackPublished,A)}for(let A=0;A<n.count-1;A+=1){let t=new ht({sid:Math.floor(1e4*Math.random()).toString(),identity:"simulated-".concat(A),state:lt.ACTIVE,tracks:[],joinedAt:L.parse(Date.now())});const i=this.getOrCreateParticipant(t.identity,t);if(n.video){const s=Ls(160*(null!==(e=n.aspectRatios[A%n.aspectRatios.length])&&void 0!==e?e:1),160,!1,!0),r=new gt({source:At.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO});i.addSubscribedMediaTrack(s,r.sid,new MediaStream([s]),new RTCRtpReceiver),t.tracks=[...t.tracks,r]}if(n.audio){const A=_s(),e=new gt({source:At.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:zA.AUDIO});i.addSubscribedMediaTrack(A,e.sid,new MediaStream([A]),new RTCRtpReceiver),t.tracks=[...t.tracks,e]}i.updateInfo(t)}}))}emit(A){for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];if(A!==En.ActiveSpeakersChanged&&A!==En.TranscriptionReceived){const t=ea(e).filter((A=>void 0!==A));this.log.debug("room event ".concat(A),Object.assign(Object.assign({},this.logContext),{event:A,args:t}))}return super.emit(A,...e)}}function ea(A){return A.map((A=>{if(A)return Array.isArray(A)?ea(A):"object"==typeof A?"logContext"in A?A.logContext:void 0:A}))}ta.cleanupRegistry="undefined"!=typeof FinalizationRegistry&&new FinalizationRegistry((A=>{A()})),(To=So||(So={}))[To.IDLE=0]="IDLE",To[To.RUNNING=1]="RUNNING",To[To.SKIPPED=2]="SKIPPED",To[To.SUCCESS=3]="SUCCESS",To[To.FAILED=4]="FAILED",oi.EventEmitter,oi.EventEmitter;const ia=Symbol.for("@ts-pattern/matcher"),na=Symbol.for("@ts-pattern/isVariadic"),sa="@ts-pattern/anonymous-select-key",ra=A=>Boolean(A&&"object"==typeof A),oa=A=>A&&!!A[ia],aa=(A,t,e)=>{if(oa(A)){const i=A[ia](),{matched:n,selections:s}=i.match(t);return n&&s&&Object.keys(s).forEach((A=>e(A,s[A]))),n}if(ra(A)){if(!ra(t))return!1;if(Array.isArray(A)){if(!Array.isArray(t))return!1;let i=[],n=[],s=[];for(const t of A.keys()){const e=A[t];oa(e)&&e[na]?s.push(e):s.length?n.push(e):i.push(e)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<i.length+n.length)return!1;const A=t.slice(0,i.length),r=0===n.length?[]:t.slice(-n.length),o=t.slice(i.length,0===n.length?1/0:-n.length);return i.every(((t,i)=>aa(t,A[i],e)))&&n.every(((A,t)=>aa(A,r[t],e)))&&(0===s.length||aa(s[0],o,e))}return A.length===t.length&&A.every(((A,i)=>aa(A,t[i],e)))}return Reflect.ownKeys(A).every((i=>{const n=A[i];return(i in t||oa(s=n)&&"optional"===s[ia]().matcherType)&&aa(n,t[i],e);var s}))}return Object.is(t,A)},ca=A=>{var t,e,i;return ra(A)?oa(A)?null!=(t=null==(e=(i=A[ia]()).getSelectionKeys)?void 0:e.call(i))?t:[]:Array.isArray(A)?ua(A,ca):ua(Object.values(A),ca):[]},ua=(A,t)=>A.reduce(((A,e)=>A.concat(t(e))),[]);function ha(A){return Object.assign(A,{optional:()=>da(A),and:t=>wa(A,t),or:t=>ga(A,t),select:t=>void 0===t?va(A):va(t,A)})}function la(A){return Object.assign((t=A,Object.assign(t,{[Symbol.iterator](){let A=0;const e=[{value:Object.assign(t,{[na]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var t;return null!=(t=e[A++])?t:e.at(-1)}}}})),{optional:()=>la(da(A)),select:t=>la(void 0===t?va(A):va(t,A))});var t}function da(A){return ha({[ia]:()=>({match:t=>{let e={};const i=(A,t)=>{e[A]=t};return void 0===t?(ca(A).forEach((A=>i(A,void 0))),{matched:!0,selections:e}):{matched:aa(A,t,i),selections:e}},getSelectionKeys:()=>ca(A),matcherType:"optional"})})}const Ba=(A,t)=>{for(const e of A)if(!t(e))return!1;return!0},fa=(A,t)=>{for(const[e,i]of A.entries())if(!t(i,e))return!1;return!0};function wa(...A){return ha({[ia]:()=>({match:t=>{let e={};const i=(A,t)=>{e[A]=t};return{matched:A.every((A=>aa(A,t,i))),selections:e}},getSelectionKeys:()=>ua(A,ca),matcherType:"and"})})}function ga(...A){return ha({[ia]:()=>({match:t=>{let e={};const i=(A,t)=>{e[A]=t};return ua(A,ca).forEach((A=>i(A,void 0))),{matched:A.some((A=>aa(A,t,i))),selections:e}},getSelectionKeys:()=>ua(A,ca),matcherType:"or"})})}function pa(A){return{[ia]:()=>({match:t=>({matched:Boolean(A(t))})})}}function va(...A){const t="string"==typeof A[0]?A[0]:void 0,e=2===A.length?A[1]:"string"==typeof A[0]?void 0:A[0];return ha({[ia]:()=>({match:A=>{let i={[null!=t?t:sa]:A};return{matched:void 0===e||aa(e,A,((A,t)=>{i[A]=t})),selections:i}},getSelectionKeys:()=>[null!=t?t:sa].concat(void 0===e?[]:ca(e))})})}function ma(A){return"number"==typeof A}function Qa(A){return"string"==typeof A}function Ca(A){return"bigint"==typeof A}const Ua=ha(pa((function(A){return!0}))),Fa=Ua,ya=A=>Object.assign(ha(A),{startsWith:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.startsWith(e))))));var e},endsWith:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.endsWith(e))))));var e},minLength:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.length>=e)))));var e},length:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.length===e)))));var e},maxLength:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.length<=e)))));var e},includes:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&A.includes(e))))));var e},regex:t=>{return ya(wa(A,(e=t,pa((A=>Qa(A)&&Boolean(A.match(e)))))));var e}}),ba=ya(pa(Qa)),Ea=A=>Object.assign(ha(A),{between:(t,e)=>{return Ea(wa(A,(i=t,n=e,pa((A=>ma(A)&&i<=A&&n>=A)))));var i,n},lt:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A<e)))));var e},gt:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A>e)))));var e},lte:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A<=e)))));var e},gte:t=>{return Ea(wa(A,(e=t,pa((A=>ma(A)&&A>=e)))));var e},int:()=>Ea(wa(A,pa((A=>ma(A)&&Number.isInteger(A))))),finite:()=>Ea(wa(A,pa((A=>ma(A)&&Number.isFinite(A))))),positive:()=>Ea(wa(A,pa((A=>ma(A)&&A>0)))),negative:()=>Ea(wa(A,pa((A=>ma(A)&&A<0))))}),Ia=Ea(pa(ma)),ka=A=>Object.assign(ha(A),{between:(t,e)=>{return ka(wa(A,(i=t,n=e,pa((A=>Ca(A)&&i<=A&&n>=A)))));var i,n},lt:t=>{return ka(wa(A,(e=t,pa((A=>Ca(A)&&A<e)))));var e},gt:t=>{return ka(wa(A,(e=t,pa((A=>Ca(A)&&A>e)))));var e},lte:t=>{return ka(wa(A,(e=t,pa((A=>Ca(A)&&A<=e)))));var e},gte:t=>{return ka(wa(A,(e=t,pa((A=>Ca(A)&&A>=e)))));var e},positive:()=>ka(wa(A,pa((A=>Ca(A)&&A>0)))),negative:()=>ka(wa(A,pa((A=>Ca(A)&&A<0))))}),Ha=ka(pa(Ca)),Sa=ha(pa((function(A){return"boolean"==typeof A}))),Ta=ha(pa((function(A){return"symbol"==typeof A}))),Oa=ha(pa((function(A){return null==A}))),Ka=ha(pa((function(A){return null!=A})));var Da={__proto__:null,matcher:ia,optional:da,array:function(...A){return la({[ia]:()=>({match:t=>{if(!Array.isArray(t))return{matched:!1};if(0===A.length)return{matched:!0};const e=A[0];let i={};if(0===t.length)return ca(e).forEach((A=>{i[A]=[]})),{matched:!0,selections:i};const n=(A,t)=>{i[A]=(i[A]||[]).concat([t])};return{matched:t.every((A=>aa(e,A,n))),selections:i}},getSelectionKeys:()=>0===A.length?[]:ca(A[0])})})},set:function(...A){return ha({[ia]:()=>({match:t=>{if(!(t instanceof Set))return{matched:!1};let e={};if(0===t.size)return{matched:!0,selections:e};if(0===A.length)return{matched:!0};const i=(A,t)=>{e[A]=(e[A]||[]).concat([t])},n=A[0];return{matched:Ba(t,(A=>aa(n,A,i))),selections:e}},getSelectionKeys:()=>0===A.length?[]:ca(A[0])})})},map:function(...A){return ha({[ia]:()=>({match:t=>{if(!(t instanceof Map))return{matched:!1};let e={};if(0===t.size)return{matched:!0,selections:e};const i=(A,t)=>{e[A]=(e[A]||[]).concat([t])};if(0===A.length)return{matched:!0};var n;if(1===A.length)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null==(n=A[0])?void 0:n.toString()}`);const[s,r]=A;return{matched:fa(t,((A,t)=>{const e=aa(s,t,i),n=aa(r,A,i);return e&&n})),selections:e}},getSelectionKeys:()=>0===A.length?[]:[...ca(A[0]),...ca(A[1])]})})},intersection:wa,union:ga,not:function(A){return ha({[ia]:()=>({match:t=>({matched:!aa(A,t,(()=>{}))}),getSelectionKeys:()=>[],matcherType:"not"})})},when:pa,select:va,any:Ua,EA:Fa,string:ba,number:Ia,bigint:Ha,boolean:Sa,symbol:Ta,nullish:Oa,nonNullable:Ka,instanceOf:function(A){return ha(pa((t=A,A=>A instanceof t)));var t},shape:function(A){return ha(pa((function(...A){if(1===A.length){const[t]=A;return A=>aa(t,A,(()=>{}))}if(2===A.length){const[t,e]=A;return aa(t,e,(()=>{}))}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${A.length}.`)})(A)))}};class Ma extends Error{constructor(A){let t;try{t=JSON.stringify(A)}catch(e){t=A}super(`Pattern matching error: no pattern matches value ${t}`),this.input=void 0,this.input=A}}const La={matched:!1,value:void 0};function xa(A){return new _a(A,La)}let _a=class A{constructor(A,t){this.input=void 0,this.state=void 0,this.input=A,this.state=t}with(...t){if(this.state.matched)return this;const e=t[t.length-1],i=[t[0]];let n;3===t.length&&"function"==typeof t[1]?n=t[1]:t.length>2&&i.push(...t.slice(1,t.length-1));let s=!1,r={};const o=(A,t)=>{s=!0,r[A]=t},a=!i.some((A=>aa(A,this.input,o)))||n&&!Boolean(n(this.input))?La:{matched:!0,value:e(s?sa in r?r[sa]:r:this.input,this.input)};return new A(this.input,a)}when(t,e){if(this.state.matched)return this;const i=Boolean(t(this.input));return new A(this.input,i?{matched:!0,value:e(this.input,this.input)}:La)}otherwise(A){return this.state.matched?this.state.value:A(this.input)}exhaustive(A=Na){return this.state.matched?this.state.value:A(this.input)}run(){return this.exhaustive()}returnType(){return this}};function Na(A){throw new Ma(A)}var Ra,ja;(ja=Ra||(Ra={})).READY="ready",ja.ERROR="error",ja.PAUSED="paused",ja.LOADING="loading",ja.THINKING="thinking",ja.RESEARCHING="researching",ja.AGENT_SPEAKING="agent_speaking",ja.USER_SPEAKING="user_speaking",ja.AWAITING_USER_INPUT="awaiting_user_input";class Ga{constructor({sessionId:A,apiBaseUrl:t}){this.currentState=Ra.READY,this.livekitState="speaking",this.assistantAudioContext=null,this.userAudioContext=null,this.IA=null,this.kA=null,this.sessionId=A,this.apiBaseUrl=t||"https://app.coragents.ai/api",this.client=new u({baseUrl:this.apiBaseUrl}),this.emitter=new d}emit(A,t){this.emitter.emit(A,t)}on(A,t){this.emitter.on(A,t)}off(A,t){this.emitter.off(A,t)}setupRoomEventListeners(){this.room&&(this.room.on(En.LocalTrackUnpublished,(A=>{A.source===ts.Source.ScreenShare&&(this.screenStream=void 0)})),this.room.on(En.Disconnected,(()=>{this.disconnect()})),this.room.on(En.ParticipantDisconnected,(()=>{this.disconnect()})),this.room.on(En.TrackSubscribed,((A,t,e)=>{if("audio"===A.kind&&A.attach(),A.source===ts.Source.Microphone&&e.identity.includes("agent-")){const t=A.mediaStream;if(!t)return void console.error("No media stream available for assistant track");const e=new AudioContext,i=e.createAnalyser();e.createMediaStreamSource(t).connect(i),i.fftSize=2048;const n=new Uint8Array(i.frequencyBinCount);this.analyzeAudio(i,n,"ASSISTANT"),this.assistantAudioContext=e}})),this.room.on(En.ParticipantAttributesChanged,(A=>{if(!A["lk.agent.state"])return;if(this.currentState===Ra.RESEARCHING||this.currentState===Ra.PAUSED)return;const t=A["lk.agent.state"],e=xa(t).with("listening",(()=>Ra.USER_SPEAKING)).with("speaking",(()=>Ra.AGENT_SPEAKING)).with("thinking",(()=>Ra.THINKING)).otherwise((()=>{}));e&&(this.setState(e),this.livekitState=t)})),this.room.on(En.DataReceived,(async A=>{try{const t=JSON.parse((new TextDecoder).decode(A));xa(t.status||t.request).with("using_tool",(()=>{this.currentState=Ra.RESEARCHING,this.emitter.emit("stateChanged",Ra.RESEARCHING)})).with("using_tool_ended",(()=>{this.currentState=Ra.AGENT_SPEAKING,this.emitter.emit("stateChanged",Ra.AGENT_SPEAKING)})).with("share_screen",(()=>{this.shareScreen()})).with("prompt_user",(()=>{this.promptContinue()})).with("capture_page_html",(()=>{this.emitter.emit("capturePageHTML")})).with("fill",(()=>{this.emitter.emit("fill",t.value)})).otherwise((()=>{console.warn("Unknown data received:",t)}))}catch(t){console.error("Error parsing data:",t)}})),this.room.localParticipant.registerRpcMethod("screen_capture",(async A=>(this.emitter.emit("screenCaptureRequested"),new Promise((A=>{this.emitter.once("screenCaptureComplete",(async t=>{if("error"!==t)try{await this.room.localParticipant.sendFile(new File([t],"screen_capture.png",{type:"image/png"}),{mimeType:"image/png",topic:"screen_capture"}),A("ok")}catch(e){A("error")}else A("error")}))}))))))}async connect(){if(!this.sessionId)return console.error("No session ID found"),void this.emitter.emit("error",new Error("No session ID provided"));try{await this.requestMicrophone(),this.room=new ta({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners();const A=await this.client.getJoinToken(this.sessionId,{skipIntro:!0});if(await this.room.connect(A.data.url,A.data.token),this.microphoneStream){const A=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(A,{name:"microphone",source:ts.Source.Microphone})}return{url:A.data.url,token:A.data.token}}catch(A){throw console.error("Failed to connect to LiveKit:",A),this.disconnect(),this.emitter.emit("error",A instanceof Error?A:new Error(String(A))),A}}async disconnect(){this.room&&(this.room.disconnect(!0),this.room.removeAllListeners(),this.room=void 0),this.screenStream?.track&&this.screenStream.track.stop(),this.microphoneStream&&this.microphoneStream.getTracks().forEach((A=>A.stop())),this.kA&&(window.clearTimeout(this.kA),this.kA=null),this.IA&&(window.clearTimeout(this.IA),this.IA=null),await(this.userAudioContext?.close().catch((()=>{}))),this.userAudioContext=null,await(this.assistantAudioContext?.close().catch((()=>{}))),this.assistantAudioContext=null,this.setState(Ra.READY),this.emitter.emit("disconnected")}setState(A){A!==this.currentState&&(this.currentState=A,this.emitter.emit("stateChanged",A))}getCurrentState(){return this.currentState}async requestMicrophone(){try{const A=await navigator.mediaDevices.getUserMedia({audio:!0});this.microphoneStream=A;const t=new AudioContext;this.userAudioContext=t;const e=t.createAnalyser(),i=t.createMediaStreamSource(A),n=t.createGain();n.gain.value=1.5,i.connect(n),n.connect(e),e.fftSize=2048;const s=new Uint8Array(e.frequencyBinCount);this.analyzeAudio(e,s,"USER")}catch(A){throw console.error("Microphone permission denied:",A),new Error("Microphone permission denied")}}async shareScreen(){if(this.room){this.emitter.emit("preScreenShare");try{if(this.screenStream=await this.room.localParticipant.setScreenShareEnabled(!0,{video:{displaySurface:"window"}}),!this.screenStream)return void console.warn("Failed to share screen");await this.room.localParticipant.publishData((new TextEncoder).encode(JSON.stringify({request:"share_screen",success:!0})),{reliable:!0})}catch(A){console.error("Error sharing screen:",A),this.emitter.emit("error",A instanceof Error?A:new Error(String(A)))}}else console.warn("[obi] shareScreen called while not connected")}pauseRecording(){this.room&&(this.setState(Ra.PAUSED),this.room.localParticipant.getTrackPublications().forEach((A=>{A.handleMuted(),A.track?.mediaStream?.getTracks().forEach((A=>A.enabled=!1))})),this.microphoneStream?.getTracks().forEach((A=>A.enabled=!1)),this.screenStream?.track?.mute())}resumeRecording(){if(!this.room)return;const A=xa(this.livekitState).with("listening",(()=>Ra.USER_SPEAKING)).with("speaking",(()=>Ra.AGENT_SPEAKING)).otherwise((()=>Ra.THINKING));this.setState(A),this.room.localParticipant.getTrackPublications().forEach((A=>{A.handleUnmuted(),A.track?.mediaStream?.getTracks().forEach((A=>A.enabled=!0))})),this.microphoneStream?.getTracks().forEach((A=>A.enabled=!0)),this.screenStream?.track?.unmute()}async promptContinue(){await this.room.localParticipant.publishData((new TextEncoder).encode(JSON.stringify({request:"prompt_user",success:!0})),{reliable:!0})}async analyzeAudio(A,t,e){if("USER"===e&&this.currentState===Ra.USER_SPEAKING||"ASSISTANT"===e&&this.currentState===Ra.AGENT_SPEAKING){A.getByteFrequencyData(t);const i=t.reduce(((A,t)=>A+t),0)/t.length,n=Math.max(.01,Math.min(1,i/128));let s;"USER"===e&&this.currentState===Ra.USER_SPEAKING?s="USER":"ASSISTANT"===e&&this.currentState===Ra.AGENT_SPEAKING&&(s="ASSISTANT"),s&&this.emitter.emit("volume",{speaker:s,spectrum:Array.from(t),volume:n})}"USER"===e?this.kA=window.setTimeout((()=>this.analyzeAudio(A,t,e)),200):this.IA=window.setTimeout((()=>this.analyzeAudio(A,t,e)),200)}async sendHTML(A){if(this.room)try{const t={type:"page_content",html:A,timestamp:(new Date).toISOString()},e=JSON.stringify(t),i=(new TextEncoder).encode(e);await this.room.localParticipant.publishData(i,{reliable:!0})}catch(t){console.error("Error sending HTML to LiveKit:",t),this.emitter.emit("error",t instanceof Error?t:new Error(String(t)))}else console.log("Cannot send HTML: Not connected to room")}async reconnect(A,t,e){try{if(!A||!t)return console.error("Missing room URL or token for reconnection"),this.emitter.emit("error",new Error("Missing room URL or token for reconnection")),!1;if(await this.requestMicrophone(),this.room=new ta({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners(),await this.room.connect(A,t),this.microphoneStream){const A=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(A,{name:"microphone",source:ts.Source.Microphone})}return this.setState(e),e===Ra.PAUSED&&this.pauseRecording(),!0}catch(i){return console.error("Failed to reconnect to room:",i),this.disconnect(),this.emitter.emit("error",i instanceof Error?i:new Error(String(i))),!1}}}const Pa="#a10fff";function Va(A){if(A=A.replace(/^#/,""),!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(A))throw new Error(`Invalid hex color format: ${A}`);3===A.length&&(A=A.split("").map((A=>A+A)).join(""));const t=parseInt(A.slice(0,2),16)/255,e=parseInt(A.slice(2,4),16)/255,i=parseInt(A.slice(4,6),16)/255,n=Math.max(t,e,i),s=Math.min(t,e,i);let r,o,a=(n+s)/2;if(n===s)r=o=0;else{const A=n-s;switch(o=a>.5?A/(2-n-s):A/(n+s),n){case t:r=(e-i)/A+(e<i?6:0);break;case e:r=(i-t)/A+2;break;case i:r=(t-e)/A+4;break;default:r=0}r/=6}return{h:360*r,s:100*o,l:100*a}}function Ja(A,t,e){A/=360,e/=100;const i=(A,t,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?A+6*(t-A)*e:e<.5?t:e<2/3?A+(t-A)*(2/3-e)*6:A);let n,s,r;if(0==(t/=100))n=s=r=e;else{const o=e<.5?e*(1+t):e+t-e*t,a=2*e-o;n=i(a,o,A+1/3),s=i(a,o,A),r=i(a,o,A-1/3)}const o=A=>{const t=Math.round(255*A).toString(16);return 1===t.length?"0"+t:t};return`#${o(n)}${o(s)}${o(r)}`}function Xa(A,t){try{const e=Va(Pa),i=Va(t),n=(i.h-e.h+360)%360,s=n>180?n-360:n,r=i.s-e.s,o=i.l-e.l,a=Va(A),c={h:(a.h+s+360)%360,s:Math.max(0,Math.min(100,a.s+r)),l:Math.max(0,Math.min(100,a.l+o))};return Ja(c.h,c.s,c.l)}catch(e){return console.warn("Failed to generate selected color, using fallback:",e),t}}const $a="49206C6F7665204F6269_session";var Ya=function(A,t){return(Ya=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,t){A.__proto__=t}||function(A,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(A[e]=t[e])})(A,t)};function Wa(A,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=A}Ya(A,t),A.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}var Za=function(){return Za=Object.assign||function(A){for(var t,e=1,i=arguments.length;e<i;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(A[n]=t[n]);return A},Za.apply(this,arguments)};function qa(A,t,e,i){return new(e||(e=Promise))((function(n,s){function r(A){try{a(i.next(A))}catch(t){s(t)}}function o(A){try{a(i.throw(A))}catch(t){s(t)}}function a(A){var t;A.done?n(A.value):(t=A.value,t instanceof e?t:new e((function(A){A(t)}))).then(r,o)}a((i=i.apply(A,t||[])).next())}))}function za(A,t){var e,i,n,s,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(a){return(function(o){if(e)throw new TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(r=0)),r;)try{if(e=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,i=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!((n=(n=r.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){r.label=o[1];break}if(6===o[0]&&r.label<n[1]){r.label=n[1],n=o;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(o);break}n[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(A,r)}catch(a){o=[6,a],i=0}finally{e=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}})([o,a])}}}function Ac(A,t,e){if(e||2===arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return A.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;for(var tc=(function(){function A(A,t,e,i){this.left=A,this.top=t,this.width=e,this.height=i}return A.prototype.add=function(t,e,i,n){return new A(this.left+t,this.top+e,this.width+i,this.height+n)},A.fromClientRect=function(t,e){return new A(e.left+t.windowBounds.left,e.top+t.windowBounds.top,e.width,e.height)},A.fromDOMRectList=function(t,e){var i=Array.from(e).find((function(A){return 0!==A.width}));return i?new A(i.left+t.windowBounds.left,i.top+t.windowBounds.top,i.width,i.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A})(),ec=function(A,t){return tc.fromClientRect(A,t.getBoundingClientRect())},ic=function(A){for(var t=[],e=0,i=A.length;e<i;){var n=A.charCodeAt(e++);if(n>=55296&&n<=56319&&e<i){var s=A.charCodeAt(e++);56320==(64512&s)?t.push(((1023&n)<<10)+(1023&s)+65536):(t.push(n),e--)}else t.push(n)}return t},nc=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var e=A.length;if(!e)return"";for(var i=[],n=-1,s="";++n<e;){var r=A[n];r<=65535?i.push(r):(r-=65536,i.push(55296+(r>>10),r%1024+56320)),(n+1===e||i.length>16384)&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return s},sc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),rc=0;rc<64;rc++)sc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(rc)]=rc;for(var oc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ac=0;ac<64;ac++)oc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(ac)]=ac;for(var cc=function(A,t,e){return A.slice?A.slice(t,e):new Uint16Array(Array.prototype.slice.call(A,t,e))},uc=(function(){function A(A,t,e,i,n,s){this.initialValue=A,this.errorValue=t,this.highStart=e,this.highValueIndex=i,this.index=n,this.data=s}return A.prototype.get=function(A){var t;if(A>=0){if(A<55296||A>56319&&A<=65535)return t=((t=this.index[A>>5])<<2)+(31&A),this.data[t];if(A<=65535)return t=((t=this.index[2048+(A-55296>>5)])<<2)+(31&A),this.data[t];if(A<this.highStart)return t=2080+(A>>11),t=this.index[t],t+=A>>5&63,t=((t=this.index[t])<<2)+(31&A),this.data[t];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),hc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),lc=0;lc<64;lc++)hc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(lc)]=lc;var dc,Bc,fc,wc,gc,pc,vc,mc,Qc,Cc,Uc=10,Fc=13,yc=15,bc=17,Ec=18,Ic=19,kc=20,Hc=21,Sc=22,Tc=24,Oc=25,Kc=26,Dc=27,Mc=28,Lc=30,xc=32,_c=33,Nc=34,Rc=35,jc=37,Gc=38,Pc=39,Vc=40,Jc=42,Xc=[9001,65288],$c="\xd7",Yc="\xf7",Wc=(wc=(function(A){var t,e,i,n,s,r=39666,o=0;"="===A[52887]&&(r--,"="===A[52886]&&r--);var a="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(r):new Array(r),c=Array.isArray(a)?a:new Uint8Array(a);for(t=0;t<52888;t+=4)e=oc[A.charCodeAt(t)],i=oc[A.charCodeAt(t+1)],n=oc[A.charCodeAt(t+2)],s=oc[A.charCodeAt(t+3)],c[o++]=e<<2|i>>4,c[o++]=(15&i)<<4|n>>2,c[o++]=(3&n)<<6|63&s;return a})("KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA=="),gc=Array.isArray(wc)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=4)e.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return e})(wc):new Uint32Array(wc),vc=cc(pc=Array.isArray(wc)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=2)e.push(A[i+1]<<8|A[i]);return e})(wc):new Uint16Array(wc),12,gc[4]/2),mc=2===gc[5]?cc(pc,(24+gc[4])/2):(dc=gc,Bc=Math.ceil((24+gc[4])/4),dc.slice?dc.slice(Bc,fc):new Uint32Array(Array.prototype.slice.call(dc,Bc,fc))),new uc(gc[0],gc[1],gc[2],gc[3],vc,mc)),Zc=[Lc,36],qc=[1,2,3,5],zc=[Uc,8],Au=[Dc,Kc],tu=qc.concat(zc),eu=[Gc,Pc,Vc,Nc,Rc],iu=[yc,Fc],nu=function(A,t,e,i){var n=i[e];if(Array.isArray(A)?-1!==A.indexOf(n):A===n)for(var s=e;s<=i.length;){if((a=i[++s])===t)return!0;if(a!==Uc)break}if(n===Uc)for(s=e;s>0;){var r=i[--s];if(Array.isArray(A)?-1!==A.indexOf(r):A===r)for(var o=e;o<=i.length;){var a;if((a=i[++o])===t)return!0;if(a!==Uc)break}if(r!==Uc)break}return!1},su=function(A,t){for(var e=A;e>=0;){var i=t[e];if(i!==Uc)return i;e--}return 0},ru=function(A,t,e,i,n){if(0===e[i])return $c;var s=i-1;if(Array.isArray(n)&&!0===n[s])return $c;var r=s-1,o=s+1,a=t[s],c=r>=0?t[r]:0,u=t[o];if(2===a&&3===u)return $c;if(-1!==qc.indexOf(a))return"!";if(-1!==qc.indexOf(u))return $c;if(-1!==zc.indexOf(u))return $c;if(8===su(s,t))return Yc;if(11===Wc.get(A[s]))return $c;if((a===xc||a===_c)&&11===Wc.get(A[o]))return $c;if(7===a||7===u)return $c;if(9===a)return $c;if(-1===[Uc,Fc,yc].indexOf(a)&&9===u)return $c;if(-1!==[bc,Ec,Ic,Tc,Mc].indexOf(u))return $c;if(su(s,t)===Sc)return $c;if(nu(23,Sc,s,t))return $c;if(nu([bc,Ec],Hc,s,t))return $c;if(nu(12,12,s,t))return $c;if(a===Uc)return Yc;if(23===a||23===u)return $c;if(16===u||16===a)return Yc;if(-1!==[Fc,yc,Hc].indexOf(u)||14===a)return $c;if(36===c&&-1!==iu.indexOf(a))return $c;if(a===Mc&&36===u)return $c;if(u===kc)return $c;if(-1!==Zc.indexOf(u)&&a===Oc||-1!==Zc.indexOf(a)&&u===Oc)return $c;if(a===Dc&&-1!==[jc,xc,_c].indexOf(u)||-1!==[jc,xc,_c].indexOf(a)&&u===Kc)return $c;if(-1!==Zc.indexOf(a)&&-1!==Au.indexOf(u)||-1!==Au.indexOf(a)&&-1!==Zc.indexOf(u))return $c;if(-1!==[Dc,Kc].indexOf(a)&&(u===Oc||-1!==[Sc,yc].indexOf(u)&&t[o+1]===Oc)||-1!==[Sc,yc].indexOf(a)&&u===Oc||a===Oc&&-1!==[Oc,Mc,Tc].indexOf(u))return $c;if(-1!==[Oc,Mc,Tc,bc,Ec].indexOf(u))for(var h=s;h>=0;){if((l=t[h])===Oc)return $c;if(-1===[Mc,Tc].indexOf(l))break;h--}if(-1!==[Dc,Kc].indexOf(u))for(h=-1!==[bc,Ec].indexOf(a)?r:s;h>=0;){var l;if((l=t[h])===Oc)return $c;if(-1===[Mc,Tc].indexOf(l))break;h--}if(Gc===a&&-1!==[Gc,Pc,Nc,Rc].indexOf(u)||-1!==[Pc,Nc].indexOf(a)&&-1!==[Pc,Vc].indexOf(u)||-1!==[Vc,Rc].indexOf(a)&&u===Vc)return $c;if(-1!==eu.indexOf(a)&&-1!==[kc,Kc].indexOf(u)||-1!==eu.indexOf(u)&&a===Dc)return $c;if(-1!==Zc.indexOf(a)&&-1!==Zc.indexOf(u))return $c;if(a===Tc&&-1!==Zc.indexOf(u))return $c;if(-1!==Zc.concat(Oc).indexOf(a)&&u===Sc&&-1===Xc.indexOf(A[o])||-1!==Zc.concat(Oc).indexOf(u)&&a===Ec)return $c;if(41===a&&41===u){for(var d=e[s],B=1;d>0&&41===t[--d];)B++;if(B%2!=0)return $c}return a===xc&&u===_c?$c:Yc},ou=(function(){function A(A,t,e,i){this.codePoints=A,this.required="!"===t,this.start=e,this.end=i}return A.prototype.slice=function(){return nc.apply(void 0,this.codePoints.slice(this.start,this.end))},A})(),au=45,cu=43,uu=-1,hu=function(A){return A>=48&&A<=57},lu=function(A){return hu(A)||A>=65&&A<=70||A>=97&&A<=102},du=function(A){return 10===A||9===A||32===A},Bu=function(A){return(function(A){return(function(A){return A>=97&&A<=122})(A)||(function(A){return A>=65&&A<=90})(A)})(A)||(function(A){return A>=128})(A)||95===A},fu=function(A){return Bu(A)||hu(A)||A===au},wu=function(A){return A>=0&&A<=8||11===A||A>=14&&A<=31||127===A},gu=function(A,t){return 92===A&&10!==t},pu=function(A,t,e){return A===au?Bu(t)||gu(t,e):!!Bu(A)||!(92!==A||!gu(A,t))},vu=function(A,t,e){return A===cu||A===au?!!hu(t)||46===t&&hu(e):hu(46===A?t:A)},mu=function(A){var t=0,e=1;A[t]!==cu&&A[t]!==au||(A[t]===au&&(e=-1),t++);for(var i=[];hu(A[t]);)i.push(A[t++]);var n=i.length?parseInt(nc.apply(void 0,i),10):0;46===A[t]&&t++;for(var s=[];hu(A[t]);)s.push(A[t++]);var r=s.length,o=r?parseInt(nc.apply(void 0,s),10):0;69!==A[t]&&101!==A[t]||t++;var a=1;A[t]!==cu&&A[t]!==au||(A[t]===au&&(a=-1),t++);for(var c=[];hu(A[t]);)c.push(A[t++]);var u=c.length?parseInt(nc.apply(void 0,c),10):0;return e*(n+o*Math.pow(10,-r))*Math.pow(10,a*u)},Qu={type:2},Cu={type:3},Uu={type:4},Fu={type:13},yu={type:8},bu={type:21},Eu={type:9},Iu={type:10},ku={type:11},Hu={type:12},Su={type:14},Tu={type:23},Ou={type:1},Ku={type:25},Du={type:24},Mu={type:26},Lu={type:27},xu={type:28},_u={type:29},Nu={type:31},Ru={type:32},ju=(function(){function A(){this.HA=[]}return A.prototype.write=function(A){this.HA=this.HA.concat(ic(A))},A.prototype.read=function(){for(var A=[],t=this.consumeToken();t!==Ru;)A.push(t),t=this.consumeToken();return A},A.prototype.consumeToken=function(){var A=this.consumeCodePoint();switch(A){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),e=this.peekCodePoint(1),i=this.peekCodePoint(2);if(fu(t)||gu(e,i)){var n=pu(t,e,i)?2:1;return{type:5,value:this.consumeName(),flags:n}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Fu;break;case 39:return this.consumeStringToken(39);case 40:return Qu;case 41:return Cu;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Su;break;case cu:if(vu(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case 44:return Uu;case au:var s=A,r=this.peekCodePoint(0),o=this.peekCodePoint(1);if(vu(s,r,o))return this.reconsumeCodePoint(A),this.consumeNumericToken();if(pu(s,r,o))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();if(r===au&&62===o)return this.consumeCodePoint(),this.consumeCodePoint(),Du;break;case 46:if(vu(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var a=this.consumeCodePoint();if(42===a&&47===(a=this.consumeCodePoint()))return this.consumeToken();if(a===uu)return this.consumeToken()}break;case 58:return Mu;case 59:return Lu;case 60:if(33===this.peekCodePoint(0)&&this.peekCodePoint(1)===au&&this.peekCodePoint(2)===au)return this.consumeCodePoint(),this.consumeCodePoint(),Ku;break;case 64:var c=this.peekCodePoint(0),u=this.peekCodePoint(1),h=this.peekCodePoint(2);if(pu(c,u,h))return{type:7,value:this.consumeName()};break;case 91:return xu;case 92:if(gu(A,this.peekCodePoint(0)))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();break;case 93:return _u;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),yu;break;case 123:return ku;case 125:return Hu;case 117:case 85:var l=this.peekCodePoint(0),d=this.peekCodePoint(1);return l!==cu||!lu(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(A),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Eu;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),bu;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Iu;break;case uu:return Ru}return du(A)?(this.consumeWhiteSpace(),Nu):hu(A)?(this.reconsumeCodePoint(A),this.consumeNumericToken()):Bu(A)?(this.reconsumeCodePoint(A),this.consumeIdentLikeToken()):{type:6,value:nc(A)}},A.prototype.consumeCodePoint=function(){var A=this.HA.shift();return void 0===A?-1:A},A.prototype.reconsumeCodePoint=function(A){this.HA.unshift(A)},A.prototype.peekCodePoint=function(A){return A>=this.HA.length?-1:this.HA[A]},A.prototype.consumeUnicodeRangeToken=function(){for(var A=[],t=this.consumeCodePoint();lu(t)&&A.length<6;)A.push(t),t=this.consumeCodePoint();for(var e=!1;63===t&&A.length<6;)A.push(t),t=this.consumeCodePoint(),e=!0;if(e)return{type:30,start:parseInt(nc.apply(void 0,A.map((function(A){return 63===A?48:A}))),16),end:parseInt(nc.apply(void 0,A.map((function(A){return 63===A?70:A}))),16)};var i=parseInt(nc.apply(void 0,A),16);if(this.peekCodePoint(0)===au&&lu(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var n=[];lu(t)&&n.length<6;)n.push(t),t=this.consumeCodePoint();return{type:30,start:i,end:parseInt(nc.apply(void 0,n),16)}}return{type:30,start:i,end:i}},A.prototype.consumeIdentLikeToken=function(){var A=this.consumeName();return"url"===A.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:A}):{type:20,value:A}},A.prototype.consumeUrlToken=function(){var A=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===uu)return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var e=this.consumeStringToken(this.consumeCodePoint());return 0===e.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===uu||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:e.value}):(this.consumeBadUrlRemnants(),Tu)}for(;;){var i=this.consumeCodePoint();if(i===uu||41===i)return{type:22,value:nc.apply(void 0,A)};if(du(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===uu||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:nc.apply(void 0,A)}):(this.consumeBadUrlRemnants(),Tu);if(34===i||39===i||40===i||wu(i))return this.consumeBadUrlRemnants(),Tu;if(92===i){if(!gu(i,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),Tu;A.push(this.consumeEscapedCodePoint())}else A.push(i)}},A.prototype.consumeWhiteSpace=function(){for(;du(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var A=this.consumeCodePoint();if(41===A||A===uu)return;gu(A,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(A){for(var t="";A>0;){var e=Math.min(5e4,A);t+=nc.apply(void 0,this.HA.splice(0,e)),A-=e}return this.HA.shift(),t},A.prototype.consumeStringToken=function(A){for(var t="",e=0;;){var i=this.HA[e];if(i===uu||void 0===i||i===A)return{type:0,value:t+=this.consumeStringSlice(e)};if(10===i)return this.HA.splice(0,e),Ou;if(92===i){var n=this.HA[e+1];n!==uu&&void 0!==n&&(10===n?(t+=this.consumeStringSlice(e),e=-1,this.HA.shift()):gu(i,n)&&(t+=this.consumeStringSlice(e),t+=nc(this.consumeEscapedCodePoint()),e=-1))}e++}},A.prototype.consumeNumber=function(){var A=[],t=4,e=this.peekCodePoint(0);for(e!==cu&&e!==au||A.push(this.consumeCodePoint());hu(this.peekCodePoint(0));)A.push(this.consumeCodePoint());e=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(46===e&&hu(i))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;hu(this.peekCodePoint(0));)A.push(this.consumeCodePoint());e=this.peekCodePoint(0),i=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((69===e||101===e)&&((i===cu||i===au)&&hu(n)||hu(i)))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;hu(this.peekCodePoint(0));)A.push(this.consumeCodePoint());return[mu(A),t]},A.prototype.consumeNumericToken=function(){var A=this.consumeNumber(),t=A[0],e=A[1],i=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);return pu(i,n,s)?{type:15,number:t,flags:e,unit:this.consumeName()}:37===i?(this.consumeCodePoint(),{type:16,number:t,flags:e}):{type:17,number:t,flags:e}},A.prototype.consumeEscapedCodePoint=function(){var A=this.consumeCodePoint();if(lu(A)){for(var t=nc(A);lu(this.peekCodePoint(0))&&t.length<6;)t+=nc(this.consumeCodePoint());du(this.peekCodePoint(0))&&this.consumeCodePoint();var e=parseInt(t,16);return 0===e||(function(A){return A>=55296&&A<=57343})(e)||e>1114111?65533:e}return A===uu?65533:A},A.prototype.consumeName=function(){for(var A="";;){var t=this.consumeCodePoint();if(fu(t))A+=nc(t);else{if(!gu(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),A;A+=nc(this.consumeEscapedCodePoint())}}},A})(),Gu=(function(){function A(A){this.SA=A}return A.create=function(t){var e=new ju;return e.write(t),new A(e.read())},A.parseValue=function(t){return A.create(t).parseComponentValue()},A.parseValues=function(t){return A.create(t).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var A=this.consumeToken();31===A.type;)A=this.consumeToken();if(32===A.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(A);var t=this.consumeComponentValue();do{A=this.consumeToken()}while(31===A.type);if(32===A.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var A=[];;){var t=this.consumeComponentValue();if(32===t.type)return A;A.push(t),A.push()}},A.prototype.consumeComponentValue=function(){var A=this.consumeToken();switch(A.type){case 11:case 28:case 2:return this.consumeSimpleBlock(A.type);case 19:return this.consumeFunction(A)}return A},A.prototype.consumeSimpleBlock=function(A){for(var t={type:A,values:[]},e=this.consumeToken();;){if(32===e.type||qu(e,A))return t;this.reconsumeToken(e),t.values.push(this.consumeComponentValue()),e=this.consumeToken()}},A.prototype.consumeFunction=function(A){for(var t={name:A.value,values:[],type:18};;){var e=this.consumeToken();if(32===e.type||3===e.type)return t;this.reconsumeToken(e),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var A=this.SA.shift();return void 0===A?Ru:A},A.prototype.reconsumeToken=function(A){this.SA.unshift(A)},A})(),Pu=function(A){return 15===A.type},Vu=function(A){return 17===A.type},Ju=function(A){return 20===A.type},Xu=function(A){return 0===A.type},$u=function(A,t){return Ju(A)&&A.value===t},Yu=function(A){return 31!==A.type},Wu=function(A){return 31!==A.type&&4!==A.type},Zu=function(A){var t=[],e=[];return A.forEach((function(A){if(4===A.type){if(0===e.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(e),void(e=[])}31!==A.type&&e.push(A)})),e.length&&t.push(e),t},qu=function(A,t){return 11===t&&12===A.type||28===t&&29===A.type||2===t&&3===A.type},zu=function(A){return 17===A.type||15===A.type},Ah=function(A){return 16===A.type||zu(A)},th=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},eh={type:17,number:0,flags:4},ih={type:16,number:50,flags:4},nh={type:16,number:100,flags:4},sh=function(A,t,e){var i=A[0],n=A[1];return[rh(i,t),rh(void 0!==n?n:i,e)]},rh=function(A,t){if(16===A.type)return A.number/100*t;if(Pu(A))switch(A.unit){case"rem":case"em":return 16*A.number;default:return A.number}return A.number},oh="grad",ah="turn",ch=function(A,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case oh:return Math.PI/200*t.number;case"rad":return t.number;case ah:return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},uh=function(A){return 15===A.type&&("deg"===A.unit||A.unit===oh||"rad"===A.unit||A.unit===ah)},hh=function(A){switch(A.filter(Ju).map((function(A){return A.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[eh,eh];case"to top":case"bottom":return lh(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[eh,nh];case"to right":case"left":return lh(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[nh,nh];case"to bottom":case"top":return lh(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[nh,eh];case"to left":case"right":return lh(270)}return 0},lh=function(A){return Math.PI*A/180},dh=function(A){return!(255&A)},Bh=function(A){var t=255&A,e=255&A>>8,i=255&A>>16,n=255&A>>24;return t<255?"rgba(".concat(n,",").concat(i,",").concat(e,",").concat(t/255,")"):"rgb(".concat(n,",").concat(i,",").concat(e,")")},fh=function(A,t,e,i){return(A<<24|t<<16|e<<8|Math.round(255*i))>>>0},wh=function(A,t){if(17===A.type)return A.number;if(16===A.type){var e=3===t?1:255;return 3===t?A.number/100*e:Math.round(A.number/100*e)}return 0},gh=function(A){return"from"===(20===A[0].type?A[0].value:"unknown")},ph=function(A,t,e){return Math.min(Math.max(A,t),e)},vh=function(A,t){return[A[0]*t[0]+A[1]*t[1]+A[2]*t[2],A[3]*t[0]+A[4]*t[1]+A[5]*t[2],A[6]*t[0]+A[7]*t[1]+A[8]*t[2]]},mh=function(A){var t=A[0],e=A[1],i=A[2],n=A[3],s=xh([t,e,i]);return fh(ph(Math.round(255*s[0]),0,255),ph(Math.round(255*s[1]),0,255),ph(Math.round(255*s[2]),0,255),n)},Qh=function(A){var t=Mh([A[0],A[1],A[2]]);return mh([t[0],t[1],t[2],A[3]])},Ch=function(A,t){var e=t.filter(Wu),i=e[0],n=e[1],s=e[2],r=e[3];return[(17===i.type?lh(i.number):ch(0,i))/(2*Math.PI),Ah(n)?n.number/100:0,Ah(s)?s.number/100:0,void 0!==r&&Ah(r)?rh(r,1):1]},Uh=function(A,t){if(gh(t))throw new Error("Relative color not supported for hsl()");var e=Ch(0,t),i=e[0],n=e[1],s=e[2],r=e[3],o=Hh([i,n,s]);return fh(255*o[0],255*o[1],255*o[2],0===n?1:r)},Fh=function(A){var t=A.filter(Wu);return[Ah(t[0])?t[0].number:0,Ah(t[1])?t[1].number:0,Vu(t[2])||Pu(t[2])?t[2].number:0,void 0!==t[4]&&Ah(t[4])?rh(t[4],1):1]},yh=function(A){var t=A.filter(Wu);return[16===t[0].type?t[0].number/100:Vu(t[0])?t[0].number:0,16===t[1].type?t[1].number/100:Vu(t[1])?t[1].number:0,Vu(t[2])||Pu(t[2])?t[2].number:0,void 0!==t[4]&&Ah(t[4])?rh(t[4],1):1]},bh=function(A){var t=A.filter(Wu);return[16===t[0].type?t[0].number/100:Vu(t[0])?t[0].number:0,16===t[1].type?t[1].number/100:Vu(t[1])?t[1].number:0,Vu(t[2])||Pu(t[2])?t[2].number:0,void 0!==t[4]&&Ah(t[4])?rh(t[4],1):1]},Eh=function(A){return vh([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],A)},Ih=function(A){return vh([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],A)},kh=function(A,t,e){return e<0&&(e+=1),e>=1&&(e-=1),e<1/6?(t-A)*e*6+A:e<.5?t:e<2/3?6*(t-A)*(2/3-e)+A:A},Hh=function(A){var t=A[0],e=A[1],i=A[2];if(0===e)return[255*i,255*i,255*i];var n=i<=.5?i*(e+1):i+e-i*e,s=2*i-n;return[kh(s,n,t+1/3),kh(s,n,t),kh(s,n,t-1/3)]},Sh=function(A){var t=A[0],e=A[1],i=A[2];return e<0&&(e=0),isNaN(i)&&(i=0),[t,e*Math.cos(i*Math.PI/180),e*Math.sin(i*Math.PI/180)]},Th=function(A){var t=vh([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],A).map((function(A){return Math.pow(A,3)}));return vh([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],t)},Oh=function(A){var t=(A[0]+16)/116,e=A[1]/500+t,i=t-A[2]/200,n=24389/27,s=24/116,r=[.3457*(e>s?Math.pow(e,3):(116*e-16)/n)/.3585,A[0]>8?Math.pow(t,3):A[0]/n,.2958*(i>s?Math.pow(i,3):(116*i-16)/n)/.3585];return Ih([r[0],r[1],r[2]])},Kh=function(A){return A},Dh=function(A){return Qh([A[0],A[1],A[2],A[3]])},Mh=function(A){return vh([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],A)},Lh=function(A){return vh([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],A)},xh=function(A){return A.map((function(A){var t=A<0?-1:1,e=Math.abs(A);return e>.0031308?t*(1.055*Math.pow(e,1/2.4)-.055):12.92*A}))},_h=function(A){return A.map((function(A){var t=A<0?-1:1,e=Math.abs(A);return e<=.04045?A/12.92:t*Math.pow((e+.055)/1.055,2.4)}))},Nh=1.09929682680944,Rh=.018053968510807,jh=function(A,t){if(18===t.type){var e=$h[t.name];if(void 0===e)throw new Error('Attempting to parse an unsupported color function "'.concat(t.name,'"'));return e(A,t.values)}if(5===t.type){var i=Gh(t),n=i[0],s=i[1],r=i[2],o=i[3];return fh(n,s,r,o)}if(20===t.type){var a=Wh[t.value.toUpperCase()];if(void 0!==a)return a}return Wh.TRANSPARENT},Gh=function(A){if(3===A.value.length){var t=A.value.substring(0,1),e=A.value.substring(1,2),i=A.value.substring(2,3);return[parseInt(t+t,16),parseInt(e+e,16),parseInt(i+i,16),1]}if(4===A.value.length){t=A.value.substring(0,1),e=A.value.substring(1,2),i=A.value.substring(2,3);var n=A.value.substring(3,4);return[parseInt(t+t,16),parseInt(e+e,16),parseInt(i+i,16),parseInt(n+n,16)/255]}return 6===A.value.length?(t=A.value.substring(0,2),e=A.value.substring(2,4),i=A.value.substring(4,6),[parseInt(t,16),parseInt(e,16),parseInt(i,16),1]):8===A.value.length?(t=A.value.substring(0,2),e=A.value.substring(2,4),i=A.value.substring(4,6),n=A.value.substring(6,8),[parseInt(t,16),parseInt(e,16),parseInt(i,16),parseInt(n,16)/255]):[0,0,0,1]},Ph=function(A,t){var e=t.filter(Wu);if(gh(e))throw new Error("Relative color not supported for rgb()");if(3===e.length){var i=e.map(wh),n=i[0],s=i[1],r=i[2];return fh(n,s,r,1)}if(4===e.length){var o=e.map(wh),a=(n=o[0],s=o[1],r=o[2],o[3]);return fh(n,s,r,a)}return 0},Vh={srgb:function(A){return fh(ph(Math.round(255*A[0]),0,255),ph(Math.round(255*A[1]),0,255),ph(Math.round(255*A[2]),0,255),ph(A[3],0,1))},"srgb-linear":mh,"display-p3":function(A){var t=(function(A){var t,e=[A[0],A[1],A[2]].map((function(A){var t=A<0?-1:1;return A*t<=.04045?A/12.92:t*Math.pow((A+.055)/1.055,2.4)||0}));return t=[e[0],e[1],e[2]],vh([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],t)})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])},"a98-rgb":function(A){var t,e,i=Mh((t=[(e=[A[0],A[1],A[2]].map((function(A){var t=A<0?-1:1,e=Math.abs(A);return t*Math.pow(e,563/256)})))[0],e[1],e[2]],vh([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],t)));return mh([i[0],i[1],i[2],A[3]])},"prophoto-rgb":function(A){var t=(function(A){var t,e=[A[0],A[1],A[2]].map((function(A){return A<16/512?A/16:Math.pow(A,1.8)}));return Ih((t=[e[0],e[1],e[2]],vh([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],t)))})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])},xyz:Dh,"xyz-d50":function(A){var t=(function(A){return Ih([A[0],A[1],A[2]])})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])},"xyz-d65":Dh,rec2020:function(A){var t=(function(A){var t,e=[A[0],A[1],A[2]].map((function(A){return A<4.5*Rh?A/4.5:Math.pow((A+Nh-1)/Nh,1/.45)}));return t=[e[0],e[1],e[2]],vh([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],t)})([A[0],A[1],A[2]]);return Qh([t[0],t[1],t[2],A[3]])}},Jh={rgb:function(A,t){var e=t.filter(Wu);if(3===e.length){var i=e.map(wh),n=i[0],s=i[1],r=i[2],o=_h([n/255,s/255,r/255]),a=Lh([o[0],o[1],o[2]]);return[a[0],a[1],a[2],1]}if(4===e.length){var c=e.map(wh),u=(n=c[0],s=c[1],r=c[2],c[3]),h=(o=_h([n/255,s/255,r/255]),Lh([o[0],o[1],o[2]]));return[h[0],h[1],h[2],u]}return[0,0,0,1]},hsl:function(A,t){var e=Ch(0,t),i=e[0],n=e[1],s=e[2],r=e[3],o=_h(Hh([i,n,s])),a=Lh([o[0],o[1],o[2]]);return[a[0],a[1],a[2],r]},lab:function(A,t){var e=yh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=Oh([i,n,s]);return[o[0],o[1],o[2],r]},lch:function(A,t){var e=Fh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=Oh(Sh([i,n,s]));return[o[0],o[1],o[2],r]},oklab:function(A,t){var e=yh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=Th([i,n,s]);return[o[0],o[1],o[2],r]},oklch:function(A,t){var e=bh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=Th(Sh([i,n,s]));return[o[0],o[1],o[2],r]}},Xh={srgb:function(A){var t=xh(Mh([A[0],A[1],A[2]]));return[t[0],t[1],t[2],A[3]]},"srgb-linear":function(A){var t=Mh([A[0],A[1],A[2]]),e=t[0],i=t[1],n=t[2];return[ph(Math.round(255*e),0,255),ph(Math.round(255*i),0,255),ph(Math.round(255*n),0,255),A[3]]},"display-p3":function(A){var t,e,i=(e=[A[0],A[1],A[2]],t=vh([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],e),xh(t));return[i[0],i[1],i[2],A[3]]},"a98-rgb":function(A){var t,e,i=(e=[A[0],A[1],A[2]],[(t=vh([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],e).map((function(A){var t=A<0?-1:1,e=Math.abs(A);return t*Math.pow(e,256/563)})))[0],t[1],t[2]]);return[i[0],i[1],i[2],A[3]]},"prophoto-rgb":function(A){var t,e=(t=Eh([A[0],A[1],A[2]]),vh([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],t).map((function(A){return A>1/512?Math.pow(A,1/1.8):16*A})));return[e[0],e[1],e[2],A[3]]},xyz:Kh,"xyz-d50":function(A){var t=Eh([A[0],A[2],A[3]]);return[t[0],t[1],t[2],A[3]]},"xyz-d65":Kh,rec2020:function(A){var t,e=(t=[A[0],A[1],A[2]],vh([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],t).map((function(A){return A>=Rh?Nh*Math.pow(A,.45)-(Nh-1):4.5*A})));return[e[0],e[1],e[2],A[3]]}},$h={hsl:Uh,hsla:Uh,rgb:Ph,rgba:Ph,lch:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for lch()");var e=Fh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=xh(Mh(Oh(Sh([i,n,s]))));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),r)},oklch:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for oklch()");var e=bh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=xh(Mh(Th(Sh([i,n,s]))));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),r)},oklab:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for oklab()");var e=yh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=xh(Mh(Th([i,n,s])));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),r)},lab:function(A,t){if(gh(t.filter(Wu)))throw new Error("Relative color not supported for lab()");var e=yh(t),i=e[0],n=e[1],s=e[2],r=e[3],o=xh(Mh(Oh([i,n,s])));return fh(ph(Math.round(255*o[0]),0,255),ph(Math.round(255*o[1]),0,255),ph(Math.round(255*o[2]),0,255),r)},color:function(A,t){var e=t.filter(Wu),i=20===e[0].type?e[0].value:"unknown";if(!gh(e)){var n=Vh[i];if(void 0===n)throw new Error('Attempting to parse an unsupported color space "'.concat(i,'" for color() function'));return n([w=Vu(e[1])?e[1].number:0,g=Vu(e[2])?e[2].number:0,p=Vu(e[3])?e[3].number:0,v=e.length>4&&6===e[4].type&&"/"===e[4].value&&Vu(e[5])?e[5].number:1])}var s=function(A,t){if(Vu(t))return t.number;var e;if(Ju(t))return A["r"===(e=t.value)||"x"===e?0:"g"===e||"y"===e?1:2];var i=function(A){for(var t="(",e=0,n=A.filter(Wu);e<n.length;e++){var s=n[e];t+=18===s.type&&"calc"===s.name?i(s.values):Vu(s)?s.number:6===s.type||Ju(s)?s.value:""}return t+")"};if(18===t.type){var n=t.values.filter(Wu);if("calc"===t.name){var s=i(n).replace(/r|x/,A[0].toString()).replace(/g|y/,A[1].toString()).replace(/b|z/,A[2].toString());return new Function("return "+s)()}}return null},r=18===e[1].type?e[1].name:Ju(e[1])||5===e[1].type?"rgb":"unknown",o=Ju(e[2])?e[2].value:"unknown",a=18===e[1].type?e[1].values:Ju(e[1])?[e[1]]:[];if(Ju(e[1])){if(void 0===Wh[e[1].value.toUpperCase()])throw new Error("Attempting to use unknown color in relative color 'from'");var c=Yh(A,e[1].value);a=[{type:17,number:255&c>>24,flags:1},{type:17,number:255&c>>16,flags:1},{type:17,number:255&c>>8,flags:1},{type:17,number:(u=255&c)>1?u/255:u,flags:1}]}else if(5===e[1].type){var u,h=Gh(e[1]);a=[{type:17,number:h[0],flags:1},{type:17,number:h[1],flags:1},{type:17,number:h[2],flags:1},{type:17,number:(u=h[3])>1?u/255:u,flags:1}]}if(0===a.length)throw new Error("Attempting to use unknown color in relative color 'from'");if("unknown"===o)throw new Error("Attempting to use unknown colorspace in relative color 'to'");var l=Jh[r],d=Xh[o],B=Vh[o];if(void 0===l)throw new Error('Attempting to parse an unsupported color space "'.concat(r,'" for color() function'));if(void 0===d)throw new Error('Attempting to parse an unsupported color space "'.concat(o,'" for color() function'));var f=d(l(A,a)),w=s(f,e[3]),g=s(f,e[4]),p=s(f,e[5]),v=e.length>6&&6===e[6].type&&"/"===e[6].value&&Vu(e[7])?e[7].number:1;if(null===w||null===g||null===p)throw new Error("Invalid relative color in color() function");return B([w,g,p,v])}},Yh=function(A,t){return jh(A,Gu.create(t).parseComponentValue())},Wh={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Zh={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,t){return t.map((function(A){if(Ju(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},qh={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},zh=function(A,t){var e=jh(A,t[0]),i=t[1];return i&&Ah(i)?{color:e,stop:i}:{color:e,stop:null}},Al=function(A,t){var e=A[0],i=A[A.length-1];null===e.stop&&(e.stop=eh),null===i.stop&&(i.stop=nh);for(var n=[],s=0,r=0;r<A.length;r++){var o=A[r].stop;if(null!==o){var a=rh(o,t);a>s?n.push(a):n.push(s),s=a}else n.push(null)}var c=null;for(r=0;r<n.length;r++){var u=n[r];if(null===u)null===c&&(c=r);else if(null!==c){for(var h=r-c,l=(u-n[c-1])/(h+1),d=1;d<=h;d++)n[c+d-1]=l*d;c=null}}return A.map((function(A,e){return{color:A.color,stop:Math.max(Math.min(1,n[e]/t),0)}}))},tl=function(A,t){return Math.sqrt(A*A+t*t)},el=function(A,t,e,i,n){return[[0,0],[0,t],[A,0],[A,t]].reduce((function(A,t){var s=t[0],r=t[1],o=tl(e-s,i-r);return(n?o<A.optimumDistance:o>A.optimumDistance)?{optimumCorner:t,optimumDistance:o}:A}),{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},il=function(A,t){var e=lh(180),i=[];return Zu(t).forEach((function(t,n){if(0===n){var s=t[0];if(20===s.type&&-1!==["top","left","right","bottom"].indexOf(s.value))return void(e=hh(t));if(uh(s))return void(e=(ch(0,s)+lh(270))%lh(360))}var r=zh(A,t);i.push(r)})),{angle:e,stops:i,type:1}},nl="closest-side",sl="farthest-side",rl="closest-corner",ol="farthest-corner",al="circle",cl="ellipse",ul="cover",hl="contain",ll=function(A,t){var e=0,i=3,n=[],s=[];return Zu(t).forEach((function(t,r){var o=!0;if(0===r?o=t.reduce((function(A,t){if(Ju(t))switch(t.value){case"center":return s.push(ih),!1;case"top":case"left":return s.push(eh),!1;case"right":case"bottom":return s.push(nh),!1}else if(Ah(t)||zu(t))return s.push(t),!1;return A}),o):1===r&&(o=t.reduce((function(A,t){if(Ju(t))switch(t.value){case al:return e=0,!1;case cl:return e=1,!1;case hl:case nl:return i=0,!1;case sl:return i=1,!1;case rl:return i=2,!1;case ul:case ol:return i=3,!1}else if(zu(t)||Ah(t))return Array.isArray(i)||(i=[]),i.push(t),!1;return A}),o)),o){var a=zh(A,t);n.push(a)}})),{size:i,shape:e,stops:n,position:s,type:2}},dl=function(A,t){if(22===t.type){var e={url:t.value,type:0};return A.cache.addImage(t.value),e}if(18===t.type){var i=Bl[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported image function "'.concat(t.name,'"'));return i(A,t.values)}throw new Error("Unsupported image type ".concat(t.type))},Bl={"linear-gradient":function(A,t){var e=lh(180),i=[];return Zu(t).forEach((function(t,n){if(0===n){var s=t[0];if(20===s.type&&"to"===s.value)return void(e=hh(t));if(uh(s))return void(e=ch(0,s))}var r=zh(A,t);i.push(r)})),{angle:e,stops:i,type:1}},"-moz-linear-gradient":il,"-ms-linear-gradient":il,"-o-linear-gradient":il,"-webkit-linear-gradient":il,"radial-gradient":function(A,t){var e=0,i=3,n=[],s=[];return Zu(t).forEach((function(t,r){var o=!0;if(0===r){var a=!1;o=t.reduce((function(A,t){if(a)if(Ju(t))switch(t.value){case"center":return s.push(ih),A;case"top":case"left":return s.push(eh),A;case"right":case"bottom":return s.push(nh),A}else(Ah(t)||zu(t))&&s.push(t);else if(Ju(t))switch(t.value){case al:return e=0,!1;case cl:return e=1,!1;case"at":return a=!0,!1;case nl:return i=0,!1;case ul:case sl:return i=1,!1;case hl:case rl:return i=2,!1;case ol:return i=3,!1}else if(zu(t)||Ah(t))return Array.isArray(i)||(i=[]),i.push(t),!1;return A}),o)}if(o){var c=zh(A,t);n.push(c)}})),{size:i,shape:e,stops:n,position:s,type:2}},"-moz-radial-gradient":ll,"-ms-radial-gradient":ll,"-o-radial-gradient":ll,"-webkit-radial-gradient":ll,"-webkit-gradient":function(A,t){var e=lh(180),i=[],n=1;return Zu(t).forEach((function(t,e){var s=t[0];if(0===e){if(Ju(s)&&"linear"===s.value)return void(n=1);if(Ju(s)&&"radial"===s.value)return void(n=2)}if(18===s.type)if("from"===s.name){var r=jh(A,s.values[0]);i.push({stop:eh,color:r})}else if("to"===s.name)r=jh(A,s.values[0]),i.push({stop:nh,color:r});else if("color-stop"===s.name){var o=s.values.filter(Wu);if(2===o.length){r=jh(A,o[1]);var a=o[0];Vu(a)&&i.push({stop:{type:16,number:100*a.number,flags:a.flags},color:r})}}})),1===n?{angle:(e+lh(180))%lh(360),stops:i,type:n}:{size:3,shape:0,stops:i,position:[],type:n}}},fl={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,t){if(0===t.length)return[];var e=t[0];return 20===e.type&&"none"===e.value?[]:t.filter((function(A){return Wu(A)&&(function(A){return!(20===A.type&&"none"===A.value||18===A.type&&!Bl[A.name])})(A)})).map((function(t){return dl(A,t)}))}},wl={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,t){return t.map((function(A){if(Ju(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},gl={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,t){return Zu(t).map((function(A){return A.filter(Ah)})).map(th)}},pl={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,t){return Zu(t).map((function(A){return A.filter(Ju).map((function(A){return A.value})).join(" ")})).map(vl)}},vl=function(A){switch(A){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};(Cc=Qc||(Qc={})).AUTO="auto",Cc.CONTAIN="contain",Cc.COVER="cover";var ml,Ql,Cl={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,t){return Zu(t).map((function(A){return A.filter(Ul)}))}},Ul=function(A){return Ju(A)||Ah(A)},Fl=function(A){return{name:"border-".concat(A,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},yl=Fl("top"),bl=Fl("right"),El=Fl("bottom"),Il=Fl("left"),kl=function(A){return{name:"border-radius-".concat(A),initialValue:"0 0",prefix:!1,type:1,parse:function(A,t){return th(t.filter(Ah))}}},Hl=kl("top-left"),Sl=kl("top-right"),Tl=kl("bottom-right"),Ol=kl("bottom-left"),Kl=function(A){return{name:"border-".concat(A,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(A,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Dl=Kl("top"),Ml=Kl("right"),Ll=Kl("bottom"),xl=Kl("left"),_l=function(A){return{name:"border-".concat(A,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(A,t){return Pu(t)?t.number:0}}},Nl=_l("top"),Rl=_l("right"),jl=_l("bottom"),Gl=_l("left"),Pl={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vl={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,t){return"rtl"===t?1:0}},Jl={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).reduce((function(A,t){return A|Xl(t.value)}),0)}},Xl=function(A){switch(A){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},$l={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Yl={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};(Ql=ml||(ml={})).NORMAL="normal",Ql.STRICT="strict";var Wl,Zl,ql={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){return"strict"===t?ml.STRICT:ml.NORMAL}},zl={name:"line-height",initialValue:"normal",prefix:!1,type:4},Ad=function(A,t){return Ju(A)&&"normal"===A.value?1.2*t:17===A.type?t*A.number:Ah(A)?rh(A,t):t},td={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,t){return 20===t.type&&"none"===t.value?null:dl(A,t)}},ed={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,t){return"inside"===t?0:1}},id={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},nd=function(A){return{name:"margin-".concat(A),initialValue:"0",prefix:!1,type:4}},sd=nd("top"),rd=nd("right"),od=nd("bottom"),ad=nd("left"),cd={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).map((function(A){switch(A.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},ud={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){return"break-word"===t?"break-word":"normal"}},hd=function(A){return{name:"padding-".concat(A),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},ld=hd("top"),dd=hd("right"),Bd=hd("bottom"),fd=hd("left"),wd={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},gd={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},pd={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,t){return 1===t.length&&$u(t[0],"none")?[]:Zu(t).map((function(t){for(var e={color:Wh.TRANSPARENT,offsetX:eh,offsetY:eh,blur:eh},i=0,n=0;n<t.length;n++){var s=t[n];zu(s)?(0===i?e.offsetX=s:1===i?e.offsetY=s:e.blur=s,i++):e.color=jh(A,s)}return e}))}},vd={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},md={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,t){if(20===t.type&&"none"===t.value)return null;if(18===t.type){var e=Qd[t.name];if(void 0===e)throw new Error('Attempting to parse an unsupported transform function "'.concat(t.name,'"'));return e(t.values)}return null}},Qd={matrix:function(A){var t=A.filter((function(A){return 17===A.type})).map((function(A){return A.number}));return 6===t.length?t:null},matrix3d:function(A){var t=A.filter((function(A){return 17===A.type})).map((function(A){return A.number})),e=t[0],i=t[1];t[2],t[3];var n=t[4],s=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var r=t[12],o=t[13];return t[14],t[15],16===t.length?[e,i,n,s,r,o]:null}},Cd={type:16,number:50,flags:4},Ud=[Cd,Cd],Fd={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,t){var e=t.filter(Ah);return 2!==e.length?Ud:[e[0],e[1]]}},yd={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,t){switch(t){case"hidden":return 1;case"collapse":return 2;default:return 0}}};(Zl=Wl||(Wl={})).NORMAL="normal",Zl.BREAK_ALL="break-all",Zl.KEEP_ALL="keep-all";for(var bd={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){switch(t){case"break-all":return Wl.BREAK_ALL;case"keep-all":return Wl.KEEP_ALL;default:return Wl.NORMAL}}},Ed={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,t){if(20===t.type)return{auto:!0,order:0};if(Vu(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},Id=function(A,t){if(15===t.type)switch(t.unit.toLowerCase()){case"s":return 1e3*t.number;case"ms":return t.number}throw new Error("Unsupported time type")},kd={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,t){return Vu(t)?t.number:1}},Hd={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Sd={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).map((function(A){switch(A.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0})).filter((function(A){return 0!==A}))}},Td={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,t){var e=[],i=[];return t.forEach((function(A){switch(A.type){case 20:case 0:e.push(A.value);break;case 17:e.push(A.number.toString());break;case 4:i.push(e.join(" ")),e.length=0}})),e.length&&i.push(e.join(" ")),i.map((function(A){return-1===A.indexOf(" ")?A:"'".concat(A,"'")}))}},Od={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Kd={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,t){return Vu(t)?t.number:Ju(t)&&"bold"===t.value?700:400}},Dd={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,t){return t.filter(Ju).map((function(A){return A.value}))}},Md={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,t){switch(t){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Ld=function(A,t){return 0!==(A&t)},xd={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,t){if(0===t.length)return[];var e=t[0];return 20===e.type&&"none"===e.value?[]:t}},_d={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,t){if(0===t.length)return null;var e=t[0];if(20===e.type&&"none"===e.value)return null;for(var i=[],n=t.filter(Yu),s=0;s<n.length;s++){var r=n[s],o=n[s+1];if(20===r.type){var a=o&&Vu(o)?o.number:1;i.push({counter:r.value,increment:a})}}return i}},Nd={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,t){if(0===t.length)return[];for(var e=[],i=t.filter(Yu),n=0;n<i.length;n++){var s=i[n],r=i[n+1];if(Ju(s)&&"none"!==s.value){var o=r&&Vu(r)?r.number:0;e.push({counter:s.value,reset:o})}}return e}},Rd={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,t){return t.filter(Pu).map((function(A){return Id(0,A)}))}},jd={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,t){if(0===t.length)return null;var e=t[0];if(20===e.type&&"none"===e.value)return null;var i=[],n=t.filter(Xu);if(n.length%2!=0)return null;for(var s=0;s<n.length;s+=2){var r=n[s].value,o=n[s+1].value;i.push({open:r,close:o})}return i}},Gd=function(A,t,e){if(!A)return"";var i=A[Math.min(t,A.length-1)];return i?e?i.open:i.close:""},Pd={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,t){return 1===t.length&&$u(t[0],"none")?[]:Zu(t).map((function(t){for(var e={color:255,offsetX:eh,offsetY:eh,blur:eh,spread:eh,inset:!1},i=0,n=0;n<t.length;n++){var s=t[n];$u(s,"inset")?e.inset=!0:zu(s)?(0===i?e.offsetX=s:1===i?e.offsetY=s:2===i?e.blur=s:e.spread=s,i++):e.color=jh(A,s)}return e}))}},Vd={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,t){var e=[];return t.filter(Ju).forEach((function(A){switch(A.value){case"stroke":e.push(1);break;case"fill":e.push(0);break;case"markers":e.push(2)}})),[0,1,2].forEach((function(A){-1===e.indexOf(A)&&e.push(A)})),e}},Jd={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Xd={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,t){return Pu(t)?t.number:0}},$d={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(A,t){return t.filter(Ju).reduce((function(A,t){return A|Yd(t.value)}),0)}},Yd=function(A){switch(A){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},Wd=(function(){function A(A,t){var e,i;this.animationDuration=zd(A,Rd,t.animationDuration),this.backgroundClip=zd(A,Zh,t.backgroundClip),this.backgroundColor=zd(A,qh,t.backgroundColor),this.backgroundImage=zd(A,fl,t.backgroundImage),this.backgroundOrigin=zd(A,wl,t.backgroundOrigin),this.backgroundPosition=zd(A,gl,t.backgroundPosition),this.backgroundRepeat=zd(A,pl,t.backgroundRepeat),this.backgroundSize=zd(A,Cl,t.backgroundSize),this.borderTopColor=zd(A,yl,t.borderTopColor),this.borderRightColor=zd(A,bl,t.borderRightColor),this.borderBottomColor=zd(A,El,t.borderBottomColor),this.borderLeftColor=zd(A,Il,t.borderLeftColor),this.borderTopLeftRadius=zd(A,Hl,t.borderTopLeftRadius),this.borderTopRightRadius=zd(A,Sl,t.borderTopRightRadius),this.borderBottomRightRadius=zd(A,Tl,t.borderBottomRightRadius),this.borderBottomLeftRadius=zd(A,Ol,t.borderBottomLeftRadius),this.borderTopStyle=zd(A,Dl,t.borderTopStyle),this.borderRightStyle=zd(A,Ml,t.borderRightStyle),this.borderBottomStyle=zd(A,Ll,t.borderBottomStyle),this.borderLeftStyle=zd(A,xl,t.borderLeftStyle),this.borderTopWidth=zd(A,Nl,t.borderTopWidth),this.borderRightWidth=zd(A,Rl,t.borderRightWidth),this.borderBottomWidth=zd(A,jl,t.borderBottomWidth),this.borderLeftWidth=zd(A,Gl,t.borderLeftWidth),this.boxShadow=zd(A,Pd,t.boxShadow),this.color=zd(A,Pl,t.color),this.direction=zd(A,Vl,t.direction),this.display=zd(A,Jl,t.display),this.float=zd(A,$l,t.cssFloat),this.fontFamily=zd(A,Td,t.fontFamily),this.fontSize=zd(A,Od,t.fontSize),this.fontStyle=zd(A,Md,t.fontStyle),this.fontVariant=zd(A,Dd,t.fontVariant),this.fontWeight=zd(A,Kd,t.fontWeight),this.letterSpacing=zd(A,Yl,t.letterSpacing),this.lineBreak=zd(A,ql,t.lineBreak),this.lineHeight=zd(A,zl,t.lineHeight),this.listStyleImage=zd(A,td,t.listStyleImage),this.listStylePosition=zd(A,ed,t.listStylePosition),this.listStyleType=zd(A,id,t.listStyleType),this.marginTop=zd(A,sd,t.marginTop),this.marginRight=zd(A,rd,t.marginRight),this.marginBottom=zd(A,od,t.marginBottom),this.marginLeft=zd(A,ad,t.marginLeft),this.opacity=zd(A,kd,t.opacity);var n=zd(A,cd,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=zd(A,ud,t.overflowWrap),this.paddingTop=zd(A,ld,t.paddingTop),this.paddingRight=zd(A,dd,t.paddingRight),this.paddingBottom=zd(A,Bd,t.paddingBottom),this.paddingLeft=zd(A,fd,t.paddingLeft),this.paintOrder=zd(A,Vd,t.paintOrder),this.position=zd(A,gd,t.position),this.textAlign=zd(A,wd,t.textAlign),this.textDecorationColor=zd(A,Hd,null!==(e=t.textDecorationColor)&&void 0!==e?e:t.color),this.textDecorationLine=zd(A,Sd,null!==(i=t.textDecorationLine)&&void 0!==i?i:t.textDecoration),this.textShadow=zd(A,pd,t.textShadow),this.textTransform=zd(A,vd,t.textTransform),this.transform=zd(A,md,t.transform),this.transformOrigin=zd(A,Fd,t.transformOrigin),this.visibility=zd(A,yd,t.visibility),this.webkitTextStrokeColor=zd(A,Jd,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=zd(A,Xd,t.webkitTextStrokeWidth),this.wordBreak=zd(A,bd,t.wordBreak),this.zIndex=zd(A,Ed,t.zIndex),this.objectFit=zd(A,$d,t.objectFit)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},A.prototype.isTransparent=function(){return dh(this.backgroundColor)},A.prototype.isTransformed=function(){return null!==this.transform},A.prototype.isPositioned=function(){return 0!==this.position},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return 0!==this.float},A.prototype.isInlineLevel=function(){return Ld(this.display,4)||Ld(this.display,33554432)||Ld(this.display,268435456)||Ld(this.display,536870912)||Ld(this.display,67108864)||Ld(this.display,134217728)},A})(),Zd=function(A,t){this.content=zd(A,xd,t.content),this.quotes=zd(A,jd,t.quotes)},qd=function(A,t){this.counterIncrement=zd(A,_d,t.counterIncrement),this.counterReset=zd(A,Nd,t.counterReset)},zd=function(A,t,e){var i=new ju,n=null!=e?e.toString():t.initialValue;i.write(n);var s=new Gu(i.read());switch(t.type){case 2:var r=s.parseComponentValue();return t.parse(A,Ju(r)?r.value:t.initialValue);case 0:return t.parse(A,s.parseComponentValue());case 1:return t.parse(A,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(t.format){case"angle":return ch(0,s.parseComponentValue());case"color":return jh(A,s.parseComponentValue());case"image":return dl(A,s.parseComponentValue());case"length":var o=s.parseComponentValue();return zu(o)?o:eh;case"length-percentage":var a=s.parseComponentValue();return Ah(a)?a:eh;case"time":return Id(0,s.parseComponentValue())}}},AB=function(A,t){var e=(function(A){switch(A.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}})(A);return 1===e||t===e},tB=function(A,t){this.context=A,this.textNodes=[],this.elements=[],this.flags=0,AB(t,3),this.styles=new Wd(A,window.getComputedStyle(t,null)),Af(t)&&(this.styles.animationDuration.some((function(A){return A>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=ec(this.context,t),AB(t,4)&&(this.flags|=16)},eB="undefined"==typeof Uint8Array?[]:new Uint8Array(256),iB=0;iB<64;iB++)eB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(iB)]=iB;for(var nB=function(A,t,e){return A.slice?A.slice(t,e):new Uint16Array(Array.prototype.slice.call(A,t,e))},sB=(function(){function A(A,t,e,i,n,s){this.initialValue=A,this.errorValue=t,this.highStart=e,this.highValueIndex=i,this.index=n,this.data=s}return A.prototype.get=function(A){var t;if(A>=0){if(A<55296||A>56319&&A<=65535)return t=((t=this.index[A>>5])<<2)+(31&A),this.data[t];if(A<=65535)return t=((t=this.index[2048+(A-55296>>5)])<<2)+(31&A),this.data[t];if(A<this.highStart)return t=2080+(A>>11),t=this.index[t],t+=A>>5&63,t=((t=this.index[t])<<2)+(31&A),this.data[t];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),rB="undefined"==typeof Uint8Array?[]:new Uint8Array(256),oB=0;oB<64;oB++)rB["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(oB)]=oB;var aB,cB,uB=8,hB=9,lB=11,dB=12,BB=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var e=A.length;if(!e)return"";for(var i=[],n=-1,s="";++n<e;){var r=A[n];r<=65535?i.push(r):(r-=65536,i.push(55296+(r>>10),r%1024+56320)),(n+1===e||i.length>16384)&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return s},fB=(function(){var A=(function(A){var t,e,i,n,s,r=19617,o=0;"="===A[26155]&&(r--,"="===A[26154]&&r--);var a="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(r):new Array(r),c=Array.isArray(a)?a:new Uint8Array(a);for(t=0;t<26156;t+=4)e=eB[A.charCodeAt(t)],i=eB[A.charCodeAt(t+1)],n=eB[A.charCodeAt(t+2)],s=eB[A.charCodeAt(t+3)],c[o++]=e<<2|i>>4,c[o++]=(15&i)<<4|n>>2,c[o++]=(3&n)<<6|63&s;return a})("AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA="),t=Array.isArray(A)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=4)e.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return e})(A):new Uint32Array(A),e=Array.isArray(A)?(function(A){for(var t=A.length,e=[],i=0;i<t;i+=2)e.push(A[i+1]<<8|A[i]);return e})(A):new Uint16Array(A),i=nB(e,12,t[4]/2),n=2===t[5]?nB(e,(24+t[4])/2):(function(A,t,e){return A.slice?A.slice(t,e):new Uint32Array(Array.prototype.slice.call(A,t,e))})(t,Math.ceil((24+t[4])/4));return new sB(t[0],t[1],t[2],t[3],i,n)})(),wB="\xd7",gB=function(A){return fB.get(A)},pB=function(A,t,e){var i=e-2,n=t[i],s=t[e-1],r=t[e];if(2===s&&3===r)return wB;if(2===s||3===s||4===s)return"\xf7";if(2===r||3===r||4===r)return"\xf7";if(s===uB&&-1!==[uB,hB,lB,dB].indexOf(r))return wB;if(!(s!==lB&&s!==hB||r!==hB&&10!==r))return wB;if((s===dB||10===s)&&10===r)return wB;if(13===r||5===r)return wB;if(7===r)return wB;if(1===s)return wB;if(13===s&&14===r){for(;5===n;)n=t[--i];if(14===n)return wB}if(15===s&&15===r){for(var o=0;15===n;)o++,n=t[--i];if(o%2==0)return wB}return"\xf7"},vB=function(A){var t=(function(A){for(var t=[],e=0,i=A.length;e<i;){var n=A.charCodeAt(e++);if(n>=55296&&n<=56319&&e<i){var s=A.charCodeAt(e++);56320==(64512&s)?t.push(((1023&n)<<10)+(1023&s)+65536):(t.push(n),e--)}else t.push(n)}return t})(A),e=t.length,i=0,n=0,s=t.map(gB);return{next:function(){if(i>=e)return{done:!0,value:null};for(var A=wB;i<e&&(A=pB(0,s,++i))===wB;);if(A!==wB||i===e){var r=BB.apply(null,t.slice(n,i));return n=i,{value:r,done:!1}}return{done:!0,value:null}}}},mB=function(A){return 0===A[0]&&255===A[1]&&0===A[2]&&255===A[3]},QB=function(A,t,e,i,n){var s="http://www.w3.org/2000/svg",r=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return r.setAttributeNS(null,"width",A.toString()),r.setAttributeNS(null,"height",t.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",e.toString()),o.setAttributeNS(null,"y",i.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),r.appendChild(o),o.appendChild(n),r},CB=function(A){return new Promise((function(t,e){var i=new Image;i.onload=function(){return t(i)},i.onerror=e,i.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent((new XMLSerializer).serializeToString(A)))}))},UB={get SUPPORT_RANGE_BOUNDS(){var A=(function(A){if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var e=A.createElement("boundtest");e.style.height="".concat(123,"px"),e.style.display="block",A.body.appendChild(e),t.selectNode(e);var i=t.getBoundingClientRect(),n=Math.round(i.height);if(A.body.removeChild(e),123===n)return!0}}return!1})(document);return Object.defineProperty(UB,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=UB.SUPPORT_RANGE_BOUNDS&&(function(A){var t=A.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",A.body.appendChild(t);var e=A.createRange();t.innerHTML="function"==typeof"".repeat?"👨".repeat(10):"";var i=t.firstChild,n=ic(i.data).map((function(A){return nc(A)})),s=0,r={},o=n.every((function(A,t){e.setStart(i,s),e.setEnd(i,s+A.length);var n=e.getBoundingClientRect();s+=A.length;var o=n.x>r.x||n.y>r.y;return r=n,0===t||o}));return A.body.removeChild(t),o})(document);return Object.defineProperty(UB,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=(function(A){var t=new Image,e=A.createElement("canvas"),i=e.getContext("2d");if(!i)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(t,0,0),e.toDataURL()}catch(n){return!1}return!0})(document);return Object.defineProperty(UB,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A="function"==typeof Array.from&&"function"==typeof window.fetch?(function(A){var t=A.createElement("canvas"),e=100;t.width=e,t.height=e;var i=t.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,e,e);var n=new Image,s=t.toDataURL();n.src=s;var r=QB(e,e,0,0,n);return i.fillStyle="red",i.fillRect(0,0,e,e),CB(r).then((function(t){i.drawImage(t,0,0);var n=i.getImageData(0,0,e,e).data;i.fillStyle="red",i.fillRect(0,0,e,e);var r=A.createElement("div");return r.style.backgroundImage="url(".concat(s,")"),r.style.height="".concat(e,"px"),mB(n)?CB(QB(e,e,0,0,r)):Promise.reject(!1)})).then((function(A){return i.drawImage(A,0,0),mB(i.getImageData(0,0,e,e).data)})).catch((function(){return!1}))})(document):Promise.resolve(!1);return Object.defineProperty(UB,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=void 0!==(new Image).crossOrigin;return Object.defineProperty(UB,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(UB,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(UB,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(UB,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},FB=function(A,t){this.text=A,this.bounds=t},yB=function(A,t,e){var i=A.ownerDocument;if(!i)throw new Error("Node has no owner document");var n=i.createRange();return n.setStart(A,t),n.setEnd(A,t+e),n},bB=function(A){if(UB.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(A)).map((function(A){return A.segment}))}return(function(A){for(var t,e=vB(A),i=[];!(t=e.next()).done;)t.value&&i.push(t.value.slice());return i})(A)},EB=[32,160,4961,65792,65793,4153,4241],IB=function(A,t,e){this.text=kB(t.data,e.textTransform),this.textBounds=(function(A,t,e,i){var n=(function(A,t){return 0!==t.letterSpacing?bB(A):(function(A,t){if(UB.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(e.segment(A)).map((function(A){return A.segment}))}return(function(A,t){for(var e,i=(function(A,t){var e=ic(A),i=(function(A,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var e=(function(A,t){void 0===t&&(t="strict");var e=[],i=[],n=[];return A.forEach((function(A,s){var r=Wc.get(A);if(r>50?(n.push(!0),r-=50):n.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(A))return i.push(s),e.push(16);if(4===r||11===r){if(0===s)return i.push(s),e.push(Lc);var o=e[s-1];return-1===tu.indexOf(o)?(i.push(i[s-1]),e.push(o)):(i.push(s),e.push(Lc))}return i.push(s),31===r?e.push("strict"===t?Hc:jc):r===Jc||29===r?e.push(Lc):43===r?A>=131072&&A<=196605||A>=196608&&A<=262141?e.push(jc):e.push(Lc):void e.push(r)})),[i,e,n]})(A,t.lineBreak),i=e[0],n=e[1],s=e[2];return"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(n=n.map((function(A){return-1!==[Oc,Lc,Jc].indexOf(A)?jc:A}))),[i,n,"keep-all"===t.wordBreak?s.map((function(t,e){return t&&A[e]>=19968&&A[e]<=40959})):void 0]})(e,t),n=i[0],s=i[1],r=i[2],o=e.length,a=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var A=$c;c<o&&(A=ru(e,s,n,++c,r))===$c;);if(A!==$c||c===o){var t=new ou(e,A,a,c);return a=c,{value:t,done:!1}}return{done:!0,value:null}}}})(A,{lineBreak:t.lineBreak,wordBreak:"break-word"===t.overflowWrap?"break-word":t.wordBreak}),n=[],s=function(){if(e.value){var A=e.value.slice(),t=ic(A),i="";t.forEach((function(A){-1===EB.indexOf(A)?i+=nc(A):(i.length&&n.push(i),n.push(nc(A)),i="")})),i.length&&n.push(i)}};!(e=i.next()).done;)s();return n})(A,t)})(A,t)})(t,e),s=[],r=0;return n.forEach((function(t){if(e.textDecorationLine.length||t.trim().length>0)if(UB.SUPPORT_RANGE_BOUNDS){var n=yB(i,r,t.length).getClientRects();if(n.length>1){var o=bB(t),a=0;o.forEach((function(t){s.push(new FB(t,tc.fromDOMRectList(A,yB(i,a+r,t.length).getClientRects()))),a+=t.length}))}else s.push(new FB(t,tc.fromDOMRectList(A,n)))}else{var c=i.splitText(t.length);s.push(new FB(t,(function(A,t){var e=t.ownerDocument;if(e){var i=e.createElement("html2canvaswrapper");i.appendChild(t.cloneNode(!0));var n=t.parentNode;if(n){n.replaceChild(i,t);var s=ec(A,i);return i.firstChild&&n.replaceChild(i.firstChild,i),s}}return tc.EMPTY})(A,i))),i=c}else UB.SUPPORT_RANGE_BOUNDS||(i=i.splitText(t.length));r+=t.length})),s})(A,this.text,e,t)},kB=function(A,t){switch(t){case 1:return A.toLowerCase();case 3:return A.replace(HB,SB);case 2:return A.toUpperCase();default:return A}},HB=/(^|\s|:|-|\(|\))([a-z])/g,SB=function(A,t,e){return A.length>0?t+e.toUpperCase():A},TB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.src=e.currentSrc||e.src,i.intrinsicWidth=e.naturalWidth,i.intrinsicHeight=e.naturalHeight,i.context.cache.addImage(i.src),i}return Wa(t,A),t})(tB),OB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.canvas=e,i.intrinsicWidth=e.width,i.intrinsicHeight=e.height,i}return Wa(t,A),t})(tB),KB=(function(A){function t(t,e){var i=A.call(this,t,e)||this,n=new XMLSerializer,s=ec(t,e);return e.setAttribute("width","".concat(s.width,"px")),e.setAttribute("height","".concat(s.height,"px")),i.svg="data:image/svg+xml,".concat(encodeURIComponent(n.serializeToString(e))),i.intrinsicWidth=e.width.baseVal.value,i.intrinsicHeight=e.height.baseVal.value,i.context.cache.addImage(i.svg),i}return Wa(t,A),t})(tB),DB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.value=e.value,i}return Wa(t,A),t})(tB),MB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.start=e.start,i.reversed="boolean"==typeof e.reversed&&!0===e.reversed,i}return Wa(t,A),t})(tB),LB=[{type:15,flags:0,unit:"px",number:3}],xB=[{type:16,flags:0,number:50}],_B="checkbox",NB="radio",RB=707406591,jB=(function(A){function t(t,e){var i,n,s,r=A.call(this,t,e)||this;switch(r.type=e.type.toLowerCase(),r.checked=e.checked,r.value=0===(n="password"===(i=e).type?new Array(i.value.length+1).join("\u2022"):i.value).length?i.placeholder||"":n,r.type!==_B&&r.type!==NB||(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=(s=r.bounds).width>s.height?new tc(s.left+(s.width-s.height)/2,s.top,s.height,s.height):s.width<s.height?new tc(s.left,s.top+(s.height-s.width)/2,s.width,s.width):s),r.type){case _B:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=LB;break;case NB:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=xB}return r}return Wa(t,A),t})(tB),GB=(function(A){function t(t,e){var i=A.call(this,t,e)||this,n=e.options[e.selectedIndex||0];return i.value=n&&n.text||"",i}return Wa(t,A),t})(tB),PB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.value=e.value,i}return Wa(t,A),t})(tB),VB=(function(A){function t(t,e){var i=A.call(this,t,e)||this;i.src=e.src,i.width=parseInt(e.width,10)||0,i.height=parseInt(e.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(e.contentWindow&&e.contentWindow.document&&e.contentWindow.document.documentElement){i.tree=YB(t,e.contentWindow.document.documentElement);var n=e.contentWindow.document.documentElement?Yh(t,getComputedStyle(e.contentWindow.document.documentElement).backgroundColor):Wh.TRANSPARENT,s=e.contentWindow.document.body?Yh(t,getComputedStyle(e.contentWindow.document.body).backgroundColor):Wh.TRANSPARENT;i.backgroundColor=dh(n)?dh(s)?i.styles.backgroundColor:s:n}}catch(r){}return i}return Wa(t,A),t})(tB),JB=["OL","UL","MENU"],XB=function(A,t,e,i){for(var n=t.firstChild,s=void 0;n;n=s)if(s=n.nextSibling,qB(n)&&n.data.length>0)e.textNodes.push(new IB(A,n,e.styles));else if(zB(n))if(ff(n)&&n.assignedNodes)n.assignedNodes().forEach((function(t){return XB(A,t,e,i)}));else{var r=$B(A,n);r.styles.isVisible()&&(WB(n,r,i)?r.flags|=4:ZB(r.styles)&&(r.flags|=2),-1!==JB.indexOf(n.tagName)&&(r.flags|=8),e.elements.push(r),n.slot,n.shadowRoot?XB(A,n.shadowRoot,r,i):df(n)||rf(n)||Bf(n)||XB(A,n,r,i))}},$B=function(A,t){return uf(t)?new TB(A,t):af(t)?new OB(A,t):rf(t)?new KB(A,t):ef(t)?new DB(A,t):nf(t)?new MB(A,t):sf(t)?new jB(A,t):Bf(t)?new GB(A,t):df(t)?new PB(A,t):hf(t)?new VB(A,t):new tB(A,t)},YB=function(A,t){var e=$B(A,t);return e.flags|=4,XB(A,t,e,e),e},WB=function(A,t,e){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||of(A)&&e.styles.isTransparent()},ZB=function(A){return A.isPositioned()||A.isFloating()},qB=function(A){return A.nodeType===Node.TEXT_NODE},zB=function(A){return A.nodeType===Node.ELEMENT_NODE},Af=function(A){return zB(A)&&void 0!==A.style&&!tf(A)},tf=function(A){return"object"==typeof A.className},ef=function(A){return"LI"===A.tagName},nf=function(A){return"OL"===A.tagName},sf=function(A){return"INPUT"===A.tagName},rf=function(A){return"svg"===A.tagName},of=function(A){return"BODY"===A.tagName},af=function(A){return"CANVAS"===A.tagName},cf=function(A){return"VIDEO"===A.tagName},uf=function(A){return"IMG"===A.tagName},hf=function(A){return"IFRAME"===A.tagName},lf=function(A){return"STYLE"===A.tagName},df=function(A){return"TEXTAREA"===A.tagName},Bf=function(A){return"SELECT"===A.tagName},ff=function(A){return"SLOT"===A.tagName},wf=function(A){return A.tagName.indexOf("-")>0},gf=(function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(A){var t=this.counters[A];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(A){return this.counters[A]||[]},A.prototype.pop=function(A){var t=this;A.forEach((function(A){return t.counters[A].pop()}))},A.prototype.parse=function(A){var t=this,e=A.counterIncrement,i=A.counterReset,n=!0;null!==e&&e.forEach((function(A){var e=t.counters[A.counter];e&&0!==A.increment&&(n=!1,e.length||e.push(1),e[Math.max(0,e.length-1)]+=A.increment)}));var s=[];return n&&i.forEach((function(A){var e=t.counters[A.counter];s.push(A.counter),e||(e=t.counters[A.counter]=[]),e.push(A.reset)})),s},A})(),pf={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},vf={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054f","\u054e","\u054d","\u054c","\u054b","\u054a","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053f","\u053e","\u053d","\u053c","\u053b","\u053a","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},mf={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05d9\u05f3","\u05d8\u05f3","\u05d7\u05f3","\u05d6\u05f3","\u05d5\u05f3","\u05d4\u05f3","\u05d3\u05f3","\u05d2\u05f3","\u05d1\u05f3","\u05d0\u05f3","\u05ea","\u05e9","\u05e8","\u05e7","\u05e6","\u05e4","\u05e2","\u05e1","\u05e0","\u05de","\u05dc","\u05db","\u05d9\u05d8","\u05d9\u05d7","\u05d9\u05d6","\u05d8\u05d6","\u05d8\u05d5","\u05d9","\u05d8","\u05d7","\u05d6","\u05d5","\u05d4","\u05d3","\u05d2","\u05d1","\u05d0"]},Qf={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10f5","\u10f0","\u10ef","\u10f4","\u10ee","\u10ed","\u10ec","\u10eb","\u10ea","\u10e9","\u10e8","\u10e7","\u10e6","\u10e5","\u10e4","\u10f3","\u10e2","\u10e1","\u10e0","\u10df","\u10de","\u10dd","\u10f2","\u10dc","\u10db","\u10da","\u10d9","\u10d8","\u10d7","\u10f1","\u10d6","\u10d5","\u10d4","\u10d3","\u10d2","\u10d1","\u10d0"]},Cf=function(A,t,e,i,n,s){return A<t||A>e?Sf(A,n,s.length>0):i.integers.reduce((function(t,e,n){for(;A>=e;)A-=e,t+=i.values[n];return t}),"")+s},Uf=function(A,t,e,i){var n="";do{e||A--,n=i(A)+n,A/=t}while(A*t>=t);return n},Ff=function(A,t,e,i,n){var s=e-t+1;return(A<0?"-":"")+(Uf(Math.abs(A),s,i,(function(A){return nc(Math.floor(A%s)+t)}))+n)},yf=function(A,t,e){void 0===e&&(e=". ");var i=t.length;return Uf(Math.abs(A),i,!1,(function(A){return t[Math.floor(A%i)]}))+e},bf=function(A,t,e,i,n,s){if(A<-9999||A>9999)return Sf(A,4,n.length>0);var r=Math.abs(A),o=n;if(0===r)return t[0]+o;for(var a=0;r>0&&a<=4;a++){var c=r%10;0===c&&Ld(s,1)&&""!==o?o=t[c]+o:c>1||1===c&&0===a||1===c&&1===a&&Ld(s,2)||1===c&&1===a&&Ld(s,4)&&A>100||1===c&&a>1&&Ld(s,8)?o=t[c]+(a>0?e[a-1]:"")+o:1===c&&a>0&&(o=e[a-1]+o),r=Math.floor(r/10)}return(A<0?i:"")+o},Ef="\u5341\u767e\u5343\u842c",If="\u62fe\u4f70\u4edf\u842c",kf="\u30de\u30a4\u30ca\u30b9",Hf="\ub9c8\uc774\ub108\uc2a4",Sf=function(A,t,e){var i=e?". ":"",n=e?"\u3001":"",s=e?", ":"",r=e?" ":"";switch(t){case 0:return"\u2022"+r;case 1:return"\u25e6"+r;case 2:return"\u25fe"+r;case 5:var o=Ff(A,48,57,!0,i);return o.length<4?"0".concat(o):o;case 4:return yf(A,"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d",n);case 6:return Cf(A,1,3999,pf,3,i).toLowerCase();case 7:return Cf(A,1,3999,pf,3,i);case 8:return Ff(A,945,969,!1,i);case 9:return Ff(A,97,122,!1,i);case 10:return Ff(A,65,90,!1,i);case 11:return Ff(A,1632,1641,!0,i);case 12:case 49:return Cf(A,1,9999,vf,3,i);case 35:return Cf(A,1,9999,vf,3,i).toLowerCase();case 13:return Ff(A,2534,2543,!0,i);case 14:case 30:return Ff(A,6112,6121,!0,i);case 15:return yf(A,"\u5b50\u4e11\u5bc5\u536f\u8fb0\u5df3\u5348\u672a\u7533\u9149\u620c\u4ea5",n);case 16:return yf(A,"\u7532\u4e59\u4e19\u4e01\u620a\u5df1\u5e9a\u8f9b\u58ec\u7678",n);case 17:case 48:return bf(A,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d",Ef,"\u8ca0",n,14);case 47:return bf(A,"\u96f6\u58f9\u8cb3\u53c3\u8086\u4f0d\u9678\u67d2\u634c\u7396",If,"\u8ca0",n,15);case 42:return bf(A,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d",Ef,"\u8d1f",n,14);case 41:return bf(A,"\u96f6\u58f9\u8d30\u53c1\u8086\u4f0d\u9646\u67d2\u634c\u7396",If,"\u8d1f",n,15);case 26:return bf(A,"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u4e07",kf,n,0);case 25:return bf(A,"\u96f6\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d","\u62fe\u767e\u5343\u4e07",kf,n,7);case 31:return bf(A,"\uc601\uc77c\uc774\uc0bc\uc0ac\uc624\uc721\uce60\ud314\uad6c","\uc2ed\ubc31\ucc9c\ub9cc",Hf,s,7);case 33:return bf(A,"\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u5341\u767e\u5343\u842c",Hf,s,0);case 32:return bf(A,"\u96f6\u58f9\u8cb3\u53c3\u56db\u4e94\u516d\u4e03\u516b\u4e5d","\u62fe\u767e\u5343",Hf,s,7);case 18:return Ff(A,2406,2415,!0,i);case 20:return Cf(A,1,19999,Qf,3,i);case 21:return Ff(A,2790,2799,!0,i);case 22:return Ff(A,2662,2671,!0,i);case 52:return Cf(A,1,10999,mf,3,i);case 23:return yf(A,"\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051\u3053\u3055\u3057\u3059\u305b\u305d\u305f\u3061\u3064\u3066\u3068\u306a\u306b\u306c\u306d\u306e\u306f\u3072\u3075\u3078\u307b\u307e\u307f\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308a\u308b\u308c\u308d\u308f\u3090\u3091\u3092\u3093");case 24:return yf(A,"\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c\u308b\u3092\u308f\u304b\u3088\u305f\u308c\u305d\u3064\u306d\u306a\u3089\u3080\u3046\u3090\u306e\u304a\u304f\u3084\u307e\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304d\u3086\u3081\u307f\u3057\u3091\u3072\u3082\u305b\u3059");case 27:return Ff(A,3302,3311,!0,i);case 28:return yf(A,"\u30a2\u30a4\u30a6\u30a8\u30aa\u30ab\u30ad\u30af\u30b1\u30b3\u30b5\u30b7\u30b9\u30bb\u30bd\u30bf\u30c1\u30c4\u30c6\u30c8\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d2\u30d5\u30d8\u30db\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8\u30e9\u30ea\u30eb\u30ec\u30ed\u30ef\u30f0\u30f1\u30f2\u30f3",n);case 29:return yf(A,"\u30a4\u30ed\u30cf\u30cb\u30db\u30d8\u30c8\u30c1\u30ea\u30cc\u30eb\u30f2\u30ef\u30ab\u30e8\u30bf\u30ec\u30bd\u30c4\u30cd\u30ca\u30e9\u30e0\u30a6\u30f0\u30ce\u30aa\u30af\u30e4\u30de\u30b1\u30d5\u30b3\u30a8\u30c6\u30a2\u30b5\u30ad\u30e6\u30e1\u30df\u30b7\u30f1\u30d2\u30e2\u30bb\u30b9",n);case 34:return Ff(A,3792,3801,!0,i);case 37:return Ff(A,6160,6169,!0,i);case 38:return Ff(A,4160,4169,!0,i);case 39:return Ff(A,2918,2927,!0,i);case 40:return Ff(A,1776,1785,!0,i);case 43:return Ff(A,3046,3055,!0,i);case 44:return Ff(A,3174,3183,!0,i);case 45:return Ff(A,3664,3673,!0,i);case 46:return Ff(A,3872,3881,!0,i);default:return Ff(A,48,57,!0,i)}},Tf="data-html2canvas-ignore",Of=(function(){function A(A,t,e){if(this.context=A,this.options=e,this.scrolledElements=[],this.referenceElement=t,this.counters=new gf,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(A,t){var e=this,i=Mf(A,t);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var n=A.defaultView.pageXOffset,s=A.defaultView.pageYOffset,r=i.contentWindow,o=r.document,a=_f(i).then((function(){return qa(e,void 0,void 0,(function(){var A,e;return za(this,(function(n){switch(n.label){case 0:return this.scrolledElements.forEach(Pf),r&&(r.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||r.scrollY===t.top&&r.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(r.scrollX-t.left,r.scrollY-t.top,0,0))),A=this.options.onclone,void 0===(e=this.clonedReferenceElement)?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:o.fonts&&o.fonts.ready?[4,o.fonts.ready]:[3,2];case 1:n.sent(),n.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,xf(o)]:[3,4];case 3:n.sent(),n.label=4;case 4:return"function"==typeof A?[2,Promise.resolve().then((function(){return A(o,e)})).then((function(){return i}))]:[2,i]}}))}))})),c=o.adoptNode(this.documentElement);return Wf(c,o),o.open(),o.write("".concat(jf(document.doctype),"<html></html>")),Gf(this.referenceElement.ownerDocument,n,s),o.replaceChild(c,o.documentElement),o.close(),a},A.prototype.createElementClone=function(A){if(AB(A,2),af(A))return this.createCanvasClone(A);if(cf(A))return this.createVideoClone(A);if(lf(A))return this.createStyleClone(A);var t=A.cloneNode(!1);return uf(t)&&(uf(A)&&A.currentSrc&&A.currentSrc!==A.src&&(t.src=A.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),wf(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(A){var t=document.createElement("html2canvascustomelement");return Rf(A.style,t),t},A.prototype.createStyleClone=function(A){try{var t=A.sheet;if(t&&t.cssRules){var e=[].slice.call(t.cssRules,0).reduce((function(A,t){return t&&"string"==typeof t.cssText?A+t.cssText:A}),""),i=A.cloneNode(!1);return i.textContent=e,i}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),"SecurityError"!==n.name)throw n}return A.cloneNode(!1)},A.prototype.createCanvasClone=function(A){var t;if(this.options.inlineImages&&A.ownerDocument){var e=A.ownerDocument.createElement("img");try{return e.src=A.toDataURL(),e}catch(a){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",A)}}var i=A.cloneNode(!1);try{i.width=A.width,i.height=A.height;var n=A.getContext("2d"),s=i.getContext("2d",{willReadFrequently:!0});if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,A.width,A.height),0,0);else{var r=null!==(t=A.getContext("webgl2"))&&void 0!==t?t:A.getContext("webgl");if(r){var o=r.getContextAttributes();!1===(null==o?void 0:o.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",A)}s.drawImage(A,0,0)}return i}catch(a){this.context.logger.info("Unable to clone canvas as it is tainted",A)}return i},A.prototype.createVideoClone=function(A){var t=A.ownerDocument.createElement("canvas");t.width=A.offsetWidth,t.height=A.offsetHeight;var e=t.getContext("2d");try{return e&&(e.drawImage(A,0,0,t.width,t.height),this.options.allowTaint||e.getImageData(0,0,t.width,t.height)),t}catch(n){this.context.logger.info("Unable to clone video as it is tainted",A)}var i=A.ownerDocument.createElement("canvas");return i.width=A.offsetWidth,i.height=A.offsetHeight,i},A.prototype.appendChildNode=function(A,t,e){zB(t)&&("SCRIPT"===t.tagName||t.hasAttribute(Tf)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&zB(t)&&lf(t)||A.appendChild(this.cloneNode(t,e))},A.prototype.cloneChildNodes=function(A,t,e){for(var i=this,n=A.shadowRoot?A.shadowRoot.firstChild:A.firstChild;n;n=n.nextSibling)if(zB(n)&&ff(n)&&"function"==typeof n.assignedNodes){var s=n.assignedNodes();s.length&&s.forEach((function(A){return i.appendChildNode(t,A,e)}))}else this.appendChildNode(t,n,e)},A.prototype.cloneNode=function(A,t){if(qB(A))return document.createTextNode(A.data);if(!A.ownerDocument)return A.cloneNode(!1);var e=A.ownerDocument.defaultView;if(e&&zB(A)&&(Af(A)||tf(A))){var i=this.createElementClone(A);i.style.transitionProperty="none";var n=e.getComputedStyle(A),s=e.getComputedStyle(A,":before"),r=e.getComputedStyle(A,":after");this.referenceElement===A&&Af(i)&&(this.clonedReferenceElement=i),of(i)&&$f(i);var o=this.counters.parse(new qd(this.context,n)),a=this.resolvePseudoContent(A,i,s,aB.BEFORE);wf(A)&&(t=!0),cf(A)||this.cloneChildNodes(A,i,t),a&&i.insertBefore(a,i.firstChild);var c=this.resolvePseudoContent(A,i,r,aB.AFTER);return c&&i.appendChild(c),this.counters.pop(o),(n&&(this.options.copyStyles||tf(A))&&!hf(A)||t)&&Rf(n,i),0===A.scrollTop&&0===A.scrollLeft||this.scrolledElements.push([i,A.scrollLeft,A.scrollTop]),(df(A)||Bf(A))&&(df(i)||Bf(i))&&(i.value=A.value),i}return A.cloneNode(!1)},A.prototype.resolvePseudoContent=function(A,t,e,i){var n=this;if(e){var s=e.content,r=t.ownerDocument;if(r&&s&&"none"!==s&&"-moz-alt-content"!==s&&"none"!==e.display){this.counters.parse(new qd(this.context,e));var o=new Zd(this.context,e),a=r.createElement("html2canvaspseudoelement");Rf(e,a),o.content.forEach((function(t){if(0===t.type)a.appendChild(r.createTextNode(t.value));else if(22===t.type){var e=r.createElement("img");e.src=t.value,e.style.opacity="1",a.appendChild(e)}else if(18===t.type){if("attr"===t.name){var i=t.values.filter(Ju);i.length&&a.appendChild(r.createTextNode(A.getAttribute(i[0].value)||""))}else if("counter"===t.name){var s=t.values.filter(Wu),c=s[0],u=s[1];if(c&&Ju(c)){var h=n.counters.getCounterValue(c.value),l=u&&Ju(u)?id.parse(n.context,u.value):3;a.appendChild(r.createTextNode(Sf(h,l,!1)))}}else if("counters"===t.name){var d=t.values.filter(Wu),B=(c=d[0],d[1]);if(u=d[2],c&&Ju(c)){var f=n.counters.getCounterValues(c.value),w=u&&Ju(u)?id.parse(n.context,u.value):3,g=B&&0===B.type?B.value:"",p=f.map((function(A){return Sf(A,w,!1)})).join(g);a.appendChild(r.createTextNode(p))}}}else if(20===t.type)switch(t.value){case"open-quote":a.appendChild(r.createTextNode(Gd(o.quotes,n.quoteDepth++,!0)));break;case"close-quote":a.appendChild(r.createTextNode(Gd(o.quotes,--n.quoteDepth,!1)));break;default:a.appendChild(r.createTextNode(t.value))}})),a.className="".concat(Vf," ").concat(Jf);var c=i===aB.BEFORE?" ".concat(Vf):" ".concat(Jf);return tf(t)?t.className.baseValue+=c:t.className+=c,a}}},A.destroy=function(A){return!!A.parentNode&&(A.parentNode.removeChild(A),!0)},A})();(cB=aB||(aB={}))[cB.BEFORE=0]="BEFORE",cB[cB.AFTER=1]="AFTER";var Kf,Df,Mf=function(A,t){var e=A.createElement("iframe");return e.className="html2canvas-container",e.style.visibility="hidden",e.style.position="fixed",e.style.left="-10000px",e.style.top="0px",e.style.border="0",e.width=t.width.toString(),e.height=t.height.toString(),e.scrolling="no",e.setAttribute(Tf,"true"),A.body.appendChild(e),e},Lf=function(A){return new Promise((function(t){A.complete?t():A.src?(A.onload=t,A.onerror=t):t()}))},xf=function(A){return Promise.all([].slice.call(A.images,0).map(Lf))},_f=function(A){return new Promise((function(t,e){var i=A.contentWindow;if(!i)return e("No window assigned for iframe");var n=i.document;i.onload=A.onload=function(){i.onload=A.onload=null;var e=setInterval((function(){n.body.childNodes.length>0&&"complete"===n.readyState&&(clearInterval(e),t(A))}),50)}}))},Nf=["all","d","content"],Rf=function(A,t){for(var e=A.length-1;e>=0;e--){var i=A.item(e);-1===Nf.indexOf(i)&&t.style.setProperty(i,A.getPropertyValue(i))}return t},jf=function(A){var t="";return A&&(t+="<!DOCTYPE ",A.name&&(t+=A.name),A.internalSubset&&(t+=A.internalSubset),A.publicId&&(t+='"'.concat(A.publicId,'"')),A.systemId&&(t+='"'.concat(A.systemId,'"')),t+=">"),t},Gf=function(A,t,e){A&&A.defaultView&&(t!==A.defaultView.pageXOffset||e!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(t,e)},Pf=function(A){var t=A[0],e=A[1],i=A[2];t.scrollLeft=e,t.scrollTop=i},Vf="___html2canvas___pseudoelement_before",Jf="___html2canvas___pseudoelement_after",Xf='{\n content: "" !important;\n display: none !important;\n}',$f=function(A){Yf(A,".".concat(Vf).concat(":before").concat(Xf,"\n .").concat(Jf).concat(":after").concat(Xf))},Yf=function(A,t){var e=A.ownerDocument;if(e){var i=e.createElement("style");i.textContent=t,A.appendChild(i)}},Wf=function(A,t){var e,i=t.createElement("base");i.href=t.baseURI;var n=A.getElementsByTagName("head").item(0);null==n||n.insertBefore(i,null!==(e=null==n?void 0:n.firstChild)&&void 0!==e?e:null)},Zf=(function(){function A(){}return A.getOrigin=function(t){var e=A.TA;return e?(e.href=t,e.href=e.href,e.protocol+e.hostname+e.port):"about:blank"},A.isSameOrigin=function(t){return A.getOrigin(t)===A.OA},A.setContext=function(t){A.TA=t.document.createElement("a"),A.OA=A.getOrigin(t.location.href)},A.OA="about:blank",A})(),qf=(function(){function A(A,t){this.context=A,this.KA=t,this.DA={}}return A.prototype.addImage=function(A){var t=Promise.resolve();return this.has(A)?t:sw(A)||ew(A)?((this.DA[A]=this.loadImage(A)).catch((function(){})),t):t},A.prototype.match=function(A){return this.DA[A]},A.prototype.loadImage=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,s,r=this;return za(this,(function(o){switch(o.label){case 0:return"function"!=typeof this.KA.customIsSameOrigin?[3,2]:[4,this.KA.customIsSameOrigin(A,Zf.isSameOrigin)];case 1:return e=o.sent(),[3,3];case 2:e=Zf.isSameOrigin(A),o.label=3;case 3:return t=e,i=!iw(A)&&!0===this.KA.useCORS&&UB.SUPPORT_CORS_IMAGES&&!t,n=!iw(A)&&!t&&!sw(A)&&"string"==typeof this.KA.proxy&&UB.SUPPORT_CORS_XHR&&!i,t||!1!==this.KA.allowTaint||iw(A)||sw(A)||n||i?(s=A,n?[4,this.proxy(s)]:[3,5]):[2];case 4:s=o.sent(),o.label=5;case 5:return this.context.logger.debug("Added image ".concat(A.substring(0,256))),[4,new Promise((function(A,t){var e=new Image;e.onload=function(){return A(e)},e.onerror=t,(nw(s)||i)&&(e.crossOrigin="anonymous"),e.src=s,!0===e.complete&&setTimeout((function(){return A(e)}),500),r.KA.imageTimeout>0&&setTimeout((function(){return t("Timed out (".concat(r.KA.imageTimeout,"ms) loading image"))}),r.KA.imageTimeout)}))];case 6:return[2,o.sent()]}}))}))},A.prototype.has=function(A){return void 0!==this.DA[A]},A.prototype.keys=function(){return Promise.resolve(Object.keys(this.DA))},A.prototype.proxy=function(A){var t=this,e=this.KA.proxy;if(!e)throw new Error("No proxy defined");var i=A.substring(0,256);return new Promise((function(n,s){var r=UB.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;o.onload=function(){if(200===o.status)if("text"===r)n(o.response);else{var A=new FileReader;A.addEventListener("load",(function(){return n(A.result)}),!1),A.addEventListener("error",(function(A){return s(A)}),!1),A.readAsDataURL(o.response)}else s("Failed to proxy resource ".concat(i," with status code ").concat(o.status))},o.onerror=s;var a=e.indexOf("?")>-1?"&":"?";if(o.open("GET","".concat(e).concat(a,"url=").concat(encodeURIComponent(A),"&responseType=").concat(r)),"text"!==r&&o instanceof XMLHttpRequest&&(o.responseType=r),t.KA.imageTimeout){var c=t.KA.imageTimeout;o.timeout=c,o.ontimeout=function(){return s("Timed out (".concat(c,"ms) proxying ").concat(i))}}o.send()}))},A})(),zf=/^data:image\/svg\+xml/i,Aw=/^data:image\/.*;base64,/i,tw=/^data:image\/.*/i,ew=function(A){return UB.SUPPORT_SVG_DRAWING||!rw(A)},iw=function(A){return tw.test(A)},nw=function(A){return Aw.test(A)},sw=function(A){return"blob"===A.substr(0,4)},rw=function(A){return"svg"===A.substr(-3).toLowerCase()||zf.test(A)},ow=(function(){function A(A,t){this.type=0,this.x=A,this.y=t}return A.prototype.add=function(t,e){return new A(this.x+t,this.y+e)},A})(),aw=function(A,t,e){return new ow(A.x+(t.x-A.x)*e,A.y+(t.y-A.y)*e)},cw=(function(){function A(A,t,e,i){this.type=1,this.start=A,this.startControl=t,this.endControl=e,this.end=i}return A.prototype.subdivide=function(t,e){var i=aw(this.start,this.startControl,t),n=aw(this.startControl,this.endControl,t),s=aw(this.endControl,this.end,t),r=aw(i,n,t),o=aw(n,s,t),a=aw(r,o,t);return e?new A(this.start,i,r,a):new A(a,o,s,this.end)},A.prototype.add=function(t,e){return new A(this.start.add(t,e),this.startControl.add(t,e),this.endControl.add(t,e),this.end.add(t,e))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),uw=function(A){return 1===A.type},hw=function(A){var t=A.styles,e=A.bounds,i=sh(t.borderTopLeftRadius,e.width,e.height),n=i[0],s=i[1],r=sh(t.borderTopRightRadius,e.width,e.height),o=r[0],a=r[1],c=sh(t.borderBottomRightRadius,e.width,e.height),u=c[0],h=c[1],l=sh(t.borderBottomLeftRadius,e.width,e.height),d=l[0],B=l[1],f=[];f.push((n+o)/e.width),f.push((d+u)/e.width),f.push((s+B)/e.height),f.push((a+h)/e.height);var w=Math.max.apply(Math,f);w>1&&(n/=w,s/=w,o/=w,a/=w,u/=w,h/=w,d/=w,B/=w);var g=e.width-o,p=e.height-h,v=e.width-u,m=e.height-B,Q=t.borderTopWidth,C=t.borderRightWidth,U=t.borderBottomWidth,F=t.borderLeftWidth,y=rh(t.paddingTop,A.bounds.width),b=rh(t.paddingRight,A.bounds.width),E=rh(t.paddingBottom,A.bounds.width),I=rh(t.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?lw(e.left+F/3,e.top+Q/3,n-F/3,s-Q/3,Kf.TOP_LEFT):new ow(e.left+F/3,e.top+Q/3),this.topRightBorderDoubleOuterBox=n>0||s>0?lw(e.left+g,e.top+Q/3,o-C/3,a-Q/3,Kf.TOP_RIGHT):new ow(e.left+e.width-C/3,e.top+Q/3),this.bottomRightBorderDoubleOuterBox=u>0||h>0?lw(e.left+v,e.top+p,u-C/3,h-U/3,Kf.BOTTOM_RIGHT):new ow(e.left+e.width-C/3,e.top+e.height-U/3),this.bottomLeftBorderDoubleOuterBox=d>0||B>0?lw(e.left+F/3,e.top+m,d-F/3,B-U/3,Kf.BOTTOM_LEFT):new ow(e.left+F/3,e.top+e.height-U/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?lw(e.left+2*F/3,e.top+2*Q/3,n-2*F/3,s-2*Q/3,Kf.TOP_LEFT):new ow(e.left+2*F/3,e.top+2*Q/3),this.topRightBorderDoubleInnerBox=n>0||s>0?lw(e.left+g,e.top+2*Q/3,o-2*C/3,a-2*Q/3,Kf.TOP_RIGHT):new ow(e.left+e.width-2*C/3,e.top+2*Q/3),this.bottomRightBorderDoubleInnerBox=u>0||h>0?lw(e.left+v,e.top+p,u-2*C/3,h-2*U/3,Kf.BOTTOM_RIGHT):new ow(e.left+e.width-2*C/3,e.top+e.height-2*U/3),this.bottomLeftBorderDoubleInnerBox=d>0||B>0?lw(e.left+2*F/3,e.top+m,d-2*F/3,B-2*U/3,Kf.BOTTOM_LEFT):new ow(e.left+2*F/3,e.top+e.height-2*U/3),this.topLeftBorderStroke=n>0||s>0?lw(e.left+F/2,e.top+Q/2,n-F/2,s-Q/2,Kf.TOP_LEFT):new ow(e.left+F/2,e.top+Q/2),this.topRightBorderStroke=n>0||s>0?lw(e.left+g,e.top+Q/2,o-C/2,a-Q/2,Kf.TOP_RIGHT):new ow(e.left+e.width-C/2,e.top+Q/2),this.bottomRightBorderStroke=u>0||h>0?lw(e.left+v,e.top+p,u-C/2,h-U/2,Kf.BOTTOM_RIGHT):new ow(e.left+e.width-C/2,e.top+e.height-U/2),this.bottomLeftBorderStroke=d>0||B>0?lw(e.left+F/2,e.top+m,d-F/2,B-U/2,Kf.BOTTOM_LEFT):new ow(e.left+F/2,e.top+e.height-U/2),this.topLeftBorderBox=n>0||s>0?lw(e.left,e.top,n,s,Kf.TOP_LEFT):new ow(e.left,e.top),this.topRightBorderBox=o>0||a>0?lw(e.left+g,e.top,o,a,Kf.TOP_RIGHT):new ow(e.left+e.width,e.top),this.bottomRightBorderBox=u>0||h>0?lw(e.left+v,e.top+p,u,h,Kf.BOTTOM_RIGHT):new ow(e.left+e.width,e.top+e.height),this.bottomLeftBorderBox=d>0||B>0?lw(e.left,e.top+m,d,B,Kf.BOTTOM_LEFT):new ow(e.left,e.top+e.height),this.topLeftPaddingBox=n>0||s>0?lw(e.left+F,e.top+Q,Math.max(0,n-F),Math.max(0,s-Q),Kf.TOP_LEFT):new ow(e.left+F,e.top+Q),this.topRightPaddingBox=o>0||a>0?lw(e.left+Math.min(g,e.width-C),e.top+Q,g>e.width+C?0:Math.max(0,o-C),Math.max(0,a-Q),Kf.TOP_RIGHT):new ow(e.left+e.width-C,e.top+Q),this.bottomRightPaddingBox=u>0||h>0?lw(e.left+Math.min(v,e.width-F),e.top+Math.min(p,e.height-U),Math.max(0,u-C),Math.max(0,h-U),Kf.BOTTOM_RIGHT):new ow(e.left+e.width-C,e.top+e.height-U),this.bottomLeftPaddingBox=d>0||B>0?lw(e.left+F,e.top+Math.min(m,e.height-U),Math.max(0,d-F),Math.max(0,B-U),Kf.BOTTOM_LEFT):new ow(e.left+F,e.top+e.height-U),this.topLeftContentBox=n>0||s>0?lw(e.left+F+I,e.top+Q+y,Math.max(0,n-(F+I)),Math.max(0,s-(Q+y)),Kf.TOP_LEFT):new ow(e.left+F+I,e.top+Q+y),this.topRightContentBox=o>0||a>0?lw(e.left+Math.min(g,e.width+F+I),e.top+Q+y,g>e.width+F+I?0:o-F+I,a-(Q+y),Kf.TOP_RIGHT):new ow(e.left+e.width-(C+b),e.top+Q+y),this.bottomRightContentBox=u>0||h>0?lw(e.left+Math.min(v,e.width-(F+I)),e.top+Math.min(p,e.height+Q+y),Math.max(0,u-(C+b)),h-(U+E),Kf.BOTTOM_RIGHT):new ow(e.left+e.width-(C+b),e.top+e.height-(U+E)),this.bottomLeftContentBox=d>0||B>0?lw(e.left+F+I,e.top+m,Math.max(0,d-(F+I)),B-(U+E),Kf.BOTTOM_LEFT):new ow(e.left+F+I,e.top+e.height-(U+E))};(Df=Kf||(Kf={}))[Df.TOP_LEFT=0]="TOP_LEFT",Df[Df.TOP_RIGHT=1]="TOP_RIGHT",Df[Df.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",Df[Df.BOTTOM_LEFT=3]="BOTTOM_LEFT";var lw=function(A,t,e,i,n){var s=(Math.sqrt(2)-1)/3*4,r=e*s,o=i*s,a=A+e,c=t+i;switch(n){case Kf.TOP_LEFT:return new cw(new ow(A,c),new ow(A,c-o),new ow(a-r,t),new ow(a,t));case Kf.TOP_RIGHT:return new cw(new ow(A,t),new ow(A+r,t),new ow(a,c-o),new ow(a,c));case Kf.BOTTOM_RIGHT:return new cw(new ow(a,t),new ow(a,t+o),new ow(A+r,c),new ow(A,c));case Kf.BOTTOM_LEFT:default:return new cw(new ow(a,c),new ow(a-r,c),new ow(A,t+o),new ow(A,t))}},dw=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Bw=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},fw=function(A,t,e){this.offsetX=A,this.offsetY=t,this.matrix=e,this.type=0,this.target=6},ww=function(A,t){this.path=A,this.target=t,this.type=1},gw=function(A){this.opacity=A,this.type=2,this.target=6},pw=function(A){return 1===A.type},vw=function(A,t){return A.length===t.length&&A.some((function(A,e){return A===t[e]}))},mw=function(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Qw=(function(){function A(A,t){if(this.container=A,this.parent=t,this.effects=[],this.curves=new hw(this.container),this.container.styles.opacity<1&&this.effects.push(new gw(this.container.styles.opacity)),null!==this.container.styles.transform){var e=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new fw(e,i,n))}if(0!==this.container.styles.overflowX){var s=dw(this.curves),r=Bw(this.curves);vw(s,r)?this.effects.push(new ww(s,6)):(this.effects.push(new ww(s,2)),this.effects.push(new ww(r,4)))}}return A.prototype.getEffects=function(A){for(var t=-1===[2,3].indexOf(this.container.styles.position),e=this.parent,i=this.effects.slice(0);e;){var n=e.effects.filter((function(A){return!pw(A)}));if(t||0!==e.container.styles.position||!e.parent){if(t=-1===[2,3].indexOf(e.container.styles.position),0!==e.container.styles.overflowX){var s=dw(e.curves),r=Bw(e.curves);vw(s,r)||i.unshift(new ww(r,6))}i.unshift.apply(i,n)}else i.unshift.apply(i,n);e=e.parent}return i.filter((function(t){return Ld(t.target,A)}))},A})(),Cw=function(A,t,e,i){A.container.elements.forEach((function(n){var s=Ld(n.flags,4),r=Ld(n.flags,2),o=new Qw(n,A);Ld(n.styles.display,2048)&&i.push(o);var a=Ld(n.flags,8)?[]:i;if(s||r){var c=s||n.styles.isPositioned()?e:t,u=new mw(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var l=0;c.negativeZIndex.some((function(A,t){return h>A.element.container.styles.zIndex.order?(l=t,!1):l>0})),c.negativeZIndex.splice(l,0,u)}else if(h>0){var d=0;c.positiveZIndex.some((function(A,t){return h>=A.element.container.styles.zIndex.order?(d=t+1,!1):d>0})),c.positiveZIndex.splice(d,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Cw(o,u,s?u:e,a)}else n.styles.isInlineLevel()?t.inlineLevel.push(o):t.nonInlineLevel.push(o),Cw(o,t,e,a);Ld(n.flags,8)&&Uw(n,a)}))},Uw=function(A,t){for(var e=A instanceof MB?A.start:1,i=A instanceof MB&&A.reversed,n=0;n<t.length;n++){var s=t[n];s.container instanceof DB&&"number"==typeof s.container.value&&0!==s.container.value&&(e=s.container.value),s.listValue=Sf(e,s.container.styles.listStyleType,!0),e+=i?-1:1}},Fw=function(A,t){switch(t){case 0:return bw(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return bw(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return bw(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return bw(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},yw=function(A,t){var e=[];return uw(A)?e.push(A.subdivide(.5,!1)):e.push(A),uw(t)?e.push(t.subdivide(.5,!0)):e.push(t),e},bw=function(A,t,e,i){var n=[];return uw(A)?n.push(A.subdivide(.5,!1)):n.push(A),uw(e)?n.push(e.subdivide(.5,!0)):n.push(e),uw(i)?n.push(i.subdivide(.5,!0).reverse()):n.push(i),uw(t)?n.push(t.subdivide(.5,!1).reverse()):n.push(t),n},Ew=function(A){var t=A.bounds,e=A.styles;return t.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},Iw=function(A){var t=A.styles,e=A.bounds,i=rh(t.paddingLeft,e.width),n=rh(t.paddingRight,e.width),s=rh(t.paddingTop,e.width),r=rh(t.paddingBottom,e.width);return e.add(i+t.borderLeftWidth,s+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+i+n),-(t.borderTopWidth+t.borderBottomWidth+s+r))},kw=function(A,t,e){var i,n,s=(n=A,0===(i=Ow(A.styles.backgroundOrigin,t))?n.bounds:2===i?Iw(n):Ew(n)),r=(function(A,t){return 0===A?t.bounds:2===A?Iw(t):Ew(t)})(Ow(A.styles.backgroundClip,t),A),o=Tw(Ow(A.styles.backgroundSize,t),e,s),a=o[0],c=o[1],u=sh(Ow(A.styles.backgroundPosition,t),s.width-a,s.height-c);return[Kw(Ow(A.styles.backgroundRepeat,t),u,o,s,r),Math.round(s.left+u[0]),Math.round(s.top+u[1]),a=Math.max(1,a),c=Math.max(1,c)]},Hw=function(A){return Ju(A)&&A.value===Qc.AUTO},Sw=function(A){return"number"==typeof A},Tw=function(A,t,e){var i=t[0],n=t[1],s=t[2],r=A[0],o=A[1];if(!r)return[0,0];if(Ah(r)&&o&&Ah(o))return[rh(r,e.width),rh(o,e.height)];var a=Sw(s);if(Ju(r)&&(r.value===Qc.CONTAIN||r.value===Qc.COVER))return Sw(s)?e.width/e.height<s!=(r.value===Qc.COVER)?[e.width,e.width/s]:[e.height*s,e.height]:[e.width,e.height];var c=Sw(i),u=Sw(n),h=c||u;if(Hw(r)&&(!o||Hw(o)))return c&&u?[i,n]:a||h?h&&a?[c?i:n*s,u?n:i/s]:[c?i:e.width,u?n:e.height]:[e.width,e.height];if(a){var l=0,d=0;return Ah(r)?l=rh(r,e.width):Ah(o)&&(d=rh(o,e.height)),Hw(r)?l=d*s:o&&!Hw(o)||(d=l/s),[l,d]}var B=null,f=null;if(Ah(r)?B=rh(r,e.width):o&&Ah(o)&&(f=rh(o,e.height)),null===B||o&&!Hw(o)||(f=c&&u?B/i*n:e.height),null!==f&&Hw(r)&&(B=c&&u?f/n*i:e.width),null!==B&&null!==f)return[B,f];throw new Error("Unable to calculate background-size for element")},Ow=function(A,t){var e=A[t];return void 0===e?A[0]:e},Kw=function(A,t,e,i,n){var s=t[0],r=t[1],o=e[0],a=e[1];switch(A){case 2:return[new ow(Math.round(i.left),Math.round(i.top+r)),new ow(Math.round(i.left+i.width),Math.round(i.top+r)),new ow(Math.round(i.left+i.width),Math.round(a+i.top+r)),new ow(Math.round(i.left),Math.round(a+i.top+r))];case 3:return[new ow(Math.round(i.left+s),Math.round(i.top)),new ow(Math.round(i.left+s+o),Math.round(i.top)),new ow(Math.round(i.left+s+o),Math.round(i.height+i.top)),new ow(Math.round(i.left+s),Math.round(i.height+i.top))];case 1:return[new ow(Math.round(i.left+s),Math.round(i.top+r)),new ow(Math.round(i.left+s+o),Math.round(i.top+r)),new ow(Math.round(i.left+s+o),Math.round(i.top+r+a)),new ow(Math.round(i.left+s),Math.round(i.top+r+a))];default:return[new ow(Math.round(n.left),Math.round(n.top)),new ow(Math.round(n.left+n.width),Math.round(n.top)),new ow(Math.round(n.left+n.width),Math.round(n.height+n.top)),new ow(Math.round(n.left),Math.round(n.height+n.top))]}},Dw="Hidden Text",Mw=(function(){function A(A){this.MA={},this.LA=A}return A.prototype.parseMetrics=function(A,t){var e=this.LA.createElement("div"),i=this.LA.createElement("img"),n=this.LA.createElement("span"),s=this.LA.body;e.style.visibility="hidden",e.style.fontFamily=A,e.style.fontSize=t,e.style.margin="0",e.style.padding="0",e.style.whiteSpace="nowrap",s.appendChild(e),i.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",n.style.fontFamily=A,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this.LA.createTextNode(Dw)),e.appendChild(n),e.appendChild(i);var r=i.offsetTop-n.offsetTop+2;e.removeChild(n),e.appendChild(this.LA.createTextNode(Dw)),e.style.lineHeight="normal",i.style.verticalAlign="super";var o=i.offsetTop-e.offsetTop+2;return s.removeChild(e),{baseline:r,middle:o}},A.prototype.getMetrics=function(A,t){var e="".concat(A," ").concat(t);return void 0===this.MA[e]&&(this.MA[e]=this.parseMetrics(A,t)),this.MA[e]},A})(),Lw=function(A,t){this.context=A,this.options=t},xw=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.xA=[],i.canvas=e.canvas?e.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),e.canvas||(i.canvas.width=Math.floor(e.width*e.scale),i.canvas.height=Math.floor(e.height*e.scale),i.canvas.style.width="".concat(e.width,"px"),i.canvas.style.height="".concat(e.height,"px")),i.fontMetrics=new Mw(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-e.x,-e.y),i.ctx.textBaseline="bottom",i.xA=[],i.context.logger.debug("Canvas renderer initialized (".concat(e.width,"x").concat(e.height,") with scale ").concat(e.scale)),i}return Wa(t,A),t.prototype.applyEffects=function(A){for(var t=this;this.xA.length;)this.popEffect();A.forEach((function(A){return t.applyEffect(A)}))},t.prototype.applyEffect=function(A){this.ctx.save(),(function(A){return 2===A.type})(A)&&(this.ctx.globalAlpha=A.opacity),(function(A){return 0===A.type})(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),pw(A)&&(this.path(A.path),this.ctx.clip()),this.xA.push(A)},t.prototype.popEffect=function(){this.xA.pop(),this.ctx.restore()},t.prototype.renderStack=function(A){return qa(this,void 0,void 0,(function(){return za(this,(function(t){switch(t.label){case 0:return A.element.container.styles.isVisible()?[4,this.renderStackContent(A)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.renderNode=function(A){return qa(this,void 0,void 0,(function(){return za(this,(function(t){switch(t.label){case 0:return Ld(A.container.flags,16),A.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(A)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(A)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype.renderTextWithLetterSpacing=function(A,t,e){var i=this;0===t?-1===navigator.userAgent.indexOf("Firefox")?(this.ctx.textBaseline="ideographic",this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+A.bounds.height)):this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+e):bB(A.text).reduce((function(t,n){return i.ctx.fillText(n,t,A.bounds.top+e),t+i.ctx.measureText(n).width}),A.bounds.left)},t.prototype.createFontStyle=function(A){var t=A.fontVariant.filter((function(A){return"normal"===A||"small-caps"===A})).join(""),e=Gw(A.fontFamily).join(", "),i=Pu(A.fontSize)?"".concat(A.fontSize.number).concat(A.fontSize.unit):"".concat(A.fontSize.number,"px");return[[A.fontStyle,t,A.fontWeight,i,e].join(" "),e,i]},t.prototype.renderTextNode=function(A,t){return qa(this,void 0,void 0,(function(){var e,i,n=this;return za(this,(function(s){return e=this.createFontStyle(t)[0],this.ctx.font=e,this.ctx.direction=1===t.direction?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",i=t.paintOrder,A.textBounds.forEach((function(A){i.forEach((function(e){switch(e){case 0:n.ctx.fillStyle=Bh(t.color),n.renderTextWithLetterSpacing(A,t.letterSpacing,t.fontSize.number);var i=t.textShadow;i.length&&A.text.trim().length&&(i.slice(0).reverse().forEach((function(e){n.ctx.shadowColor=Bh(e.color),n.ctx.shadowOffsetX=e.offsetX.number*n.options.scale,n.ctx.shadowOffsetY=e.offsetY.number*n.options.scale,n.ctx.shadowBlur=e.blur.number,n.renderTextWithLetterSpacing(A,t.letterSpacing,t.fontSize.number)})),n.ctx.shadowColor="",n.ctx.shadowOffsetX=0,n.ctx.shadowOffsetY=0,n.ctx.shadowBlur=0),t.textDecorationLine.length&&(n.ctx.fillStyle=Bh(t.textDecorationColor||t.color),t.textDecorationLine.forEach((function(t){switch(t){case 1:n.ctx.fillRect(A.bounds.left,A.bounds.top+A.bounds.height-1,A.bounds.width,1);break;case 2:n.ctx.fillRect(A.bounds.left,A.bounds.top,A.bounds.width,1);break;case 3:n.ctx.fillRect(A.bounds.left,A.bounds.top+(A.bounds.height/2-.5),A.bounds.width,1)}})));break;case 1:t.webkitTextStrokeWidth&&A.text.trim().length&&(n.ctx.strokeStyle=Bh(t.webkitTextStrokeColor),n.ctx.lineWidth=t.webkitTextStrokeWidth,n.ctx.lineJoin=window.chrome?"miter":"round",n.ctx.strokeText(A.text,A.bounds.left,A.bounds.top+A.bounds.height)),n.ctx.strokeStyle="",n.ctx.lineWidth=0,n.ctx.lineJoin="miter"}}))})),[2]}))}))},t.prototype.renderReplacedElement=function(A,t,e){var i=e.naturalWidth||A.intrinsicWidth,n=e.naturalHeight||A.intrinsicHeight;if(e&&i>0&&n>0){var s=Iw(A),r=Bw(t);this.path(r),this.ctx.save(),this.ctx.clip();var o=0,a=0,c=i,u=n,h=s.left,l=s.top,d=s.width,B=s.height,f=A.styles.objectFit,w=d/B,g=c/u;2===f?g>w?(B=d/g,l+=(s.height-B)/2):(d=B*g,h+=(s.width-d)/2):4===f?g>w?o+=(i-(c=u*w))/2:a+=(n-(u=c/w))/2:8===f?(c>d?(o+=(c-d)/2,c=d):(h+=(d-c)/2,d=c),u>B?(a+=(u-B)/2,u=B):(l+=(B-u)/2,B=u)):16===f&&((g>w?d:B*g)<(c>d?c:d)?g>w?(B=d/g,l+=(s.height-B)/2):(d=B*g,h+=(s.width-d)/2):(c>d?(o+=(c-d)/2,c=d):(h+=(d-c)/2,d=c),u>B?(a+=(u-B)/2,u=B):(l+=(B-u)/2,B=u))),this.ctx.drawImage(e,o,a,c,u,h,l,d,B),this.ctx.restore()}},t.prototype.renderNodeContent=function(A){return qa(this,void 0,void 0,(function(){var e,i,n,s,r,o,a,c,u,h,l,d,B,f,w,g,p,v,m;return za(this,(function(Q){switch(Q.label){case 0:this.applyEffects(A.getEffects(4)),e=A.container,i=A.curves,n=e.styles,s=0,r=e.textNodes,Q.label=1;case 1:return s<r.length?(o=r[s],[4,this.renderTextNode(o,n)]):[3,4];case 2:Q.sent(),Q.label=3;case 3:return s++,[3,1];case 4:if(!(e instanceof TB))return[3,8];Q.label=5;case 5:return Q.trys.push([5,7,,8]),[4,this.context.cache.match(e.src)];case 6:return g=Q.sent(),this.renderReplacedElement(e,i,g),[3,8];case 7:return Q.sent(),this.context.logger.error("Error loading image ".concat(e.src)),[3,8];case 8:if(e instanceof OB&&this.renderReplacedElement(e,i,e.canvas),!(e instanceof KB))return[3,12];Q.label=9;case 9:return Q.trys.push([9,11,,12]),[4,this.context.cache.match(e.svg)];case 10:return g=Q.sent(),this.renderReplacedElement(e,i,g),[3,12];case 11:return Q.sent(),this.context.logger.error("Error loading svg ".concat(e.svg.substring(0,255))),[3,12];case 12:return e instanceof VB&&e.tree?[4,new t(this.context,{scale:this.options.scale,backgroundColor:e.backgroundColor,x:0,y:0,width:e.width,height:e.height}).render(e.tree)]:[3,14];case 13:a=Q.sent(),e.width&&e.height&&this.ctx.drawImage(a,0,0,e.width,e.height,e.bounds.left,e.bounds.top,e.bounds.width,e.bounds.height),Q.label=14;case 14:if(e instanceof jB&&(c=Math.min(e.bounds.width,e.bounds.height),e.type===_B?e.checked&&(this.ctx.save(),this.path([new ow(e.bounds.left+.39363*c,e.bounds.top+.79*c),new ow(e.bounds.left+.16*c,e.bounds.top+.5549*c),new ow(e.bounds.left+.27347*c,e.bounds.top+.44071*c),new ow(e.bounds.left+.39694*c,e.bounds.top+.5649*c),new ow(e.bounds.left+.72983*c,e.bounds.top+.23*c),new ow(e.bounds.left+.84*c,e.bounds.top+.34085*c),new ow(e.bounds.left+.39363*c,e.bounds.top+.79*c)]),this.ctx.fillStyle=Bh(RB),this.ctx.fill(),this.ctx.restore()):e.type===NB&&e.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(e.bounds.left+c/2,e.bounds.top+c/2,c/4,0,2*Math.PI,!0),this.ctx.fillStyle=Bh(RB),this.ctx.fill(),this.ctx.restore())),_w(e)&&e.value.length){switch(u=this.createFontStyle(n),v=u[0],h=u[1],l=u[2],d=this.fontMetrics.getMetrics(h,l).baseline,this.ctx.font=v,this.ctx.fillStyle=Bh(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Rw(e.styles.textAlign),m=Iw(e),B=0,e.styles.textAlign){case 1:B+=m.width/2;break;case 2:B+=m.width}f=m.add(B,0,0,-m.height/2+1),this.ctx.save(),this.path([new ow(m.left,m.top),new ow(m.left+m.width,m.top),new ow(m.left+m.width,m.top+m.height),new ow(m.left,m.top+m.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new FB(e.value,f),n.letterSpacing,d),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ld(e.styles.display,2048))return[3,20];if(null===e.styles.listStyleImage)return[3,19];if(0!==(w=e.styles.listStyleImage).type)return[3,18];g=void 0,p=w.url,Q.label=15;case 15:return Q.trys.push([15,17,,18]),[4,this.context.cache.match(p)];case 16:return g=Q.sent(),this.ctx.drawImage(g,e.bounds.left-(g.width+10),e.bounds.top),[3,18];case 17:return Q.sent(),this.context.logger.error("Error loading list-style-image ".concat(p)),[3,18];case 18:return[3,20];case 19:A.listValue&&-1!==e.styles.listStyleType&&(v=this.createFontStyle(n)[0],this.ctx.font=v,this.ctx.fillStyle=Bh(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",m=new tc(e.bounds.left,e.bounds.top+rh(e.styles.paddingTop,e.bounds.width),e.bounds.width,Ad(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new FB(A.listValue,m),n.letterSpacing,Ad(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),Q.label=20;case 20:return[2]}}))}))},t.prototype.renderStackContent=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,s,r,o,a,c,u,h,l,d,B,f;return za(this,(function(w){switch(w.label){case 0:return Ld(A.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(A.element)];case 1:w.sent(),t=0,e=A.negativeZIndex,w.label=2;case 2:return t<e.length?(f=e[t],[4,this.renderStack(f)]):[3,5];case 3:w.sent(),w.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(A.element)];case 6:w.sent(),i=0,n=A.nonInlineLevel,w.label=7;case 7:return i<n.length?(f=n[i],[4,this.renderNode(f)]):[3,10];case 8:w.sent(),w.label=9;case 9:return i++,[3,7];case 10:s=0,r=A.nonPositionedFloats,w.label=11;case 11:return s<r.length?(f=r[s],[4,this.renderStack(f)]):[3,14];case 12:w.sent(),w.label=13;case 13:return s++,[3,11];case 14:o=0,a=A.nonPositionedInlineLevel,w.label=15;case 15:return o<a.length?(f=a[o],[4,this.renderStack(f)]):[3,18];case 16:w.sent(),w.label=17;case 17:return o++,[3,15];case 18:c=0,u=A.inlineLevel,w.label=19;case 19:return c<u.length?(f=u[c],[4,this.renderNode(f)]):[3,22];case 20:w.sent(),w.label=21;case 21:return c++,[3,19];case 22:h=0,l=A.zeroOrAutoZIndexOrTransformedOrOpacity,w.label=23;case 23:return h<l.length?(f=l[h],[4,this.renderStack(f)]):[3,26];case 24:w.sent(),w.label=25;case 25:return h++,[3,23];case 26:d=0,B=A.positiveZIndex,w.label=27;case 27:return d<B.length?(f=B[d],[4,this.renderStack(f)]):[3,30];case 28:w.sent(),w.label=29;case 29:return d++,[3,27];case 30:return[2]}}))}))},t.prototype.mask=function(A){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(A.slice(0).reverse()),this.ctx.closePath()},t.prototype.path=function(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()},t.prototype.formatPath=function(A){var t=this;A.forEach((function(A,e){var i=uw(A)?A.start:A;0===e?t.ctx.moveTo(i.x,i.y):t.ctx.lineTo(i.x,i.y),uw(A)&&t.ctx.bezierCurveTo(A.startControl.x,A.startControl.y,A.endControl.x,A.endControl.y,A.end.x,A.end.y)}))},t.prototype.renderRepeat=function(A,t,e,i){this.path(A),this.ctx.fillStyle=t,this.ctx.translate(e,i),this.ctx.fill(),this.ctx.translate(-e,-i)},t.prototype.resizeImage=function(A,t,e){var i,n=(null!==(i=this.canvas.ownerDocument)&&void 0!==i?i:document).createElement("canvas");return n.width=Math.max(1,t),n.height=Math.max(1,e),n.getContext("2d").drawImage(A,0,0,A.width,A.height,0,0,t,e),n},t.prototype.renderBackgroundImage=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,s,r;return za(this,(function(o){switch(o.label){case 0:t=A.styles.backgroundImage.length-1,e=function(e){var n,s,r,o,a,c,u,h,l,d,B,f,w,g,p,v,m,Q,C,U,F,y,b,E,I,k,H,S,T,O,K,D,M;return za(this,(function(L){switch(L.label){case 0:if(0!==e.type)return[3,5];n=void 0,s=e.url,L.label=1;case 1:return L.trys.push([1,3,,4]),[4,i.context.cache.match(s)];case 2:return n=L.sent(),[3,4];case 3:return L.sent(),i.context.logger.error("Error loading background-image ".concat(s)),[3,4];case 4:return n&&(r=isNaN(n.width)||0===n.width?1:n.width,o=isNaN(n.height)||0===n.height?1:n.height,a=kw(A,t,[r,o,r/o]),Q=a[0],E=a[1],I=a[2],F=a[3],y=a[4],v=i.ctx.createPattern(i.resizeImage(n,F,y),"repeat"),i.renderRepeat(Q,v,E,I)),[3,6];case 5:1===e.type?(c=kw(A,t,[null,null,null]),Q=c[0],E=c[1],I=c[2],F=c[3],y=c[4],u=(function(A,t,e){var i="number"==typeof A?A:(function(A,t,e){var i=t/2,n=e/2,s=rh(A[0],t)-i,r=n-rh(A[1],e);return(Math.atan2(r,s)+2*Math.PI)%(2*Math.PI)})(A,t,e),n=Math.abs(t*Math.sin(i))+Math.abs(e*Math.cos(i)),s=t/2,r=e/2,o=n/2,a=Math.sin(i-Math.PI/2)*o,c=Math.cos(i-Math.PI/2)*o;return[n,s-c,s+c,r-a,r+a]})(e.angle,F,y),h=u[0],l=u[1],d=u[2],B=u[3],f=u[4],(w=document.createElement("canvas")).width=F,w.height=y,g=w.getContext("2d"),p=g.createLinearGradient(l,B,d,f),Al(e.stops,h||1).forEach((function(A){return p.addColorStop(A.stop,Bh(A.color))})),g.fillStyle=p,g.fillRect(0,0,F,y),F>0&&y>0&&(v=i.ctx.createPattern(w,"repeat"),i.renderRepeat(Q,v,E,I))):2===e.type&&(m=kw(A,t,[null,null,null]),Q=m[0],C=m[1],U=m[2],F=m[3],y=m[4],b=0===e.position.length?[ih]:e.position,E=rh(b[0],F),I=rh(b[b.length-1],y),k=(function(A,t,e,i,n){var s=0,r=0;switch(A.size){case 0:0===A.shape?s=r=Math.min(Math.abs(t),Math.abs(t-i),Math.abs(e),Math.abs(e-n)):1===A.shape&&(s=Math.min(Math.abs(t),Math.abs(t-i)),r=Math.min(Math.abs(e),Math.abs(e-n)));break;case 2:if(0===A.shape)s=r=Math.min(tl(t,e),tl(t,e-n),tl(t-i,e),tl(t-i,e-n));else if(1===A.shape){var o=Math.min(Math.abs(e),Math.abs(e-n))/Math.min(Math.abs(t),Math.abs(t-i)),a=el(i,n,t,e,!0),c=a[0],u=a[1];r=o*(s=tl(c-t,(u-e)/o))}break;case 1:0===A.shape?s=r=Math.max(Math.abs(t),Math.abs(t-i),Math.abs(e),Math.abs(e-n)):1===A.shape&&(s=Math.max(Math.abs(t),Math.abs(t-i)),r=Math.max(Math.abs(e),Math.abs(e-n)));break;case 3:if(0===A.shape)s=r=Math.max(tl(t,e),tl(t,e-n),tl(t-i,e),tl(t-i,e-n));else if(1===A.shape){o=Math.max(Math.abs(e),Math.abs(e-n))/Math.max(Math.abs(t),Math.abs(t-i));var h=el(i,n,t,e,!1);c=h[0],u=h[1],r=o*(s=tl(c-t,(u-e)/o))}}return Array.isArray(A.size)&&(s=rh(A.size[0],i),r=2===A.size.length?rh(A.size[1],n):s),[s,r]})(e,E,I,F,y),H=k[0],S=k[1],H>0&&S>0&&(T=i.ctx.createRadialGradient(C+E,U+I,0,C+E,U+I,H),Al(e.stops,2*H).forEach((function(A){return T.addColorStop(A.stop,Bh(A.color))})),i.path(Q),i.ctx.fillStyle=T,H!==S?(O=A.bounds.left+.5*A.bounds.width,K=A.bounds.top+.5*A.bounds.height,M=1/(D=S/H),i.ctx.save(),i.ctx.translate(O,K),i.ctx.transform(1,0,0,D,0,0),i.ctx.translate(-O,-K),i.ctx.fillRect(C,M*(U-K)+K,F,y*M),i.ctx.restore()):i.ctx.fill())),L.label=6;case 6:return t--,[2]}}))},i=this,n=0,s=A.styles.backgroundImage.slice(0).reverse(),o.label=1;case 1:return n<s.length?(r=s[n],[5,e(r)]):[3,4];case 2:o.sent(),o.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.renderSolidBorder=function(A,t,e){return qa(this,void 0,void 0,(function(){return za(this,(function(i){return this.path(Fw(e,t)),this.ctx.fillStyle=Bh(A),this.ctx.fill(),[2]}))}))},t.prototype.renderDoubleBorder=function(A,t,e,i){return qa(this,void 0,void 0,(function(){var n,s;return za(this,(function(r){switch(r.label){case 0:return t<3?[4,this.renderSolidBorder(A,e,i)]:[3,2];case 1:return r.sent(),[2];case 2:return n=(function(A,t){switch(t){case 0:return bw(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return bw(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return bw(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return bw(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}})(i,e),this.path(n),this.ctx.fillStyle=Bh(A),this.ctx.fill(),s=(function(A,t){switch(t){case 0:return bw(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return bw(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return bw(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return bw(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}})(i,e),this.path(s),this.ctx.fill(),[2]}}))}))},t.prototype.renderNodeBackgroundAndBorders=function(A){return qa(this,void 0,void 0,(function(){var t,e,i,n,s,r,o,a,c=this;return za(this,(function(u){switch(u.label){case 0:return this.applyEffects(A.getEffects(2)),t=A.container.styles,e=!dh(t.backgroundColor)||t.backgroundImage.length,i=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],n=Nw(Ow(t.backgroundClip,0),A.curves),e||t.boxShadow.length?(this.ctx.save(),this.path(n),this.ctx.clip(),dh(t.backgroundColor)||(this.ctx.fillStyle=Bh(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(A.container)]):[3,2];case 1:u.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach((function(t){c.ctx.save();var e,i,n,s,r,o=dw(A.curves),a=t.inset?0:1e4,u=(e=o,i=-a+(t.inset?1:-1)*t.spread.number,n=(t.inset?1:-1)*t.spread.number,s=t.spread.number*(t.inset?-2:2),r=t.spread.number*(t.inset?-2:2),e.map((function(A,t){switch(t){case 0:return A.add(i,n);case 1:return A.add(i+s,n);case 2:return A.add(i+s,n+r);case 3:return A.add(i,n+r)}return A})));t.inset?(c.path(o),c.ctx.clip(),c.mask(u)):(c.mask(o),c.ctx.clip(),c.path(u)),c.ctx.shadowOffsetX=t.offsetX.number+a,c.ctx.shadowOffsetY=t.offsetY.number,c.ctx.shadowColor=Bh(t.color),c.ctx.shadowBlur=t.blur.number,c.ctx.fillStyle=t.inset?Bh(t.color):"rgba(0,0,0,1)",c.ctx.fill(),c.ctx.restore()})),u.label=2;case 2:s=0,r=0,o=i,u.label=3;case 3:return r<o.length?0!==(a=o[r]).style&&!dh(a.color)&&a.width>0?2!==a.style?[3,5]:[4,this.renderDashedDottedBorder(a.color,a.width,s,A.curves,2)]:[3,11]:[3,13];case 4:return u.sent(),[3,11];case 5:return 3!==a.style?[3,7]:[4,this.renderDashedDottedBorder(a.color,a.width,s,A.curves,3)];case 6:return u.sent(),[3,11];case 7:return 4!==a.style?[3,9]:[4,this.renderDoubleBorder(a.color,a.width,s,A.curves)];case 8:return u.sent(),[3,11];case 9:return[4,this.renderSolidBorder(a.color,s,A.curves)];case 10:u.sent(),u.label=11;case 11:s++,u.label=12;case 12:return r++,[3,3];case 13:return[2]}}))}))},t.prototype.renderDashedDottedBorder=function(A,t,e,i,n){return qa(this,void 0,void 0,(function(){var s,r,o,a,c,u,h,l,d,B,f,w,g,p,v,m;return za(this,(function(Q){return this.ctx.save(),s=(function(A,t){switch(t){case 0:return yw(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return yw(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return yw(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return yw(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}})(i,e),r=Fw(i,e),2===n&&(this.path(r),this.ctx.clip()),uw(r[0])?(o=r[0].start.x,a=r[0].start.y):(o=r[0].x,a=r[0].y),uw(r[1])?(c=r[1].end.x,u=r[1].end.y):(c=r[1].x,u=r[1].y),h=0===e||2===e?Math.abs(o-c):Math.abs(a-u),this.ctx.beginPath(),3===n?this.formatPath(s):this.formatPath(r.slice(0,2)),l=t<3?3*t:2*t,d=t<3?2*t:t,3===n&&(l=t,d=t),B=!0,h<=2*l?B=!1:h<=2*l+d?(l*=f=h/(2*l+d),d*=f):(w=Math.floor((h+d)/(l+d)),g=(h-w*l)/(w-1),d=(p=(h-(w+1)*l)/w)<=0||Math.abs(d-g)<Math.abs(d-p)?g:p),B&&(3===n?this.ctx.setLineDash([0,l+d]):this.ctx.setLineDash([l,d])),3===n?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=2*t+1.1,this.ctx.strokeStyle=Bh(A),this.ctx.stroke(),this.ctx.setLineDash([]),2===n&&(uw(r[0])&&(v=r[3],m=r[0],this.ctx.beginPath(),this.formatPath([new ow(v.end.x,v.end.y),new ow(m.start.x,m.start.y)]),this.ctx.stroke()),uw(r[1])&&(v=r[1],m=r[2],this.ctx.beginPath(),this.formatPath([new ow(v.end.x,v.end.y),new ow(m.start.x,m.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]}))}))},t.prototype.render=function(A){return qa(this,void 0,void 0,(function(){var t;return za(this,(function(e){switch(e.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Bh(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=(function(A){var t=new Qw(A,null),e=new mw(t),i=[];return Cw(t,e,e,i),Uw(t.container,i),e})(A),[4,this.renderStack(t)];case 1:return e.sent(),this.applyEffects([]),[2,this.canvas]}}))}))},t})(Lw),_w=function(A){return A instanceof PB||A instanceof GB||A instanceof jB&&A.type!==NB&&A.type!==_B},Nw=function(A,t){switch(A){case 0:return dw(t);case 2:return(function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]})(t);default:return Bw(t)}},Rw=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},jw=["-apple-system","system-ui"],Gw=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter((function(A){return-1===jw.indexOf(A)})):A},Pw=(function(A){function t(t,e){var i=A.call(this,t,e)||this;return i.canvas=e.canvas?e.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=e,i.canvas.width=Math.floor(e.width*e.scale),i.canvas.height=Math.floor(e.height*e.scale),i.canvas.style.width="".concat(e.width,"px"),i.canvas.style.height="".concat(e.height,"px"),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-e.x,-e.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(e.width,"x").concat(e.height," at ").concat(e.x,",").concat(e.y,") with scale ").concat(e.scale)),i}return Wa(t,A),t.prototype.render=function(A){return qa(this,void 0,void 0,(function(){var t,e;return za(this,(function(i){switch(i.label){case 0:return t=QB(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),[4,Vw(t)];case 1:return e=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Bh(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(e,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}}))}))},t})(Lw),Vw=function(A){return new Promise((function(t,e){var i=new Image;i.onload=function(){t(i)},i.onerror=e,i.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent((new XMLSerializer).serializeToString(A)))}))},Jw=(function(){function A(A){var t=A.id,e=A.enabled;this.id=t,this.enabled=e,this.start=Date.now()}return A.prototype.debug=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.debug?console.debug.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1)):this.info.apply(this,A))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&"undefined"!=typeof window&&window.console&&"function"==typeof console.info&&console.info.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1))},A.prototype.warn=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.warn?console.warn.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1)):this.info.apply(this,A))},A.prototype.error=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.error?console.error.apply(console,Ac([this.id,"".concat(this.getTime(),"ms")],A,!1)):this.info.apply(this,A))},A.instances={},A})(),Xw=(function(){function A(t,e){var i;this.windowBounds=e,this.instanceName="#".concat(A.instanceCount++),this.logger=new Jw({id:this.instanceName,enabled:t.logging}),this.cache=null!==(i=t.cache)&&void 0!==i?i:new qf(this,t)}return A.instanceCount=1,A})();"undefined"!=typeof window&&Zf.setContext(window);const $w=globalThis,Yw=$w.ShadowRoot&&(void 0===$w.ShadyCSS||$w.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ww=Symbol(),Zw=new WeakMap;let qw=class{constructor(A,t,e){if(this._A=!0,e!==Ww)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=A,this.t=t}get styleSheet(){let A=this.o;const t=this.t;if(Yw&&void 0===A){const e=void 0!==t&&1===t.length;e&&(A=Zw.get(t)),void 0===A&&((this.o=A=new CSSStyleSheet).replaceSync(this.cssText),e&&Zw.set(t,A))}return A}toString(){return this.cssText}};const zw=(A,...t)=>{const e=1===A.length?A[0]:t.reduce(((t,e,i)=>t+(A=>{if(!0===A._A)return A.cssText;if("number"==typeof A)return A;throw Error("Value passed to 'css' function must be a 'css' function result: "+A+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+A[i+1]),A[0]);return new qw(e,A,Ww)},Ag=Yw?A=>A:A=>A instanceof CSSStyleSheet?(A=>{let t="";for(const e of A.cssRules)t+=e.cssText;return(A=>new qw("string"==typeof A?A:A+"",void 0,Ww))(t)})(A):A,{is:tg,defineProperty:eg,getOwnPropertyDescriptor:ig,getOwnPropertyNames:ng,getOwnPropertySymbols:sg,getPrototypeOf:rg}=Object,og=globalThis,ag=og.trustedTypes,cg=ag?ag.emptyScript:"",ug=og.reactiveElementPolyfillSupport,hg=(A,t)=>A,lg={toAttribute(A,t){switch(t){case Boolean:A=A?cg:null;break;case Object:case Array:A=null==A?A:JSON.stringify(A)}return A},fromAttribute(A,t){let e=A;switch(t){case Boolean:e=null!==A;break;case Number:e=null===A?null:Number(A);break;case Object:case Array:try{e=JSON.parse(A)}catch(i){e=null}}return e}},dg=(A,t)=>!tg(A,t),Bg={attribute:!0,type:String,converter:lg,reflect:!1,useDefault:!1,hasChanged:dg};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),og.litPropertyMetadata??(og.litPropertyMetadata=new WeakMap);let fg=class extends HTMLElement{static addInitializer(A){this.NA(),(this.l??(this.l=[])).push(A)}static get observedAttributes(){return this.finalize(),this.RA&&[...this.RA.keys()]}static createProperty(A,t=Bg){if(t.state&&(t.attribute=!1),this.NA(),this.prototype.hasOwnProperty(A)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(A,t),!t.noAccessor){const e=Symbol(),i=this.getPropertyDescriptor(A,e,t);void 0!==i&&eg(this.prototype,A,i)}}static getPropertyDescriptor(A,t,e){const{get:i,set:n}=ig(this.prototype,A)??{get(){return this[t]},set(A){this[t]=A}};return{get:i,set(t){const s=i?.call(this);n?.call(this,t),this.requestUpdate(A,s,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(A){return this.elementProperties.get(A)??Bg}static NA(){if(this.hasOwnProperty(hg("elementProperties")))return;const A=rg(this);A.finalize(),void 0!==A.l&&(this.l=[...A.l]),this.elementProperties=new Map(A.elementProperties)}static finalize(){if(this.hasOwnProperty(hg("finalized")))return;if(this.finalized=!0,this.NA(),this.hasOwnProperty(hg("properties"))){const A=this.properties,t=[...ng(A),...sg(A)];for(const e of t)this.createProperty(e,A[e])}const A=this[Symbol.metadata];if(null!==A){const t=litPropertyMetadata.get(A);if(void 0!==t)for(const[A,e]of t)this.elementProperties.set(A,e)}this.RA=new Map;for(const[t,e]of this.elementProperties){const A=this.jA(t,e);void 0!==A&&this.RA.set(A,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(A){const t=[];if(Array.isArray(A)){const e=new Set(A.flat(1/0).reverse());for(const A of e)t.unshift(Ag(A))}else void 0!==A&&t.push(Ag(A));return t}static jA(A,t){const e=t.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof A?A.toLowerCase():void 0}constructor(){super(),this.GA=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.PA=null,this.VA()}VA(){this.JA=new Promise((A=>this.enableUpdating=A)),this.XA=new Map,this.$A(),this.requestUpdate(),this.constructor.l?.forEach((A=>A(this)))}addController(A){(this.YA??(this.YA=new Set)).add(A),void 0!==this.renderRoot&&this.isConnected&&A.hostConnected?.()}removeController(A){this.YA?.delete(A)}$A(){const A=new Map,t=this.constructor.elementProperties;for(const e of t.keys())this.hasOwnProperty(e)&&(A.set(e,this[e]),delete this[e]);A.size>0&&(this.GA=A)}createRenderRoot(){const A=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((A,t)=>{if(Yw)A.adoptedStyleSheets=t.map((A=>A instanceof CSSStyleSheet?A:A.styleSheet));else for(const e of t){const t=document.createElement("style"),i=$w.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=e.cssText,A.appendChild(t)}})(A,this.constructor.elementStyles),A}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this.YA?.forEach((A=>A.hostConnected?.()))}enableUpdating(A){}disconnectedCallback(){this.YA?.forEach((A=>A.hostDisconnected?.()))}attributeChangedCallback(A,t,e){this.WA(A,e)}ZA(A,t){const e=this.constructor.elementProperties.get(A),i=this.constructor.jA(A,e);if(void 0!==i&&!0===e.reflect){const n=(void 0!==e.converter?.toAttribute?e.converter:lg).toAttribute(t,e.type);this.PA=A,null==n?this.removeAttribute(i):this.setAttribute(i,n),this.PA=null}}WA(A,t){const e=this.constructor,i=e.RA.get(A);if(void 0!==i&&this.PA!==i){const A=e.getPropertyOptions(i),n="function"==typeof A.converter?{fromAttribute:A.converter}:void 0!==A.converter?.fromAttribute?A.converter:lg;this.PA=i,this[i]=n.fromAttribute(t,A.type)??this.qA?.get(i)??null,this.PA=null}}requestUpdate(A,t,e){if(void 0!==A){const i=this.constructor,n=this[A];if(e??(e=i.getPropertyOptions(A)),!((e.hasChanged??dg)(n,t)||e.useDefault&&e.reflect&&n===this.qA?.get(A)&&!this.hasAttribute(i.jA(A,e))))return;this.C(A,t,e)}!1===this.isUpdatePending&&(this.JA=this.zA())}C(A,t,{useDefault:e,reflect:i,wrapped:n},s){e&&!(this.qA??(this.qA=new Map)).has(A)&&(this.qA.set(A,s??t??this[A]),!0!==n||void 0!==s)||(this.XA.has(A)||(this.hasUpdated||e||(t=void 0),this.XA.set(A,t)),!0===i&&this.PA!==A&&(this.At??(this.At=new Set)).add(A))}async zA(){this.isUpdatePending=!0;try{await this.JA}catch(t){Promise.reject(t)}const A=this.scheduleUpdate();return null!=A&&await A,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.GA){for(const[A,t]of this.GA)this[A]=t;this.GA=void 0}const A=this.constructor.elementProperties;if(A.size>0)for(const[t,e]of A){const{wrapped:A}=e,i=this[t];!0!==A||this.XA.has(t)||void 0===i||this.C(t,void 0,e,i)}}let A=!1;const t=this.XA;try{A=this.shouldUpdate(t),A?(this.willUpdate(t),this.YA?.forEach((A=>A.hostUpdate?.())),this.update(t)):this.tt()}catch(e){throw A=!1,this.tt(),e}A&&this.et(t)}willUpdate(A){}et(A){this.YA?.forEach((A=>A.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(A)),this.updated(A)}tt(){this.XA=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.JA}shouldUpdate(A){return!0}update(A){this.At&&(this.At=this.At.forEach((A=>this.ZA(A,this[A])))),this.tt()}updated(A){}firstUpdated(A){}};fg.elementStyles=[],fg.shadowRootOptions={mode:"open"},fg[hg("elementProperties")]=new Map,fg[hg("finalized")]=new Map,ug?.({ReactiveElement:fg}),(og.reactiveElementVersions??(og.reactiveElementVersions=[])).push("2.1.0");const wg=globalThis,gg=wg.trustedTypes,pg=gg?gg.createPolicy("lit-html",{createHTML:A=>A}):void 0,vg="$lit$",mg=`lit$${Math.random().toFixed(9).slice(2)}$`,Qg="?"+mg,Cg=`<${Qg}>`,Ug=document,Fg=()=>Ug.createComment(""),yg=A=>null===A||"object"!=typeof A&&"function"!=typeof A,bg=Array.isArray,Eg="[ \t\n\f\r]",Ig=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,kg=/-->/g,Hg=/>/g,Sg=RegExp(`>|${Eg}(?:([^\\s"'>=/]+)(${Eg}*=${Eg}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Tg=/'/g,Og=/"/g,Kg=/^(?:script|style|textarea|title)$/i,Dg=A=>(t,...e)=>({it:A,strings:t,values:e}),Mg=Dg(1),Lg=Dg(2),xg=Symbol.for("lit-noChange"),_g=Symbol.for("lit-nothing"),Ng=new WeakMap,Rg=Ug.createTreeWalker(Ug,129);function jg(A,t){if(!bg(A)||!A.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==pg?pg.createHTML(t):t}class Gg{constructor({strings:A,it:t},e){let i;this.parts=[];let n=0,s=0;const r=A.length-1,o=this.parts,[a,c]=((A,t)=>{const e=A.length-1,i=[];let n,s=2===t?"<svg>":3===t?"<math>":"",r=Ig;for(let o=0;o<e;o++){const t=A[o];let e,a,c=-1,u=0;for(;u<t.length&&(r.lastIndex=u,a=r.exec(t),null!==a);)u=r.lastIndex,r===Ig?"!--"===a[1]?r=kg:void 0!==a[1]?r=Hg:void 0!==a[2]?(Kg.test(a[2])&&(n=RegExp("</"+a[2],"g")),r=Sg):void 0!==a[3]&&(r=Sg):r===Sg?">"===a[0]?(r=n??Ig,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,e=a[1],r=void 0===a[3]?Sg:'"'===a[3]?Og:Tg):r===Og||r===Tg?r=Sg:r===kg||r===Hg?r=Ig:(r=Sg,n=void 0);const h=r===Sg&&A[o+1].startsWith("/>")?" ":"";s+=r===Ig?t+Cg:c>=0?(i.push(e),t.slice(0,c)+vg+t.slice(c)+mg+h):t+mg+(-2===c?o:h)}return[jg(A,s+(A[e]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(A,t);if(this.el=Gg.createElement(a,e),Rg.currentNode=this.el.content,2===t||3===t){const A=this.el.content.firstChild;A.replaceWith(...A.childNodes)}for(;null!==(i=Rg.nextNode())&&o.length<r;){if(1===i.nodeType){if(i.hasAttributes())for(const A of i.getAttributeNames())if(A.endsWith(vg)){const t=c[s++],e=i.getAttribute(A).split(mg),r=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:r[2],strings:e,ctor:"."===r[1]?$g:"?"===r[1]?Yg:"@"===r[1]?Wg:Xg}),i.removeAttribute(A)}else A.startsWith(mg)&&(o.push({type:6,index:n}),i.removeAttribute(A));if(Kg.test(i.tagName)){const A=i.textContent.split(mg),t=A.length-1;if(t>0){i.textContent=gg?gg.emptyScript:"";for(let e=0;e<t;e++)i.append(A[e],Fg()),Rg.nextNode(),o.push({type:2,index:++n});i.append(A[t],Fg())}}}else if(8===i.nodeType)if(i.data===Qg)o.push({type:2,index:n});else{let A=-1;for(;-1!==(A=i.data.indexOf(mg,A+1));)o.push({type:7,index:n}),A+=mg.length-1}n++}}static createElement(A,t){const e=Ug.createElement("template");return e.innerHTML=A,e}}function Pg(A,t,e=A,i){if(t===xg)return t;let n=void 0!==i?e.nt?.[i]:e.st;const s=yg(t)?void 0:t.ot;return n?.constructor!==s&&(n?.ut?.(!1),void 0===s?n=void 0:(n=new s(A),n.dt(A,e,i)),void 0!==i?(e.nt??(e.nt=[]))[i]=n:e.st=n),void 0!==n&&(t=Pg(A,n.Bt(A,t.values),n,i)),t}class Vg{constructor(A,t){this.ft=[],this.wt=void 0,this.vt=A,this.Qt=t}get parentNode(){return this.Qt.parentNode}get Ct(){return this.Qt.Ct}u(A){const{el:{content:t},parts:e}=this.vt,i=(A?.creationScope??Ug).importNode(t,!0);Rg.currentNode=i;let n=Rg.nextNode(),s=0,r=0,o=e[0];for(;void 0!==o;){if(s===o.index){let t;2===o.type?t=new Jg(n,n.nextSibling,this,A):1===o.type?t=new o.ctor(n,o.name,o.strings,this,A):6===o.type&&(t=new Zg(n,this,A)),this.ft.push(t),o=e[++r]}s!==o?.index&&(n=Rg.nextNode(),s++)}return Rg.currentNode=Ug,i}p(A){let t=0;for(const e of this.ft)void 0!==e&&(void 0!==e.strings?(e.Ut(A,e,t),t+=e.strings.length-2):e.Ut(A[t])),t++}}class Jg{get Ct(){return this.Qt?.Ct??this.Ft}constructor(A,t,e,i){this.type=2,this.yt=_g,this.wt=void 0,this.bt=A,this.Et=t,this.Qt=e,this.options=i,this.Ft=i?.isConnected??!0}get parentNode(){let A=this.bt.parentNode;const t=this.Qt;return void 0!==t&&11===A?.nodeType&&(A=t.parentNode),A}get startNode(){return this.bt}get endNode(){return this.Et}Ut(A,t=this){A=Pg(this,A,t),yg(A)?A===_g||null==A||""===A?(this.yt!==_g&&this.It(),this.yt=_g):A!==this.yt&&A!==xg&&this.EA(A):void 0!==A.it?this.$(A):void 0!==A.nodeType?this.T(A):(A=>bg(A)||"function"==typeof A?.[Symbol.iterator])(A)?this.k(A):this.EA(A)}O(A){return this.bt.parentNode.insertBefore(A,this.Et)}T(A){this.yt!==A&&(this.It(),this.yt=this.O(A))}EA(A){this.yt!==_g&&yg(this.yt)?this.bt.nextSibling.data=A:this.T(Ug.createTextNode(A)),this.yt=A}$(A){const{values:t,it:e}=A,i="number"==typeof e?this.kt(A):(void 0===e.el&&(e.el=Gg.createElement(jg(e.h,e.h[0]),this.options)),e);if(this.yt?.vt===i)this.yt.p(t);else{const A=new Vg(i,this),e=A.u(this.options);A.p(t),this.T(e),this.yt=A}}kt(A){let t=Ng.get(A.strings);return void 0===t&&Ng.set(A.strings,t=new Gg(A)),t}k(A){bg(this.yt)||(this.yt=[],this.It());const t=this.yt;let e,i=0;for(const n of A)i===t.length?t.push(e=new Jg(this.O(Fg()),this.O(Fg()),this,this.options)):e=t[i],e.Ut(n),i++;i<t.length&&(this.It(e&&e.Et.nextSibling,i),t.length=i)}It(A=this.bt.nextSibling,t){for(this.Ht?.(!1,!0,t);A&&A!==this.Et;){const t=A.nextSibling;A.remove(),A=t}}setConnected(A){void 0===this.Qt&&(this.Ft=A,this.Ht?.(A))}}class Xg{get tagName(){return this.element.tagName}get Ct(){return this.Qt.Ct}constructor(A,t,e,i,n){this.type=1,this.yt=_g,this.wt=void 0,this.element=A,this.name=t,this.Qt=i,this.options=n,e.length>2||""!==e[0]||""!==e[1]?(this.yt=Array(e.length-1).fill(new String),this.strings=e):this.yt=_g}Ut(A,t=this,e,i){const n=this.strings;let s=!1;if(void 0===n)A=Pg(this,A,t,0),s=!yg(A)||A!==this.yt&&A!==xg,s&&(this.yt=A);else{const i=A;let r,o;for(A=n[0],r=0;r<n.length-1;r++)o=Pg(this,i[e+r],t,r),o===xg&&(o=this.yt[r]),s||(s=!yg(o)||o!==this.yt[r]),o===_g?A=_g:A!==_g&&(A+=(o??"")+n[r+1]),this.yt[r]=o}s&&!i&&this.j(A)}j(A){A===_g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,A??"")}}class $g extends Xg{constructor(){super(...arguments),this.type=3}j(A){this.element[this.name]=A===_g?void 0:A}}class Yg extends Xg{constructor(){super(...arguments),this.type=4}j(A){this.element.toggleAttribute(this.name,!!A&&A!==_g)}}class Wg extends Xg{constructor(A,t,e,i,n){super(A,t,e,i,n),this.type=5}Ut(A,t=this){if((A=Pg(this,A,t,0)??_g)===xg)return;const e=this.yt,i=A===_g&&e!==_g||A.capture!==e.capture||A.once!==e.once||A.passive!==e.passive,n=A!==_g&&(e===_g||i);i&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,A),this.yt=A}handleEvent(A){"function"==typeof this.yt?this.yt.call(this.options?.host??this.element,A):this.yt.handleEvent(A)}}class Zg{constructor(A,t,e){this.element=A,this.type=6,this.wt=void 0,this.Qt=t,this.options=e}get Ct(){return this.Qt.Ct}Ut(A){Pg(this,A)}}const qg=wg.litHtmlPolyfillSupport;qg?.(Gg,Jg),(wg.litHtmlVersions??(wg.litHtmlVersions=[])).push("3.3.0");const zg=globalThis;let Ap=class extends fg{constructor(){super(...arguments),this.renderOptions={host:this},this.St=void 0}createRenderRoot(){var A;const t=super.createRenderRoot();return(A=this.renderOptions).renderBefore??(A.renderBefore=t.firstChild),t}update(A){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(A),this.St=((A,t,e)=>{const i=e?.renderBefore??t;let n=i.Tt;if(void 0===n){const A=e?.renderBefore??null;i.Tt=n=new Jg(t.insertBefore(Fg(),A),A,void 0,e??{})}return n.Ut(A),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.St?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.St?.setConnected(!1)}render(){return xg}};Ap.Ot=!0,Ap.finalized=!0,zg.litElementHydrateSupport?.({LitElement:Ap});const tp=zg.litElementPolyfillSupport;tp?.({LitElement:Ap}),(zg.litElementVersions??(zg.litElementVersions=[])).push("4.2.0");const ep={attribute:!0,type:String,converter:lg,reflect:!1,hasChanged:dg},ip=(A=ep,t,e)=>{const{kind:i,metadata:n}=e;let s=globalThis.litPropertyMetadata.get(n);if(void 0===s&&globalThis.litPropertyMetadata.set(n,s=new Map),"setter"===i&&((A=Object.create(A)).wrapped=!0),s.set(e.name,A),"accessor"===i){const{name:i}=e;return{set(e){const n=t.get.call(this);t.set.call(this,e),this.requestUpdate(i,n,A)},init(t){return void 0!==t&&this.C(i,void 0,A,t),t}}}if("setter"===i){const{name:i}=e;return function(e){const n=this[i];t.call(this,e),this.requestUpdate(i,n,A)}}throw Error("Unsupported decorator location: "+i)};function np(A){return(t,e)=>"object"==typeof e?ip(A,t,e):((A,t,e)=>{const i=t.hasOwnProperty(e);return t.constructor.createProperty(e,A),i?Object.getOwnPropertyDescriptor(t,e):void 0})(A,t,e)}function sp(A){return np({...A,state:!0,attribute:!1})}const rp="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,op="9.23.0",ap=globalThis;function cp(){return up(ap),ap}function up(A){const t=A.Kt=A.Kt||{};return t.version=t.version||op,t[op]=t[op]||{}}function hp(A,t,e=ap){const i=e.Kt=e.Kt||{},n=i[op]=i[op]||{};return n[A]||(n[A]=t())}const lp=Object.prototype.toString;function dp(A){switch(lp.call(A)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Up(A,Error)}}function Bp(A,t){return lp.call(A)===`[object ${t}]`}function fp(A){return Bp(A,"ErrorEvent")}function wp(A){return Bp(A,"DOMError")}function gp(A){return Bp(A,"String")}function pp(A){return"object"==typeof A&&null!==A&&"Dt"in A&&"Mt"in A}function vp(A){return null===A||pp(A)||"object"!=typeof A&&"function"!=typeof A}function mp(A){return Bp(A,"Object")}function Qp(A){return"undefined"!=typeof Event&&Up(A,Event)}function Cp(A){return Boolean(A?.then&&"function"==typeof A.then)}function Up(A,t){try{return A instanceof t}catch(e){return!1}}function Fp(A){return!("object"!=typeof A||null===A||!A.Lt&&!A.xt)}const yp=ap;function bp(A,t={}){if(!A)return"<unknown>";try{let e=A;const i=5,n=[];let s=0,r=0;const o=" > ",a=o.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,h=!Array.isArray(t)&&t.maxStringLength||80;for(;e&&s++<i&&(c=Ep(e,u),!("html"===c||s>1&&r+n.length*a+c.length>=h));)n.push(c),r+=c.length,e=e.parentNode;return n.reverse().join(o)}catch(e){return"<unknown>"}}function Ep(A,t){const e=A,i=[];if(!e?.tagName)return"";if(yp.HTMLElement&&e instanceof HTMLElement&&e.dataset){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}i.push(e.tagName.toLowerCase());const n=t?.length?t.filter((A=>e.getAttribute(A))).map((A=>[A,e.getAttribute(A)])):null;if(n?.length)n.forEach((A=>{i.push(`[${A[0]}="${A[1]}"]`)}));else{e.id&&i.push(`#${e.id}`);const A=e.className;if(A&&gp(A)){const t=A.split(/\s+/);for(const A of t)i.push(`.${A}`)}}const s=["aria-label","type","name","title","alt"];for(const r of s){const A=e.getAttribute(r);A&&i.push(`[${r}="${A}"]`)}return i.join("")}function Ip(){try{return yp.document.location.href}catch(A){return""}}const kp=["debug","info","warn","error","log","assert","trace"],Hp={};function Sp(A){if(!("console"in ap))return A();const t=ap.console,e={},i=Object.keys(Hp);i.forEach((A=>{const i=Hp[A];e[A]=t[A],t[A]=i}));try{return A()}finally{i.forEach((A=>{t[A]=e[A]}))}}const Tp=hp("logger",(function(){let A=!1;const t={enable:()=>{A=!0},disable:()=>{A=!1},isEnabled:()=>A};return rp?kp.forEach((e=>{t[e]=(...t)=>{A&&Sp((()=>{ap.console[e](`Sentry Logger [${e}]:`,...t)}))}})):kp.forEach((A=>{t[A]=()=>{}})),t}));function Op(A,t=0){return"string"!=typeof A||0===t||A.length<=t?A:`${A.slice(0,t)}...`}function Kp(A,t){if(!Array.isArray(A))return"";const e=[];for(let n=0;n<A.length;n++){const t=A[n];try{Fp(t)?e.push("[VueViewModel]"):e.push(String(t))}catch(i){e.push("[value cannot be serialized]")}}return e.join(t)}function Dp(A,t=[],e=!1){return t.some((t=>(function(A,t,e=!1){return!!gp(A)&&(Bp(t,"RegExp")?t.test(A):!!gp(t)&&(e?A===t:A.includes(t)))})(A,t,e)))}function Mp(A,t,e){if(!(t in A))return;const i=A[t];if("function"!=typeof i)return;const n=e(i);"function"==typeof n&&xp(n,i);try{A[t]=n}catch{rp&&Tp.log(`Failed to replace method "${t}" in object`,A)}}function Lp(A,t,e){try{Object.defineProperty(A,t,{value:e,writable:!0,configurable:!0})}catch(i){rp&&Tp.log(`Failed to add non-enumerable property "${t}" to object`,A)}}function xp(A,t){try{const e=t.prototype||{};A.prototype=t.prototype=e,Lp(A,"__sentry_original__",t)}catch(e){}}function _p(A){return A._t}function Np(A){if(dp(A))return{message:A.message,name:A.name,stack:A.stack,...jp(A)};if(Qp(A)){const t={type:A.type,target:Rp(A.target),currentTarget:Rp(A.currentTarget),...jp(A)};return"undefined"!=typeof CustomEvent&&Up(A,CustomEvent)&&(t.detail=A.detail),t}return A}function Rp(A){try{return"undefined"!=typeof Element&&Up(A,Element)?bp(A):Object.prototype.toString.call(A)}catch(t){return"<unknown>"}}function jp(A){if("object"==typeof A&&null!==A){const t={};for(const e in A)Object.prototype.hasOwnProperty.call(A,e)&&(t[e]=A[e]);return t}return{}}function Gp(A=(function(){const A=ap;return A.crypto||A.msCrypto})()){let t=()=>16*Math.random();try{if(A?.randomUUID)return A.randomUUID().replace(/-/g,"");A?.getRandomValues&&(t=()=>{const t=new Uint8Array(1);return A.getRandomValues(t),t[0]})}catch(e){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(A=>(A^(15&t())>>A/4).toString(16)))}function Pp(A){return A.exception?.values?.[0]}function Vp(A){const{message:t,event_id:e}=A;if(t)return t;const i=Pp(A);return i?i.type&&i.value?`${i.type}: ${i.value}`:i.type||i.value||e||"<unknown>":e||"<unknown>"}function Jp(A,t,e){const i=A.exception=A.exception||{},n=i.values=i.values||[],s=n[0]=n[0]||{};s.value||(s.value=t||""),s.type||(s.type=e||"Error")}function Xp(A,t){const e=Pp(A);if(!e)return;const i=e.mechanism;if(e.mechanism={type:"generic",handled:!0,...i,...t},t&&"data"in t){const A={...i?.data,...t.data};e.mechanism.data=A}}function $p(A){if((function(A){try{return A.Nt}catch{}})(A))return!0;try{Lp(A,"__sentry_captured__",!0)}catch(t){}return!1}function Yp(){return Date.now()/1e3}const Wp=(function(){const{performance:A}=ap;if(!A?.now)return Yp;const t=Date.now()-A.now(),e=null==A.timeOrigin?t:A.timeOrigin;return()=>(e+A.now())/1e3})();function Zp(A,t={}){if(t.user&&(!A.ipAddress&&t.user.ip_address&&(A.ipAddress=t.user.ip_address),A.did||t.did||(A.did=t.user.id||t.user.email||t.user.username)),A.timestamp=t.timestamp||Wp(),t.abnormal_mechanism&&(A.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(A.ignoreDuration=t.ignoreDuration),t.sid&&(A.sid=32===t.sid.length?t.sid:Gp()),void 0!==t.init&&(A.init=t.init),!A.did&&t.did&&(A.did=`${t.did}`),"number"==typeof t.started&&(A.started=t.started),A.ignoreDuration)A.duration=void 0;else if("number"==typeof t.duration)A.duration=t.duration;else{const t=A.timestamp-A.started;A.duration=t>=0?t:0}t.release&&(A.release=t.release),t.environment&&(A.environment=t.environment),!A.ipAddress&&t.ipAddress&&(A.ipAddress=t.ipAddress),!A.userAgent&&t.userAgent&&(A.userAgent=t.userAgent),"number"==typeof t.errors&&(A.errors=t.errors),t.status&&(A.status=t.status)}function qp(A,t,e=2){if(!t||"object"!=typeof t||e<=0)return t;if(A&&0===Object.keys(t).length)return A;const i={...A};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=qp(i[n],t[n],e-1));return i}const zp="_sentrySpan";function Av(A,t){t?Lp(A,zp,t):delete A[zp]}function tv(A){return A[zp]}function ev(){return Gp()}function iv(){return Gp().substring(16)}class nv{constructor(){this.Rt=!1,this.jt=[],this.Gt=[],this.Pt=[],this.Vt=[],this.Jt={},this.Xt={},this.$t={},this.Yt={},this.Wt={},this.Zt={traceId:ev(),sampleRand:Math.random()}}clone(){const A=new nv;return A.Pt=[...this.Pt],A.Xt={...this.Xt},A.$t={...this.$t},A.Yt={...this.Yt},this.Yt.flags&&(A.Yt.flags={values:[...this.Yt.flags.values]}),A.Jt=this.Jt,A.qt=this.qt,A.zt=this.zt,A.Ae=this.Ae,A.te=this.te,A.Gt=[...this.Gt],A.Vt=[...this.Vt],A.Wt={...this.Wt},A.Zt={...this.Zt},A.ee=this.ee,A.ie=this.ie,Av(A,tv(this)),A}setClient(A){this.ee=A}setLastEventId(A){this.ie=A}getClient(){return this.ee}lastEventId(){return this.ie}addScopeListener(A){this.jt.push(A)}addEventProcessor(A){return this.Gt.push(A),this}setUser(A){return this.Jt=A||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.zt&&Zp(this.zt,{user:A}),this.ne(),this}getUser(){return this.Jt}setTags(A){return this.Xt={...this.Xt,...A},this.ne(),this}setTag(A,t){return this.Xt={...this.Xt,[A]:t},this.ne(),this}setExtras(A){return this.$t={...this.$t,...A},this.ne(),this}setExtra(A,t){return this.$t={...this.$t,[A]:t},this.ne(),this}setFingerprint(A){return this.te=A,this.ne(),this}setLevel(A){return this.qt=A,this.ne(),this}setTransactionName(A){return this.Ae=A,this.ne(),this}setContext(A,t){return null===t?delete this.Yt[A]:this.Yt[A]=t,this.ne(),this}setSession(A){return A?this.zt=A:delete this.zt,this.ne(),this}getSession(){return this.zt}update(A){if(!A)return this;const t="function"==typeof A?A(this):A,e=t instanceof nv?t.getScopeData():mp(t)?A:void 0,{tags:i,extra:n,user:s,contexts:r,level:o,fingerprint:a=[],propagationContext:c}=e||{};return this.Xt={...this.Xt,...i},this.$t={...this.$t,...n},this.Yt={...this.Yt,...r},s&&Object.keys(s).length&&(this.Jt=s),o&&(this.qt=o),a.length&&(this.te=a),c&&(this.Zt=c),this}clear(){return this.Pt=[],this.Xt={},this.$t={},this.Jt={},this.Yt={},this.qt=void 0,this.Ae=void 0,this.te=void 0,this.zt=void 0,Av(this,void 0),this.Vt=[],this.setPropagationContext({traceId:ev(),sampleRand:Math.random()}),this.ne(),this}addBreadcrumb(A,t){const e="number"==typeof t?t:100;if(e<=0)return this;const i={timestamp:Yp(),...A,message:A.message?Op(A.message,2048):A.message};return this.Pt.push(i),this.Pt.length>e&&(this.Pt=this.Pt.slice(-e),this.ee?.recordDroppedEvent("buffer_overflow","log_item")),this.ne(),this}getLastBreadcrumb(){return this.Pt[this.Pt.length-1]}clearBreadcrumbs(){return this.Pt=[],this.ne(),this}addAttachment(A){return this.Vt.push(A),this}clearAttachments(){return this.Vt=[],this}getScopeData(){return{breadcrumbs:this.Pt,attachments:this.Vt,contexts:this.Yt,tags:this.Xt,extra:this.$t,user:this.Jt,level:this.qt,fingerprint:this.te||[],eventProcessors:this.Gt,propagationContext:this.Zt,sdkProcessingMetadata:this.Wt,transactionName:this.Ae,span:tv(this)}}setSDKProcessingMetadata(A){return this.Wt=qp(this.Wt,A,2),this}setPropagationContext(A){return this.Zt=A,this}getPropagationContext(){return this.Zt}captureException(A,t){const e=t?.event_id||Gp();if(!this.ee)return Tp.warn("No client configured on scope - will not capture exception!"),e;const i=new Error("Sentry syntheticException");return this.ee.captureException(A,{originalException:A,syntheticException:i,...t,event_id:e},this),e}captureMessage(A,t,e){const i=e?.event_id||Gp();if(!this.ee)return Tp.warn("No client configured on scope - will not capture message!"),i;const n=new Error(A);return this.ee.captureMessage(A,t,{originalException:A,syntheticException:n,...e,event_id:i},this),i}captureEvent(A,t){const e=t?.event_id||Gp();return this.ee?(this.ee.captureEvent(A,{...t,event_id:e},this),e):(Tp.warn("No client configured on scope - will not capture event!"),e)}ne(){this.Rt||(this.Rt=!0,this.jt.forEach((A=>{A(this)})),this.Rt=!1)}}class sv{constructor(A,t){let e,i;e=A||new nv,i=t||new nv,this.se=[{scope:e}],this.re=i}withScope(A){const t=this.oe();let e;try{e=A(t)}catch(i){throw this.ae(),i}return Cp(e)?e.then((A=>(this.ae(),A)),(A=>{throw this.ae(),A})):(this.ae(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.re}getStackTop(){return this.se[this.se.length-1]}oe(){const A=this.getScope().clone();return this.se.push({client:this.getClient(),scope:A}),A}ae(){return!(this.se.length<=1||!this.se.pop())}}function rv(){const A=up(cp());return A.stack=A.stack||new sv(hp("defaultCurrentScope",(()=>new nv)),hp("defaultIsolationScope",(()=>new nv)))}function ov(A){return rv().withScope(A)}function av(A,t){const e=rv();return e.withScope((()=>(e.getStackTop().scope=A,t(A))))}function cv(A){return rv().withScope((()=>A(rv().getIsolationScope())))}function uv(A){const t=up(A);return t.acs?t.acs:{withIsolationScope:cv,withScope:ov,withSetScope:av,withSetIsolationScope:(A,t)=>cv(t),getCurrentScope:()=>rv().getScope(),getIsolationScope:()=>rv().getIsolationScope()}}function hv(){return uv(cp()).getCurrentScope()}function lv(){return uv(cp()).getIsolationScope()}function dv(...A){const t=uv(cp());if(2===A.length){const[e,i]=A;return e?t.withSetScope(e,i):t.withScope(i)}return t.withScope(A[0])}function Bv(){return hv().getClient()}function fv(A){const t=A.getPropagationContext(),{traceId:e,parentSpanId:i,propagationSpanId:n}=t,s={trace_id:e,span_id:n||iv()};return i&&(s.parent_span_id=i),s}const wv="sentry.profile_id",gv="sentry.exclusive_time";function pv(A){return{scope:A.ce,isolationScope:A.ue}}const vv=/^sentry-/;function mv(A){return A.split(",").map((A=>A.split("=").map((A=>{try{return decodeURIComponent(A.trim())}catch{return}})))).reduce(((A,[t,e])=>(t&&e&&(A[t]=e),A)),{})}let Qv=!1;function Cv(A){const{spanId:t,traceId:e,isRemote:i}=A.spanContext(),n=i?t:bv(A).parent_span_id,s=pv(A).scope;return{parent_span_id:n,span_id:i?s?.getPropagationContext().propagationSpanId||iv():t,trace_id:e}}function Uv(A){return A&&A.length>0?A.map((({context:{spanId:A,traceId:t,traceFlags:e,...i},attributes:n})=>({span_id:A,trace_id:t,sampled:1===e,attributes:n,...i}))):void 0}function Fv(A){return"number"==typeof A?yv(A):Array.isArray(A)?A[0]+A[1]/1e9:A instanceof Date?yv(A.getTime()):Wp()}function yv(A){return A>9999999999?A/1e3:A}function bv(A){if((function(A){return"function"==typeof A.getSpanJSON})(A))return A.getSpanJSON();const{spanId:t,traceId:e}=A.spanContext();if((function(A){const t=A;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)})(A)){const{attributes:i,startTime:n,name:s,endTime:r,status:o,links:a}=A;return{span_id:t,trace_id:e,data:i,description:s,parent_span_id:"parentSpanId"in A?A.parentSpanId:"parentSpanContext"in A?A.parentSpanContext?.spanId:void 0,start_timestamp:Fv(n),timestamp:Fv(r)||void 0,status:Ev(o),op:i["sentry.op"],origin:i["sentry.origin"],links:Uv(a)}}return{span_id:t,trace_id:e,start_timestamp:0,data:{}}}function Ev(A){if(A&&0!==A.code)return 1===A.code?"ok":A.message||"unknown_error"}function Iv(A){return A.he||A}function kv(){Qv||(Sp((()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")})),Qv=!0)}const Hv="?",Sv=/\(error: (.*)\)/,Tv=/captureMessage|captureException/;function Ov(A){return A[A.length-1]||{}}const Kv="<anonymous>";function Dv(A){try{return A&&"function"==typeof A&&A.name||Kv}catch(t){return Kv}}function Mv(A){const t=A.exception;if(t){const A=[];try{return t.values.forEach((t=>{t.stacktrace.frames&&A.push(...t.stacktrace.frames)})),A}catch(e){return}}}const Lv={},xv={};function _v(A,t){Lv[A]=Lv[A]||[],Lv[A].push(t)}function Nv(A,t){if(!xv[A]){xv[A]=!0;try{t()}catch(e){rp&&Tp.error(`Error while instrumenting ${A}`,e)}}}function Rv(A,t){const e=A&&Lv[A];if(e)for(const n of e)try{n(t)}catch(i){rp&&Tp.error(`Error while triggering instrumentation handler.\nType: ${A}\nName: ${Dv(n)}\nError:`,i)}}let jv=null;function Gv(){jv=ap.onerror,ap.onerror=function(A,t,e,i,n){return Rv("error",{column:i,error:n,line:e,msg:A,url:t}),!!jv&&jv.apply(this,arguments)},ap.onerror.le=!0}let Pv=null;function Vv(){Pv=ap.onunhandledrejection,ap.onunhandledrejection=function(A){return Rv("unhandledrejection",A),!Pv||Pv.apply(this,arguments)},ap.onunhandledrejection.le=!0}const Jv="production",Xv=/^o(\d+)\./,$v=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Yv(A,t=!1){const{host:e,path:i,pass:n,port:s,projectId:r,protocol:o,publicKey:a}=A;return`${o}://${a}${t&&n?`:${n}`:""}@${e}${s?`:${s}`:""}/${i?`${i}/`:i}${r}`}function Wv(A){return{protocol:A.protocol,publicKey:A.publicKey||"",pass:A.pass||"",host:A.host,port:A.port||"",path:A.path||"",projectId:A.projectId}}function Zv(A,t){const e=t.getOptions(),{publicKey:i,host:n}=t.getDsn()||{};let s;e.orgId?s=String(e.orgId):n&&(s=(function(A){const t=A.match(Xv);return t?.[1]})(n));const r={environment:e.environment||Jv,release:e.release,public_key:i,trace_id:A,org_id:s};return t.emit("createDsc",r),r}function qv(A){const t=Bv();if(!t)return{};const e=Iv(A),i=bv(e),n=i.data,s=e.spanContext().traceState,r=s?.get("sentry.sample_rate")??n["sentry.sample_rate"]??n["sentry.previous_trace_sample_rate"];function o(A){return"number"!=typeof r&&"string"!=typeof r||(A.sample_rate=`${r}`),A}const a=e.de;if(a)return o(a);const c=s?.get("sentry.dsc"),u=c&&(function(A){const t=(function(A){if(A&&(gp(A)||Array.isArray(A)))return Array.isArray(A)?A.reduce(((A,t)=>{const e=mv(t);return Object.entries(e).forEach((([t,e])=>{A[t]=e})),A}),{}):mv(A)})(A);if(!t)return;const e=Object.entries(t).reduce(((A,[t,e])=>(t.match(vv)&&(A[t.slice(7)]=e),A)),{});return Object.keys(e).length>0?e:void 0})(c);if(u)return o(u);const h=Zv(A.spanContext().traceId,t),l=n["sentry.source"],d=i.description;return"url"!==l&&d&&(h.transaction=d),(function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const A=Bv()?.getOptions();return!(!A||null==A.tracesSampleRate&&!A.tracesSampler)})()&&(h.sampled=String((function(A){const{traceFlags:t}=A.spanContext();return 1===t})(e)),h.sample_rand=s?.get("sentry.sample_rand")??pv(e).scope?.getPropagationContext().sampleRand.toString()),o(h),t.emit("createDsc",h,e),h}function zv(A,t=100,e=1/0){try{return tm("",A,t,e)}catch(i){return{ERROR:`**non-serializable** (${i})`}}}function Am(A,t=3,e=102400){const i=zv(A,t);return n=i,(function(A){return~-encodeURI(A).split(/%..|./).length})(JSON.stringify(n))>e?Am(A,t-1,e):i;var n}function tm(A,t,e=1/0,i=1/0,n=(function(){const A=new WeakSet;return[function(t){return!!A.has(t)||(A.add(t),!1)},function(t){A.delete(t)}]})()){const[s,r]=n;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const o=(function(A,t){try{if("domain"===A&&t&&"object"==typeof t&&t.B)return"[Domain]";if("domainEmitter"===A)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(Fp(t))return"[VueViewModel]";if(mp(e=t)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Dv(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const i=(function(A){const t=Object.getPrototypeOf(A);return t?.constructor?t.constructor.name:"null prototype"})(t);return/^HTML(\w*)Element$/.test(i)?`[HTMLElement: ${i}]`:`[object ${i}]`}catch(i){return`**non-serializable** (${i})`}var e})(A,t);if(!o.startsWith("[object "))return o;if(t.Be)return t;const a="number"==typeof t.fe?t.fe:e;if(0===a)return o.replace("object ","");if(s(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return tm("",c.toJSON(),a-1,i,n)}catch(d){}const u=Array.isArray(t)?[]:{};let h=0;const l=Np(t);for(const B in l){if(!Object.prototype.hasOwnProperty.call(l,B))continue;if(h>=i){u[B]="[MaxProperties ~]";break}const A=l[B];u[B]=tm(B,A,a-1,i,n),h++}return r(t),u}function em(A,t=[]){return[A,t]}function im(A,t){const[e,i]=A;return[e,[...i,t]]}function nm(A,t){const e=A[1];for(const i of e)if(t(i,i[0].type))return!0;return!1}function sm(A){const t=up(ap);return t.encodePolyfill?t.encodePolyfill(A):(new TextEncoder).encode(A)}function rm(A){const[t,e]=A;let i=JSON.stringify(t);function n(A){"string"==typeof i?i="string"==typeof A?i+A:[sm(i),A]:i.push("string"==typeof A?sm(A):A)}for(const r of e){const[A,t]=r;if(n(`\n${JSON.stringify(A)}\n`),"string"==typeof t||t instanceof Uint8Array)n(t);else{let A;try{A=JSON.stringify(t)}catch(s){A=JSON.stringify(zv(t))}n(A)}}return"string"==typeof i?i:(function(A){const t=A.reduce(((A,t)=>A+t.length),0),e=new Uint8Array(t);let i=0;for(const n of A)e.set(n,i),i+=n.length;return e})(i)}function om(A){const t="string"==typeof A.data?sm(A.data):A.data;return[{type:"attachment",length:t.length,filename:A.filename,content_type:A.contentType,attachment_type:A.attachmentType},t]}const am={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function cm(A){return am[A]}function um(A){if(!A?.sdk)return;const{name:t,version:e}=A.sdk;return{name:t,version:e}}var hm,lm;function dm(A){return new fm((t=>{t(A)}))}function Bm(A){return new fm(((t,e)=>{e(A)}))}(lm=hm||(hm={}))[lm.PENDING=0]="PENDING",lm[lm.RESOLVED=1]="RESOLVED",lm[lm.REJECTED=2]="REJECTED";class fm{constructor(A){this.we=hm.PENDING,this.ge=[],this.pe(A)}then(A,t){return new fm(((e,i)=>{this.ge.push([!1,t=>{if(A)try{e(A(t))}catch(n){i(n)}else e(t)},A=>{if(t)try{e(t(A))}catch(n){i(n)}else i(A)}]),this.ve()}))}catch(A){return this.then((A=>A),A)}finally(A){return new fm(((t,e)=>{let i,n;return this.then((t=>{n=!1,i=t,A&&A()}),(t=>{n=!0,i=t,A&&A()})).then((()=>{n?e(i):t(i)}))}))}ve(){if(this.we===hm.PENDING)return;const A=this.ge.slice();this.ge=[],A.forEach((A=>{A[0]||(this.we===hm.RESOLVED&&A[1](this.HA),this.we===hm.REJECTED&&A[2](this.HA),A[0]=!0)}))}pe(A){const t=(A,t)=>{this.we===hm.PENDING&&(Cp(t)?t.then(e,i):(this.we=A,this.HA=t,this.ve()))},e=A=>{t(hm.RESOLVED,A)},i=A=>{t(hm.REJECTED,A)};try{A(e,i)}catch(n){i(n)}}}function wm(A,t,e,i=0){return new fm(((n,s)=>{const r=A[i];if(null===t||"function"!=typeof r)n(t);else{const o=r({...t},e);rp&&r.id&&null===o&&Tp.log(`Event processor "${r.id}" dropped event`),Cp(o)?o.then((t=>wm(A,t,e,i+1).then(n))).then(null,s):wm(A,o,e,i+1).then(n).then(null,s)}}))}let gm,pm,vm;function mm(A,t){const{extra:e,tags:i,user:n,contexts:s,level:r,sdkProcessingMetadata:o,breadcrumbs:a,fingerprint:c,eventProcessors:u,attachments:h,propagationContext:l,transactionName:d,span:B}=t;Qm(A,"extra",e),Qm(A,"tags",i),Qm(A,"user",n),Qm(A,"contexts",s),A.sdkProcessingMetadata=qp(A.sdkProcessingMetadata,o,2),r&&(A.level=r),d&&(A.transactionName=d),B&&(A.span=B),a.length&&(A.breadcrumbs=[...A.breadcrumbs,...a]),c.length&&(A.fingerprint=[...A.fingerprint,...c]),u.length&&(A.eventProcessors=[...A.eventProcessors,...u]),h.length&&(A.attachments=[...A.attachments,...h]),A.propagationContext={...A.propagationContext,...l}}function Qm(A,t,e){A[t]=qp(A[t],e,1)}function Cm(A,t,e,i,n,s){const{normalizeDepth:r=3,normalizeMaxBreadth:o=1e3}=A,a={...t,event_id:t.event_id||e.event_id||Gp(),timestamp:t.timestamp||Yp()},c=e.integrations||A.integrations.map((A=>A.name));!(function(A,t){const{environment:e,release:i,dist:n,maxValueLength:s=250}=t;A.environment=A.environment||e||Jv,!A.release&&i&&(A.release=i),!A.dist&&n&&(A.dist=n);const r=A.request;r?.url&&(r.url=Op(r.url,s))})(a,A),(function(A,t){t.length>0&&(A.sdk=A.sdk||{},A.sdk.integrations=[...A.sdk.integrations||[],...t])})(a,c),n&&n.emit("applyFrameMetadata",t),void 0===t.type&&(function(A,t){const e=(function(A){const t=ap.me;if(!t)return{};const e=Object.keys(t);return vm&&e.length===pm||(pm=e.length,vm=e.reduce(((e,i)=>{gm||(gm={});const n=gm[i];if(n)e[n[0]]=n[1];else{const n=A(i);for(let A=n.length-1;A>=0;A--){const s=n[A],r=s?.filename,o=t[i];if(r&&o){e[r]=o,gm[i]=[r,o];break}}}return e}),{})),vm})(t);A.exception?.values?.forEach((A=>{A.stacktrace?.frames?.forEach((A=>{A.filename&&(A.debug_id=e[A.filename])}))}))})(a,A.stackParser);const u=(function(A,t){if(!t)return A;const e=A?A.clone():new nv;return e.update(t),e})(i,e.captureContext);e.mechanism&&Xp(a,e.mechanism);const h=n?n.getEventProcessors():[],l=hp("globalScope",(()=>new nv)).getScopeData();s&&mm(l,s.getScopeData()),u&&mm(l,u.getScopeData());const d=[...e.attachments||[],...l.attachments];return d.length&&(e.attachments=d),(function(A,t){const{fingerprint:e,span:i,breadcrumbs:n,sdkProcessingMetadata:s}=t;!(function(A,t){const{extra:e,tags:i,user:n,contexts:s,level:r,transactionName:o}=t;Object.keys(e).length&&(A.extra={...e,...A.extra}),Object.keys(i).length&&(A.tags={...i,...A.tags}),Object.keys(n).length&&(A.user={...n,...A.user}),Object.keys(s).length&&(A.contexts={...s,...A.contexts}),r&&(A.level=r),o&&"transaction"!==A.type&&(A.transaction=o)})(A,t),i&&(function(A,t){A.contexts={trace:Cv(t),...A.contexts},A.sdkProcessingMetadata={dynamicSamplingContext:qv(t),...A.sdkProcessingMetadata};const e=bv(Iv(t)).description;e&&!A.transaction&&"transaction"===A.type&&(A.transaction=e)})(A,i),(function(A,t){A.fingerprint=A.fingerprint?Array.isArray(A.fingerprint)?A.fingerprint:[A.fingerprint]:[],t&&(A.fingerprint=A.fingerprint.concat(t)),A.fingerprint.length||delete A.fingerprint})(A,e),(function(A,t){const e=[...A.breadcrumbs||[],...t];A.breadcrumbs=e.length?e:void 0})(A,n),(function(A,t){A.sdkProcessingMetadata={...A.sdkProcessingMetadata,...t}})(A,s)})(a,l),wm([...h,...l.eventProcessors],a,e).then((A=>(A&&(function(A){const t={};if(A.exception?.values?.forEach((A=>{A.stacktrace?.frames?.forEach((A=>{A.debug_id&&(A.abs_path?t[A.abs_path]=A.debug_id:A.filename&&(t[A.filename]=A.debug_id),delete A.debug_id)}))})),0===Object.keys(t).length)return;A.debug_meta=A.debug_meta||{},A.debug_meta.images=A.debug_meta.images||[];const e=A.debug_meta.images;Object.entries(t).forEach((([A,t])=>{e.push({type:"sourcemap",code_file:A,debug_id:t})}))})(A),"number"==typeof r&&r>0?(function(A,t,e){if(!A)return null;const i={...A,...A.breadcrumbs&&{breadcrumbs:A.breadcrumbs.map((A=>({...A,...A.data&&{data:zv(A.data,t,e)}})))},...A.user&&{user:zv(A.user,t,e)},...A.contexts&&{contexts:zv(A.contexts,t,e)},...A.extra&&{extra:zv(A.extra,t,e)}};return A.contexts?.trace&&i.contexts&&(i.contexts.trace=A.contexts.trace,A.contexts.trace.data&&(i.contexts.trace.data=zv(A.contexts.trace.data,t,e))),A.spans&&(i.spans=A.spans.map((A=>({...A,...A.data&&{data:zv(A.data,t,e)}})))),A.contexts?.flags&&i.contexts&&(i.contexts.flags=zv(A.contexts.flags,3,e)),i})(A,r,o):A)))}function Um(A,t){return hv().captureEvent(A,t)}function Fm(A){const t=lv(),e=hv(),{userAgent:i}=ap.navigator||{},n=(function(A){const t=Wp(),e={sid:Gp(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>(function(A){return{sid:`${A.sid}`,init:A.init,started:new Date(1e3*A.started).toISOString(),timestamp:new Date(1e3*A.timestamp).toISOString(),status:A.status,errors:A.errors,did:"number"==typeof A.did||"string"==typeof A.did?`${A.did}`:void 0,duration:A.duration,abnormal_mechanism:A.abnormal_mechanism,attrs:{release:A.release,environment:A.environment,ip_address:A.ipAddress,user_agent:A.userAgent}}})(e)};return A&&Zp(e,A),e})({user:e.getUser()||t.getUser(),...i&&{userAgent:i},...A}),s=t.getSession();return"ok"===s?.status&&Zp(s,{status:"exited"}),ym(),t.setSession(n),n}function ym(){const A=lv(),t=hv().getSession()||A.getSession();t&&(function(A){let t={};"ok"===A.status&&(t={status:"exited"}),Zp(A,t)})(t),bm(),A.setSession()}function bm(){const A=lv(),t=Bv(),e=A.getSession();e&&t&&t.captureSession(e)}function Em(A=!1){A?ym():bm()}const Im=[];function km(A,t){for(const e of t)e?.afterAllSetup&&e.afterAllSetup(A)}function Hm(A,t,e){if(e[t.name])rp&&Tp.log(`Integration skipped because it was already installed: ${t.name}`);else{if(e[t.name]=t,-1===Im.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),Im.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(A),"function"==typeof t.preprocessEvent){const e=t.preprocessEvent.bind(t);A.on("preprocessEvent",((t,i)=>e(t,i,A)))}if("function"==typeof t.processEvent){const e=t.processEvent.bind(t),i=Object.assign(((t,i)=>e(t,i,A)),{id:t.name});A.addEventProcessor(i)}rp&&Tp.log(`Integration installed: ${t.name}`)}}function Sm(A){const t=[];A.message&&t.push(A.message);try{const e=A.exception.values[A.exception.values.length-1];e?.value&&(t.push(e.value),e.type&&t.push(`${e.type}: ${e.value}`))}catch(e){}return t}const Tm="Not capturing exception because it's already been captured.",Om="Discarded session because of missing or non-string release",Km=Symbol.for("SentryInternalError"),Dm=Symbol.for("SentryDoNotSendEventError");function Mm(A){return{message:A,[Km]:!0}}function Lm(A){return{message:A,[Dm]:!0}}function xm(A){return!!A&&"object"==typeof A&&Km in A}function _m(A){return!!A&&"object"==typeof A&&Dm in A}class Nm{constructor(A){if(this.KA=A,this.Qe={},this.Ce=0,this.Ue={},this.Fe={},this.Gt=[],A.dsn?this.ye=(function(A){const t="string"==typeof A?(function(A){const t=$v.exec(A);if(!t)return void Sp((()=>{console.error(`Invalid Sentry Dsn: ${A}`)}));const[e,i,n="",s="",r="",o=""]=t.slice(1);let a="",c=o;const u=c.split("/");if(u.length>1&&(a=u.slice(0,-1).join("/"),c=u.pop()),c){const A=c.match(/^\d+/);A&&(c=A[0])}return Wv({host:s,pass:n,path:a,projectId:c,port:r,protocol:e,publicKey:i})})(A):Wv(A);if(t&&(function(A){if(!rp)return!0;const{port:t,projectId:e,protocol:i}=A;return!(["protocol","publicKey","host","projectId"].find((t=>!A[t]&&(Tp.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(e.match(/^\d+$/)?(function(A){return"http"===A||"https"===A})(i)?t&&isNaN(parseInt(t,10))&&(Tp.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Tp.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),1):(Tp.error(`Invalid Sentry Dsn: Invalid projectId ${e}`),1)))})(t))return t})(A.dsn):rp&&Tp.warn("No DSN provided, client will not send events."),this.ye){const n=(t=this.ye,e=A.tunnel,i=A.be?A.be.sdk:void 0,e||`${(function(A){return`${(function(A){const t=A.protocol?`${A.protocol}:`:"",e=A.port?`:${A.port}`:"";return`${t}//${A.host}${e}${A.path?`/${A.path}`:""}/api/`})(A)}${A.projectId}/envelope/`})(t)}?${(function(A,t){const e={sentry_version:"7"};return A.publicKey&&(e.sentry_key=A.publicKey),t&&(e.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(e).toString()})(t,i)}`);this.Ee=A.transport({tunnel:this.KA.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...A.transportOptions,url:n})}var t,e,i}captureException(A,t,e){const i=Gp();if($p(A))return rp&&Tp.log(Tm),i;const n={event_id:i,...t};return this.Ie(this.eventFromException(A,n).then((A=>this.ke(A,n,e)))),n.event_id}captureMessage(A,t,e,i){const n={event_id:Gp(),...e},s=pp(A)?A:String(A),r=vp(A)?this.eventFromMessage(s,t,n):this.eventFromException(A,n);return this.Ie(r.then((A=>this.ke(A,n,i)))),n.event_id}captureEvent(A,t,e){const i=Gp();if(t?.originalException&&$p(t.originalException))return rp&&Tp.log(Tm),i;const n={event_id:i,...t},s=A.sdkProcessingMetadata||{},r=s.capturedSpanScope,o=s.capturedSpanIsolationScope;return this.Ie(this.ke(A,n,r||e,o)),n.event_id}captureSession(A){this.sendSession(A),Zp(A,{init:!1})}getDsn(){return this.ye}getOptions(){return this.KA}getSdkMetadata(){return this.KA.be}getTransport(){return this.Ee}flush(A){const t=this.Ee;return t?(this.emit("flush"),this.He(A).then((e=>t.flush(A).then((A=>e&&A))))):dm(!0)}close(A){return this.flush(A).then((A=>(this.getOptions().enabled=!1,this.emit("close"),A)))}getEventProcessors(){return this.Gt}addEventProcessor(A){this.Gt.push(A)}init(){(this.Se()||this.KA.integrations.some((({name:A})=>A.startsWith("Spotlight"))))&&this.Te()}getIntegrationByName(A){return this.Qe[A]}addIntegration(A){const t=this.Qe[A.name];Hm(this,A,this.Qe),t||km(this,[A])}sendEvent(A,t={}){this.emit("beforeSendEvent",A,t);let e=(function(A,t,e,i){const n=um(e),s=A.type&&"replay_event"!==A.type?A.type:"event";!(function(A,t){t&&(A.sdk=A.sdk||{},A.sdk.name=A.sdk.name||t.name,A.sdk.version=A.sdk.version||t.version,A.sdk.integrations=[...A.sdk.integrations||[],...t.integrations||[]],A.sdk.packages=[...A.sdk.packages||[],...t.packages||[]])})(A,e?.sdk);const r=(function(A,t,e,i){const n=A.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:A.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!e&&i&&{dsn:Yv(i)},...n&&{trace:n}}})(A,n,i,t);return delete A.sdkProcessingMetadata,em(r,[[{type:s},A]])})(A,this.ye,this.KA.be,this.KA.tunnel);for(const n of t.attachments||[])e=im(e,om(n));const i=this.sendEnvelope(e);i&&i.then((t=>this.emit("afterSendEvent",A,t)),null)}sendSession(A){const{release:t,environment:e=Jv}=this.KA;if("aggregates"in A){const i=A.attrs||{};if(!i.release&&!t)return void(rp&&Tp.warn(Om));i.release=i.release||t,i.environment=i.environment||e,A.attrs=i}else{if(!A.release&&!t)return void(rp&&Tp.warn(Om));A.release=A.release||t,A.environment=A.environment||e}this.emit("beforeSendSession",A);const i=(function(A,t,e,i){const n=um(e);return em({sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!i&&t&&{dsn:Yv(t)}},["aggregates"in A?[{type:"sessions"},A]:[{type:"session"},A.toJSON()]])})(A,this.ye,this.KA.be,this.KA.tunnel);this.sendEnvelope(i)}recordDroppedEvent(A,t,e=1){if(this.KA.sendClientReports){const i=`${A}:${t}`;rp&&Tp.log(`Recording outcome: "${i}"${e>1?` (${e} times)`:""}`),this.Ue[i]=(this.Ue[i]||0)+e}}on(A,t){const e=this.Fe[A]=this.Fe[A]||[];return e.push(t),()=>{const A=e.indexOf(t);A>-1&&e.splice(A,1)}}emit(A,...t){const e=this.Fe[A];e&&e.forEach((A=>A(...t)))}sendEnvelope(A){return this.emit("beforeEnvelope",A),this.Se()&&this.Ee?this.Ee.send(A).then(null,(A=>(rp&&Tp.error("Error while sending envelope:",A),A))):(rp&&Tp.error("Transport disabled"),dm({}))}Te(){const{integrations:A}=this.KA;this.Qe=(function(A,t){const e={};return t.forEach((t=>{t&&Hm(A,t,e)})),e})(this,A),km(this,A)}Oe(A,t){let e="fatal"===t.level,i=!1;const n=t.exception?.values;if(n){i=!0;for(const A of n){const t=A.mechanism;if(!1===t?.handled){e=!0;break}}}const s="ok"===A.status;(s&&0===A.errors||s&&e)&&(Zp(A,{...e&&{status:"crashed"},errors:A.errors||Number(i||e)}),this.captureSession(A))}He(A){return new fm((t=>{let e=0;const i=setInterval((()=>{0==this.Ce?(clearInterval(i),t(!0)):(e+=1,A&&e>=A&&(clearInterval(i),t(!1)))}),1)}))}Se(){return!1!==this.getOptions().enabled&&void 0!==this.Ee}Ke(A,t,e,i){const n=this.getOptions(),s=Object.keys(this.Qe);return!t.integrations&&s?.length&&(t.integrations=s),this.emit("preprocessEvent",A,t),A.type||i.setLastEventId(A.event_id||t.event_id),Cm(n,A,t,e,this,i).then((A=>{if(null===A)return A;this.emit("postprocessEvent",A,t),A.contexts={trace:fv(e),...A.contexts};const i=(function(A,t){const e=t.getPropagationContext();return e.dsc||Zv(e.traceId,A)})(this,e);return A.sdkProcessingMetadata={dynamicSamplingContext:i,...A.sdkProcessingMetadata},A}))}ke(A,t={},e=hv(),i=lv()){return rp&&Rm(A)&&Tp.log(`Captured error event \`${Sm(A)[0]||"<unknown>"}\``),this.De(A,t,e,i).then((A=>A.event_id),(A=>{rp&&(_m(A)?Tp.log(A.message):xm(A)?Tp.warn(A.message):Tp.warn(A))}))}De(A,t,e,i){const n=this.getOptions(),{sampleRate:s}=n,r=jm(A),o=Rm(A),a=A.type||"error",c=`before send for type \`${a}\``,u=void 0===s?void 0:(function(A){if("boolean"==typeof A)return Number(A);const t="string"==typeof A?parseFloat(A):A;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t})(s);if(o&&"number"==typeof u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),Bm(Lm(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));const h="replay_event"===a?"replay":a;return this.Ke(A,t,e,i).then((A=>{if(null===A)throw this.recordDroppedEvent("event_processor",h),Lm("An event processor returned `null`, will not send event.");if(t.data&&!0===t.data.Me)return A;const e=(function(A,t,e,i){const{beforeSend:n,beforeSendTransaction:s,beforeSendSpan:r}=t;let o=e;if(Rm(o)&&n)return n(o,i);if(jm(o)){if(r){const A=r((function(A){const{trace_id:t,parent_span_id:e,span_id:i,status:n,origin:s,data:r,op:o}=A.contexts?.trace??{};return{data:r??{},description:A.transaction,op:o,parent_span_id:e,span_id:i??"",start_timestamp:A.start_timestamp??0,status:n,timestamp:A.timestamp,trace_id:t??"",origin:s,profile_id:r?.[wv],exclusive_time:r?.[gv],measurements:A.measurements,is_segment:!0}})(o));if(A?o=qp(e,{type:"transaction",timestamp:(a=A).timestamp,start_timestamp:a.start_timestamp,transaction:a.description,contexts:{trace:{trace_id:a.trace_id,span_id:a.span_id,parent_span_id:a.parent_span_id,op:a.op,status:a.status,origin:a.origin,data:{...a.data,...a.profile_id&&{[wv]:a.profile_id},...a.exclusive_time&&{[gv]:a.exclusive_time}}}},measurements:a.measurements}):kv(),o.spans){const A=[];for(const t of o.spans){const e=r(t);e?A.push(e):(kv(),A.push(t))}o.spans=A}}if(s){if(o.spans){const A=o.spans.length;o.sdkProcessingMetadata={...e.sdkProcessingMetadata,spanCountBeforeProcessing:A}}return s(o,i)}}var a;return o})(0,n,A,t);return(function(A,t){const e=`${t} must return \`null\` or a valid event.`;if(Cp(A))return A.then((A=>{if(!mp(A)&&null!==A)throw Mm(e);return A}),(A=>{throw Mm(`${t} rejected with ${A}`)}));if(!mp(A)&&null!==A)throw Mm(e);return A})(e,c)})).then((n=>{if(null===n){if(this.recordDroppedEvent("before_send",h),r){const t=1+(A.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw Lm(`${c} returned \`null\`, will not send event.`)}const s=e.getSession()||i.getSession();if(o&&s&&this.Oe(s,n),r){const A=(n.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(n.spans?n.spans.length:0);A>0&&this.recordDroppedEvent("before_send","span",A)}const a=n.transaction_info;if(r&&a&&n.transaction!==A.transaction){const A="custom";n.transaction_info={...a,source:A}}return this.sendEvent(n,t),n})).then(null,(A=>{if(_m(A)||xm(A))throw A;throw this.captureException(A,{data:{Me:!0},originalException:A}),Mm(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${A}`)}))}Ie(A){this.Ce++,A.then((A=>(this.Ce--,A)),(A=>(this.Ce--,A)))}Le(){const A=this.Ue;return this.Ue={},Object.entries(A).map((([A,t])=>{const[e,i]=A.split(":");return{reason:e,category:i,quantity:t}}))}xe(){rp&&Tp.log("Flushing outcomes...");const A=this.Le();if(0===A.length)return void(rp&&Tp.log("No outcomes to send"));if(!this.ye)return void(rp&&Tp.log("No dsn provided, will not send outcomes"));rp&&Tp.log("Sending outcomes:",A);const t=(e=A,em((i=this.KA.tunnel&&Yv(this.ye))?{dsn:i}:{},[[{type:"client_report"},{timestamp:Yp(),discarded_events:e}]]));var e,i;this.sendEnvelope(t)}}function Rm(A){return void 0===A.type}function jm(A){return"transaction"===A.type}function Gm(A,t){const e=t??(function(A){return ap._e?.get(A)})(A)??[];if(0===e.length)return;const i=A.getOptions(),n=(function(A,t,e,i){const n={};return t?.sdk&&(n.sdk={name:t.sdk.name,version:t.sdk.version}),e&&i&&(n.dsn=Yv(i)),em(n,[(s=A,[{type:"log",item_count:s.length,content_type:"application/vnd.sentry.items.log+json"},{items:s}])]);var s})(e,i.be,i.tunnel,A.getDsn());ap._e?.set(A,[]),A.emit("flushLogs"),A.sendEnvelope(n)}ap._e=new WeakMap;const Pm=Symbol.for("SentryBufferFullError");function Vm(A){void 0===A.user?.ip_address&&(A.user={...A.user,ip_address:"{{auto}}"})}function Jm(A){"aggregates"in A?void 0===A.attrs?.ip_address&&(A.attrs={...A.attrs,ip_address:"{{auto}}"}):void 0===A.ipAddress&&(A.ipAddress="{{auto}}")}const Xm=100;function $m(A,t){const e=Bv(),i=lv();if(!e)return;const{beforeBreadcrumb:n=null,maxBreadcrumbs:s=Xm}=e.getOptions();if(s<=0)return;const r={timestamp:Yp(),...A},o=n?Sp((()=>n(r,t))):r;null!==o&&(e.emit&&e.emit("beforeAddBreadcrumb",o,t),i.addBreadcrumb(o,s))}let Ym;const Wm=new WeakMap,Zm=()=>({name:"FunctionToString",setupOnce(){Ym=Function.prototype.toString;try{Function.prototype.toString=function(...A){const t=_p(this),e=Wm.has(Bv())&&void 0!==t?t:this;return Ym.apply(e,A)}}catch{}},setup(A){Wm.set(A,!0)}}),qm=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],zm=(A={})=>{let t;return{name:"EventFilters",setup(e){const i=e.getOptions();t=tQ(A,i)},processEvent(e,i,n){if(!t){const e=n.getOptions();t=tQ(A,e)}return(function(A,t){if(A.type){if("transaction"===A.type&&(function(A,t){if(!t?.length)return!1;const e=A.transaction;return!!e&&Dp(e,t)})(A,t.ignoreTransactions))return rp&&Tp.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Vp(A)}`),!0}else{if((function(A,t){return!!t?.length&&Sm(A).some((A=>Dp(A,t)))})(A,t.ignoreErrors))return rp&&Tp.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Vp(A)}`),!0;if((function(A){return!!A.exception?.values?.length&&!A.message&&!A.exception.values.some((A=>A.stacktrace||A.type&&"Error"!==A.type||A.value))})(A))return rp&&Tp.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Vp(A)}`),!0;if((function(A,t){if(!t?.length)return!1;const e=eQ(A);return!!e&&Dp(e,t)})(A,t.denyUrls))return rp&&Tp.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Vp(A)}.\nUrl: ${eQ(A)}`),!0;if(!(function(A,t){if(!t?.length)return!0;const e=eQ(A);return!e||Dp(e,t)})(A,t.allowUrls))return rp&&Tp.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Vp(A)}.\nUrl: ${eQ(A)}`),!0}return!1})(e,t)?null:e}}},AQ=(A={})=>({...zm(A),name:"InboundFilters"});function tQ(A={},t={}){return{allowUrls:[...A.allowUrls||[],...t.allowUrls||[]],denyUrls:[...A.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...A.ignoreErrors||[],...t.ignoreErrors||[],...A.disableErrorDefaults?[]:qm],ignoreTransactions:[...A.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function eQ(A){try{const t=[...A.exception?.values??[]].reverse().find((A=>void 0===A.mechanism?.parent_id&&A.stacktrace?.frames?.length)),e=t?.stacktrace?.frames;return e?(function(A=[]){for(let t=A.length-1;t>=0;t--){const e=A[t];if(e&&"<anonymous>"!==e.filename&&"[native code]"!==e.filename)return e.filename||null}return null})(e):null}catch(t){return rp&&Tp.error(`Cannot extract url for event ${Vp(A)}`),null}}function iQ(A,t,e,i,n,s){if(!n.exception?.values||!s||!Up(s.originalException,Error))return;const r=n.exception.values.length>0?n.exception.values[n.exception.values.length-1]:void 0;r&&(n.exception.values=nQ(A,t,i,s.originalException,e,n.exception.values,r,0))}function nQ(A,t,e,i,n,s,r,o){if(s.length>=e+1)return s;let a=[...s];if(Up(i[n],Error)){sQ(r,o);const s=A(t,i[n]),c=a.length;rQ(s,n,c,o),a=nQ(A,t,e,i[n],n,[s,...a],s,c)}return Array.isArray(i.errors)&&i.errors.forEach(((i,s)=>{if(Up(i,Error)){sQ(r,o);const c=A(t,i),u=a.length;rQ(c,`errors[${s}]`,u,o),a=nQ(A,t,e,i,n,[c,...a],c,u)}})),a}function sQ(A,t){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,..."AggregateError"===A.type&&{is_exception_group:!0},exception_id:t}}function rQ(A,t,e,i){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,type:"chained",source:t,exception_id:e,parent_id:i}}function oQ(){"console"in ap&&kp.forEach((function(A){A in ap.console&&Mp(ap.console,A,(function(t){return Hp[A]=t,function(...t){Rv("console",{args:t,level:A});const e=Hp[A];e?.apply(ap.console,t)}}))}))}const aQ=()=>{let A;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if((function(A,t){return!(!t||!(function(A,t){const e=A.message,i=t.message;return!(!e&&!i||e&&!i||!e&&i||e!==i||!uQ(A,t)||!cQ(A,t))})(A,t)&&!(function(A,t){const e=hQ(t),i=hQ(A);return!!(e&&i&&e.type===i.type&&e.value===i.value&&uQ(A,t)&&cQ(A,t))})(A,t))})(t,A))return rp&&Tp.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return A=t}}};function cQ(A,t){let e=Mv(A),i=Mv(t);if(!e&&!i)return!0;if(e&&!i||!e&&i)return!1;if(i.length!==e.length)return!1;for(let n=0;n<i.length;n++){const A=i[n],t=e[n];if(A.filename!==t.filename||A.lineno!==t.lineno||A.colno!==t.colno||A.function!==t.function)return!1}return!0}function uQ(A,t){let e=A.fingerprint,i=t.fingerprint;if(!e&&!i)return!0;if(e&&!i||!e&&i)return!1;try{return!(e.join("")!==i.join(""))}catch(n){return!1}}function hQ(A){return A.exception?.values&&A.exception.values[0]}function lQ(A){if(!A)return{};const t=A.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const e=t[6]||"",i=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:e,hash:i,relative:t[5]+e+i}}function dQ(A){return void 0===A?void 0:A>=400&&A<500?"warning":A>=500?"error":void 0}const BQ=ap;function fQ(A){return A&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(A.toString())}function wQ(A,t){return!!A&&"object"==typeof A&&!!A[t]}function gQ(A){return"string"==typeof A?A:A?wQ(A,"url")?A.url:A.toString?A.toString():"":""}function pQ(A){const[t,e]=A;try{if("object"==typeof e&&null!==e&&"headers"in e&&e.headers)return new Headers(e.headers);if("undefined"!=typeof Request&&Up(t,Request))return new Headers(t.headers)}catch{}}const vQ=ap;let mQ=0;function QQ(){return mQ>0}function CQ(A,t={}){if("function"!=typeof A)return A;try{const t=A.Ne;if(t)return"function"==typeof t?t:A;if(_p(A))return A}catch(i){return A}const e=function(...e){try{const i=e.map((A=>CQ(A,t)));return A.apply(this,i)}catch(i){throw mQ++,setTimeout((()=>{mQ--})),dv((A=>{var n;A.addEventProcessor((A=>(t.mechanism&&(Jp(A,void 0,void 0),Xp(A,t.mechanism)),A.extra={...A.extra,arguments:e},A))),n=i,hv().captureException(n,void 0)})),i}};try{for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t])}catch{}xp(e,A),Lp(A,"__sentry_wrapped__",e);try{Object.getOwnPropertyDescriptor(e,"name").configurable&&Object.defineProperty(e,"name",{get:()=>A.name})}catch{}return e}function UQ(A,t){const e=yQ(A,t),i={type:IQ(t),value:kQ(t)};return e.length&&(i.stacktrace={frames:e}),void 0===i.type&&""===i.value&&(i.value="Unrecoverable error caught"),i}function FQ(A,t){return{exception:{values:[UQ(A,t)]}}}function yQ(A,t){const e=t.stacktrace||t.stack||"",i=(function(A){return A&&bQ.test(A.message)?1:0})(t),n=(function(A){return"number"==typeof A.framesToPop?A.framesToPop:0})(t);try{return A(e,i,n)}catch(s){}return[]}const bQ=/Minified React error #\d+;/i;function EQ(A){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&A instanceof WebAssembly.Exception}function IQ(A){const t=A?.name;return!t&&EQ(A)?A.message&&Array.isArray(A.message)&&2==A.message.length?A.message[0]:"WebAssembly.Exception":t}function kQ(A){const t=A?.message;return EQ(A)?Array.isArray(A.message)&&2==A.message.length?A.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function HQ(A,t,e,i,n){let s;if(fp(t)&&t.error)return FQ(A,t.error);if(wp(t)||Bp(t,"DOMException")){const n=t;if("stack"in t)s=FQ(A,t);else{const t=n.name||(wp(n)?"DOMError":"DOMException"),r=n.message?`${t}: ${n.message}`:t;s=SQ(A,r,e,i),Jp(s,r)}return"code"in n&&(s.tags={...s.tags,"DOMException.code":`${n.code}`}),s}return dp(t)?FQ(A,t):mp(t)||Qp(t)?(s=(function(A,t,e,i){const n=Bv(),s=n?.getOptions().normalizeDepth,r=(function(A){for(const t in A)if(Object.prototype.hasOwnProperty.call(A,t)){const e=A[t];if(e instanceof Error)return e}})(t),o={Re:Am(t,s)};if(r)return{exception:{values:[UQ(A,r)]},extra:o};const a={exception:{values:[{type:Qp(t)?t.constructor.name:i?"UnhandledRejection":"Error",value:TQ(t,{isUnhandledRejection:i})}]},extra:o};if(e){const t=yQ(A,e);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a})(A,t,e,n),Xp(s,{synthetic:!0}),s):(s=SQ(A,t,e,i),Jp(s,`${t}`,void 0),Xp(s,{synthetic:!0}),s)}function SQ(A,t,e,i){const n={};if(i&&e){const i=yQ(A,e);i.length&&(n.exception={values:[{value:t,stacktrace:{frames:i}}]}),Xp(n,{synthetic:!0})}if(pp(t)){const{Dt:A,Mt:e}=t;return n.logentry={message:A,params:e},n}return n.message=t,n}function TQ(A,{isUnhandledRejection:t}){const e=(function(A,t=40){const e=Object.keys(Np(A));e.sort();const i=e[0];if(!i)return"[object has no keys]";if(i.length>=t)return Op(i,t);for(let n=e.length;n>0;n--){const A=e.slice(0,n).join(", ");if(!(A.length>t))return n===e.length?A:Op(A,t)}return""})(A),i=t?"promise rejection":"exception";return fp(A)?`Event \`ErrorEvent\` captured as ${i} with message \`${A.message}\``:Qp(A)?`Event \`${(function(A){try{const t=Object.getPrototypeOf(A);return t?t.constructor.name:void 0}catch(t){}})(A)}\` (type=${A.type}) captured as ${i}`:`Object captured as ${i} with keys: ${e}`}class OQ extends Nm{constructor(A){const t=(e=A,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:vQ.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e});var e;!(function(A,t,e=[t],i="npm"){const n=A.be||{};n.sdk||(n.sdk={name:`sentry.javascript.${t}`,packages:e.map((A=>({name:`${i}:@sentry/${A}`,version:op}))),version:op}),A.be=n})(t,"browser",["browser"],vQ.SENTRY_SDK_SOURCE||"npm"),super(t);const{sendDefaultPii:i,sendClientReports:n,je:s}=this.KA,r=s?.enableLogs;vQ.document&&(n||r)&&vQ.document.addEventListener("visibilitychange",(()=>{"hidden"===vQ.document.visibilityState&&(n&&this.xe(),r&&Gm(this))})),r&&(this.on("flush",(()=>{Gm(this)})),this.on("afterCaptureLog",(()=>{this.Ge&&clearTimeout(this.Ge),this.Ge=setTimeout((()=>{Gm(this)}),5e3)}))),i&&(this.on("postprocessEvent",Vm),this.on("beforeSendSession",Jm))}eventFromException(A,t){return(function(A,t,e,i){const n=HQ(A,t,e?.syntheticException||void 0,i);return Xp(n),n.level="error",e?.event_id&&(n.event_id=e.event_id),dm(n)})(this.KA.stackParser,A,t,this.KA.attachStacktrace)}eventFromMessage(A,t="info",e){return(function(A,t,e="info",i,n){const s=SQ(A,t,i?.syntheticException||void 0,n);return s.level=e,i?.event_id&&(s.event_id=i.event_id),dm(s)})(this.KA.stackParser,A,t,e,this.KA.attachStacktrace)}Ke(A,t,e,i){return A.platform=A.platform||"javascript",super.Ke(A,t,e,i)}}const KQ="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,DQ=ap;let MQ,LQ,xQ,_Q;function NQ(){if(!DQ.document)return;const A=Rv.bind(null,"dom"),t=RQ(A,!0);DQ.document.addEventListener("click",t,!1),DQ.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach((t=>{const e=DQ,i=e[t]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(Mp(i,"addEventListener",(function(t){return function(e,i,n){if("click"===e||"keypress"==e)try{const i=this.Pe=this.Pe||{},s=i[e]=i[e]||{refCount:0};if(!s.handler){const i=RQ(A);s.handler=i,t.call(this,e,i,n)}s.refCount++}catch(s){}return t.call(this,e,i,n)}})),Mp(i,"removeEventListener",(function(A){return function(t,e,i){if("click"===t||"keypress"==t)try{const e=this.Pe||{},n=e[t];n&&(n.refCount--,n.refCount<=0&&(A.call(this,t,n.handler,i),n.handler=void 0,delete e[t]),0===Object.keys(e).length&&delete this.Pe)}catch(n){}return A.call(this,t,e,i)}})))}))}function RQ(A,t=!1){return e=>{if(!e||e.Ve)return;const i=(function(A){try{return A.target}catch(t){return null}})(e);if((function(A,t){return"keypress"===A&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)})(e.type,i))return;Lp(e,"_sentryCaptured",!0),i&&!i.Je&&Lp(i,"_sentryId",Gp());const n="keypress"===e.type?"input":e.type;(function(A){if(A.type!==LQ)return!1;try{if(!A.target||A.target.Je!==xQ)return!1}catch(t){}return!0})(e)||(A({event:e,name:n,global:t}),LQ=e.type,xQ=i?i.Je:void 0),clearTimeout(MQ),MQ=DQ.setTimeout((()=>{xQ=void 0,LQ=void 0}),1e3)}}function jQ(A){const t="history";_v(t,A),Nv(t,GQ)}function GQ(){function A(A){return function(...t){const e=t.length>2?t[2]:void 0;if(e){const i=_Q,n=(function(A){try{return new URL(A,DQ.location.origin).toString()}catch{return A}})(String(e));if(_Q=n,i===n)return A.apply(this,t);Rv("history",{from:i,to:n})}return A.apply(this,t)}}DQ.addEventListener("popstate",(()=>{const A=DQ.location.href,t=_Q;_Q=A,t!==A&&Rv("history",{from:t,to:A})})),"history"in BQ&&BQ.history&&(Mp(DQ.history,"pushState",A),Mp(DQ.history,"replaceState",A))}const PQ={};function VQ(A){PQ[A]=void 0}const JQ="__sentry_xhr_v3__";function XQ(){if(!DQ.XMLHttpRequest)return;const A=XMLHttpRequest.prototype;A.open=new Proxy(A.open,{apply(A,t,e){const i=new Error,n=1e3*Wp(),s=gp(e[0])?e[0].toUpperCase():void 0,r=(function(A){if(gp(A))return A;try{return A.toString()}catch{}})(e[1]);if(!s||!r)return A.apply(t,e);t[JQ]={method:s,url:r,request_headers:{}},"POST"===s&&r.match(/sentry_key/)&&(t.Xe=!0);const o=()=>{const A=t[JQ];if(A&&4===t.readyState){try{A.status_code=t.status}catch(e){}Rv("xhr",{endTimestamp:1e3*Wp(),startTimestamp:n,xhr:t,virtualError:i})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(A,t,e)=>(o(),A.apply(t,e))}):t.addEventListener("readystatechange",o),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(A,t,e){const[i,n]=e,s=t[JQ];return s&&gp(i)&&gp(n)&&(s.request_headers[i.toLowerCase()]=n),A.apply(t,e)}}),A.apply(t,e)}}),A.send=new Proxy(A.send,{apply(A,t,e){const i=t[JQ];return i?(void 0!==e[0]&&(i.body=e[0]),Rv("xhr",{startTimestamp:1e3*Wp(),xhr:t}),A.apply(t,e)):A.apply(t,e)}})}function $Q(A,t=(function(A){const t=PQ[A];if(t)return t;let e=DQ[A];if(fQ(e))return PQ[A]=e.bind(DQ);const i=DQ.document;if(i&&"function"==typeof i.createElement)try{const t=i.createElement("iframe");t.hidden=!0,i.head.appendChild(t);const n=t.contentWindow;n?.[A]&&(e=n[A]),i.head.removeChild(t)}catch(n){KQ&&Tp.warn(`Could not create sandbox iframe for ${A} check, bailing to window.${A}: `,n)}return e?PQ[A]=e.bind(DQ):e})("fetch")){let e=0,i=0;return(function(A,t,e=(function(A){const t=[];function e(A){return t.splice(t.indexOf(A),1)[0]||Promise.resolve(void 0)}return{$:t,add:function(i){if(!(void 0===A||t.length<A))return Bm(Pm);const n=i();return-1===t.indexOf(n)&&t.push(n),n.then((()=>e(n))).then(null,(()=>e(n).then(null,(()=>{})))),n},drain:function(A){return new fm(((e,i)=>{let n=t.length;if(!n)return e(!0);const s=setTimeout((()=>{A&&A>0&&e(!1)}),A);t.forEach((A=>{dm(A).then((()=>{--n||(clearTimeout(s),e(!0))}),i)}))}))}}})(A.bufferSize||64)){let i={};return{send:function(n){const s=[];if(nm(n,((t,e)=>{const n=cm(e);!(function(A,t,e=Date.now()){return(function(A,t){return A[t]||A.all||0})(A,t)>e})(i,n)?s.push(t):A.recordDroppedEvent("ratelimit_backoff",n)})),0===s.length)return dm({});const r=em(n[0],s),o=t=>{nm(r,((e,i)=>{A.recordDroppedEvent(t,cm(i))}))};return e.add((()=>t({body:rm(r)}).then((A=>(void 0!==A.statusCode&&(A.statusCode<200||A.statusCode>=300)&&rp&&Tp.warn(`Sentry responded with status code ${A.statusCode} to sent event.`),i=(function(A,{statusCode:t,headers:e},i=Date.now()){const n={...A},s=e?.["x-sentry-rate-limits"],r=e?.["retry-after"];if(s)for(const o of s.trim().split(",")){const[A,t,,,e]=o.split(":",5),s=parseInt(A,10),r=1e3*(isNaN(s)?60:s);if(t)for(const o of t.split(";"))"metric_bucket"===o&&e&&!e.split(";").includes("custom")||(n[o]=i+r);else n.all=i+r}else r?n.all=i+(function(A,t=Date.now()){const e=parseInt(`${A}`,10);if(!isNaN(e))return 1e3*e;const i=Date.parse(`${A}`);return isNaN(i)?6e4:i-t})(r,i):429===t&&(n.all=i+6e4);return n})(i,A),A)),(A=>{throw o("network_error"),rp&&Tp.error("Encountered error running transport request:",A),A})))).then((A=>A),(A=>{if(A===Pm)return rp&&Tp.error("Skipped sending event because buffer is full."),o("queue_overflow"),dm({});throw A}))},flush:A=>e.drain(A)}})(A,(function(n){const s=n.body.length;e+=s,i++;const r={body:n.body,method:"POST",referrerPolicy:"strict-origin",headers:A.headers,keepalive:e<=6e4&&i<15,...A.fetchOptions};if(!t)return VQ("fetch"),Bm("No fetch implementation available");try{return t(A.url,r).then((A=>(e-=s,i--,{statusCode:A.status,headers:{"x-sentry-rate-limits":A.headers.get("X-Sentry-Rate-Limits"),"retry-after":A.headers.get("Retry-After")}})))}catch(o){return VQ("fetch"),e-=s,i--,Bm(o)}}))}function YQ(A,t,e,i){const n={filename:A,function:"<anonymous>"===t?Hv:t,in_app:!0};return void 0!==e&&(n.lineno=e),void 0!==i&&(n.colno=i),n}const WQ=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ZQ=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qQ=/\((\S*)(?::(\d+))(?::(\d+))\)/,zQ=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,AC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tC=(function(...A){const t=A.sort(((A,t)=>A[0]-t[0])).map((A=>A[1]));return(A,e=0,i=0)=>{const n=[],s=A.split("\n");for(let r=e;r<s.length;r++){const A=s[r];if(A.length>1024)continue;const e=Sv.test(A)?A.replace(Sv,"$1"):A;if(!e.match(/\S*Error: /)){for(const A of t){const t=A(e);if(t){n.push(t);break}}if(n.length>=50+i)break}}return(function(A){if(!A.length)return[];const t=Array.from(A);return/sentryWrapped/.test(Ov(t).function||"")&&t.pop(),t.reverse(),Tv.test(Ov(t).function||"")&&(t.pop(),Tv.test(Ov(t).function||"")&&t.pop()),t.slice(0,50).map((A=>({...A,filename:A.filename||Ov(t).filename,function:A.function||Hv})))})(n.slice(i))}})([30,A=>{const t=WQ.exec(A);if(t){const[,A,e,i]=t;return YQ(A,Hv,+e,+i)}const e=ZQ.exec(A);if(e){if(e[2]&&0===e[2].indexOf("eval")){const A=qQ.exec(e[2]);A&&(e[2]=A[1],e[3]=A[2],e[4]=A[3])}const[A,t]=eC(e[1]||Hv,e[2]);return YQ(t,A,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}}],[50,A=>{const t=zQ.exec(A);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const A=AC.exec(t[3]);A&&(t[1]=t[1]||"eval",t[3]=A[1],t[4]=A[2],t[5]="")}let A=t[3],e=t[1]||Hv;return[e,A]=eC(e,A),YQ(A,e,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),eC=(A,t)=>{const e=-1!==A.indexOf("safari-extension"),i=-1!==A.indexOf("safari-web-extension");return e||i?[-1!==A.indexOf("@")?A.split("@")[0]:Hv,e?`safari-extension:${t}`:`safari-web-extension:${t}`]:[A,t]},iC="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,nC=(A={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...A};return{name:"Breadcrumbs",setup(A){var e;t.console&&(function(A){const t="console";_v(t,A),Nv(t,oQ)})((function(A){return function(t){if(Bv()!==A)return;const e={category:"console",data:{arguments:t.args,logger:"console"},level:(i=t.level,"warn"===i?"warning":["fatal","error","warning","log","info","debug"].includes(i)?i:"log"),message:Kp(t.args," ")};var i;if("assert"===t.level){if(!1!==t.args[0])return;e.message=`Assertion failed: ${Kp(t.args.slice(1)," ")||"console.assert"}`,e.data.arguments=t.args.slice(1)}$m(e,{input:t.args,level:t.level})}})(A)),t.dom&&(e=(function(A,t){return function(e){if(Bv()!==A)return;let i,n,s="object"==typeof t?t.serializeAttribute:void 0,r="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;r&&r>1024&&(iC&&Tp.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${r} was configured. Sentry will use 1024 instead.`),r=1024),"string"==typeof s&&(s=[s]);try{const A=e.event,t=(function(A){return!!A&&!!A.target})(A)?A.target:A;i=bp(t,{keyAttrs:s,maxStringLength:r}),n=(function(A){if(!yp.HTMLElement)return null;let t=A;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null})(t)}catch(a){i="<unknown>"}if(0===i.length)return;const o={category:`ui.${e.name}`,message:i};n&&(o.data={"ui.component_name":n}),$m(o,{event:e.event,name:e.name,global:e.global})}})(A,t.dom),_v("dom",e),Nv("dom",NQ)),t.xhr&&(function(A){_v("xhr",A),Nv("xhr",XQ)})((function(A){return function(t){if(Bv()!==A)return;const{startTimestamp:e,endTimestamp:i}=t,n=t.xhr[JQ];if(!e||!i||!n)return;const{method:s,url:r,status_code:o,body:a}=n,c={method:s,url:r,status_code:o},u={xhr:t.xhr,input:a,startTimestamp:e,endTimestamp:i},h={category:"xhr",data:c,type:"http",level:dQ(o)};A.emit("beforeOutgoingRequestBreadcrumb",h,u),$m(h,u)}})(A)),t.fetch&&(function(A,t){const e="fetch";_v(e,A),Nv(e,(()=>(function(A,t=!1){t&&!(function(){if("string"==typeof EdgeRuntime)return!0;if(!(function(){if(!("fetch"in BQ))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch(A){return!1}})())return!1;if(fQ(BQ.fetch))return!0;let A=!1;const t=BQ.document;if(t&&"function"==typeof t.createElement)try{const e=t.createElement("iframe");e.hidden=!0,t.head.appendChild(e),e.contentWindow?.fetch&&(A=fQ(e.contentWindow.fetch)),t.head.removeChild(e)}catch(e){rp&&Tp.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return A})()||Mp(ap,"fetch",(function(t){return function(...e){const i=new Error,{method:n,url:s}=(function(A){if(0===A.length)return{method:"GET",url:""};if(2===A.length){const[t,e]=A;return{url:gQ(t),method:wQ(e,"method")?String(e.method).toUpperCase():"GET"}}const t=A[0];return{url:gQ(t),method:wQ(t,"method")?String(t.method).toUpperCase():"GET"}})(e),r={args:e,fetchData:{method:n,url:s},startTimestamp:1e3*Wp(),virtualError:i,headers:pQ(e)};return A||Rv("fetch",{...r}),t.apply(ap,e).then((async t=>(A?A(t):Rv("fetch",{...r,endTimestamp:1e3*Wp(),response:t}),t)),(A=>{if(Rv("fetch",{...r,endTimestamp:1e3*Wp(),error:A}),dp(A)&&void 0===A.stack&&(A.stack=i.stack,Lp(A,"framesToPop",1)),A instanceof TypeError&&("Failed to fetch"===A.message||"Load failed"===A.message||"NetworkError when attempting to fetch resource."===A.message))try{const t=new URL(r.fetchData.url);A.message=`${A.message} (${t.host})`}catch{}throw A}))}}))})(void 0,t)))})((function(A){return function(t){if(Bv()!==A)return;const{startTimestamp:e,endTimestamp:i}=t;if(i&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.fetchData.method,t.fetchData.url,t.error){const n=t.fetchData,s={data:t.error,input:t.args,startTimestamp:e,endTimestamp:i},r={category:"fetch",data:n,level:"error",type:"http"};A.emit("beforeOutgoingRequestBreadcrumb",r,s),$m(r,s)}else{const n=t.response,s={...t.fetchData,status_code:n?.status};t.fetchData.request_body_size,t.fetchData.response_body_size;const r={input:t.args,response:n,startTimestamp:e,endTimestamp:i},o={category:"fetch",data:s,type:"http",level:dQ(s.status_code)};A.emit("beforeOutgoingRequestBreadcrumb",o,r),$m(o,r)}}})(A)),t.history&&jQ((function(A){return function(t){if(Bv()!==A)return;let e=t.from,i=t.to;const n=lQ(vQ.location.href);let s=e?lQ(e):void 0;const r=lQ(i);s?.path||(s=n),n.protocol===r.protocol&&n.host===r.host&&(i=r.relative),n.protocol===s.protocol&&n.host===s.host&&(e=s.relative),$m({category:"navigation",data:{from:e,to:i}})}})(A)),t.sentry&&A.on("beforeSendEvent",(function(A){return function(t){Bv()===A&&$m({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Vp(t)},{event:t})}})(A))}}},sC=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],rC=(A={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...A};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Mp(vQ,"setTimeout",oC),t.setInterval&&Mp(vQ,"setInterval",oC),t.requestAnimationFrame&&Mp(vQ,"requestAnimationFrame",aC),t.XMLHttpRequest&&"XMLHttpRequest"in vQ&&Mp(XMLHttpRequest.prototype,"send",cC);const A=t.eventTarget;A&&(Array.isArray(A)?A:sC).forEach(uC)}}};function oC(A){return function(...t){const e=t[0];return t[0]=CQ(e,{mechanism:{data:{function:Dv(A)},handled:!1,type:"instrument"}}),A.apply(this,t)}}function aC(A){return function(t){return A.apply(this,[CQ(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Dv(A)},handled:!1,type:"instrument"}})])}}function cC(A){return function(...t){const e=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((A=>{A in e&&"function"==typeof e[A]&&Mp(e,A,(function(t){const e={mechanism:{data:{function:A,handler:Dv(t)},handled:!1,type:"instrument"}},i=_p(t);return i&&(e.mechanism.data.handler=Dv(i)),CQ(t,e)}))})),A.apply(this,t)}}function uC(A){const t=vQ,e=t[A]?.prototype;e?.hasOwnProperty?.("addEventListener")&&(Mp(e,"addEventListener",(function(t){return function(e,i,n){try{"function"==typeof i.handleEvent&&(i.handleEvent=CQ(i.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Dv(i),target:A},handled:!1,type:"instrument"}}))}catch{}return t.apply(this,[e,CQ(i,{mechanism:{data:{function:"addEventListener",handler:Dv(i),target:A},handled:!1,type:"instrument"}}),n])}})),Mp(e,"removeEventListener",(function(A){return function(t,e,i){try{const n=e.Ne;n&&A.call(this,t,n,i)}catch(n){}return A.call(this,t,e,i)}})))}const hC=(A={})=>{const t={onerror:!0,onunhandledrejection:!0,...A};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(A){t.onerror&&((function(A){!(function(){const t="error";_v(t,(t=>{const{stackParser:e,attachStacktrace:i}=dC();if(Bv()!==A||QQ())return;const{msg:n,url:s,line:r,column:o,error:a}=t,c=(function(A,t,e,i){const n=A.exception=A.exception||{},s=n.values=n.values||[],r=s[0]=s[0]||{},o=r.stacktrace=r.stacktrace||{},a=o.frames=o.frames||[],c=i,u=e,h=gp(t)&&t.length>0?t:Ip();return 0===a.length&&a.push({colno:c,filename:h,function:Hv,in_app:!0,lineno:u}),A})(HQ(e,a||n,void 0,i,!1),s,r,o);c.level="error",Um(c,{originalException:a,mechanism:{handled:!1,type:"onerror"}})})),Nv(t,Gv)})()})(A),lC("onerror")),t.onunhandledrejection&&((function(A){!(function(){const t="unhandledrejection";_v(t,(t=>{const{stackParser:e,attachStacktrace:i}=dC();if(Bv()!==A||QQ())return;const n=(function(A){if(vp(A))return A;try{if("reason"in A)return A.reason;if("detail"in A&&"reason"in A.detail)return A.detail.reason}catch{}return A})(t),s=vp(n)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`}]}}:HQ(e,n,void 0,i,!0);s.level="error",Um(s,{originalException:n,mechanism:{handled:!1,type:"onunhandledrejection"}})})),Nv(t,Vv)})()})(A),lC("onunhandledrejection"))}}};function lC(A){iC&&Tp.log(`Global Handler attached: ${A}`)}function dC(){const A=Bv();return A?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const BC=(A={})=>{const t=A.limit||5,e=A.key||"cause";return{name:"LinkedErrors",preprocessEvent(A,i,n){iQ(UQ,n.getOptions().stackParser,e,t,A,i)}}};let fC=null,wC={};function gC(A,t){fC||(fC=(function(){const A=[AQ(),Zm(),rC(),nC(),hC(),BC(),aQ(),{name:"HttpContext",preprocessEvent(A){if(!vQ.navigator&&!vQ.location&&!vQ.document)return;const t=(function(){const A=Ip(),{referrer:t}=vQ.document||{},{userAgent:e}=vQ.navigator||{};return{url:A,headers:{...t&&{Referer:t},...e&&{"User-Agent":e}}}})(),e={...t.headers,...A.request?.headers};A.request={...t,...A.request,headers:e}}},{name:"BrowserSession",setupOnce(){void 0!==vQ.document?(Fm({ignoreDuration:!0}),Em(),jQ((({from:A,to:t})=>{void 0!==A&&A!==t&&(Fm({ignoreDuration:!0}),Em())}))):iC&&Tp.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}].filter((A=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers","HttpContext"].includes(A.name))),t=new OQ({dsn:"https://ac54bd10eac67be2dafbc346e704e4d4@o4507251798835200.ingest.us.sentry.io/4509409566392320",environment:"production",transport:$Q,stackParser:tC,integrations:A,beforeSend(A,t){const e=t.originalException;if(e instanceof Error){if(e.message.includes("Failed to fetch")||e.message.includes("Network request failed")||e.message.includes("Load failed"))return null;if(e.message.includes("Permission denied")||e.message.includes("NotAllowedError"))return null}return A},release:process.env.npm_package_version||"0.6.2"}),e=new nv;return e.setClient(t),t.init(),e})()),fC&&dv((e=>{Object.entries(wC).forEach((([A,t])=>{void 0!==t&&e.setTag(A,String(t))})),t&&(Object.entries(t).forEach((([A,t])=>{void 0!==t&&e.setTag(A,String(t))})),(t.userId||t.userEmail)&&e.setUser({id:t.userId,email:t.userEmail,...t.userMetadata}),(t.eventType||t.eventData||t.userJourney)&&e.setContext("eventContext",{eventType:t.eventType,eventData:t.eventData,userJourney:t.userJourney,timestamp:(new Date).toISOString()})),fC.captureException(A)}))}function pC(A,t,e){wC.eventType=A,wC.eventData=t,wC.userJourney||(wC.userJourney=[]);const i=`${(new Date).toISOString()}: ${A}${e?` (${e})`:""}`;wC.userJourney.push(i),wC.userJourney.length>10&&(wC.userJourney=wC.userJourney.slice(-10))}function vC(A){wC={...wC,...A}}function mC(A,t,e){return async(...i)=>{try{pC(`${t}_started`,{componentName:e},e);const n=await A(...i);return pC(`${t}_completed`,{componentName:e},e),n}catch(n){throw gC(n,{...wC,componentName:e,handlerName:t,eventType:`${t}_failed`,eventData:{error:n instanceof Error?n.message:String(n)}}),n}}}function QC(A,t,e){return(...i)=>{try{pC(`${t}_started`,{componentName:e},e);const n=A(...i);return pC(`${t}_completed`,{componentName:e},e),n}catch(n){throw gC(n,{...wC,componentName:e,handlerName:t,eventType:`${t}_failed`,eventData:{error:n instanceof Error?n.message:String(n)}}),n}}}function CC(A){return{trackLifecycle:(t,e)=>{try{pC(`${A}_${t}`,{},A),e()}catch(i){throw gC(i,{componentName:A,lifecycle:t,eventType:`${A}_${t}_failed`}),i}},trackRender:t=>{try{return t()}catch(e){return gC(e,{componentName:A,lifecycle:"render",eventType:`${A}_render_failed`}),Mg`<div>Error rendering ${A}</div>`}},setContext:()=>{vC({componentName:A}),pC(`${A}_initialized`,{},A)}}}const UC="session_data",FC=new class{constructor(A){this.namespace=A}getItem(A){return localStorage.getItem(`${this.namespace}.${A}`)}setItem(A,t){localStorage.setItem(`${this.namespace}.${A}`,t)}removeItem(A){localStorage.removeItem(`${this.namespace}.${A}`)}clear(){for(let A=0;A<localStorage.length;A++){const t=localStorage.key(A);t&&t.startsWith(`${this.namespace}.`)&&localStorage.removeItem(t)}}}("io.obi.widget");var yC=Object.defineProperty,bC=Object.getOwnPropertyDescriptor,EC=(A,t,e,i)=>{for(var n,s=i>1?void 0:i?bC(t,e):t,r=A.length-1;r>=0;r--)(n=A[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&yC(t,e,s),s};class IC extends Ap{constructor(){super(...arguments),this.id="",this.isActive=!1,this.isSpecial=!1}handleClick(A){A.preventDefault(),A.stopPropagation();const t=new CustomEvent("obi-nav-icon-click",{detail:{id:this.id,isActive:!this.isActive},bubbles:!0,composed:!0});this.dispatchEvent(t),this.onClick&&this.onClick(this.id,!this.isActive)}render(){return Mg`
|
|
2
2
|
<button
|
|
3
3
|
id="obi-nav-${this.id}"
|
|
4
4
|
class=${this.isSpecial?"special":""}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
>
|
|
9
9
|
<slot></slot>
|
|
10
10
|
</button>
|
|
11
|
-
`}}
|
|
11
|
+
`}}IC.styles=zw`
|
|
12
12
|
:host {
|
|
13
13
|
display: block;
|
|
14
14
|
}
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
width: 18px;
|
|
61
61
|
height: 18px;
|
|
62
62
|
}
|
|
63
|
-
`,
|
|
63
|
+
`,EC([np({type:String})],IC.prototype,"id",2),EC([np({type:Boolean})],IC.prototype,"isActive",2),EC([np({type:Boolean})],IC.prototype,"isSpecial",2),EC([np({type:Function})],IC.prototype,"onClick",2),customElements.get("obi-nav-icon")||customElements.define("obi-nav-icon",IC);const kC=A=>Mg`
|
|
64
64
|
<svg
|
|
65
65
|
xmlns="http://www.w3.org/2000/svg"
|
|
66
66
|
width="24"
|
|
@@ -76,31 +76,31 @@
|
|
|
76
76
|
>
|
|
77
77
|
${A}
|
|
78
78
|
</svg>
|
|
79
|
-
`,
|
|
79
|
+
`,HC=kC(Lg`
|
|
80
80
|
<rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/>
|
|
81
|
-
`),
|
|
81
|
+
`),SC=kC(Lg`<polygon points="6 3 20 12 6 21 6 3"/>`),TC=kC(Lg`
|
|
82
82
|
<path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.77.04"/>
|
|
83
|
-
`),
|
|
83
|
+
`),OC=kC(Lg`
|
|
84
84
|
<path d="M18 6 6 18"/><path d="m6 6 12 12"/>
|
|
85
|
-
`),
|
|
85
|
+
`),KC=kC(Lg`
|
|
86
86
|
<path d="M12 7v14" />
|
|
87
87
|
<path
|
|
88
88
|
d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"
|
|
89
89
|
/>
|
|
90
|
-
`),
|
|
90
|
+
`),DC=Mg`
|
|
91
91
|
<img
|
|
92
92
|
class="widget-icon"
|
|
93
93
|
src="data:image/svg+xml;base64,${btoa('<?xml version="1.0" encoding="UTF-8"?>\n <svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M158.803 0L160.352 0.0399439C176.267 0.844061 188.922 13.9634 188.922 30.0311C188.922 46.6174 175.438 60.0653 158.803 60.0656H99.0263L98.9061 60.0722C78.8071 61.4795 62.6269 77.004 60.2644 96.7673L60.241 96.9704V158.93L60.2644 159.13C62.7406 179.86 80.4234 195.934 101.881 195.935H153.842C176.993 195.935 195.759 177.223 195.759 154.14V96.9138L195.799 95.3693C196.606 79.5009 209.766 66.8827 225.881 66.8827C242.515 66.8834 256 80.328 256 96.9138V159.086L255.963 160.564C255.225 175.748 243.176 187.971 228.038 189.038V189.214C207.121 190.591 190.4 207.263 189.019 228.119H188.842C187.738 243.7 174.712 256 158.803 256H96.4491C79.8147 256 66.3309 242.555 66.3302 225.969C66.3302 225.673 66.3349 225.375 66.3436 225.077H66.3503H66.3035C63.3344 206.008 47.4427 190.589 27.8321 189.231L27.8354 189.031C12.2702 187.868 0.000167669 174.905 0 159.086V96.9138L0.0367222 95.4192C0.791087 80.0787 13.0909 67.7634 28.453 66.9293C47.7697 65.3039 63.3522 50.3234 66.2969 31.4658L66.3469 31.1595L66.3369 30.85C66.3301 30.5933 66.3302 30.3238 66.3302 30.0311C66.3309 13.4454 79.8148 0.000165137 96.4491 0H158.803Z" fill="white"/>\n </svg>')}"
|
|
94
94
|
alt="Obi Icon"
|
|
95
95
|
/>
|
|
96
|
-
`;var
|
|
96
|
+
`;var MC=Object.defineProperty,LC=Object.getOwnPropertyDescriptor,xC=(A,t,e,i)=>{for(var n,s=i>1?void 0:i?LC(t,e):t,r=A.length-1;r>=0;r--)(n=A[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&MC(t,e,s),s};class _C extends Ap{constructor(){super(),this.isActive=!1,this.isScreenActive=!1,this.position={top:0,left:0},this.currentState=Ra.READY,this.direction="up"}connectedCallback(){super.connectedCallback()}handleIconClick(A,t){this.onItemSelect&&this.onItemSelect(A,t)}render(){return Mg`
|
|
97
97
|
${this.isActive?Mg`
|
|
98
98
|
<obi-nav-icon
|
|
99
99
|
id="pause"
|
|
100
|
-
?isActive=${this.currentState===
|
|
101
|
-
@obi-nav-icon-click=${()=>this.handleIconClick("pause",this.currentState!==
|
|
100
|
+
?isActive=${this.currentState===Ra.PAUSED}
|
|
101
|
+
@obi-nav-icon-click=${()=>this.handleIconClick("pause",this.currentState!==Ra.PAUSED)}
|
|
102
102
|
>
|
|
103
|
-
${this.currentState===
|
|
103
|
+
${this.currentState===Ra.PAUSED?SC:HC}
|
|
104
104
|
</obi-nav-icon>
|
|
105
105
|
<obi-nav-icon
|
|
106
106
|
id="activate"
|
|
@@ -108,17 +108,17 @@
|
|
|
108
108
|
?isSpecial=${!0}
|
|
109
109
|
@obi-nav-icon-click=${()=>this.handleIconClick("activate",!this.isActive)}
|
|
110
110
|
>
|
|
111
|
-
${this.isActive?
|
|
111
|
+
${this.isActive?OC:TC}
|
|
112
112
|
</obi-nav-icon>
|
|
113
113
|
`:Mg`
|
|
114
114
|
<obi-nav-icon
|
|
115
115
|
id="experiences"
|
|
116
116
|
@obi-nav-icon-click=${()=>this.handleIconClick("experiences",!0)}
|
|
117
117
|
>
|
|
118
|
-
${
|
|
118
|
+
${KC}
|
|
119
119
|
</obi-nav-icon>
|
|
120
120
|
`}
|
|
121
|
-
`}}
|
|
121
|
+
`}}_C.styles=zw`
|
|
122
122
|
:host {
|
|
123
123
|
display: flex;
|
|
124
124
|
position: absolute;
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
bottom: auto;
|
|
142
142
|
flex-direction: column;
|
|
143
143
|
}
|
|
144
|
-
`,
|
|
144
|
+
`,xC([np({type:Boolean})],_C.prototype,"isActive",2),xC([np({type:Boolean})],_C.prototype,"isScreenActive",2),xC([np({type:Object})],_C.prototype,"position",2),xC([np({type:String})],_C.prototype,"currentState",2),xC([np({type:String})],_C.prototype,"direction",2),xC([np({type:Function})],_C.prototype,"onItemSelect",2),customElements.get("obi-navigation-bar")||customElements.define("obi-navigation-bar",_C);var NC=Object.defineProperty,RC=Object.getOwnPropertyDescriptor,jC=(A,t,e,i)=>{for(var n,s=i>1?void 0:i?RC(t,e):t,r=A.length-1;r>=0;r--)(n=A[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&NC(t,e,s),s};class GC extends Ap{constructor(){super(),this.id="",this.name="",this.description="",this.duration=10,this.selected=!1,this.handleClick=QC((()=>{pC("course_clicked",{courseId:this.id,courseName:this.name},"Course"),this.dispatchEvent(new CustomEvent("course-card-click",{detail:{id:this.id,name:this.name,description:this.description,duration:this.duration},bubbles:!0,composed:!0}))}),"handleClick","Course");try{CC("Course").setContext()}catch(A){gC(A,{componentName:"Course",lifecycle:"constructor"})}}render(){return Mg`
|
|
145
145
|
<div class="course-container ${this.selected?"selected":""}" @click=${this.handleClick}>
|
|
146
146
|
<div class="header-row">
|
|
147
147
|
<h2 class="course-title">${this.name}</h2>
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
</div>
|
|
150
150
|
${this.description?Mg`<p class="course-description">${this.description}</p>`:""}
|
|
151
151
|
</div>
|
|
152
|
-
`}}
|
|
152
|
+
`}}GC.styles=zw`
|
|
153
153
|
:host {
|
|
154
154
|
display: block;
|
|
155
155
|
}
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
-webkit-box-orient: vertical;
|
|
249
249
|
text-align: left;
|
|
250
250
|
}
|
|
251
|
-
`,
|
|
251
|
+
`,jC([np({type:String})],GC.prototype,"id",2),jC([np({type:String})],GC.prototype,"name",2),jC([np({type:String})],GC.prototype,"description",2),jC([np({type:Number})],GC.prototype,"duration",2),jC([np({type:Boolean})],GC.prototype,"selected",2);class PC extends Ap{constructor(){super(...arguments),this.courses=[],this.selectedCourseId=null,this.loading=!1,this.error=""}render(){return this.loading?Mg`<div class="loading">Loading...</div>`:this.error?Mg`<div class="error">${this.error}</div>`:this.courses&&0!==this.courses.length?Mg`
|
|
252
252
|
<div class="course-grid">
|
|
253
253
|
${this.courses.map((A=>{const t=A.id===this.selectedCourseId;return Mg`
|
|
254
254
|
<obi-course
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
></obi-course>
|
|
261
261
|
`}))}
|
|
262
262
|
</div>
|
|
263
|
-
`:Mg`<div class="empty">No courses available</div>`}}
|
|
263
|
+
`:Mg`<div class="empty">No courses available</div>`}}PC.styles=zw`
|
|
264
264
|
:host {
|
|
265
265
|
display: block;
|
|
266
266
|
}
|
|
@@ -272,6 +272,7 @@
|
|
|
272
272
|
padding: 12px 0px;
|
|
273
273
|
flex: 1 0 0;
|
|
274
274
|
align-self: stretch;
|
|
275
|
+
min-height: 364px; /* Ensure minimum 2 rows: 2 * 180px + 4px gap */
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
@media (max-width: 767px) {
|
|
@@ -292,14 +293,21 @@
|
|
|
292
293
|
.error {
|
|
293
294
|
color: #ef4444;
|
|
294
295
|
}
|
|
295
|
-
`,
|
|
296
|
+
`,jC([np({type:Array})],PC.prototype,"courses",2),jC([np({type:String})],PC.prototype,"selectedCourseId",2),jC([np({type:Boolean})],PC.prototype,"loading",2),jC([np({type:String})],PC.prototype,"error",2),customElements.get("obi-course")||customElements.define("obi-course",GC),customElements.get("obi-course-list")||customElements.define("obi-course-list",PC);var VC=Object.defineProperty,JC=Object.getOwnPropertyDescriptor,XC=(A,t,e,i)=>{for(var n,s=i>1?void 0:i?JC(t,e):t,r=A.length-1;r>=0;r--)(n=A[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&VC(t,e,s),s};class $C extends Ap{constructor(){super(...arguments),this.courses=[],this.loading=!0,this.error="",this.apiKey="",this.apiBaseUrl="",this.selectedCourse=null,this.agentName=""}handleClose(){this.onClose&&this.onClose()}handleGetStarted(){this.selectedCourse&&this.dispatchEvent(new CustomEvent("course-select",{detail:this.selectedCourse,bubbles:!0,composed:!0}))}async fetchCourses(){try{this.loading=!0,console.log("[CourseModal] Fetching sessions from API",{apiKey:this.apiKey?"present":"missing"});const A=await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`,{cache:"no-cache",headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache"}});if(!A.ok)throw new Error(`HTTP ${A.status}: ${A.statusText}`);const t=await A.json();let e="";const i=t.sessions?.map((A=>(e||(e=A.onboarding_plan.product.agent_name),{id:A.uuid,name:A.onboarding_plan.name,description:A.onboarding_plan.description,duration:A.onboarding_plan.duration}))),n=i.filter((A=>!!A.name));this.agentName=e||"Obi",this.courses=[...n],this.error="",console.log("[CourseModal] Sessions fetched successfully",{sessionCount:n.length,sessions:n.map((A=>({id:A.id,name:A.name})))}),this.requestUpdate()}catch(A){console.error("[CourseModal] Fetch error:",A),this.error=`Failed to fetch courses: ${A instanceof Error?A.message:"Unknown error"}`}finally{this.loading=!1,this.requestUpdate()}}handleCourseCardClick(A){const{id:t,name:e,description:i,duration:n}=A.detail;this.selectedCourse={id:t,name:e,description:i,duration:n}}connectedCallback(){super.connectedCallback(),window.obiWidgetConfig?.apiKey&&(this.apiKey=window.obiWidgetConfig.apiKey),this.apiBaseUrl=t,this.apiBaseUrl&&this.apiKey?this.fetchCourses():(this.loading=!1,this.error="API base URL or API key is missing")}render(){return Mg`
|
|
296
297
|
<div class="backdrop"></div>
|
|
297
298
|
<div class="container">
|
|
298
299
|
<div class="header">
|
|
299
|
-
<div class="icon">${
|
|
300
|
+
<div class="icon">${DC}</div>
|
|
300
301
|
<div class="title-section">
|
|
301
|
-
|
|
302
|
-
|
|
302
|
+
${this.loading?Mg`
|
|
303
|
+
<div class="skeleton skeleton-title"></div>
|
|
304
|
+
<div class="skeleton skeleton-subtitle"></div>
|
|
305
|
+
`:Mg`
|
|
306
|
+
<h1>Give ${this.agentName} a try!</h1>
|
|
307
|
+
<p class="subtitle">
|
|
308
|
+
Pick a tour, share your screen, and ${this.agentName} will take it from there.
|
|
309
|
+
</p>
|
|
310
|
+
`}
|
|
303
311
|
</div>
|
|
304
312
|
<button class="close-button" aria-label="Close course modal" @click=${this.handleClose}>
|
|
305
313
|
<svg
|
|
@@ -358,10 +366,10 @@
|
|
|
358
366
|
</p>
|
|
359
367
|
</div>
|
|
360
368
|
</div>
|
|
361
|
-
`}}
|
|
369
|
+
`}}$C.styles=zw`
|
|
362
370
|
:host {
|
|
363
371
|
display: block;
|
|
364
|
-
font-family: "
|
|
372
|
+
font-family: "Satoshi", sans-serif;
|
|
365
373
|
}
|
|
366
374
|
|
|
367
375
|
.backdrop {
|
|
@@ -550,7 +558,34 @@
|
|
|
550
558
|
margin: 0;
|
|
551
559
|
text-align: center;
|
|
552
560
|
}
|
|
553
|
-
|
|
561
|
+
|
|
562
|
+
.skeleton {
|
|
563
|
+
background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
|
|
564
|
+
background-size: 200% 100%;
|
|
565
|
+
animation: loading 1.5s infinite;
|
|
566
|
+
border-radius: 4px;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
@keyframes loading {
|
|
570
|
+
0% {
|
|
571
|
+
background-position: 200% 0;
|
|
572
|
+
}
|
|
573
|
+
100% {
|
|
574
|
+
background-position: -200% 0;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.skeleton-title {
|
|
579
|
+
height: 32px;
|
|
580
|
+
width: 60%;
|
|
581
|
+
margin-bottom: 12px;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.skeleton-subtitle {
|
|
585
|
+
height: 20px;
|
|
586
|
+
width: 80%;
|
|
587
|
+
}
|
|
588
|
+
`,XC([np({type:Array})],$C.prototype,"courses",2),XC([np({type:Boolean})],$C.prototype,"loading",2),XC([np({type:String})],$C.prototype,"error",2),XC([np({type:String})],$C.prototype,"apiKey",2),XC([np({type:Function})],$C.prototype,"onClose",2),XC([sp()],$C.prototype,"apiBaseUrl",2),XC([sp()],$C.prototype,"selectedCourse",2),XC([sp()],$C.prototype,"agentName",2),customElements.get("obi-course-modal")||customElements.define("obi-course-modal",$C);class YC{constructor(A){}get Ct(){return this.Qt.Ct}dt(A,t,e){this.$e=A,this.Qt=t,this.Ye=e}Bt(A,t){return this.update(A,t)}update(A,t){return this.render(...t)}}const WC=(A,t)=>{const e=A.wt;if(void 0===e)return!1;for(const i of e)i.ut?.(t,!1),WC(i,t);return!0},ZC=A=>{let t,e;do{if(void 0===(t=A.Qt))break;e=t.wt,e.delete(A),A=t}while(0===e?.size)},qC=A=>{for(let t;t=A.Qt;A=t){let e=t.wt;if(void 0===e)t.wt=e=new Set;else if(e.has(A))break;e.add(A),tU(t)}};function zC(A){void 0!==this.wt?(ZC(this),this.Qt=A,qC(this)):this.Qt=A}function AU(A,t=!1,e=0){const i=this.yt,n=this.wt;if(void 0!==n&&0!==n.size)if(t)if(Array.isArray(i))for(let s=e;s<i.length;s++)WC(i[s],!1),ZC(i[s]);else null!=i&&(WC(i,!1),ZC(i));else WC(this,A)}const tU=A=>{2==A.type&&(A.Ht??(A.Ht=AU),A.We??(A.We=zC))};class eU extends YC{constructor(){super(...arguments),this.wt=void 0}dt(A,t,e){super.dt(A,t,e),qC(this),this.isConnected=A.Ct}ut(A,t=!0){A!==this.isConnected&&(this.isConnected=A,A?this.reconnected?.():this.disconnected?.()),t&&(WC(this,A),ZC(this))}setValue(A){if(void 0===this.$e.strings)this.$e.Ut(A,this);else{const t=[...this.$e.yt];t[this.Ye]=A,this.$e.Ut(t,this,0)}}disconnected(){}reconnected(){}}class iU{}const nU=new WeakMap,sU=(rU=class extends eU{render(A){return _g}update(A,[t]){const e=t!==this.G;return e&&void 0!==this.G&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=A.options?.host,this.rt(this.ct=A.element)),_g}rt(A){if(this.isConnected||(A=void 0),"function"==typeof this.G){const t=this.ht??globalThis;let e=nU.get(t);void 0===e&&(e=new WeakMap,nU.set(t,e)),void 0!==e.get(this.G)&&this.G.call(this.ht,void 0),e.set(this.G,A),void 0!==A&&this.G.call(this.ht,A)}else this.G.value=A}get lt(){return"function"==typeof this.G?nU.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}},(...A)=>({ot:rU,values:A}));var rU,oU=Object.defineProperty,aU=Object.getOwnPropertyDescriptor,cU=(A,t,e,i)=>{for(var n,s=i>1?void 0:i?aU(t,e):t,r=A.length-1;r>=0;r--)(n=A[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&oU(t,e,s),s};class uU extends Ap{constructor(){super(...arguments),this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.canvasRef=new iU,this.barCount=8,this.animationFrame=null,this.primaryColor=Pa}connectedCallback(){super.connectedCallback(),this.primaryColor=getComputedStyle(this).getPropertyValue("--obi-primary").trim()||Pa,this.startAnimation()}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){const A=()=>{this.drawEqualizer(),this.animationFrame=requestAnimationFrame(A)};this.animationFrame=requestAnimationFrame(A)}stopAnimation(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null)}drawEqualizer(){const A=this.canvasRef.value;if(!A)return;const t=A.getContext("2d");if(!t)return;const e=window.devicePixelRatio||1,i=A.clientWidth,n=A.clientHeight;A.width=Math.round(i*e),A.height=Math.round(n*e),t.scale(e,e),t.imageSmoothingEnabled=!1,t.clearRect(0,0,i,n);const s=Math.max(1,(i-3*(this.barCount-1))/this.barCount),r=n/2,o=(this.volume.speaker,this.volume.volume),a=(this.volume.speaker,this.volume.spectrum);if(0===o)return;let c=[];if(a&&a.length>0){const A=a.length,t=Math.ceil(A/10);let e=[];for(let c=0;c<10;c++){const i=c*t,n=Math.min((c+1)*t,A);let s=0;for(let A=i;A<n;A++)s+=a[A]||0;e.push({region:c,startIdx:i,endIdx:n,energy:s})}e.sort(((A,t)=>t.energy-A.energy));const i=e.slice(0,3),n=Math.min(...i.map((A=>A.startIdx))),s=Math.max(...i.map((A=>A.endIdx)));if(s>n)for(let u=0;u<this.barCount;u++){const t=n+u/(this.barCount-1)*(s-n),e=Math.min(A-1,Math.floor(t));c[u]=a[e]||0}else for(let u=0;u<this.barCount;u++){const t=u/(this.barCount-1)*(A/2),e=Math.min(A-1,Math.floor(t));c[u]=a[e]||0}const r=Math.max(...c,1),o="USER"===this.volume.speaker?.7:.6;c=c.map(((A,t)=>{const e=A/r,i=o+t/(this.barCount-1)*.3;return Math.min(1,e*i)}))}else if("USER"!==this.volume.speaker)for(let u=0;u<this.barCount;u++){const A=.002*Date.now(),t=.3+.2*Math.sin(A+.7*u);c[u]=t}for(let u=0;u<this.barCount;u++){const A=c.length>0&&void 0!==c[u]?c[u]:o;"USER"===this.volume.speaker?t.fillStyle=`${this.primaryColor}`:t.fillStyle="#FFFFFF";const e=Math.max(2,.8*A*r),a=i-(this.barCount-u)*(s+3),h=s/2;t.beginPath(),t.moveTo(a+h,n/2-e),t.lineTo(a+s-h,n/2-e),t.quadraticCurveTo(a+s,n/2-e,a+s,n/2-e+h),t.lineTo(a+s,n/2),t.lineTo(a,n/2),t.lineTo(a,n/2-e+h),t.quadraticCurveTo(a,n/2-e,a+h,n/2-e),t.fill(),t.beginPath(),t.moveTo(a,n/2),t.lineTo(a+s,n/2),t.lineTo(a+s,n/2+e-h),t.quadraticCurveTo(a+s,n/2+e,a+s-h,n/2+e),t.lineTo(a+h,n/2+e),t.quadraticCurveTo(a,n/2+e,a,n/2+e-h),t.lineTo(a,n/2),t.fill()}}render(){return Mg` <canvas ${sU(this.canvasRef)} width="40" height="40"></canvas> `}}uU.styles=zw`
|
|
554
589
|
:host {
|
|
555
590
|
display: block;
|
|
556
591
|
width: 40px;
|
|
@@ -562,7 +597,7 @@
|
|
|
562
597
|
width: 100%;
|
|
563
598
|
height: 100%;
|
|
564
599
|
}
|
|
565
|
-
`,
|
|
600
|
+
`,cU([np({type:Object})],uU.prototype,"volume",2),cU([sp()],uU.prototype,"canvasRef",2),customElements.get("obi-audio-equalizer")||customElements.define("obi-audio-equalizer",uU);var hU=Object.defineProperty;Object.getOwnPropertyDescriptor;class lU extends Ap{constructor(){super(...arguments),this.activeDots=Array(5).fill(!1),this.numDots=5,this.containerWidth=32,this.dotSize=2,this.bounceHeight=12,this.animationDuration=200,this.pauseDuration=300,this.overlapFactor=.7,this.color="#FFF",this.timeoutIds=[]}connectedCallback(){super.connectedCallback(),this.startAnimation(),this.style.setProperty("--dot-loader-width",`${this.containerWidth}px`),this.style.setProperty("--dot-size",`${this.dotSize}px`),this.style.setProperty("--dot-color",this.color)}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){this.animateSequence()}stopAnimation(){this.timeoutIds.forEach((A=>window.clearTimeout(A))),this.timeoutIds=[]}animateSequence(){this.activeDots=Array(this.numDots).fill(!1);for(let t=0;t<this.numDots;t++){const A=t*(this.animationDuration*this.overlapFactor),e=window.setTimeout((()=>{this.activeDots=[...this.activeDots],this.activeDots[t]=!0;const A=window.setTimeout((()=>{this.activeDots=[...this.activeDots],this.activeDots[t]=!1}),this.animationDuration);this.timeoutIds.push(A)}),A);this.timeoutIds.push(e)}const A=window.setTimeout((()=>{this.animateSequence()}),this.numDots*this.animationDuration*this.overlapFactor+this.pauseDuration);this.timeoutIds.push(A)}render(){return Mg`
|
|
566
601
|
<div class="dot-loader">
|
|
567
602
|
${this.activeDots.map((A=>Mg`
|
|
568
603
|
<div
|
|
@@ -571,7 +606,7 @@
|
|
|
571
606
|
></div>
|
|
572
607
|
`))}
|
|
573
608
|
</div>
|
|
574
|
-
`}}
|
|
609
|
+
`}}lU.styles=zw`
|
|
575
610
|
:host {
|
|
576
611
|
display: block;
|
|
577
612
|
}
|
|
@@ -598,10 +633,10 @@
|
|
|
598
633
|
transition: transform 0.2s ease-in-out;
|
|
599
634
|
opacity: 1;
|
|
600
635
|
}
|
|
601
|
-
`,((A,t,e)=>{for(var i,n=void 0,
|
|
636
|
+
`,((A,t,e)=>{for(var i,n=void 0,s=A.length-1;s>=0;s--)(i=A[s])&&(n=i(t,e,n)||n);n&&hU(t,e,n)})([sp()],lU.prototype,"activeDots"),customElements.get("obi-dot-loader")||customElements.define("obi-dot-loader",lU);class dU extends Ap{render(){return Mg`
|
|
602
637
|
<obi-dot-loader loading style="margin-left: 2px"></obi-dot-loader>
|
|
603
638
|
<span class="text">Searching the knowledge base</span>
|
|
604
|
-
`}}
|
|
639
|
+
`}}dU.styles=zw`
|
|
605
640
|
:host {
|
|
606
641
|
display: flex;
|
|
607
642
|
align-items: center;
|
|
@@ -616,26 +651,42 @@
|
|
|
616
651
|
font-weight: 500;
|
|
617
652
|
font-size: 14px;
|
|
618
653
|
}
|
|
619
|
-
`,customElements.get("obi-searching-loader")||customElements.define("obi-searching-loader",
|
|
654
|
+
`,customElements.get("obi-searching-loader")||customElements.define("obi-searching-loader",dU);var BU=Object.defineProperty,fU=Object.getOwnPropertyDescriptor,wU=(A,t,e,i)=>{for(var n,s=i>1?void 0:i?fU(t,e):t,r=A.length-1;r>=0;r--)(n=A[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&BU(t,e,s),s};class gU extends Ap{constructor(){super(...arguments),this.isLoading=!1,this.error=null,this.startAttempts=0}async handleStart(){if(console.log("[SessionStartModal] Start button clicked",{sessionId:this.session?.id,hasOnStartCallback:!!this.onStart,hasSession:!!this.session,isLoading:this.isLoading,startAttempts:this.startAttempts,timestamp:(new Date).toISOString()}),pC("session_start_modal_continue_clicked",{sessionId:this.session?.id,sessionName:this.session?.name},"SessionStartModal"),this.isLoading)console.warn("[SessionStartModal] Start already in progress, ignoring click");else{if(!this.session){const A="Session data is missing.";return console.error("[SessionStartModal] Validation failed:",A),void this.showError(A)}if(!this.session.id){const A="Session ID is missing.";return console.error("[SessionStartModal] Validation failed:",A,{session:this.session}),void this.showError(A)}if(!this.onStart){const A="Start callback is not defined.";return console.error("[SessionStartModal] Validation failed:",A),gC(A,{componentName:"SessionStartModal",handlerName:"handleStart",sessionData:this.session,hasOnStart:!!this.onStart}),void this.showError(A)}this.startAttempts++,console.log("[SessionStartModal] Starting session attempt",{attempt:this.startAttempts,sessionId:this.session.id}),this.error=null,this.isLoading=!0;try{console.log("[SessionStartModal] Calling onStart callback",{sessionId:this.session.id,attempt:this.startAttempts}),pC("session_start_modal_calling_onStart",{sessionId:this.session.id},"SessionStartModal"),this.onStart(this.session.id),console.log("[SessionStartModal] Session start completed successfully",{sessionId:this.session.id,attempt:this.startAttempts}),pC("session_start_modal_onStart_called",{sessionId:this.session.id},"SessionStartModal"),setTimeout((()=>{this.isConnected&&gC(new Error("Session start modal did not close after Continue was clicked"),{componentName:"SessionStartModal",handlerName:"handleStart_timeout",sessionId:this.session?.id,modalStillVisible:!0})}),2e3)}catch(A){console.error("[SessionStartModal] Session start failed",{sessionId:this.session.id,attempt:this.startAttempts,error:A instanceof Error?A.message:String(A),errorStack:A instanceof Error?A.stack:void 0}),gC(A,{componentName:"SessionStartModal",handlerName:"handleStart",sessionId:this.session?.id}),this.isLoading=!1,A instanceof Error?A.message.includes("network")||A.message.includes("fetch")?this.showError("Network connection failed. Please check your internet connection, refresh the page, and try again."):A.message.includes("unauthorized")||A.message.includes("403")?this.showError("Session access denied."):A.message.includes("session")&&A.message.includes("not found")?this.showError("Session not found."):this.showError(`Failed to start session: ${A.message}.`):this.showError("An unexpected error occurred while starting the session.")}}}showError(A){this.error=A,console.error("[SessionStartModal] Displaying error to user:",A)}handleClose(){console.log("[SessionStartModal] Close button clicked",{sessionId:this.session?.id,isLoading:this.isLoading,startAttempts:this.startAttempts}),this.isLoading&&console.warn("[SessionStartModal] Attempted to close while loading"),this.onClose&&this.onClose()}render(){return Mg`
|
|
620
655
|
<div class="backdrop"></div>
|
|
621
656
|
<div class="container">
|
|
622
657
|
<button
|
|
623
658
|
class="close-button"
|
|
624
659
|
aria-label="Close session start modal"
|
|
625
660
|
@click=${this.handleClose}
|
|
661
|
+
?disabled=${this.isLoading}
|
|
626
662
|
>
|
|
627
663
|
×
|
|
628
664
|
</button>
|
|
629
665
|
|
|
630
666
|
<div class="header">
|
|
631
|
-
<div class="logo">${
|
|
632
|
-
<h1>${this.session
|
|
633
|
-
<p class="subtitle">${this.session
|
|
667
|
+
<div class="logo">${DC}</div>
|
|
668
|
+
<h1>${this.session?.name||"Session"}</h1>
|
|
669
|
+
<p class="subtitle">${this.session?.description||"Starting your session..."}</p>
|
|
634
670
|
</div>
|
|
635
671
|
|
|
636
|
-
<button
|
|
672
|
+
<button
|
|
673
|
+
class="button button-primary"
|
|
674
|
+
@click=${this.handleStart}
|
|
675
|
+
?disabled=${this.isLoading}
|
|
676
|
+
aria-label=${this.isLoading?"Starting session...":"Start session"}
|
|
677
|
+
>
|
|
678
|
+
${this.isLoading?Mg`<div class="loading-spinner"></div>
|
|
679
|
+
<span class="button-text">Starting...</span>`:Mg`<span class="button-text">Continue</span>`}
|
|
680
|
+
</button>
|
|
681
|
+
|
|
682
|
+
${this.error?Mg`
|
|
683
|
+
<div class="error-message">
|
|
684
|
+
<div>${this.error}</div>
|
|
685
|
+
<div>Please refresh the page and try again.</div>
|
|
686
|
+
</div>
|
|
687
|
+
`:""}
|
|
637
688
|
</div>
|
|
638
|
-
`}}
|
|
689
|
+
`}}gU.styles=zw`
|
|
639
690
|
:host {
|
|
640
691
|
display: block;
|
|
641
692
|
font-family: "Inter", sans-serif;
|
|
@@ -762,12 +813,80 @@
|
|
|
762
813
|
background: #18181b;
|
|
763
814
|
color: white;
|
|
764
815
|
margin-top: 32px;
|
|
816
|
+
position: relative;
|
|
817
|
+
overflow: hidden;
|
|
765
818
|
}
|
|
766
819
|
|
|
767
|
-
.button-primary:hover {
|
|
820
|
+
.button-primary:hover:not(:disabled) {
|
|
768
821
|
background: color-mix(in srgb, #18181b 90%, white);
|
|
769
822
|
}
|
|
770
823
|
|
|
824
|
+
.button-primary:disabled {
|
|
825
|
+
background: #6b7280;
|
|
826
|
+
cursor: not-allowed;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.button-primary:disabled .button-text {
|
|
830
|
+
opacity: 0.7;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.loading-spinner {
|
|
834
|
+
width: 16px;
|
|
835
|
+
height: 16px;
|
|
836
|
+
border: 2px solid transparent;
|
|
837
|
+
border-top: 2px solid white;
|
|
838
|
+
border-radius: 50%;
|
|
839
|
+
animation: spin 1s linear infinite;
|
|
840
|
+
margin-right: 8px;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
@keyframes spin {
|
|
844
|
+
0% {
|
|
845
|
+
transform: rotate(0deg);
|
|
846
|
+
}
|
|
847
|
+
100% {
|
|
848
|
+
transform: rotate(360deg);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
.error-message {
|
|
853
|
+
margin-top: 16px;
|
|
854
|
+
padding: 12px 16px;
|
|
855
|
+
background: #fef2f2;
|
|
856
|
+
border: 1px solid #fecaca;
|
|
857
|
+
border-radius: 6px;
|
|
858
|
+
color: #dc2626;
|
|
859
|
+
font-size: 14px;
|
|
860
|
+
line-height: 1.4;
|
|
861
|
+
text-align: center;
|
|
862
|
+
max-width: 100%;
|
|
863
|
+
word-wrap: break-word;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.error-actions {
|
|
867
|
+
margin-top: 12px;
|
|
868
|
+
display: flex;
|
|
869
|
+
gap: 8px;
|
|
870
|
+
justify-content: center;
|
|
871
|
+
flex-wrap: wrap;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
.error-action-button {
|
|
875
|
+
padding: 6px 12px;
|
|
876
|
+
background: white;
|
|
877
|
+
border: 1px solid #dc2626;
|
|
878
|
+
color: #dc2626;
|
|
879
|
+
border-radius: 4px;
|
|
880
|
+
font-size: 12px;
|
|
881
|
+
cursor: pointer;
|
|
882
|
+
transition: all 0.2s ease;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
.error-action-button:hover {
|
|
886
|
+
background: #dc2626;
|
|
887
|
+
color: white;
|
|
888
|
+
}
|
|
889
|
+
|
|
771
890
|
.close-button {
|
|
772
891
|
position: absolute;
|
|
773
892
|
top: 12px;
|
|
@@ -784,16 +903,21 @@
|
|
|
784
903
|
align-items: center;
|
|
785
904
|
justify-content: center;
|
|
786
905
|
}
|
|
787
|
-
`,wC([np({type:Object})],gC.prototype,"session",2),wC([np({type:Function})],gC.prototype,"onStart",2),wC([np({type:Function})],gC.prototype,"onClose",2),customElements.get("obi-session-start-modal")||customElements.define("obi-session-start-modal",gC);var pC=Object.defineProperty,vC=Object.getOwnPropertyDescriptor,mC=(A,t,e,i)=>{for(var n,r=i>1?void 0:i?vC(t,e):t,s=A.length-1;s>=0;s--)(n=A[s])&&(r=(i?n(t,e,r):n(r))||r);return i&&r&&pC(t,e,r),r};class QC extends Ap{constructor(){super(),this.apiKey="",this.isActive=!0,this.linkOnlyAccess=!1,this.position="bottom-right",this.user=null,this.state=Na.READY,this.storedActiveState=void 0,this.showCourseModal=!1,this.showSessionStartModal=!1,this.selectedCourse=null,this.isHovering=!1,this.navVisible=!1,this.activeSession=null,this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.sessionToken=null,this.roomToken=null,this.roomUrl=null,this.boundSaveSessionData=null,this.obiClient=null,this.closeNavTimeoutRef=null,this.researchingTimeoutRef=null,this.connectObi=mU((async A=>{if(this.activeSession)return pU("connection_already_exists",{sessionToken:A},"ObiWidget"),void console.log("Connection already exists");pU("session_connection_started",{sessionToken:A},"ObiWidget"),vU({sessionId:A});try{const t=this.createSession(A);if(!t)return void this.handleSessionCreationFailure((()=>this.removeSessionUrlParams()));this.setupSessionEventListeners(t,(()=>this.removeSessionUrlParams())),t.on("screenCaptureRequested",mU((async()=>{pU("screen_capture_requested",{},"ObiWidget");try{const A=(await(t=document.documentElement,e={useCORS:!0,allowTaint:!0,foreignObjectRendering:!0},void 0===e&&(e={}),(function(A,t){return qa(void 0,void 0,void 0,(function(){var e,i,n,r,s,o,a,c,u,h,l,d,B,f,w,g,p,v,m,Q,U,C,F,y,b,E,I,H,k,T,S,O,K,D,M,L,x,_;return za(this,(function(R){switch(R.label){case 0:if(!A||"object"!=typeof A)return[2,Promise.reject("Invalid element provided as first argument")];if(!(e=A.ownerDocument))throw new Error("Element is not attached to a Document");if(!(i=e.defaultView))throw new Error("Document is not attached to a Window");return n={allowTaint:null!==(C=t.allowTaint)&&void 0!==C&&C,imageTimeout:null!==(F=t.imageTimeout)&&void 0!==F?F:15e3,proxy:t.proxy,useCORS:null!==(y=t.useCORS)&&void 0!==y&&y,customIsSameOrigin:t.customIsSameOrigin},r=Za({logging:null===(b=t.logging)||void 0===b||b,cache:t.cache},n),s={windowWidth:null!==(E=t.windowWidth)&&void 0!==E?E:i.innerWidth,windowHeight:null!==(I=t.windowHeight)&&void 0!==I?I:i.innerHeight,scrollX:null!==(H=t.scrollX)&&void 0!==H?H:i.pageXOffset,scrollY:null!==(k=t.scrollY)&&void 0!==k?k:i.pageYOffset},o=new tc(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),a=new Xw(r,o),c=null!==(T=t.foreignObjectRendering)&&void 0!==T&&T,u={allowTaint:null!==(S=t.allowTaint)&&void 0!==S&&S,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:c,copyStyles:c},a.logger.debug("Starting document clone with size ".concat(o.width,"x").concat(o.height," scrolled to ").concat(-o.left,",").concat(-o.top)),h=new Of(a,A,u),(l=h.clonedReferenceElement)?[4,h.toIFrame(e,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=R.sent(),B=of(l)||"HTML"===l.tagName?(function(A){var t=A.body,e=A.documentElement;if(!t||!e)throw new Error("Unable to get document size");var i=Math.max(Math.max(t.scrollWidth,e.scrollWidth),Math.max(t.offsetWidth,e.offsetWidth),Math.max(t.clientWidth,e.clientWidth)),n=Math.max(Math.max(t.scrollHeight,e.scrollHeight),Math.max(t.offsetHeight,e.offsetHeight),Math.max(t.clientHeight,e.clientHeight));return new tc(0,0,i,n)})(l.ownerDocument):ec(a,l),f=B.width,w=B.height,g=B.left,p=B.top,v=(function(A,t,e){var i=t.ownerDocument,n=i.documentElement?$h(A,getComputedStyle(i.documentElement).backgroundColor):Wh.TRANSPARENT,r=i.body?$h(A,getComputedStyle(i.body).backgroundColor):Wh.TRANSPARENT,s="string"==typeof e?$h(A,e):null===e?Wh.TRANSPARENT:4294967295;return t===i.documentElement?dh(n)?dh(r)?s:r:n:s})(a,l,t.backgroundColor),m={canvas:t.canvas,backgroundColor:v,scale:null!==(K=null!==(O=t.scale)&&void 0!==O?O:i.devicePixelRatio)&&void 0!==K?K:1,x:(null!==(D=t.x)&&void 0!==D?D:0)+g,y:(null!==(M=t.y)&&void 0!==M?M:0)+p,width:null!==(L=t.width)&&void 0!==L?L:Math.ceil(f),height:null!==(x=t.height)&&void 0!==x?x:Math.ceil(w)},c?(a.logger.debug("Document cloned, using foreign object rendering"),[4,new Pw(a,m).render(l)]):[3,3];case 2:return Q=R.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at ".concat(g,",").concat(p," with size ").concat(f,"x").concat(w," using computed rendering")),a.logger.debug("Starting DOM parsing"),U=$B(a,l),v===U.styles.backgroundColor&&(U.styles.backgroundColor=Wh.TRANSPARENT),a.logger.debug("Starting renderer for element at ".concat(m.x,",").concat(m.y," with size ").concat(m.width,"x").concat(m.height)),[4,new xw(a,m).render(U)];case 4:Q=R.sent(),R.label=5;case 5:return(null===(_=t.removeContainer)||void 0===_||_)&&(Of.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,Q]}}))}))})(t,e))).toDataURL("image/png");this.activeSession.emit("screenCaptureComplete",A),pU("screen_capture_completed",{},"ObiWidget")}catch(i){gU(i,{componentName:"ObiWidget",handlerName:"screenCaptureRequested",sessionToken:A}),console.error("[obi] error capturing screen:",i),this.activeSession.emit("screenCaptureComplete","error"),pU("screen_capture_failed",{error:i instanceof Error?i.message:String(i)},"ObiWidget")}var t,e}),"screenCaptureRequested","ObiWidget"));const e=await t.connect();e&&(this.sessionToken=A,this.roomToken=e.token,this.roomUrl=e.url,vU({sessionId:A,widgetState:this.state.toString()}),this.removeSessionUrlParams(),pU("session_connection_established",{sessionToken:A,hasRoomToken:!!e.token},"ObiWidget")),this.activeSession=t}catch(t){console.error("Failed to start session:",t),gU(t,{componentName:"ObiWidget",handlerName:"connectObi",sessionToken:A}),this.handleSessionCreationFailure((()=>this.removeSessionUrlParams()))}}),"connectObi","ObiWidget"),this.handleCourseSelectEvent=A=>{const t=A;this.selectedCourse=t.detail,this.showCourseModal=!1,this.showSessionStartModal=!0},this.handleUrlSessionEvent=mU((async A=>{pU("url_session_event",{sessionToken:A},"ObiWidget");try{if(!this.obiClient)return gU(new Error("ObiClient not initialized"),{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:A}),void console.error("ObiClient not initialized");const t=await this.obiClient.startSession(A,this.apiKey);if(t.data){const{session:e}=t.data;if(console.log("[obi-sdk] session:",e),pU("session_started",{sessionId:e?.id,sessionToken:A},"ObiWidget"),e){const t=e;this.selectedCourse={id:A,name:t.onboarding_plan?.name||"",description:t.onboarding_plan?.description||""},this.state=Na.LOADING,this.showSessionStartModal=!0,pU("matching_session_found",{sessionToken:A,hasOnboardingPlan:!!t.onboarding_plan},"ObiWidget")}else console.log("[obi-sdk] no session found with token:",A),pU("no_matching_session",{sessionToken:A},"ObiWidget")}}catch(t){console.error("Failed to fetch session details:",t),gU(t,{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:A})}}),"handleUrlSessionEvent","ObiWidget"),this.handleSessionStart=mU((async A=>{if(pU("session_start_requested",{sessionToken:A},"ObiWidget"),this.activeSession)return pU("session_start_blocked",{sessionToken:A},"ObiWidget"),void console.log("Connection already in progress or active session exists");this.showSessionStartModal=!1,this.state=Na.LOADING,vU({widgetState:this.state.toString()}),await this.connectObi(A)}),"handleSessionStart","ObiWidget"),this.checkExistingSession=mU((async()=>{pU("checking_existing_session",{},"ObiWidget");try{const A=JSON.parse(FU.getItem(CU)||"{}"),{sessionToken:t,roomToken:e,roomUrl:i,sessionExpiry:n,obiState:r}=A;if(!t||!e||!i)return void pU("no_existing_session_data",{},"ObiWidget");if(console.log("[obi-sdk] using existing session"),pU("existing_session_data_found",{sessionToken:t,hasExpiry:!!n,obiState:r},"ObiWidget"),n&&new Date(n)<new Date)return this.clearSessionStorage(),void pU("session_expired",{sessionToken:t},"ObiWidget");this.state=Na.LOADING,vU({sessionId:t,widgetState:this.state.toString()});const s=this.createSession(t);if(!s)return void this.handleSessionCreationFailure((()=>this.clearSessionStorage()));this.setupSessionEventListeners(s,(()=>this.clearSessionStorage())),await s.reconnect(i,e,r)?(this.activeSession=s,this.sessionToken=t,this.roomToken=e,this.roomUrl=i,this.state=r,this.storedActiveState=r,pU("session_reconnected",{sessionToken:t,obiState:r},"ObiWidget")):(this.clearSessionStorage(),pU("session_reconnection_failed",{sessionToken:t},"ObiWidget"))}catch(A){console.error("Error reconnecting to session:",A),gU(A,{componentName:"ObiWidget",handlerName:"checkExistingSession"}),this.handleSessionCreationFailure((()=>this.clearSessionStorage()))}}),"checkExistingSession","ObiWidget");try{UU("ObiWidget").setContext(),this.obiClient=new u({baseUrl:t});const A=()=>{try{this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl&&this.saveSessionData()}catch(A){gU(A,{componentName:"ObiWidget",handlerName:"handleUnload"})}};window.addEventListener("beforeunload",A),window.addEventListener("pagehide",A),pU("ObiWidget_constructor_completed",{},"ObiWidget")}catch(A){throw gU(A,{componentName:"ObiWidget",lifecycle:"constructor"}),A}}updateFromConfig(){if(window.obiWidgetConfig){this.apiKey=window.obiWidgetConfig.apiKey||this.apiKey,this.position=window.obiWidgetConfig.position||this.position,this.user=window.obiWidgetConfig.user||this.user,void 0!==window.obiWidgetConfig.isActive&&(this.isActive=window.obiWidgetConfig.isActive),void 0!==window.obiWidgetConfig.linkOnlyAccess&&(this.linkOnlyAccess=window.obiWidgetConfig.linkOnlyAccess);const A=window.obiWidgetConfig?.primaryColor||Pa;this.style.setProperty("--obi-primary",A),this.generateColorVariables(A)}}generateColorVariables(A){try{const t=Xa(A,"#c4b5fd"),e=Xa(A,"#c76cff"),i=(function(A){try{const t={h:Va(A).h,s:100,l:96};return Ja(t.h,t.s,t.l)}catch(t){return console.warn("Failed to transform to light tint, using fallback:",t),A}})(A),n=Xa(A,"#A06DF9");this.style.setProperty("--obi-secondary",t),this.style.setProperty("--obi-course-selected",e),this.style.setProperty("--obi-course-selected-bg",i),this.style.setProperty("--obi-paused-pulse",n)}catch(t){console.warn("Failed to generate color variables:",t),this.style.setProperty("--obi-secondary","#c4b5fd"),this.style.setProperty("--obi-course-selected","#c76cff"),this.style.setProperty("--obi-course-selected-bg","#fbf3ff"),this.style.setProperty("--obi-paused-pulse","#A06DF9")}}removeSessionUrlParams(){const A=new URL(window.location.href);A.searchParams.delete(Ya),window.history.replaceState({},"",A.toString()),localStorage.removeItem("obi-url-params")}createSession(A){try{return new Ga({sessionId:A,apiBaseUrl:t})||(console.error("Failed to create session"),null)}catch(e){return console.error("Error creating session:",e),null}}setupSessionEventListeners(A,t){A.on("stateChanged",(t=>{if(t===Na.RESEARCHING)return this.researchingTimeoutRef&&window.clearTimeout(this.researchingTimeoutRef),this.state=t,this.researchingTimeoutRef=window.setTimeout((()=>{this.researchingTimeoutRef=null;const t=A.getCurrentState();this.state=t,t!==Na.READY&&(this.storedActiveState=t)}),1500),void(this.storedActiveState=t);null===this.researchingTimeoutRef&&(this.state=t,t!==Na.READY&&(this.storedActiveState=t))})),A.on("volume",(({speaker:A,spectrum:t,volume:e})=>{this.volume={speaker:A,spectrum:t,volume:e}})),A.on("error",(A=>{console.error("Session error:",A),this.state=Na.ERROR,this.activeSession=null,t&&t()}))}handleSessionCreationFailure(A){this.state=Na.ERROR,this.activeSession=null,A&&A()}clearSessionStorage(){FU.removeItem(CU)}saveSessionData(){if(this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl){const A=new Date;A.setMinutes(A.getMinutes()+5);const t={sessionToken:this.sessionToken,roomToken:this.roomToken,roomUrl:this.roomUrl,obiState:this.storedActiveState??this.state,sessionExpiry:A.toISOString()};FU.setItem(CU,JSON.stringify(t))}}async sessionConnectionCheck(){const A=(function(){let A={};return A=JSON.parse(localStorage.getItem("obi-url-params")||"{}"),0===Object.keys(A).length&&new URLSearchParams(window.location.search).forEach(((t,e)=>{A[e]=t})),localStorage.removeItem("obi-url-params"),A[Ya]})();A?(console.log("[obi-sdk] using magic link"),this.apiKey?await this.handleUrlSessionEvent(A):(console.log("[obi-sdk] API key not ready, retrying..."),setTimeout((()=>{this.apiKey&&this.handleUrlSessionEvent(A)}),100))):await this.checkExistingSession()}connectedCallback(){super.connectedCallback(),this.updateFromConfig(),this.addEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),this.setAttribute("position",this.position),this.boundSaveSessionData=this.saveSessionData.bind(this),window.addEventListener("beforeunload",this.boundSaveSessionData),window.addEventListener("pagehide",this.boundSaveSessionData),this.addEventListener("course-select",this.handleCourseSelectEvent),this.isActive&&this.sessionConnectionCheck()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),null!==this.closeNavTimeoutRef&&window.clearTimeout(this.closeNavTimeoutRef),null!==this.researchingTimeoutRef&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.boundSaveSessionData&&(window.removeEventListener("beforeunload",this.boundSaveSessionData),window.removeEventListener("pagehide",this.boundSaveSessionData)),this.removeSessionUrlParams()}handleConfigUpdate(A){const t=A.detail.isActive&&!this.isActive;this.updateFromConfig(),this.position&&this.setAttribute("position",this.position),t&&this.sessionConnectionCheck(),this.requestUpdate()}handleMouseEnter(){this.isHovering=!0,this.navVisible=!0}handleMouseLeave(){this.isHovering=!1,null!==this.closeNavTimeoutRef&&window.clearTimeout(this.closeNavTimeoutRef),this.closeNavTimeoutRef=window.setTimeout((()=>{this.isHovering||(this.navVisible=!1),this.closeNavTimeoutRef=null}),300)}terminateSession(){this.clearSessionStorage(),this.sessionToken=null,this.roomToken=null,this.roomUrl=null,null!==this.researchingTimeoutRef&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.activeSession&&(this.activeSession.disconnect(),this.activeSession=null),this.state=Na.READY}handleItemSelect(A,t){"experiences"!==A?xa([A,t]).with(["pause",!0],(()=>{this.activeSession?.pauseRecording()})).with(["pause",!1],(()=>{this.activeSession?.resumeRecording()})).with(["activate",!1],(()=>{this.terminateSession()})).otherwise((()=>{})):this.showCourseModal=!0}render(){if(!this.isActive)return _g;if(this.linkOnlyAccess&&this.state===Na.READY)return _g;const A=xa(this.state).with(Na.LOADING,(()=>Mg`<obi-dot-loader></obi-dot-loader>`)).with(Na.RESEARCHING,(()=>Mg`<obi-searching-loader></obi-searching-loader>`)).with(Da.union(Na.USER_SPEAKING,Na.AGENT_SPEAKING),(()=>Mg`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`)).with(Na.THINKING,(()=>Mg`<obi-dot-loader></obi-dot-loader>`)).with(Na.PAUSED,(()=>DU)).otherwise((()=>DU)),t=this.state===Na.USER_SPEAKING||this.state===Na.AGENT_SPEAKING,e=this.state===Na.PAUSED,i=this.state===Na.RESEARCHING,n=this.state===Na.USER_SPEAKING,r=this.state!==Na.READY||this.navVisible,s=this.state!==Na.READY||this.navVisible,o=this.position.includes("top")?"down":"up",a=["widget-container",r?"rotated":"",t?"pulse":"",e?"paused-pulse":"",i?"researching":"",n?"user-speaking":""].filter(Boolean).join(" ");return Mg`
|
|
906
|
+
|
|
907
|
+
.close-button:disabled {
|
|
908
|
+
opacity: 0.5;
|
|
909
|
+
cursor: not-allowed;
|
|
910
|
+
}
|
|
911
|
+
`,wU([np({type:Object})],gU.prototype,"session",2),wU([np({type:Function})],gU.prototype,"onStart",2),wU([np({type:Function})],gU.prototype,"onClose",2),wU([sp()],gU.prototype,"isLoading",2),wU([sp()],gU.prototype,"error",2),wU([sp()],gU.prototype,"startAttempts",2),customElements.get("obi-session-start-modal")||customElements.define("obi-session-start-modal",gU);var pU=Object.defineProperty,vU=Object.getOwnPropertyDescriptor,mU=(A,t,e,i)=>{for(var n,s=i>1?void 0:i?vU(t,e):t,r=A.length-1;r>=0;r--)(n=A[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&pU(t,e,s),s};class QU extends Ap{constructor(){super(),this.apiKey="",this.isActive=!0,this.linkOnlyAccess=!1,this.position="bottom-right",this.user=null,this.state=Ra.READY,this.storedActiveState=void 0,this.showCourseModal=!1,this.showSessionStartModal=!1,this.selectedCourse=null,this.isHovering=!1,this.navVisible=!1,this.activeSession=null,this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.sessionToken=null,this.roomToken=null,this.roomUrl=null,this.boundSaveSessionData=null,this.obiClient=null,this.closeNavTimeoutRef=null,this.researchingTimeoutRef=null,this.connectObi=mC((async A=>{if(this.activeSession)return pC("connection_already_exists",{sessionToken:A},"ObiWidget"),void console.log("Connection already exists");pC("session_connection_started",{sessionToken:A},"ObiWidget"),vC({sessionId:A});try{const t=this.createSession(A);if(!t)return void this.handleSessionCreationFailure((()=>this.removeSessionUrlParams()));this.setupSessionEventListeners(t,(()=>this.removeSessionUrlParams())),t.on("screenCaptureRequested",mC((async()=>{pC("screen_capture_requested",{},"ObiWidget");try{const A=(await(t=document.documentElement,e={useCORS:!0,allowTaint:!0,foreignObjectRendering:!0},void 0===e&&(e={}),(function(A,t){return qa(void 0,void 0,void 0,(function(){var e,i,n,s,r,o,a,c,u,h,l,d,B,f,w,g,p,v,m,Q,C,U,F,y,b,E,I,k,H,S,T,O,K,D,M,L,x,_;return za(this,(function(N){switch(N.label){case 0:if(!A||"object"!=typeof A)return[2,Promise.reject("Invalid element provided as first argument")];if(!(e=A.ownerDocument))throw new Error("Element is not attached to a Document");if(!(i=e.defaultView))throw new Error("Document is not attached to a Window");return n={allowTaint:null!==(U=t.allowTaint)&&void 0!==U&&U,imageTimeout:null!==(F=t.imageTimeout)&&void 0!==F?F:15e3,proxy:t.proxy,useCORS:null!==(y=t.useCORS)&&void 0!==y&&y,customIsSameOrigin:t.customIsSameOrigin},s=Za({logging:null===(b=t.logging)||void 0===b||b,cache:t.cache},n),r={windowWidth:null!==(E=t.windowWidth)&&void 0!==E?E:i.innerWidth,windowHeight:null!==(I=t.windowHeight)&&void 0!==I?I:i.innerHeight,scrollX:null!==(k=t.scrollX)&&void 0!==k?k:i.pageXOffset,scrollY:null!==(H=t.scrollY)&&void 0!==H?H:i.pageYOffset},o=new tc(r.scrollX,r.scrollY,r.windowWidth,r.windowHeight),a=new Xw(s,o),c=null!==(S=t.foreignObjectRendering)&&void 0!==S&&S,u={allowTaint:null!==(T=t.allowTaint)&&void 0!==T&&T,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:c,copyStyles:c},a.logger.debug("Starting document clone with size ".concat(o.width,"x").concat(o.height," scrolled to ").concat(-o.left,",").concat(-o.top)),h=new Of(a,A,u),(l=h.clonedReferenceElement)?[4,h.toIFrame(e,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=N.sent(),B=of(l)||"HTML"===l.tagName?(function(A){var t=A.body,e=A.documentElement;if(!t||!e)throw new Error("Unable to get document size");var i=Math.max(Math.max(t.scrollWidth,e.scrollWidth),Math.max(t.offsetWidth,e.offsetWidth),Math.max(t.clientWidth,e.clientWidth)),n=Math.max(Math.max(t.scrollHeight,e.scrollHeight),Math.max(t.offsetHeight,e.offsetHeight),Math.max(t.clientHeight,e.clientHeight));return new tc(0,0,i,n)})(l.ownerDocument):ec(a,l),f=B.width,w=B.height,g=B.left,p=B.top,v=(function(A,t,e){var i=t.ownerDocument,n=i.documentElement?Yh(A,getComputedStyle(i.documentElement).backgroundColor):Wh.TRANSPARENT,s=i.body?Yh(A,getComputedStyle(i.body).backgroundColor):Wh.TRANSPARENT,r="string"==typeof e?Yh(A,e):null===e?Wh.TRANSPARENT:4294967295;return t===i.documentElement?dh(n)?dh(s)?r:s:n:r})(a,l,t.backgroundColor),m={canvas:t.canvas,backgroundColor:v,scale:null!==(K=null!==(O=t.scale)&&void 0!==O?O:i.devicePixelRatio)&&void 0!==K?K:1,x:(null!==(D=t.x)&&void 0!==D?D:0)+g,y:(null!==(M=t.y)&&void 0!==M?M:0)+p,width:null!==(L=t.width)&&void 0!==L?L:Math.ceil(f),height:null!==(x=t.height)&&void 0!==x?x:Math.ceil(w)},c?(a.logger.debug("Document cloned, using foreign object rendering"),[4,new Pw(a,m).render(l)]):[3,3];case 2:return Q=N.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at ".concat(g,",").concat(p," with size ").concat(f,"x").concat(w," using computed rendering")),a.logger.debug("Starting DOM parsing"),C=YB(a,l),v===C.styles.backgroundColor&&(C.styles.backgroundColor=Wh.TRANSPARENT),a.logger.debug("Starting renderer for element at ".concat(m.x,",").concat(m.y," with size ").concat(m.width,"x").concat(m.height)),[4,new xw(a,m).render(C)];case 4:Q=N.sent(),N.label=5;case 5:return(null===(_=t.removeContainer)||void 0===_||_)&&(Of.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,Q]}}))}))})(t,e))).toDataURL("image/png");this.activeSession.emit("screenCaptureComplete",A),pC("screen_capture_completed",{},"ObiWidget")}catch(i){gC(i,{componentName:"ObiWidget",handlerName:"screenCaptureRequested",sessionToken:A}),console.error("[obi] error capturing screen:",i),this.activeSession.emit("screenCaptureComplete","error"),pC("screen_capture_failed",{error:i instanceof Error?i.message:String(i)},"ObiWidget")}var t,e}),"screenCaptureRequested","ObiWidget"));const e=await t.connect();e&&(this.sessionToken=A,this.roomToken=e.token,this.roomUrl=e.url,vC({sessionId:A,widgetState:this.state.toString()}),this.removeSessionUrlParams(),pC("session_connection_established",{sessionToken:A,hasRoomToken:!!e.token},"ObiWidget")),this.activeSession=t}catch(t){console.error("Failed to start session:",t),gC(t,{componentName:"ObiWidget",handlerName:"connectObi",sessionToken:A}),this.handleSessionCreationFailure((()=>this.removeSessionUrlParams()))}}),"connectObi","ObiWidget"),this.handleCloseModals=()=>{this.state=Ra.READY,this.showCourseModal=!1,this.showSessionStartModal=!1},this.handleCourseSelectEvent=A=>{const t=A;this.selectedCourse=t.detail,this.showCourseModal=!1,this.showSessionStartModal=!0},this.handleUrlSessionEvent=mC((async A=>{pC("url_session_event",{sessionToken:A},"ObiWidget");try{if(!this.obiClient)return gC(new Error("ObiClient not initialized"),{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:A}),void console.error("ObiClient not initialized");const t=await this.obiClient.startSession(A,this.apiKey);if(t.data){const{session:e}=t.data;if(console.log("[obi-sdk] session:",e),pC("session_started",{sessionId:e?.id,sessionToken:A},"ObiWidget"),e){const t=e;this.selectedCourse={id:A,name:t.onboarding_plan?.name||"",description:t.onboarding_plan?.description||""},this.state=Ra.LOADING,this.showSessionStartModal=!0,pC("matching_session_found",{sessionToken:A,hasOnboardingPlan:!!t.onboarding_plan},"ObiWidget")}else console.log("[obi-sdk] no session found with token:",A),pC("no_matching_session",{sessionToken:A},"ObiWidget")}}catch(t){console.error("Failed to fetch session details:",t),gC(t,{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:A})}}),"handleUrlSessionEvent","ObiWidget"),this.handleSessionStart=mC((async A=>{pC("session_start_requested",{sessionToken:A},"ObiWidget"),this.activeSession&&(pC("session_start_blocked",{sessionToken:A},"ObiWidget"),gC(new Error("Session start blocked"),{componentName:"ObiWidget",handlerName:"handleSessionStart",sessionToken:A}),this.activeSession.disconnect(),this.activeSession=null),this.showSessionStartModal=!1,this.state=Ra.LOADING,vC({widgetState:this.state.toString()}),await this.connectObi(A)}),"handleSessionStart","ObiWidget"),this.checkExistingSession=mC((async()=>{pC("checking_existing_session",{},"ObiWidget");try{const A=JSON.parse(FC.getItem(UC)||"{}"),{sessionToken:t,roomToken:e,roomUrl:i,sessionExpiry:n,obiState:s}=A;if(!t||!e||!i)return void pC("no_existing_session_data",{},"ObiWidget");if(console.log("[obi-sdk] using existing session"),pC("existing_session_data_found",{sessionToken:t,hasExpiry:!!n,obiState:s},"ObiWidget"),n&&new Date(n)<new Date)return this.clearSessionStorage(),void pC("session_expired",{sessionToken:t},"ObiWidget");this.state=Ra.LOADING,vC({sessionId:t,widgetState:this.state.toString()});const r=this.createSession(t);if(!r)return void this.handleSessionCreationFailure((()=>this.clearSessionStorage()));this.setupSessionEventListeners(r,(()=>this.clearSessionStorage())),await r.reconnect(i,e,s)?(this.activeSession=r,this.sessionToken=t,this.roomToken=e,this.roomUrl=i,this.state=s,this.storedActiveState=s,pC("session_reconnected",{sessionToken:t,obiState:s},"ObiWidget")):(this.clearSessionStorage(),pC("session_reconnection_failed",{sessionToken:t},"ObiWidget"))}catch(A){console.error("Error reconnecting to session:",A),gC(A,{componentName:"ObiWidget",handlerName:"checkExistingSession"}),this.handleSessionCreationFailure((()=>this.clearSessionStorage()))}}),"checkExistingSession","ObiWidget");try{CC("ObiWidget").setContext(),this.obiClient=new u({baseUrl:t});const A=()=>{try{this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl&&this.saveSessionData()}catch(A){gC(A,{componentName:"ObiWidget",handlerName:"handleUnload"})}};window.addEventListener("beforeunload",A),window.addEventListener("pagehide",A),pC("ObiWidget_constructor_completed",{},"ObiWidget")}catch(A){throw gC(A,{componentName:"ObiWidget",lifecycle:"constructor"}),A}}updateFromConfig(){if(window.obiWidgetConfig){this.apiKey=window.obiWidgetConfig.apiKey||this.apiKey,this.position=window.obiWidgetConfig.position||this.position,this.user=window.obiWidgetConfig.user||this.user,void 0!==window.obiWidgetConfig.isActive&&(this.isActive=window.obiWidgetConfig.isActive),void 0!==window.obiWidgetConfig.linkOnlyAccess&&(this.linkOnlyAccess=window.obiWidgetConfig.linkOnlyAccess),!0===window.obiWidgetConfig.showMenu&&(this.state=Ra.LOADING,this.showCourseModal=!0,window.obiWidgetConfig.showMenu=!1);const A=window.obiWidgetConfig?.primaryColor||Pa;this.style.setProperty("--obi-primary",A),this.generateColorVariables(A)}}generateColorVariables(A){try{const t=Xa(A,"#c4b5fd"),e=Xa(A,"#c76cff"),i=(function(A){try{const t={h:Va(A).h,s:100,l:96};return Ja(t.h,t.s,t.l)}catch(t){return console.warn("Failed to transform to light tint, using fallback:",t),A}})(A),n=Xa(A,"#A06DF9");this.style.setProperty("--obi-secondary",t),this.style.setProperty("--obi-course-selected",e),this.style.setProperty("--obi-course-selected-bg",i),this.style.setProperty("--obi-paused-pulse",n)}catch(t){console.warn("Failed to generate color variables:",t),this.style.setProperty("--obi-secondary","#c4b5fd"),this.style.setProperty("--obi-course-selected","#c76cff"),this.style.setProperty("--obi-course-selected-bg","#fbf3ff"),this.style.setProperty("--obi-paused-pulse","#A06DF9")}}removeSessionUrlParams(){const A=new URL(window.location.href);A.searchParams.delete($a),window.history.replaceState({},"",A.toString()),localStorage.removeItem("obi-url-params")}createSession(A){try{return new Ga({sessionId:A,apiBaseUrl:t})||(console.error("Failed to create session"),null)}catch(e){return console.error("Error creating session:",e),null}}setupSessionEventListeners(A,t){A.on("stateChanged",(t=>{if(t===Ra.RESEARCHING)return this.researchingTimeoutRef&&window.clearTimeout(this.researchingTimeoutRef),this.state=t,this.researchingTimeoutRef=window.setTimeout((()=>{this.researchingTimeoutRef=null;const t=A.getCurrentState();this.state=t,t!==Ra.READY&&(this.storedActiveState=t)}),1500),void(this.storedActiveState=t);null===this.researchingTimeoutRef&&(this.state=t,t!==Ra.READY&&(this.storedActiveState=t))})),A.on("volume",(({speaker:A,spectrum:t,volume:e})=>{this.volume={speaker:A,spectrum:t,volume:e}})),A.on("error",(A=>{console.error("Session error:",A),this.state=Ra.ERROR,this.activeSession=null,t&&t()}))}handleSessionCreationFailure(A){this.state=Ra.ERROR,this.activeSession=null,A&&A()}clearSessionStorage(){FC.removeItem(UC)}saveSessionData(){if(this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl){const A=new Date;A.setMinutes(A.getMinutes()+5);const t={sessionToken:this.sessionToken,roomToken:this.roomToken,roomUrl:this.roomUrl,obiState:this.storedActiveState??this.state,sessionExpiry:A.toISOString()};FC.setItem(UC,JSON.stringify(t))}}async sessionConnectionCheck(){const A=(function(){let A={};return A=JSON.parse(localStorage.getItem("obi-url-params")||"{}"),0===Object.keys(A).length&&new URLSearchParams(window.location.search).forEach(((t,e)=>{A[e]=t})),localStorage.removeItem("obi-url-params"),A[$a]})();A?(console.log("[obi-sdk] using magic link"),this.apiKey?await this.handleUrlSessionEvent(A):(console.log("[obi-sdk] API key not ready, retrying..."),setTimeout((()=>{this.apiKey&&this.handleUrlSessionEvent(A)}),100))):await this.checkExistingSession()}connectedCallback(){super.connectedCallback(),this.updateFromConfig(),this.addEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),this.setAttribute("position",this.position),this.boundSaveSessionData=this.saveSessionData.bind(this),window.addEventListener("beforeunload",this.boundSaveSessionData),window.addEventListener("pagehide",this.boundSaveSessionData),this.addEventListener("course-select",this.handleCourseSelectEvent),this.isActive&&this.sessionConnectionCheck()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),null!==this.closeNavTimeoutRef&&window.clearTimeout(this.closeNavTimeoutRef),null!==this.researchingTimeoutRef&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.boundSaveSessionData&&(window.removeEventListener("beforeunload",this.boundSaveSessionData),window.removeEventListener("pagehide",this.boundSaveSessionData)),this.removeSessionUrlParams()}handleConfigUpdate(A){const t=A.detail.isActive&&!this.isActive;this.updateFromConfig(),this.position&&this.setAttribute("position",this.position),t&&this.sessionConnectionCheck(),this.requestUpdate()}handleMouseEnter(){this.isHovering=!0,this.navVisible=!0}handleMouseLeave(){this.isHovering=!1,null!==this.closeNavTimeoutRef&&window.clearTimeout(this.closeNavTimeoutRef),this.closeNavTimeoutRef=window.setTimeout((()=>{this.isHovering||(this.navVisible=!1),this.closeNavTimeoutRef=null}),300)}terminateSession(){this.clearSessionStorage(),this.sessionToken=null,this.roomToken=null,this.roomUrl=null,null!==this.researchingTimeoutRef&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.activeSession&&(this.activeSession.disconnect(),this.activeSession=null),this.state=Ra.READY}handleItemSelect(A,t){"experiences"!==A?xa([A,t]).with(["pause",!0],(()=>{this.activeSession?.pauseRecording()})).with(["pause",!1],(()=>{this.activeSession?.resumeRecording()})).with(["activate",!1],(()=>{this.terminateSession()})).otherwise((()=>{})):this.showCourseModal=!0}render(){if(!this.isActive)return _g;if(this.linkOnlyAccess&&this.state===Ra.READY)return _g;const A=xa(this.state).with(Ra.LOADING,(()=>Mg`<obi-dot-loader></obi-dot-loader>`)).with(Ra.RESEARCHING,(()=>Mg`<obi-searching-loader></obi-searching-loader>`)).with(Da.union(Ra.USER_SPEAKING,Ra.AGENT_SPEAKING),(()=>Mg`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`)).with(Ra.THINKING,(()=>Mg`<obi-dot-loader></obi-dot-loader>`)).with(Ra.PAUSED,(()=>DC)).otherwise((()=>DC)),t=this.state===Ra.USER_SPEAKING||this.state===Ra.AGENT_SPEAKING,e=this.state===Ra.PAUSED,i=this.state===Ra.RESEARCHING,n=this.state===Ra.USER_SPEAKING,s=this.state!==Ra.READY||this.navVisible,r=this.state!==Ra.READY||this.navVisible,o=this.position.includes("top")?"down":"up",a=["widget-container",s?"rotated":"",t?"pulse":"",e?"paused-pulse":"",i?"researching":"",n?"user-speaking":""].filter(Boolean).join(" ");return Mg`
|
|
788
912
|
<div
|
|
789
913
|
class="${a}"
|
|
790
914
|
@mouseenter=${this.handleMouseEnter}
|
|
791
915
|
@mouseleave=${this.handleMouseLeave}
|
|
792
916
|
>
|
|
793
917
|
${A}
|
|
794
|
-
${
|
|
918
|
+
${r&&this.state!==Ra.RESEARCHING?Mg`
|
|
795
919
|
<obi-navigation-bar
|
|
796
|
-
?isActive=${this.state!==
|
|
920
|
+
?isActive=${this.state!==Ra.READY}
|
|
797
921
|
.position=${this.position}
|
|
798
922
|
data-direction="${o}"
|
|
799
923
|
.currentState=${this.state}
|
|
@@ -802,16 +926,16 @@
|
|
|
802
926
|
`:_g}
|
|
803
927
|
</div>
|
|
804
928
|
${this.showCourseModal?Mg`<obi-course-modal
|
|
805
|
-
.onClose=${()
|
|
929
|
+
.onClose=${this.handleCloseModals.bind(this)}
|
|
806
930
|
.apiKey=${this.apiKey}
|
|
807
931
|
@course-select=${this.handleCourseSelectEvent}
|
|
808
932
|
></obi-course-modal>`:_g}
|
|
809
933
|
${this.showSessionStartModal&&this.selectedCourse?Mg`<obi-session-start-modal
|
|
810
934
|
.session=${this.selectedCourse}
|
|
811
935
|
.onStart=${this.handleSessionStart.bind(this)}
|
|
812
|
-
.onClose=${()=>{this.
|
|
936
|
+
.onClose=${()=>{this.handleCloseModals(),this.selectedCourse=null,this.removeSessionUrlParams()}}
|
|
813
937
|
></obi-session-start-modal>`:_g}
|
|
814
|
-
`}}function
|
|
938
|
+
`}}function CU(A){return new Promise((t=>setTimeout(t,A)))}function UU(A){const t=200*Math.pow(2,A);return Math.min(t,2e3)}async function FU(A,t,e=3){let i=null;for(let r=0;r<e;r++)try{return pC(`${t}_attempt`,{attempt:r+1},"init"),await A()}catch(s){if(i=s,console.warn(`[obi-sdk] ${t} failed (attempt ${r+1}/${e}):`,s),pC(`${t}_failed`,{error:s instanceof Error?s.message:String(s),attempt:r+1,maxAttempts:e},"init"),r<e-1){const A=UU(r);await CU(A)}}const n=new Error(`${t} failed after ${e} attempts: ${i?.message}`);throw gC(n,{componentName:"init",handlerName:"retryOperation",operationName:t,maxAttempts:e,lastErrorMessage:i?.message}),n}QU.styles=zw`
|
|
815
939
|
:host {
|
|
816
940
|
display: block;
|
|
817
941
|
position: fixed;
|
|
@@ -829,7 +953,7 @@
|
|
|
829
953
|
}
|
|
830
954
|
|
|
831
955
|
h1 {
|
|
832
|
-
font-family: "
|
|
956
|
+
font-family: "Satoshi", sans-serif;
|
|
833
957
|
}
|
|
834
958
|
|
|
835
959
|
/* Position-specific styles */
|
|
@@ -960,4 +1084,4 @@
|
|
|
960
1084
|
box-shadow: 0px 0px 18px 6px
|
|
961
1085
|
color-mix(in srgb, var(--obi-paused-pulse, #a06df9) 75%, transparent);
|
|
962
1086
|
}
|
|
963
|
-
`,
|
|
1087
|
+
`,mU([sp()],QU.prototype,"apiKey",2),mU([sp()],QU.prototype,"isActive",2),mU([sp()],QU.prototype,"linkOnlyAccess",2),mU([sp()],QU.prototype,"position",2),mU([sp()],QU.prototype,"user",2),mU([sp()],QU.prototype,"state",2),mU([sp()],QU.prototype,"storedActiveState",2),mU([sp()],QU.prototype,"showCourseModal",2),mU([sp()],QU.prototype,"showSessionStartModal",2),mU([sp()],QU.prototype,"selectedCourse",2),mU([sp()],QU.prototype,"isHovering",2),mU([sp()],QU.prototype,"navVisible",2),mU([sp()],QU.prototype,"activeSession",2),mU([sp()],QU.prototype,"volume",2),customElements.get("obi-widget")||customElements.define("obi-widget",QU),customElements.get("obi-widget")||customElements.define("obi-widget",QU);const yU=QC((function(){const A=window;let t=[];"function"!=typeof A.ObiSDK&&"object"!=typeof A.ObiSDK||(t=A.ObiSDK.q||[]),A.obiWidgetConfig&&vC({apiKey:A.obiWidgetConfig.apiKey,userId:A.obiWidgetConfig.user?.id,userEmail:A.obiWidgetConfig.user?.email,userMetadata:A.obiWidgetConfig.user?.metadata}),A.ObiSDK=function(t,e){try{"update"===t&&e&&(A.obiWidgetConfig={...A.obiWidgetConfig,...e},e.user&&vC({userId:e.user.id,userEmail:e.user.email,userMetadata:e.user.metadata}),document.querySelectorAll("obi-widget").forEach((A=>{A.dispatchEvent(new CustomEvent("obi-config-updated",{detail:e,bubbles:!0,composed:!0}))})),pC("SDK_config_updated",{hasUser:!!e.user,configKeys:Object.keys(e)},"init"))}catch(i){throw gC(i,{componentName:"init",handlerName:"ObiSDK.update",command:t}),i}},A.ObiSDK.q=t}),"mountSDK","init"),bU=mC((async function(){return FU((async()=>{if(document.querySelector("obi-widget"))return void pC("widget_already_exists",{},"init");if(!document.body)throw new Error("document.body not available");const A=document.createElement("obi-widget");document.body.appendChild(A),console.log("[obi-sdk] widget mounted"),pC("widget_mounted",{},"init")}),"widget mounting")}),"mountWidget","init"),EU=QC((function(){const A=window;if(A.ObiSDK&&Array.isArray(A.ObiSDK.q)){const t=A.ObiSDK.q.length;pC("queue_processing",{queueLength:t},"init"),(A.ObiSDK.q||[]).forEach((t=>{A.ObiSDK(...t)})),A.ObiSDK.q=[],t>0&&pC("queue_processed",{queueLength:t},"init")}}),"processQueue","init"),IU=mC((async function(){await kU("https://fonts.cdnfonts.com/css/satoshi"),await kU("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}),"loadFonts","init"),kU=mC((async function(A){return FU((async()=>{if(!document.head)throw new Error("document.head not available");const t=document.createElement("link");t.href=A,t.rel="stylesheet",document.head.appendChild(t),pC("font_loaded",{fontUrl:A},"init")}),"font loading")}),"loadFont","init"),HU=mC((async function(){pC("SDK_initialization_started",{},"init"),await new Promise((A=>setTimeout(A,500))),yU(),await IU(),await bU(),EU(),pC("SDK_initialization_completed",{},"init")}),"safeInitialize","init"),SU=mC((async function(){"loading"===document.readyState?(pC("DOM_not_ready",{},"init"),document.addEventListener("DOMContentLoaded",(async()=>{try{await HU()}catch(A){gC(A,{componentName:"init",handlerName:"DOMContentLoaded"}),console.error("[obi-sdk] initialization failed:",A)}}))):(pC("DOM_ready",{},"init"),await HU())}),"initializeObiWidget","init");try{vC({componentName:"init"}),pC("SDK_script_loaded",{},"init"),SU().catch((A=>{gC(A,{componentName:"init",handlerName:"initializeObiWidget"}),console.error("[obi-sdk] initialization failed:",A)}))}catch(TU){gC(TU,{componentName:"init",handlerName:"top-level"}),console.error("[obi-sdk] initialization failed:",TU)}A.ObiWidget=QU,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})})({});//# sourceMappingURL=obi-sdk.standalone.iife.js.map
|