@tavus/widget 0.7.0 → 0.8.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/index.iife.js +2 -2
- package/dist/index.mjs +11 -7
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -6,7 +6,7 @@ var TavusWidget=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
|
|
|
6
6
|
|| ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),Pn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=En(),n=Dn();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),Fn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=En(),n=Dn(),r=On(),i=Dn();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),In=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=En(),n=On(),r=Fn(),i=kn();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),Ln=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=En(),n=Dn();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),Rn=o(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),zn=o(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else(p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),Bn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Dn(),n=Rn(),r=zn(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),Vn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=An(),n=Nn(),r=Mn(),i=Nn(),a=Pn(),o=In(),s=Ln(),c=En(),l=On(),u=Bn(),d=Dn(),f=kn();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&ne(e),D(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),re(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&ne(e),ee(e),te(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),E(e)}function T(e,t){if(e.opts.jtd)return ie(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);ie(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function E(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function D(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function ee(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function te(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function ne({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function re(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&O(e),t.return((0,c._)`${l.default.errors} === 0`))}function O({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function ie(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>pe(e,`$ref`,h.all.$ref.definition));return}p.jtd||k(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),ae(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):ae(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function ae(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&pe(e,n.keyword,n.definition,t.type)})}function k(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(A(e,t),e.opts.allowUnionTypes||oe(e,t),se(e,e.dataTypes))}function A(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{le(e.dataTypes,t)||de(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),ue(e,t)}}function oe(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&de(e,`use allowUnionTypes to allow union type keyword`)}function se(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>ce(t,e))&&de(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function ce(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function le(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function ue(e,t){let n=[];for(let r of e.dataTypes)le(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function de(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var fe=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,ge(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=fe;function pe(e,t,n,r){let i=new fe(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var me=/^\/(?:[^~]|~0|~1)*$/,he=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ge(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!me.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=he.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=ge})),Hn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),Un=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Bn();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),Wn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=En(),n=Hn(),r=On(),i=Bn(),a=Dn(),o=Vn(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),Gn=s({$id:()=>Kn,additionalProperties:()=>!1,default:()=>Zn,description:()=>qn,properties:()=>Xn,required:()=>Yn,type:()=>Jn}),Kn,qn,Jn,Yn,Xn,Zn,Qn=a((()=>{Kn=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,qn=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,Jn=`object`,Yn=[`$data`],Xn={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},Zn={$id:Kn,description:qn,type:Jn,required:Yn,properties:Xn,additionalProperties:!1}})),$n=o(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),i=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function s(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var c=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(e){return e.length=0,!0}function u(e,t,n){if(e.length){let r=s(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function d(e){let t=0,n={error:!1,address:``,zone:``},r=[],i=[],a=!1,o=!1,c=u;for(let s=0;s<e.length;s++){let u=e[s];if(!(u===`[`||u===`]`))if(u===`:`){if(a===!0&&(o=!0),!c(i,r,n))break;if(++t>7){n.error=!0;break}s>0&&e[s-1]===`:`&&(a=!0),r.push(`:`);continue}else if(u===`%`){if(!c(i,r,n))break;c=l}else{i.push(u);continue}}return i.length&&(c===l?n.zone=i.join(``):o?r.push(i.join(``)):r.push(s(i))),n.address=r.join(``),n}function f(e){if(p(e,`:`)<2)return{host:e,isIPV6:!1};let t=d(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function p(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function m(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}var h={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},g=/[@/?#:]/g,_=/[@/?#]/g;function v(e,t){let n=t?_:g;return n.lastIndex=0,e.replace(n,e=>h[e])}function y(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let o=e.slice(r+1,r+3);if(i(o)){let e=o.toUpperCase(),i=String.fromCharCode(parseInt(e,16));t&&a(i)?n+=i:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function b(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&a(i)?t+=i:t+=`%`+e,n+=2;continue}}o(e[n])?t+=e[n]:t+=escape(e[n])}return t}function x(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function S(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let e=f(n);n=e.isIPV6===!0?`[${e.escapedHost}]`:v(n,!1)}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:c,recomposeAuthority:S,reescapeHostDelimiters:v,normalizePercentEncoding:y,normalizePathEncoding:b,escapePreservingEscapes:x,removeDotSegments:m,isIPv4:r,isUUID:n,normalizeIPv6:f,stringArrayToHexStripped:s}})),er=o(((e,t)=>{var{isUUID:n}=$n(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),tr=o(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,escapePreservingEscapes:s,reescapeHostDelimiters:c,isIPv4:l,nonSimpleDomain:u}=$n(),{SCHEMES:d,getSchemeHandler:f}=er();function p(e,t){return typeof e==`string`?e=w(e,t):typeof e==`object`&&(e=C(_(e,t),t)),e}function m(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},{parsed:i,malformedAuthorityOrPort:a}=S(e,r),{parsed:o,malformedAuthorityOrPort:s}=S(t,r);if(a||s)throw Error(i.error||o.error||`URI is malformed.`);let c=h(i,o,r,!0);return r.skipEscape=!0,_(c,r)}function h(e,t,n,i){let a={};return i||(e=C(_(e,n),n),t=C(_(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function g(e,t,n){let r=E(e,n),i=E(t,n);return r!==void 0&&i!==void 0&&r.toLowerCase()===i.toLowerCase()}function _(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},o=Object.assign({},t),c=[],l=f(o.scheme||n.scheme);l&&l.serialize&&l.serialize(n,o),n.path!==void 0&&(o.skipEscape?n.path=a(n.path):(n.path=s(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),o.reference!==`suffix`&&n.scheme&&c.push(n.scheme,`:`);let u=i(n);if(u!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(u),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!l||!l.absolutePath)&&(e=r(e)),u===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,n.query),n.fragment!==void 0&&c.push(`#`,n.fragment),c.join(``)}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,y=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,b=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function x(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function S(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1,s=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let d=e.match(y);d!==null&&d[1].indexOf(`\\`)!==-1&&(i.error=`URI authority must not contain a literal backslash.`,a=!0);let p=e.match(b);if(p!==null){let e=p[1],t=e.replace(/[\t\n\r]/g,``);t.length>=2&&(t.slice(0,2)===`//`?e.length!==t.length&&(i.error=i.error||`URI authority introducer must not contain whitespace.`,a=!0):(i.error=i.error||`URI authority must not contain a literal backslash.`,a=!0))}let m=e.match(v);if(m){i.scheme=m[1],i.userinfo=m[3],i.host=m[4],i.port=parseInt(m[5],10),i.path=m[6]||``,i.query=m[7],i.fragment=m[8],isNaN(i.port)&&(i.port=m[5]);let t=x(i,m);if(t!==void 0&&(i.error=i.error||t,a=!0),i.host)if(l(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),s=e.isIPV6}else s=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let d=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!d||!d.unicodeSupport)&&i.host&&(r.domainHost||d&&d.domainHost)&&s===!1&&u(i.host))try{i.host=new URL(`http://`+i.host).hostname}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}if((!d||d&&!d.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=c(unescape(i.host),s))),i.path&&=o(i.path),i.fragment))try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||`URI malformed`}d&&d.parse&&d.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:a}}function C(e,t){return S(e,t).parsed}function w(e,t){return T(e,t).normalized}function T(e,t){let{parsed:n,malformedAuthorityOrPort:r}=S(e,t);return{normalized:r?e:_(n,t),malformedAuthorityOrPort:r}}function E(e,t){if(typeof e==`string`){let{normalized:n,malformedAuthorityOrPort:r}=T(e,t);return r?void 0:n}if(typeof e==`object`)return _(e,t)}var D={SCHEMES:d,normalize:p,resolve:m,resolveComponent:h,equal:g,serialize:_,parse:C};t.exports=D,t.exports.default=D,t.exports.fastUri=D})),nr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tr();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),rr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Vn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=En();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});var r=Hn(),i=Un(),a=jn(),o=Wn(),s=En(),c=Bn(),u=Nn(),d=Dn(),f=(Qn(),l(Gn).default),p=nr(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=te(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=D.call(this),e.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(re.call(this,n,t),!t)return(0,d.eachItem)(n,e=>O.call(this,e)),this;ae.call(this,t);let r={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,r.type.length===0?e=>O.call(this,e,r):e=>r.type.forEach(t=>O.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=A(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=r.default,x.MissingRefError=i.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function T(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function D(){let e={...this.opts};for(let t of h)delete e[t];return e}var ee={log(){},warn(){},error(){}};function te(e){if(e===!1)return ee;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var ne=/^[a-z_$][a-z0-9_$:-]*$/i;function re(e,t){let{RULES:n}=this;if((0,d.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!ne.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function O(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?ie.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function ie(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function ae(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=A(t)),e.validateSchema=this.compile(t,!0))}var k={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function A(e){return{anyOf:[e,k]}}})),ir=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),ar=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=Un(),n=Fn(),r=En(),i=On(),a=Wn(),o=Dn(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0)if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),or=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ir(),n=ar();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),sr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),cr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),lr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),ur=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn(),r=lr();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),dr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fn(),n=Dn(),r=En();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),fr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),pr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fn(),n=En(),r=Dn();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),mr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),hr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Rn();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),gr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nn(),n=En(),r=Dn(),i=hr();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),_r=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn(),r=hr();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),vr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn(),r=hr();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),yr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=sr(),n=cr(),r=ur(),i=dr(),a=fr(),o=pr(),s=mr(),c=gr(),l=_r(),u=vr();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),br=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=En(),n=Dn(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),xr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=En(),n=Dn(),r=Fn(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),Sr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=xr();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),Cr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn(),r=Fn(),i=br();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),wr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Tr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=En(),n=Dn(),r=Fn();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
|
|
7
7
|
missingProperty: ${i},
|
|
8
8
|
depsCount: ${n},
|
|
9
|
-
deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Er=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Dr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fn(),n=En(),r=On(),i=Dn();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Or=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Vn(),n=Fn(),r=Dn(),i=Dr();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),kr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fn(),n=En(),r=Dn(),i=Dn();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),Ar=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dn();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),jr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Fn().validateUnion,error:{message:`must match a schema in anyOf`}}})),Mr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Nr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dn();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Pr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Fr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dn();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Ir=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=br(),n=Sr(),r=xr(),i=Cr(),a=wr(),o=Tr(),s=Er(),c=Dr(),l=Or(),u=kr(),d=Ar(),f=jr(),p=Mr(),m=Nr(),h=Pr(),g=Fr();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),Lr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Rr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[Lr().default]})),zr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Br=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=or(),n=yr(),r=Ir(),i=Rr(),a=zr();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),Vr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),Hr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Vr(),r=Wn(),i=Un(),a=Dn();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),Ur=s({$id:()=>Gr,$schema:()=>Wr,default:()=>Xr,definitions:()=>qr,properties:()=>Yr,title:()=>Kr,type:()=>Jr}),Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr=a((()=>{Wr=`http://json-schema.org/draft-07/schema#`,Gr=`http://json-schema.org/draft-07/schema#`,Kr=`Core schema meta-schema`,qr={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},Jr=[`object`,`boolean`],Yr={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},Xr={$schema:Wr,$id:Gr,title:Kr,definitions:qr,type:Jr,properties:Yr,default:!0}})),Qr=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=rr(),r=Br(),i=Hr(),a=(Zr(),l(Ur).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=Vn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=En();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=Hn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=Un();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}))(),$r=[0,1,2,3,4],ei=[1,2,3],ti={type:`object`,default:{},properties:{mode:{type:`string`,enum:[`system`,`light`,`dark`],default:`system`},style:{type:`string`,enum:[`basic`,`wireframe`,`silk`,`cyberpunk`,`retro`,`lemonade`],default:`basic`},boxes_radius:{type:`integer`,enum:$r,default:1},field_radius:{type:`integer`,enum:$r,default:1},selectors_radius:{type:`integer`,enum:$r,default:1},border_width:{type:`integer`,enum:$r,default:0},depth_effect:{type:`boolean`,default:!1},noise_effect:{type:`boolean`,default:!1},fields_size:{type:`integer`,enum:ei,default:2},selectors_size:{type:`integer`,enum:ei,default:2},icon_library:{type:`string`,enum:[`pixelarticons`,`lucide`],default:`pixelarticons`}}},ni={type:`object`,default:{},properties:{modality:{type:`string`,enum:[`audio`,`video`,`chat`],default:`video`},enable_chat:{type:`boolean`,default:!1},enable_closed_captions:{type:`boolean`,default:!1},enable_picture_in_picture:{type:`boolean`,default:!1},unique_memory_tag:{type:`boolean`,default:!0},context:{type:`string`,default:``},magic_grid:{type:`boolean`}}},ri={type:`object`,properties:{title:{type:`string`},url:{type:`string`}},required:[`title`,`url`]},ii={type:`object`,default:{},properties:{title:{type:`string`,default:``},description:{type:`string`,default:``},btn_title:{type:`string`,default:``},background:{type:`object`,default:{},properties:{type:{type:[`string`,`null`],enum:[`replica`,`background-gradient`,`custom-image`,null],default:null},url:{type:`string`,default:``}}}}},ai={type:`object`,default:{},properties:{permission_request_title:{type:`string`,default:``},permission_request_description:{type:`string`,default:``},permission_granted_title:{type:`string`,default:``},permission_granted_description:{type:`string`,default:``},permission_denied_title:{type:`string`,default:``},permission_denied_description:{type:`string`,default:``},join_button:{type:`string`,default:``},cancel_btn:{type:`string`,default:``}}},oi={type:`object`,default:{},properties:{title:{type:`string`,default:``},description:{type:`string`,default:``},cta:{type:`array`,items:ri,default:[]}}},si={type:`object`,default:{},properties:{hide_tavus_badge:{type:`boolean`,default:!1},logo:{type:`string`,default:``},text:{type:`string`,default:``}}},ci={type:`object`,default:{},properties:{template:{type:`string`,enum:[`1`,`2`,`3`,`4`,`5`],default:`1`},access:{type:`string`,enum:[`public`,`auth_required`],default:`public`},logo:{type:`string`,default:``},title:{type:`string`,default:``},description:{type:`string`,default:``},cta:{type:`array`,items:ri,default:[]},background:{type:[`object`,`null`],default:null,properties:{type:{type:`string`,enum:[`default`,`image`],default:`default`},url:{type:[`string`,`null`],default:null}}}}},li={type:`object`,properties:{title:{type:`string`,default:``},description:{type:`string`,default:``}}},ui={type:`object`,properties:{schema_version:{type:`integer`,const:1,default:1},terms_content:{type:`string`,default:``},terms_enabled:{type:`boolean`,default:!1},show_haircheck:{type:`boolean`,default:!0},language_selector:{type:`boolean`,default:!1},conversation:ni,style:ti,widget:{type:`object`,default:{},properties:{variant:{type:`string`,enum:[`tiny`,`compact`,`full`],default:`compact`},position:{type:`string`,enum:[`bottom-left`,`bottom-right`,`top-left`,`top-right`,`top`,`bottom`],default:`bottom-right`},expandable:{type:`string`,enum:[`default`,`always`,`start-expanded`],default:`default`},avatar:{type:`object`,default:{},properties:{type:{type:`string`,enum:[`orb`,`image`],default:`orb`}}},text:{type:`object`,default:{},properties:{title:{type:`string`,default:``},btn_title:{type:`string`,default:``}}}}},landing_page:ci,preview:ii,haircheck:ai,after_call:oi,branding:si,unavailable_screen:{type:`object`,properties:{daily_limit:li,total_limit:li,busy:li,cta:{type:`array`,items:ri}}}}},di=mn(`Config`),fi=new Qr.Ajv({useDefaults:!0,removeAdditional:`all`,strict:!1}).compile(ui);function pi(e){let t=e.customization??{};return t.widget===null&&delete t.widget,t.landing_page===null&&delete t.landing_page,fi(t)||di.warn(`Customization validation failed`,fi.errors),{...e,customization:t}}var mi=mn(`Config`);function hi(){return{is_available:!1}}var gi=280,_i=Ae(null);function vi({children:e,fallback:t}){let n=I(yt),r=n.deploymentId??``,i=n.overrideConfig,a=n.baseUrl,o=n.previewToken,s=P(()=>gn({baseUrl:a??`https://tavusapi.com`,token:o}),[a,o]),c=P(()=>zt(null),[]),l=P(()=>zt(null),[]),u=P(()=>zt(!1),[]);pn(()=>{if(!r){l.value=null,u.value=!1,c.value=i||null;return}let e=new AbortController;return vn(s,r).then(t=>{e.signal.aborted||(l.value=null,u.value=!1,c.value=t,mi.info(`Deployment initialized`,t.deployment_id))}).catch(t=>{e.signal.aborted||(mi.error(`Init failed:`,t),l.value=t,u.value=!i,c.value=i||hi())}),()=>{e.abort()}});let d=P(()=>zt(null),[]);M(()=>{let e=e=>{if(!e){d.value=null;return}let t=i?Cn(e,i):e;d.value=pi(t)};return e(c.peek()),c.subscribe(e)},[d,c,i]);let f=d.value!==null,[p,m]=j(`pending`);if(M(()=>{if(!f){m(`pending`);return}if(!t){m(`done`);return}if(globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1){m(`done`);return}m(`fading`);let e=setTimeout(()=>m(`done`),gi);return()=>clearTimeout(e)},[f]),!t){if(!f)return L(k,{});let t={deploymentId:r,config:d,initError:l,configError:u,client:s};return L(_i.Provider,{value:t,children:e})}let h=f?{deploymentId:r,config:d,initError:l,configError:u,client:s}:null;return L(`div`,{class:`relative w-full h-full`,children:[h&&L(_i.Provider,{value:h,children:e}),p!==`done`&&L(`div`,{class:`absolute inset-0 z-10${p===`fading`?` pointer-events-none motion-safe:animate-[tavusFadeOut_280ms_ease-out_forwards]`:``}`,"aria-hidden":p===`fading`?`true`:void 0,children:t})]})}var yi=Ae(null);function bi({children:e}){let{client:t}=I(_i),n=P(()=>({client:t}),[t]);return L(yi.Provider,{value:n,children:e})}function xi(e){return`init`in e}function Si(e){return typeof e.write==`function`}function Ci(e){return!!e.onMount}function wi(e){return`v`in e||`e`in e}function Ti(e){if(`e`in e)throw e.e;return e.v}function Ei(e){return typeof e?.then==`function`}function Di(e){if(!(e instanceof Error))return!1;let t=e.name,n=e.message.toLowerCase();return(t===`RangeError`||t===`InternalError`)&&(n.includes(`call stack`)||n.includes(`too much recursion`)||n.includes(`stack overflow`))}function Oi(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function ki(e,t,n){let r=n.get(e)?.t,i=t.p;if(!r?.size)return i;if(!i.size)return r;let a=new Set(r);for(let e of i)a.add(e);return a}function Ai(e){return!!e.INTERNAL_onInit}var ji=(e,t,n,...r)=>n.read(...r),Mi=(e,t,n,...r)=>n.write(...r),Ni=(e,t,n)=>n.INTERNAL_onInit(t),Pi=(e,t,n,r)=>n.onMount?.call(n,r),Fi=(e,t,n)=>{var r;let i=e[0],a=i.get(n);if(!a){let o=e[6],s=e[9];a={d:new Map,p:new Set,n:0},i.set(n,a),(r=o.i)==null||r.call(o,n),Ai(n)&&s(e,t,n)}return a},Ii=(e,t)=>{let n=e[1],r=e[3],i=e[4],a=e[5],o=e[6],s=e[13];if(!o.f&&!r.size&&!i.size&&!a.size)return;let c=[],l=e=>{try{e()}catch(e){c.push(e)}};do{o.f&&l(o.f);let c=new Set;for(let e of r){let t=n.get(e)?.l;if(t)for(let e of t)c.add(e)}r.clear();for(let e of a)c.add(e);a.clear();for(let e of i)c.add(e);i.clear();for(let e of c)l(e);r.size&&s(e,t)}while(r.size||a.size||i.size);if(c.length)throw AggregateError(c)},Li=(e,t)=>{let n=e[1],r=e[2],i=e[3],a=e[11],o=e[14],s=e[17];if(!i.size)return;let c=[],l=[],u=new WeakSet,d=new WeakSet,f=[],p=[];for(let n of i)f.push(n),p.push(a(e,t,n));for(;f.length;){let i=f.length-1,o=f[i],s=p[i];if(d.has(o)){f.pop(),p.pop();continue}if(u.has(o)){r.get(o)===s.n&&(c.push(o),l.push(s)),d.add(o),f.pop(),p.pop();continue}u.add(o);for(let r of ki(o,s,n))u.has(r)||(f.push(r),p.push(a(e,t,r)))}for(let n=c.length-1;n>=0;--n){let a=c[n],u=l[n],d=!1;for(let e of u.d.keys())if(e!==a&&i.has(e)){d=!0;break}d&&(r.set(a,u.n),o(e,t,a),s(e,t,a)),r.delete(a)}},Ri=(e,t,n)=>{var r,i;let a=e[1],o=e[2],s=e[3],c=e[6],l=e[7],u=e[11],d=e[12],f=e[13],p=e[14],m=e[16],h=e[17],g=e[20],_=e[26],v=e[28],y=u(e,t,n),b=v[0];if(wi(y)){if(a.has(n)&&o.get(n)!==y.n||y.m===b)return y.m=b,y;let r=!1;for(let[n,i]of y.d)if(p(e,t,n).n!==i){r=!0;break}if(!r)return y.m=b,y}let x=!0,S=new Set(y.d.keys()),C=()=>{for(let e of S)y.d.delete(e)},w=()=>{if(a.has(n)){let r=!s.size;h(e,t,n),r&&(f(e,t),d(e,t))}},T=r=>{var i;if(r===n){let n=u(e,t,r);if(!wi(n))if(xi(r))g(e,t,r,r.init);else throw Error(`no atom init`);return Ti(n)}let o=p(e,t,r);try{return Ti(o)}finally{S.delete(r),y.d.set(r,o.n),Ei(y.v)&&Oi(n,y.v,o),a.has(n)&&((i=a.get(r))==null||i.t.add(n)),x||w()}},E,D,ee={get signal(){return E||=new AbortController,E.signal},get setSelf(){return!D&&Si(n)&&(D=(...r)=>{if(!x)try{return m(e,t,n,r)}finally{f(e,t),d(e,t)}}),D}},te=y.n,ne=o.get(n)===te;try{let i=l(e,t,n,T,ee);if(g(e,t,n,i),Ei(i)){_(e,t,i,()=>E?.abort());let n=()=>{C(),w()};i.then(n,n)}else C();return(r=c.r)==null||r.call(c,n),y.m=b,y}catch(e){if(Di(e))throw e;return delete y.v,y.e=e,++y.n,y.m=b,y}finally{x=!1,y.n!==te&&ne&&(o.set(n,y.n),s.add(n),(i=c.c)==null||i.call(c,n))}},zi=(e,t,n)=>{let r=e[1],i=e[2],a=e[11],o=[n];for(;o.length;){let n=o.pop(),s=a(e,t,n);for(let c of ki(n,s,r)){let n=a(e,t,c);i.get(c)!==n.n&&(i.set(c,n.n),o.push(c))}}},Bi=(e,t,n,r)=>{let i=e[3],a=e[6],o=e[8],s=e[11],c=e[12],l=e[13],u=e[14],d=e[15],f=e[16],p=e[17],m=e[20],h=e[28],g=!0,_=n=>Ti(u(e,t,n)),v=(r,...o)=>{var u;let _=s(e,t,r);try{if(r===n){if(!xi(r))throw Error(`atom not writable`);let n=_.n,s=o[0];m(e,t,r,s),p(e,t,r),n!==_.n&&(++h[0],i.add(r),d(e,t,r),(u=a.c)==null||u.call(a,r));return}else return f(e,t,r,o)}finally{g||(l(e,t),c(e,t))}};try{return o(e,t,n,_,v,...r)}finally{g=!1}},Vi=(e,t,n)=>{var r;let i=e[1],a=e[3],o=e[6],s=e[11],c=e[15],l=e[18],u=e[19],d=s(e,t,n),f=i.get(n);if(f&&d.d.size>0){for(let[i,u]of d.d)if(!f.d.has(i)){let d=s(e,t,i);l(e,t,i).t.add(n),f.d.add(i),u!==d.n&&(a.add(i),c(e,t,i),(r=o.c)==null||r.call(o,i))}for(let r of f.d)d.d.has(r)||(f.d.delete(r),u(e,t,r)?.t.delete(n))}},Hi=(e,t,n)=>{var r;let i=e[1],a=e[4],o=e[6],s=e[10],c=e[11],l=e[12],u=e[13],d=e[14],f=e[16],p=e[18],m=c(e,t,n),h=i.get(n);if(!h){d(e,t,n);for(let r of m.d.keys())p(e,t,r).t.add(n);h={l:new Set,d:new Set(m.d.keys()),t:new Set},i.set(n,h),Si(n)&&Ci(n)&&a.add(()=>{let r=!0,i=(...i)=>{try{return f(e,t,n,i)}finally{r||(u(e,t),l(e,t))}};try{let a=s(e,t,n,i);a&&(h.u=()=>{r=!0;try{a()}finally{r=!1}})}finally{r=!1}}),(r=o.m)==null||r.call(o,n)}return h},Ui=(e,t,n)=>{var r;let i=e[1],a=e[5],o=e[6],s=e[11],c=e[19],l=s(e,t,n),u=i.get(n);if(!u||u.l.size)return u;let d=!1;for(let e of u.t)if(i.get(e)?.d.has(n)){d=!0;break}if(!d){u.u&&a.add(u.u),u=void 0,i.delete(n);for(let r of l.d.keys())c(e,t,r)?.t.delete(n);(r=o.u)==null||r.call(o,n);return}return u},Wi=(e,t,n,r)=>{let i=e[11],a=e[27],o=i(e,t,n),s=`v`in o,c=o.v;if(Ei(r))for(let a of o.d.keys())Oi(n,r,i(e,t,a));o.v=r,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,Ei(c)&&a(e,t,c))},Gi=(e,t,n)=>{let r=e[14];return Ti(r(e,t,n))},Ki=(e,t,n,...r)=>{let i=e[3],a=e[12],o=e[13],s=e[16],c=i.size;try{return s(e,t,n,r)}finally{i.size!==c&&(o(e,t),a(e,t))}},qi=(e,t,n,r)=>{let i=e[12],a=e[18],o=e[19],s=a(e,t,n).l;return s.add(r),i(e,t),()=>{s.delete(r),o(e,t,n),i(e,t)}},Ji=(e,t,n,r)=>{let i=e[25],a=i.get(n);if(!a){a=new Set,i.set(n,a);let e=()=>i.delete(n);n.then(e,e)}a.add(r)},Yi=(e,t,n)=>{e[25].get(n)?.forEach(e=>e())},Xi=new WeakMap;function Zi(e){let t=Xi.get(e),n=t[24];return n?n(t,e):t}function Qi(...e){let t={get(e){return r(n,t,e)},set(e,...r){return i(n,t,e,...r)},sub(e,r){return a(n,t,e,r)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,void 0,new WeakMap,Ji,Yi,[0]].map((t,n)=>e[n]||t);Xi.set(t,Object.freeze(n));let r=n[21],i=n[22],a=n[23];return t}var $i=0;function ea(e,t){let n=`atom${++$i}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=ta,r.write=na),t&&(r.write=t),r}function ta(e){return e(this)}function na(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}var ra;function ia(){return ra?ra():Qi()}var aa;function oa(){return aa||=ia(),aa}function sa(e,t){for(var n in t)e[n]=t[n];return e}function ca(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function la(e,t){var n=t(),r=j({t:{__:n,u:t}}),i=r[0].t,a=r[1];return at(function(){i.__=n,i.u=t,ua(i)&&a({t:i})},[e,n,t]),M(function(){return ua(i)&&a({t:i}),e(function(){ua(i)&&a({t:i})})},[e]),n}function ua(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function da(e){e()}function fa(e){return e}function pa(){return[!1,da]}var ma=at;function ha(e,t){this.props=e,this.context=t}function ga(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&(typeof n==`function`?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:ca(this.props,e)}function r(t){return this.shouldComponentUpdate=n,O(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(ha.prototype=new A).isPureReactComponent=!0,ha.prototype.shouldComponentUpdate=function(e,t){return ca(this.props,e)||ca(this.state,t)};var _a=d.__b;d.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),_a&&_a(e)};var va=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function ya(e){function t(t){var n=sa({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=va,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var ba=function(e,t){return e==null?null:me(me(e).map(t))},xa={map:ba,forEach:ba,count:function(e){return e?me(e).length:0},only:function(e){var t=me(e);if(t.length!==1)throw`Children.only`;return t[0]},toArray:me},Sa=d.__e;d.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Sa(e,t,n,r)};var Ca=d.unmount;function wa(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=sa({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return wa(e,t,n)})),e}function Ta(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ta(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ea(){this.__u=0,this.o=null,this.__b=null}function Da(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Oa(e){var t,n,r,i=null;function a(a){if(t||(t=e()).then(function(e){e&&(i=e.default||e),r=!0},function(e){n=e,r=!0}),n)throw n;if(!r)throw t;return i?O(i,a):null}return a.displayName=`Lazy`,a.__f=!0,a}function ka(){this.i=null,this.l=null}d.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ca&&Ca(e)},(Ea.prototype=new A).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Da(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Ta(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Ea.prototype.componentWillUnmount=function(){this.o=[]},Ea.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=wa(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&O(k,null,e.fallback);return i&&(i.__u&=-33),[O(k,null,t.__a?null:e.children),i]};var Aa=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function ja(e){return this.getChildContext=function(){return e.context},e.children}function Ma(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){De(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}De(O(ja,{context:t.context},e.__v),t.v)}function Na(e,t){var n=O(Ma,{__v:e,h:t});return n.containerInfo=t,n}(ka.prototype=new A).__a=function(e){var t=this,n=Da(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Aa(t,e,r)):i()};n?n(a):a()}},ka.prototype.render=function(e){this.i=null,this.l=new Map;var t=me(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},ka.prototype.componentDidUpdate=ka.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Aa(e,n,t)})};var Pa=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Fa=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ia=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,La=/[A-Z0-9]/g,Ra=typeof document<`u`,za=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};function Ba(e,t,n){return t.__k??(t.textContent=``),De(e,t),typeof n==`function`&&n(),e?e.__c:null}function Va(e,t,n){return Oe(e,t),typeof n==`function`&&n(),e?e.__c:null}A.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(A.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ha=d.event;d.event=function(e){return Ha&&(e=Ha(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ua,Wa={configurable:!0,get:function(){return this.class}},Ga=d.vnode;d.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Ra&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||za(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Ia.test(a)&&(a=s):s=a=`oninput`:i&&Fa.test(a)?a=a.replace(La,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=me(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=me(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Wa)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Pa,Ga&&Ga(e)};var Ka=d.__r;d.__r=function(e){Ka&&Ka(e),Ua=e.__c};var qa=d.diffed;d.diffed=function(e){qa&&qa(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value),Ua=null};var Ja={ReactCurrentDispatcher:{current:{readContext:function(e){return Ua.__n[e.__c].props.value},useCallback:F,useContext:I,useDebugValue:st,useDeferredValue:fa,useEffect:M,useId:ct,useImperativeHandle:ot,useInsertionEffect:ma,useLayoutEffect:at,useMemo:P,useReducer:it,useRef:N,useState:j,useSyncExternalStore:la,useTransition:pa}}};function Ya(e){return O.bind(null,e)}function Xa(e){return!!e&&e.$$typeof===Pa}function Za(e){return Xa(e)&&e.type===k}function Qa(e){return!!e&&typeof e.displayName==`string`&&e.displayName.indexOf(`Memo(`)==0}function $a(e){return Xa(e)?ke.apply(null,arguments):e}function eo(e){return!!e.__k&&(De(null,e),!0)}function to(e){return e&&(e.base||e.nodeType===1&&e)||null}var no={useState:j,useId:ct,useReducer:it,useEffect:M,useLayoutEffect:at,useInsertionEffect:ma,useTransition:pa,useDeferredValue:fa,useSyncExternalStore:la,startTransition:da,useRef:N,useImperativeHandle:ot,useMemo:P,useCallback:F,useContext:I,useDebugValue:st,version:`18.3.1`,Children:xa,render:Ba,hydrate:Va,unmountComponentAtNode:eo,createPortal:Na,createElement:O,createContext:Ae,createFactory:Ya,cloneElement:$a,createRef:ae,Fragment:k,isValidElement:Xa,isElement:Xa,isFragment:Za,isMemo:Qa,findDOMNode:to,Component:A,PureComponent:ha,memo:ga,forwardRef:ya,flushSync:function(e,t){var n=d.debounceRendering;d.debounceRendering=function(e){return e()};var r=e(t);return d.debounceRendering=n,r},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:k,Suspense:Ea,SuspenseList:ka,lazy:Oa,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ja},ro=Ae(void 0);function io(e){let t=I(ro);return e?.store||t||oa()}function ao({children:e,store:t}){let n=N(null);return t?O(ro.Provider,{value:t},e):(n.current===null&&(n.current=ia()),O(ro.Provider,{value:n.current},e))}var oo=e=>typeof e?.then==`function`,so=e=>{e.status||(e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t}))},co=no.use||(e=>{if(e.status===`pending`)throw e;if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:(so(e),e)}),lo=new WeakMap,uo=(e,t,n)=>{let r=Zi(e),i=r[26],a=lo.get(t);return a||(a=new Promise((o,s)=>{let c=t,l=e=>t=>{c===e&&o(t)},u=e=>t=>{c===e&&s(t)},d=()=>{try{let t=n();oo(t)?(lo.set(t,a),c=t,t.then(l(t),u(t)),i(r,e,t,d)):o(t)}catch(e){s(e)}};t.then(l(t),u(t)),i(r,e,t,d)}),lo.set(t,a)),a};function fo(e,t){let{delay:n,unstable_promiseStatus:r=!no.use}=t||{},i=io(t),[[a,o,s],c]=it(t=>{let n=i.get(e);return Object.is(t[0],n)&&t[1]===i&&t[2]===e?t:[n,i,e]},void 0,()=>[i.get(e),i,e]),l=a;if((o!==i||s!==e)&&(c(),l=i.get(e)),M(()=>{let t=i.sub(e,()=>{if(r)try{let t=i.get(e);oo(t)&&so(uo(i,t,()=>i.get(e)))}catch{}if(typeof n==`number`){console.warn(`[DEPRECATED] delay option is deprecated and will be removed in v3.
|
|
9
|
+
deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Er=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Dr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fn(),n=En(),r=On(),i=Dn();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Or=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Vn(),n=Fn(),r=Dn(),i=Dr();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),kr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fn(),n=En(),r=Dn(),i=Dn();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),Ar=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dn();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),jr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Fn().validateUnion,error:{message:`must match a schema in anyOf`}}})),Mr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Nr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dn();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Pr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Dn(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Fr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dn();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Ir=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=br(),n=Sr(),r=xr(),i=Cr(),a=wr(),o=Tr(),s=Er(),c=Dr(),l=Or(),u=kr(),d=Ar(),f=jr(),p=Mr(),m=Nr(),h=Pr(),g=Fr();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),Lr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Rr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[Lr().default]})),zr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Br=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=or(),n=yr(),r=Ir(),i=Rr(),a=zr();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),Vr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),Hr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=En(),n=Vr(),r=Wn(),i=Un(),a=Dn();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),Ur=s({$id:()=>Gr,$schema:()=>Wr,default:()=>Xr,definitions:()=>qr,properties:()=>Yr,title:()=>Kr,type:()=>Jr}),Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr=a((()=>{Wr=`http://json-schema.org/draft-07/schema#`,Gr=`http://json-schema.org/draft-07/schema#`,Kr=`Core schema meta-schema`,qr={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},Jr=[`object`,`boolean`],Yr={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},Xr={$schema:Wr,$id:Gr,title:Kr,definitions:qr,type:Jr,properties:Yr,default:!0}})),Qr=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=rr(),r=Br(),i=Hr(),a=(Zr(),l(Ur).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=Vn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=En();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=Hn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=Un();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}))(),$r=[0,1,2,3,4],ei=[1,2,3],ti={type:`object`,default:{},properties:{mode:{type:`string`,enum:[`system`,`light`,`dark`],default:`system`},style:{type:`string`,enum:[`basic`,`wireframe`,`silk`,`cyberpunk`,`retro`,`lemonade`],default:`basic`},boxes_radius:{type:`integer`,enum:$r,default:1},field_radius:{type:`integer`,enum:$r,default:1},selectors_radius:{type:`integer`,enum:$r,default:1},border_width:{type:`integer`,enum:$r,default:0},depth_effect:{type:`boolean`,default:!1},noise_effect:{type:`boolean`,default:!1},fields_size:{type:`integer`,enum:ei,default:2},selectors_size:{type:`integer`,enum:ei,default:2},icon_library:{type:`string`,enum:[`pixelarticons`,`lucide`],default:`pixelarticons`}}},ni={type:`object`,default:{},properties:{modality:{type:`string`,enum:[`audio`,`video`,`chat`],default:`video`},enable_chat:{type:`boolean`,default:!1},enable_closed_captions:{type:`boolean`,default:!1},enable_picture_in_picture:{type:`boolean`,default:!1},show_fullscreen_hint:{type:`boolean`,default:!0},unique_memory_tag:{type:`boolean`,default:!0},context:{type:`string`,default:``},magic_grid:{type:`boolean`}}},ri={type:`object`,properties:{title:{type:`string`},url:{type:`string`}},required:[`title`,`url`]},ii={type:`object`,default:{},properties:{title:{type:`string`,default:``},description:{type:`string`,default:``},btn_title:{type:`string`,default:``},background:{type:`object`,default:{},properties:{type:{type:[`string`,`null`],enum:[`replica`,`background-gradient`,`custom-image`,null],default:null},url:{type:`string`,default:``}}}}},ai={type:`object`,default:{},properties:{permission_request_title:{type:`string`,default:``},permission_request_description:{type:`string`,default:``},permission_granted_title:{type:`string`,default:``},permission_granted_description:{type:`string`,default:``},permission_denied_title:{type:`string`,default:``},permission_denied_description:{type:`string`,default:``},join_button:{type:`string`,default:``},cancel_btn:{type:`string`,default:``}}},oi={type:`object`,default:{},properties:{title:{type:`string`,default:``},description:{type:`string`,default:``},cta:{type:`array`,items:ri,default:[]}}},si={type:`object`,default:{},properties:{hide_tavus_badge:{type:`boolean`,default:!1},logo:{type:`string`,default:``},text:{type:`string`,default:``}}},ci={type:`object`,default:{},properties:{template:{type:`string`,enum:[`1`,`2`,`3`,`4`,`5`],default:`1`},access:{type:`string`,enum:[`public`,`auth_required`],default:`public`},logo:{type:`string`,default:``},title:{type:`string`,default:``},description:{type:`string`,default:``},cta:{type:`array`,items:ri,default:[]},background:{type:[`object`,`null`],default:null,properties:{type:{type:`string`,enum:[`default`,`image`],default:`default`},url:{type:[`string`,`null`],default:null}}}}},li={type:`object`,properties:{title:{type:`string`,default:``},description:{type:`string`,default:``}}},ui={type:`object`,properties:{schema_version:{type:`integer`,const:1,default:1},terms_content:{type:`string`,default:``},terms_enabled:{type:`boolean`,default:!1},show_haircheck:{type:`boolean`,default:!0},language_selector:{type:`boolean`,default:!1},conversation:ni,style:ti,widget:{type:`object`,default:{},properties:{variant:{type:`string`,enum:[`tiny`,`compact`,`full`],default:`compact`},position:{type:`string`,enum:[`bottom-left`,`bottom-right`,`top-left`,`top-right`,`top`,`bottom`],default:`bottom-right`},expandable:{type:`string`,enum:[`default`,`always`,`start-expanded`],default:`default`},avatar:{type:`object`,default:{},properties:{type:{type:`string`,enum:[`orb`,`image`],default:`orb`}}},text:{type:`object`,default:{},properties:{title:{type:`string`,default:``},btn_title:{type:`string`,default:``}}}}},landing_page:ci,preview:ii,haircheck:ai,after_call:oi,branding:si,unavailable_screen:{type:`object`,properties:{daily_limit:li,total_limit:li,busy:li,cta:{type:`array`,items:ri}}}}},di=mn(`Config`),fi=new Qr.Ajv({useDefaults:!0,removeAdditional:`all`,strict:!1}).compile(ui);function pi(e){let t=e.customization??{};return t.widget===null&&delete t.widget,t.landing_page===null&&delete t.landing_page,fi(t)||di.warn(`Customization validation failed`,fi.errors),{...e,customization:t}}var mi=mn(`Config`);function hi(){return{is_available:!1}}var gi=280,_i=Ae(null);function vi({children:e,fallback:t}){let n=I(yt),r=n.deploymentId??``,i=n.overrideConfig,a=n.baseUrl,o=n.previewToken,s=P(()=>gn({baseUrl:a??`https://tavusapi.com`,token:o}),[a,o]),c=P(()=>zt(null),[]),l=P(()=>zt(null),[]),u=P(()=>zt(!1),[]);pn(()=>{if(!r){l.value=null,u.value=!1,c.value=i||null;return}let e=new AbortController;return vn(s,r).then(t=>{e.signal.aborted||(l.value=null,u.value=!1,c.value=t,mi.info(`Deployment initialized`,t.deployment_id))}).catch(t=>{e.signal.aborted||(mi.error(`Init failed:`,t),l.value=t,u.value=!i,c.value=i||hi())}),()=>{e.abort()}});let d=P(()=>zt(null),[]);M(()=>{let e=e=>{if(!e){d.value=null;return}let t=i?Cn(e,i):e;d.value=pi(t)};return e(c.peek()),c.subscribe(e)},[d,c,i]);let f=d.value!==null,[p,m]=j(`pending`);if(M(()=>{if(!f){m(`pending`);return}if(!t){m(`done`);return}if(globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1){m(`done`);return}m(`fading`);let e=setTimeout(()=>m(`done`),gi);return()=>clearTimeout(e)},[f]),!t){if(!f)return L(k,{});let t={deploymentId:r,config:d,initError:l,configError:u,client:s};return L(_i.Provider,{value:t,children:e})}let h=f?{deploymentId:r,config:d,initError:l,configError:u,client:s}:null;return L(`div`,{class:`relative w-full h-full`,children:[h&&L(_i.Provider,{value:h,children:e}),p!==`done`&&L(`div`,{class:`absolute inset-0 z-10${p===`fading`?` pointer-events-none motion-safe:animate-[tavusFadeOut_280ms_ease-out_forwards]`:``}`,"aria-hidden":p===`fading`?`true`:void 0,children:t})]})}var yi=Ae(null);function bi({children:e}){let{client:t}=I(_i),n=P(()=>({client:t}),[t]);return L(yi.Provider,{value:n,children:e})}function xi(e){return`init`in e}function Si(e){return typeof e.write==`function`}function Ci(e){return!!e.onMount}function wi(e){return`v`in e||`e`in e}function Ti(e){if(`e`in e)throw e.e;return e.v}function Ei(e){return typeof e?.then==`function`}function Di(e){if(!(e instanceof Error))return!1;let t=e.name,n=e.message.toLowerCase();return(t===`RangeError`||t===`InternalError`)&&(n.includes(`call stack`)||n.includes(`too much recursion`)||n.includes(`stack overflow`))}function Oi(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function ki(e,t,n){let r=n.get(e)?.t,i=t.p;if(!r?.size)return i;if(!i.size)return r;let a=new Set(r);for(let e of i)a.add(e);return a}function Ai(e){return!!e.INTERNAL_onInit}var ji=(e,t,n,...r)=>n.read(...r),Mi=(e,t,n,...r)=>n.write(...r),Ni=(e,t,n)=>n.INTERNAL_onInit(t),Pi=(e,t,n,r)=>n.onMount?.call(n,r),Fi=(e,t,n)=>{var r;let i=e[0],a=i.get(n);if(!a){let o=e[6],s=e[9];a={d:new Map,p:new Set,n:0},i.set(n,a),(r=o.i)==null||r.call(o,n),Ai(n)&&s(e,t,n)}return a},Ii=(e,t)=>{let n=e[1],r=e[3],i=e[4],a=e[5],o=e[6],s=e[13];if(!o.f&&!r.size&&!i.size&&!a.size)return;let c=[],l=e=>{try{e()}catch(e){c.push(e)}};do{o.f&&l(o.f);let c=new Set;for(let e of r){let t=n.get(e)?.l;if(t)for(let e of t)c.add(e)}r.clear();for(let e of a)c.add(e);a.clear();for(let e of i)c.add(e);i.clear();for(let e of c)l(e);r.size&&s(e,t)}while(r.size||a.size||i.size);if(c.length)throw AggregateError(c)},Li=(e,t)=>{let n=e[1],r=e[2],i=e[3],a=e[11],o=e[14],s=e[17];if(!i.size)return;let c=[],l=[],u=new WeakSet,d=new WeakSet,f=[],p=[];for(let n of i)f.push(n),p.push(a(e,t,n));for(;f.length;){let i=f.length-1,o=f[i],s=p[i];if(d.has(o)){f.pop(),p.pop();continue}if(u.has(o)){r.get(o)===s.n&&(c.push(o),l.push(s)),d.add(o),f.pop(),p.pop();continue}u.add(o);for(let r of ki(o,s,n))u.has(r)||(f.push(r),p.push(a(e,t,r)))}for(let n=c.length-1;n>=0;--n){let a=c[n],u=l[n],d=!1;for(let e of u.d.keys())if(e!==a&&i.has(e)){d=!0;break}d&&(r.set(a,u.n),o(e,t,a),s(e,t,a)),r.delete(a)}},Ri=(e,t,n)=>{var r,i;let a=e[1],o=e[2],s=e[3],c=e[6],l=e[7],u=e[11],d=e[12],f=e[13],p=e[14],m=e[16],h=e[17],g=e[20],_=e[26],v=e[28],y=u(e,t,n),b=v[0];if(wi(y)){if(a.has(n)&&o.get(n)!==y.n||y.m===b)return y.m=b,y;let r=!1;for(let[n,i]of y.d)if(p(e,t,n).n!==i){r=!0;break}if(!r)return y.m=b,y}let x=!0,S=new Set(y.d.keys()),C=()=>{for(let e of S)y.d.delete(e)},w=()=>{if(a.has(n)){let r=!s.size;h(e,t,n),r&&(f(e,t),d(e,t))}},T=r=>{var i;if(r===n){let n=u(e,t,r);if(!wi(n))if(xi(r))g(e,t,r,r.init);else throw Error(`no atom init`);return Ti(n)}let o=p(e,t,r);try{return Ti(o)}finally{S.delete(r),y.d.set(r,o.n),Ei(y.v)&&Oi(n,y.v,o),a.has(n)&&((i=a.get(r))==null||i.t.add(n)),x||w()}},E,D,ee={get signal(){return E||=new AbortController,E.signal},get setSelf(){return!D&&Si(n)&&(D=(...r)=>{if(!x)try{return m(e,t,n,r)}finally{f(e,t),d(e,t)}}),D}},te=y.n,ne=o.get(n)===te;try{let i=l(e,t,n,T,ee);if(g(e,t,n,i),Ei(i)){_(e,t,i,()=>E?.abort());let n=()=>{C(),w()};i.then(n,n)}else C();return(r=c.r)==null||r.call(c,n),y.m=b,y}catch(e){if(Di(e))throw e;return delete y.v,y.e=e,++y.n,y.m=b,y}finally{x=!1,y.n!==te&&ne&&(o.set(n,y.n),s.add(n),(i=c.c)==null||i.call(c,n))}},zi=(e,t,n)=>{let r=e[1],i=e[2],a=e[11],o=[n];for(;o.length;){let n=o.pop(),s=a(e,t,n);for(let c of ki(n,s,r)){let n=a(e,t,c);i.get(c)!==n.n&&(i.set(c,n.n),o.push(c))}}},Bi=(e,t,n,r)=>{let i=e[3],a=e[6],o=e[8],s=e[11],c=e[12],l=e[13],u=e[14],d=e[15],f=e[16],p=e[17],m=e[20],h=e[28],g=!0,_=n=>Ti(u(e,t,n)),v=(r,...o)=>{var u;let _=s(e,t,r);try{if(r===n){if(!xi(r))throw Error(`atom not writable`);let n=_.n,s=o[0];m(e,t,r,s),p(e,t,r),n!==_.n&&(++h[0],i.add(r),d(e,t,r),(u=a.c)==null||u.call(a,r));return}else return f(e,t,r,o)}finally{g||(l(e,t),c(e,t))}};try{return o(e,t,n,_,v,...r)}finally{g=!1}},Vi=(e,t,n)=>{var r;let i=e[1],a=e[3],o=e[6],s=e[11],c=e[15],l=e[18],u=e[19],d=s(e,t,n),f=i.get(n);if(f&&d.d.size>0){for(let[i,u]of d.d)if(!f.d.has(i)){let d=s(e,t,i);l(e,t,i).t.add(n),f.d.add(i),u!==d.n&&(a.add(i),c(e,t,i),(r=o.c)==null||r.call(o,i))}for(let r of f.d)d.d.has(r)||(f.d.delete(r),u(e,t,r)?.t.delete(n))}},Hi=(e,t,n)=>{var r;let i=e[1],a=e[4],o=e[6],s=e[10],c=e[11],l=e[12],u=e[13],d=e[14],f=e[16],p=e[18],m=c(e,t,n),h=i.get(n);if(!h){d(e,t,n);for(let r of m.d.keys())p(e,t,r).t.add(n);h={l:new Set,d:new Set(m.d.keys()),t:new Set},i.set(n,h),Si(n)&&Ci(n)&&a.add(()=>{let r=!0,i=(...i)=>{try{return f(e,t,n,i)}finally{r||(u(e,t),l(e,t))}};try{let a=s(e,t,n,i);a&&(h.u=()=>{r=!0;try{a()}finally{r=!1}})}finally{r=!1}}),(r=o.m)==null||r.call(o,n)}return h},Ui=(e,t,n)=>{var r;let i=e[1],a=e[5],o=e[6],s=e[11],c=e[19],l=s(e,t,n),u=i.get(n);if(!u||u.l.size)return u;let d=!1;for(let e of u.t)if(i.get(e)?.d.has(n)){d=!0;break}if(!d){u.u&&a.add(u.u),u=void 0,i.delete(n);for(let r of l.d.keys())c(e,t,r)?.t.delete(n);(r=o.u)==null||r.call(o,n);return}return u},Wi=(e,t,n,r)=>{let i=e[11],a=e[27],o=i(e,t,n),s=`v`in o,c=o.v;if(Ei(r))for(let a of o.d.keys())Oi(n,r,i(e,t,a));o.v=r,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,Ei(c)&&a(e,t,c))},Gi=(e,t,n)=>{let r=e[14];return Ti(r(e,t,n))},Ki=(e,t,n,...r)=>{let i=e[3],a=e[12],o=e[13],s=e[16],c=i.size;try{return s(e,t,n,r)}finally{i.size!==c&&(o(e,t),a(e,t))}},qi=(e,t,n,r)=>{let i=e[12],a=e[18],o=e[19],s=a(e,t,n).l;return s.add(r),i(e,t),()=>{s.delete(r),o(e,t,n),i(e,t)}},Ji=(e,t,n,r)=>{let i=e[25],a=i.get(n);if(!a){a=new Set,i.set(n,a);let e=()=>i.delete(n);n.then(e,e)}a.add(r)},Yi=(e,t,n)=>{e[25].get(n)?.forEach(e=>e())},Xi=new WeakMap;function Zi(e){let t=Xi.get(e),n=t[24];return n?n(t,e):t}function Qi(...e){let t={get(e){return r(n,t,e)},set(e,...r){return i(n,t,e,...r)},sub(e,r){return a(n,t,e,r)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,void 0,new WeakMap,Ji,Yi,[0]].map((t,n)=>e[n]||t);Xi.set(t,Object.freeze(n));let r=n[21],i=n[22],a=n[23];return t}var $i=0;function ea(e,t){let n=`atom${++$i}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=ta,r.write=na),t&&(r.write=t),r}function ta(e){return e(this)}function na(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}var ra;function ia(){return ra?ra():Qi()}var aa;function oa(){return aa||=ia(),aa}function sa(e,t){for(var n in t)e[n]=t[n];return e}function ca(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function la(e,t){var n=t(),r=j({t:{__:n,u:t}}),i=r[0].t,a=r[1];return at(function(){i.__=n,i.u=t,ua(i)&&a({t:i})},[e,n,t]),M(function(){return ua(i)&&a({t:i}),e(function(){ua(i)&&a({t:i})})},[e]),n}function ua(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function da(e){e()}function fa(e){return e}function pa(){return[!1,da]}var ma=at;function ha(e,t){this.props=e,this.context=t}function ga(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&(typeof n==`function`?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:ca(this.props,e)}function r(t){return this.shouldComponentUpdate=n,O(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(ha.prototype=new A).isPureReactComponent=!0,ha.prototype.shouldComponentUpdate=function(e,t){return ca(this.props,e)||ca(this.state,t)};var _a=d.__b;d.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),_a&&_a(e)};var va=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function ya(e){function t(t){var n=sa({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=va,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var ba=function(e,t){return e==null?null:me(me(e).map(t))},xa={map:ba,forEach:ba,count:function(e){return e?me(e).length:0},only:function(e){var t=me(e);if(t.length!==1)throw`Children.only`;return t[0]},toArray:me},Sa=d.__e;d.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Sa(e,t,n,r)};var Ca=d.unmount;function wa(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=sa({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return wa(e,t,n)})),e}function Ta(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ta(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ea(){this.__u=0,this.o=null,this.__b=null}function Da(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Oa(e){var t,n,r,i=null;function a(a){if(t||(t=e()).then(function(e){e&&(i=e.default||e),r=!0},function(e){n=e,r=!0}),n)throw n;if(!r)throw t;return i?O(i,a):null}return a.displayName=`Lazy`,a.__f=!0,a}function ka(){this.i=null,this.l=null}d.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ca&&Ca(e)},(Ea.prototype=new A).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Da(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Ta(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Ea.prototype.componentWillUnmount=function(){this.o=[]},Ea.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=wa(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&O(k,null,e.fallback);return i&&(i.__u&=-33),[O(k,null,t.__a?null:e.children),i]};var Aa=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function ja(e){return this.getChildContext=function(){return e.context},e.children}function Ma(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){De(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}De(O(ja,{context:t.context},e.__v),t.v)}function Na(e,t){var n=O(Ma,{__v:e,h:t});return n.containerInfo=t,n}(ka.prototype=new A).__a=function(e){var t=this,n=Da(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Aa(t,e,r)):i()};n?n(a):a()}},ka.prototype.render=function(e){this.i=null,this.l=new Map;var t=me(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},ka.prototype.componentDidUpdate=ka.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Aa(e,n,t)})};var Pa=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Fa=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ia=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,La=/[A-Z0-9]/g,Ra=typeof document<`u`,za=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};function Ba(e,t,n){return t.__k??(t.textContent=``),De(e,t),typeof n==`function`&&n(),e?e.__c:null}function Va(e,t,n){return Oe(e,t),typeof n==`function`&&n(),e?e.__c:null}A.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(A.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ha=d.event;d.event=function(e){return Ha&&(e=Ha(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ua,Wa={configurable:!0,get:function(){return this.class}},Ga=d.vnode;d.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Ra&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||za(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Ia.test(a)&&(a=s):s=a=`oninput`:i&&Fa.test(a)?a=a.replace(La,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=me(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=me(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Wa)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Pa,Ga&&Ga(e)};var Ka=d.__r;d.__r=function(e){Ka&&Ka(e),Ua=e.__c};var qa=d.diffed;d.diffed=function(e){qa&&qa(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value),Ua=null};var Ja={ReactCurrentDispatcher:{current:{readContext:function(e){return Ua.__n[e.__c].props.value},useCallback:F,useContext:I,useDebugValue:st,useDeferredValue:fa,useEffect:M,useId:ct,useImperativeHandle:ot,useInsertionEffect:ma,useLayoutEffect:at,useMemo:P,useReducer:it,useRef:N,useState:j,useSyncExternalStore:la,useTransition:pa}}};function Ya(e){return O.bind(null,e)}function Xa(e){return!!e&&e.$$typeof===Pa}function Za(e){return Xa(e)&&e.type===k}function Qa(e){return!!e&&typeof e.displayName==`string`&&e.displayName.indexOf(`Memo(`)==0}function $a(e){return Xa(e)?ke.apply(null,arguments):e}function eo(e){return!!e.__k&&(De(null,e),!0)}function to(e){return e&&(e.base||e.nodeType===1&&e)||null}var no={useState:j,useId:ct,useReducer:it,useEffect:M,useLayoutEffect:at,useInsertionEffect:ma,useTransition:pa,useDeferredValue:fa,useSyncExternalStore:la,startTransition:da,useRef:N,useImperativeHandle:ot,useMemo:P,useCallback:F,useContext:I,useDebugValue:st,version:`18.3.1`,Children:xa,render:Ba,hydrate:Va,unmountComponentAtNode:eo,createPortal:Na,createElement:O,createContext:Ae,createFactory:Ya,cloneElement:$a,createRef:ae,Fragment:k,isValidElement:Xa,isElement:Xa,isFragment:Za,isMemo:Qa,findDOMNode:to,Component:A,PureComponent:ha,memo:ga,forwardRef:ya,flushSync:function(e,t){var n=d.debounceRendering;d.debounceRendering=function(e){return e()};var r=e(t);return d.debounceRendering=n,r},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:k,Suspense:Ea,SuspenseList:ka,lazy:Oa,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ja},ro=Ae(void 0);function io(e){let t=I(ro);return e?.store||t||oa()}function ao({children:e,store:t}){let n=N(null);return t?O(ro.Provider,{value:t},e):(n.current===null&&(n.current=ia()),O(ro.Provider,{value:n.current},e))}var oo=e=>typeof e?.then==`function`,so=e=>{e.status||(e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t}))},co=no.use||(e=>{if(e.status===`pending`)throw e;if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:(so(e),e)}),lo=new WeakMap,uo=(e,t,n)=>{let r=Zi(e),i=r[26],a=lo.get(t);return a||(a=new Promise((o,s)=>{let c=t,l=e=>t=>{c===e&&o(t)},u=e=>t=>{c===e&&s(t)},d=()=>{try{let t=n();oo(t)?(lo.set(t,a),c=t,t.then(l(t),u(t)),i(r,e,t,d)):o(t)}catch(e){s(e)}};t.then(l(t),u(t)),i(r,e,t,d)}),lo.set(t,a)),a};function fo(e,t){let{delay:n,unstable_promiseStatus:r=!no.use}=t||{},i=io(t),[[a,o,s],c]=it(t=>{let n=i.get(e);return Object.is(t[0],n)&&t[1]===i&&t[2]===e?t:[n,i,e]},void 0,()=>[i.get(e),i,e]),l=a;if((o!==i||s!==e)&&(c(),l=i.get(e)),M(()=>{let t=i.sub(e,()=>{if(r)try{let t=i.get(e);oo(t)&&so(uo(i,t,()=>i.get(e)))}catch{}if(typeof n==`number`){console.warn(`[DEPRECATED] delay option is deprecated and will be removed in v3.
|
|
10
10
|
|
|
11
11
|
Migration guide:
|
|
12
12
|
|
|
@@ -161,7 +161,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
161
161
|
- omitted: host decides border`)});var wP=X({method:Z(`ui/request-display-mode`),params:X({mode:lP.describe(`The display mode being requested.`)})});X({mode:lP.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough();var TP=Yk([Z(`model`),Z(`app`)]).describe(`Tool visibility scope - who can access the tool.`);X({resourceUri:J().optional(),visibility:Y(TP).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
162
162
|
- "model": Tool visible to and callable by the agent
|
|
163
163
|
- "app": Tool callable by the app from this server only`),csp:qk().optional(),permissions:qk().optional()}),X({mimeTypes:Y(J()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var EP=X({method:Z(`ui/download-file`),params:X({contents:Y(Yk([eN,tN])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),DP=X({method:Z(`ui/message`),params:X({role:Z(`user`).describe(`Message role, currently only "user" is supported.`),content:Y(nN).describe(`Message content blocks (text, image, etc.).`)})});X({method:Z(`ui/notifications/sandbox-resource-ready`),params:X({html:J().describe(`HTML content to load into the inner iframe.`),sandbox:J().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:pP.optional().describe(`CSP configuration from resource metadata.`),permissions:mP.optional().describe(`Sandbox permissions from resource metadata.`)})}),X({method:Z(`ui/notifications/tool-result`),params:dN.describe(`Standard MCP tool execution result.`)});var OP=X({toolInfo:X({id:jj.optional().describe(`JSON-RPC id of the tools/call request.`),tool:cN.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:cP.optional().describe(`Current color theme preference.`),styles:_P.optional().describe(`Style configuration for theming the app.`),displayMode:lP.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:Y(lP).optional().describe(`Display modes the host supports.`),containerDimensions:Yk([X({height:Vk().describe(`Fixed container height in pixels.`)}),X({maxHeight:Yk([Vk(),Wk()]).optional().describe(`Maximum container height in pixels.`)})]).and(Yk([X({width:Vk().describe(`Fixed container width in pixels.`)}),X({maxWidth:Yk([Vk(),Wk()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
164
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:J().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:J().optional().describe(`User's timezone in IANA format.`),userAgent:J().optional().describe(`Host application identifier.`),platform:Yk([Z(`web`),Z(`desktop`),Z(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:X({touch:Uk().optional().describe(`Whether the device supports touch input.`),hover:Uk().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:X({top:Vk().describe(`Top safe area inset in pixels.`),right:Vk().describe(`Right safe area inset in pixels.`),bottom:Vk().describe(`Bottom safe area inset in pixels.`),left:Vk().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();X({method:Z(`ui/notifications/host-context-changed`),params:OP.describe(`Partial context update containing only changed fields.`)});var kP=X({method:Z(`ui/update-model-context`),params:X({content:Y(nN).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:Qk(J(),Kk().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),AP=X({method:Z(`ui/initialize`),params:X({appInfo:Kj.describe(`App identification (name and version).`),appCapabilities:SP.describe(`Features and capabilities this app provides.`),protocolVersion:J().describe(`Protocol version this app supports.`)})});X({protocolVersion:J().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Kj.describe(`Host application identification and version.`),hostCapabilities:xP.describe(`Features and capabilities provided by the host.`),hostContext:OP.describe(`Rich context about the host environment.`)}).passthrough();var jP=[sP],MP=class extends oP{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_baseReplaceRequestHandler=this.replaceRequestHandler;replaceRequestHandler=(e,t)=>{this._baseReplaceRequestHandler(e,(e,n)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${e.method}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),t(e,n)))};eventSchemas={sizechange:hP,sandboxready:fP,initialized:CP,requestteardown:bP,loggingmessage:yN};constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._capabilities=n,this.addEventListener(`initialized`,()=>{this._initializedReceived=!0}),this._hostContext=r?.hostContext||{},this.setRequestHandler(AP,e=>this._oninitialize(e)),this.setRequestHandler(nM,(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler(wP,e=>({mode:this._hostContext.displayMode??`inline`}))}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler(`sizechange`)}set onsizechange(e){this.setEventHandler(`sizechange`,e)}get onsandboxready(){return this.getEventHandler(`sandboxready`)}set onsandboxready(e){this.setEventHandler(`sandboxready`,e)}get oninitialized(){return this.getEventHandler(`initialized`)}set oninitialized(e){this.setEventHandler(`initialized`,e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced(`onmessage`,this._onmessage,e),this._onmessage=e,this.replaceRequestHandler(DP,async(e,t)=>{if(!this._onmessage)throw Error(`No onmessage handler set`);return this._onmessage(e.params,t)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced(`onopenlink`,this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler(dP,async(e,t)=>{if(!this._onopenlink)throw Error(`No onopenlink handler set`);return this._onopenlink(e.params,t)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced(`ondownloadfile`,this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler(EP,async(e,t)=>{if(!this._ondownloadfile)throw Error(`No ondownloadfile handler set`);return this._ondownloadfile(e.params,t)})}get onrequestteardown(){return this.getEventHandler(`requestteardown`)}set onrequestteardown(e){this.setEventHandler(`requestteardown`,e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced(`onrequestdisplaymode`,this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler(wP,async(e,t)=>{if(!this._onrequestdisplaymode)throw Error(`No onrequestdisplaymode handler set`);return this._onrequestdisplaymode(e.params,t)})}get onloggingmessage(){return this.getEventHandler(`loggingmessage`)}set onloggingmessage(e){this.setEventHandler(`loggingmessage`,e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced(`onupdatemodelcontext`,this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler(kP,async(e,t)=>{if(!this._onupdatemodelcontext)throw Error(`No onupdatemodelcontext handler set`);return this._onupdatemodelcontext(e.params,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(pN,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}set oncreatesamplingmessage(e){this.setRequestHandler(DN,async(t,n)=>e(t.params,n))}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced(`onlistresources`,this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler(kM,async(e,t)=>{if(!this._onlistresources)throw Error(`No onlistresources handler set`);return this._onlistresources(e.params,t)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced(`onlistresourcetemplates`,this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler(jM,async(e,t)=>{if(!this._onlistresourcetemplates)throw Error(`No onlistresourcetemplates handler set`);return this._onlistresourcetemplates(e.params,t)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced(`onreadresource`,this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler(FM,async(e,t)=>{if(!this._onreadresource)throw Error(`No onreadresource handler set`);return this._onreadresource(e.params,t)})}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced(`onlistprompts`,this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler(KM,async(e,t)=>{if(!this._onlistprompts)throw Error(`No onlistprompts handler set`);return this._onlistprompts(e.params,t)})}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}assertTaskCapability(e){throw Error(`Tasks are not supported in MCP Apps`)}assertTaskHandlerCapability(e){throw Error(`Task handlers are not supported in MCP Apps`)}getCapabilities(){return this._capabilities}async _oninitialize(e){let t=e.params.protocolVersion;return this._appInfo!==void 0&&console.warn(`[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.`),this._appCapabilities=e.params.appCapabilities,this._appInfo=e.params.appInfo,{protocolVersion:jP.includes(t)?t:sP,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];NP(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},vP,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:`tools/call`,params:e},dN,t)}listTools(e,t){return this.request({method:`tools/list`,params:e},uN,t)}async connect(e){if(this.transport)throw Error(`AppBridge is already connected. Call close() before connecting again.`);if(this._initializedReceived=!1,this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},dN,{signal:t.signal}),e.tools.listChanged&&this._client.setNotificationHandler(mN,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},AM,{signal:t.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},MM,{signal:t.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},IM,{signal:t.signal}),e.resources.listChanged&&this._client.setNotificationHandler(LM,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},qM,{signal:t.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(aN,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function NP(e,t){return JSON.stringify(e)===JSON.stringify(t)}function PP(){let e=I(Kv);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}var FP={committedClass:null,pendingClass:null,pendingSinceMs:null,lastResolution:null},IP={classes:{widthCompactMaxPx:767,widthMediumMaxPx:1023,heightShortMaxPx:479},hysteresis:{windowMs:250,decisiveJumpPxDelta:200},rail:{widthPx:448,insetPx:16,gutterPx:24},sidecar:{minViewportWidthPx:900,maxVideoShiftPx:360,maxVideoShiftFraction:.3},card:{maxHeightPx:720,reportedHeightFloorPx:48,coldDefaultHeightPx:320,minDisplayScale:.85,layoutDefaultMinHeightPx:240,stackBandMaxFraction:.6,stackMaxWidthPx:600,componentOverrides:{}},content:{stackedAspect:16/9},pip:{gapPaddingPx:24,minWidthPx:128,maxAreaRatio:.35},motion:{layoutTransitionMs:560},insets:{callControlsBottomPx:72,participantsPadPx:16,cardsPadPx:16,surfacePadPx:16,compactCardsPadPx:8,compactSurfacePadPx:8},eviction:{policy:`evict-oldest`,maxVisibleCards:2,compactTakeoverMaxCards:1},degradationLadder:[`evict-cards`,`drop-self-view`,`collapse-replica`]};function LP(e,t){let n=Math.round(e.widthPx),r=Math.round(e.heightPx);return{width:n<=t.classes.widthCompactMaxPx?`compact`:n<=t.classes.widthMediumMaxPx?`medium`:`expanded`,height:r<=t.classes.heightShortMaxPx?`short`:`regular`}}var RP={idle:{id:`idle`,regions:[]},"conversation-full":{id:`conversation-full`,regions:[{name:`stage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.72},width:{fraction:.24},height:{fraction:.24},accepts:[`selfView`],zBase:100}]},"canvas-rail":{id:`canvas-rail`,soloVariant:`canvas-solo`,regions:[{name:`stage`,x:{px:0},y:{px:0},width:{fraction:.62},height:{fraction:1},accepts:[`replica`],zBase:0},{name:`rail`,x:{px:-448},y:{px:0},width:{px:448},height:{fraction:1},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.38},y:{fraction:.72},width:{fraction:.2},height:{fraction:.24},accepts:[`selfView`],zBase:100}]},"canvas-stack":{id:`canvas-stack`,soloVariant:`canvas-solo`,regions:[{name:`canvasBand`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.38},accepts:[`card`],zBase:0},{name:`stage`,x:{fraction:0},y:{fraction:.38},width:{fraction:1},height:{fraction:.62},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.76},width:{fraction:.24},height:{fraction:.2},accepts:[`selfView`],zBase:100}]},"canvas-sheet":{id:`canvas-sheet`,soloVariant:`canvas-solo`,regions:[{name:`stage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.55},accepts:[`replica`],zBase:0},{name:`canvasSheet`,x:{fraction:0},y:{fraction:.55},width:{fraction:1},height:{fraction:.45},accepts:[`card`],zBase:10},{name:`pip`,x:{fraction:.66},y:{fraction:.33},width:{fraction:.3},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"content-columns":{id:`content-columns`,soloVariant:`content-solo`,regions:[{name:`replicaColumn`,x:{fraction:0},y:{fraction:0},width:{fraction:.25},height:{fraction:1},accepts:[`replica`,`selfView`],zBase:0},{name:`contentStage`,x:{fraction:.25},y:{fraction:0},width:{fraction:.75},height:{fraction:1},accepts:[`content`],zBase:0},{name:`pip`,x:{fraction:.02},y:{fraction:.76},width:{fraction:.2},height:{fraction:.2},accepts:[`selfView`],zBase:100}]},"content-stack":{id:`content-stack`,soloVariant:`content-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.62},accepts:[`content`],zBase:0},{name:`replicaBand`,x:{fraction:0},y:{fraction:.62},width:{fraction:1},height:{fraction:.38},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.74},width:{fraction:.24},height:{fraction:.22},accepts:[`selfView`],zBase:100}]},"content-stack-compact":{id:`content-stack-compact`,soloVariant:`content-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.58},accepts:[`content`],zBase:0},{name:`replicaStrip`,x:{fraction:0},y:{fraction:.58},width:{fraction:1},height:{fraction:.42},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.66},y:{fraction:.78},width:{fraction:.3},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"content-sheet-compact":{id:`content-sheet-compact`,soloVariant:`content-sheet-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.58},accepts:[`content`],zBase:0},{name:`replicaStrip`,x:{fraction:0},y:{fraction:.58},width:{fraction:1},height:{fraction:.42},accepts:[`replica`],zBase:0},{name:`cardSheet`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`card`],zBase:100},{name:`pip`,x:{fraction:.66},y:{fraction:.78},width:{fraction:.3},height:{fraction:.18},accepts:[`selfView`],zBase:110}]},"content-rail":{id:`content-rail`,soloVariant:`content-rail-solo`,regions:[{name:`replicaColumn`,x:{fraction:0},y:{fraction:0},width:{fraction:.22},height:{fraction:1},accepts:[`replica`,`selfView`],zBase:0},{name:`contentStage`,x:{fraction:.22},y:{fraction:0},width:{fraction:.48},height:{fraction:1},accepts:[`content`],zBase:0},{name:`rail`,x:{px:-448},y:{px:0},width:{px:448},height:{fraction:1},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.02},y:{fraction:.78},width:{fraction:.18},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"content-stack-canvas":{id:`content-stack-canvas`,soloVariant:`content-sheet-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.5},accepts:[`content`],zBase:0},{name:`replicaBand`,x:{fraction:0},y:{fraction:.5},width:{fraction:1},height:{fraction:.22},accepts:[`replica`],zBase:0},{name:`canvasBand`,x:{fraction:0},y:{fraction:.72},width:{fraction:1},height:{fraction:.28},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.52},width:{fraction:.24},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"canvas-takeover-columns":{id:`canvas-takeover-columns`,soloVariant:`canvas-solo`,regions:[{name:`replicaColumn`,x:{fraction:0},y:{fraction:0},width:{fraction:.24},height:{fraction:1},accepts:[`replica`,`selfView`],zBase:0},{name:`canvasStage`,x:{fraction:.24},y:{fraction:0},width:{fraction:.76},height:{fraction:1},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.02},y:{fraction:.78},width:{fraction:.18},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"canvas-takeover-strip":{id:`canvas-takeover-strip`,soloVariant:`canvas-solo`,regions:[{name:`canvasStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.78},accepts:[`card`],zBase:0},{name:`replicaStrip`,x:{fraction:0},y:{fraction:.78},width:{fraction:1},height:{fraction:.22},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.66},y:{fraction:.8},width:{fraction:.3},height:{fraction:.16},accepts:[`selfView`],zBase:100}]},"canvas-solo":{id:`canvas-solo`,regions:[{name:`canvasStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`card`],zBase:0}]},"content-solo":{id:`content-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`content`],zBase:0}]},"content-rail-solo":{id:`content-rail-solo`,regions:[{name:`contentStage`,x:{px:0},y:{px:0},width:{fraction:1},height:{fraction:1},accepts:[`content`],zBase:0},{name:`rail`,x:{px:-448},y:{px:0},width:{px:448},height:{fraction:1},accepts:[`card`],zBase:0}]},"content-sheet-solo":{id:`content-sheet-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.62},accepts:[`content`],zBase:0},{name:`canvasBand`,x:{fraction:0},y:{fraction:.62},width:{fraction:1},height:{fraction:.38},accepts:[`card`],zBase:10}]}},zP={idle:{compact:{short:`idle`,regular:`idle`},medium:{short:`idle`,regular:`idle`},expanded:{short:`idle`,regular:`idle`}},conversation:{compact:{short:`conversation-full`,regular:`conversation-full`},medium:{short:`conversation-full`,regular:`conversation-full`},expanded:{short:`conversation-full`,regular:`conversation-full`}},"conversation-canvas":{compact:{short:`canvas-sheet`,regular:`canvas-sheet`},medium:{short:`canvas-rail`,regular:`canvas-stack`},expanded:{short:`canvas-rail`,regular:`canvas-rail`}},"content-focus":{compact:{short:`content-stack-compact`,regular:`content-stack-compact`},medium:{short:`content-columns`,regular:`content-stack`},expanded:{short:`content-columns`,regular:`content-columns`}},"content-plus-canvas":{compact:{short:`content-sheet-compact`,regular:`content-sheet-compact`},medium:{short:`content-rail`,regular:`content-stack-canvas`},expanded:{short:`content-rail`,regular:`content-rail`}},"canvas-dominant":{compact:{short:`canvas-takeover-strip`,regular:`canvas-takeover-strip`},medium:{short:`canvas-takeover-columns`,regular:`canvas-takeover-columns`},expanded:{short:`canvas-takeover-columns`,regular:`canvas-takeover-columns`}}};function BP(e,t,n=RP,r=zP,i=!0){let a=r[e][t.width][t.height],o=n[a];if(!o)throw Error(`Template matrix references missing template id: ${a}`);if(!i&&o.soloVariant!==void 0){let e=n[o.soloVariant];if(!e)throw Error(`soloVariant references missing template id: ${o.soloVariant}`);return e}return o}function VP(e,t,n){let r=[],{prefs:i}=e,a=e.userShare?`userShare`:e.presentation?`presentation`:null,o=e.cards.length>0,s=t.width===`compact`;return i.pipCorner!==void 0&&s&&r.push(`pipCorner`),a===null?(i.expandCanvas&&!o&&r.push(`expandCanvas`),o&&(i.expandCanvas||s)?{state:`canvas-dominant`,suppressedPrefs:r,contentKind:null}:o?{state:`conversation-canvas`,suppressedPrefs:r,contentKind:null}:e.replica||e.selfView?{state:`conversation`,suppressedPrefs:r,contentKind:null}:{state:`idle`,suppressedPrefs:r,contentKind:null}):(i.expandCanvas&&r.push(`expandCanvas`),{state:o?`content-plus-canvas`:`content-focus`,suppressedPrefs:r,contentKind:a})}var HP={alert:{minWidthPx:220,sizeClass:()=>`S`,estimateHeightPx:e=>e.charCount===void 0?120:Math.min(400,Math.round(90+e.charCount*.26))},input:{minWidthPx:220,sizeClass:()=>`S`,estimateHeightPx:()=>182},question:{minWidthPx:240,sizeClass:e=>{let t=e.optionCount??4;return t<=2?`S`:t>=10?`L`:`M`},estimateHeightPx:e=>{let t=e.optionCount??4;return 72+t*48+(t-1)*8+64}},text:{minWidthPx:220,sizeClass:e=>(e.charCount??400)>1500?`L`:`M`,estimateHeightPx:e=>{let t=e.charCount??400,n=Math.max(1,e.widthPx/8);return Math.max(100,Math.round(t/n*22+40))}},chart:{minWidthPx:260,sizeClass:()=>`M`,estimateHeightPx:e=>Math.round(e.widthPx*(260/480))+90},calendar:{minWidthPx:320,sizeClass:e=>e.slotCount===void 0?`M`:`L`,estimateHeightPx:e=>e.slotCount===void 0?470:64+e.slotCount*48},image:{minWidthPx:240,sizeClass:()=>`M`,estimateHeightPx:e=>Math.round((Math.min(e.widthPx,520)-36)*(9/16))+95+((e.imageCount??1)>1?44:0)},scheduling_embed:{minWidthPx:320,hardMinHeightPx:640,sizeClass:()=>`L`,estimateHeightPx:()=>640}},UP={minWidthPx:240,sizeClass:()=>`M`,estimateHeightPx:e=>e.coldDefaultHeightPx??320},WP=`canvas.`;function GP(e){return e.startsWith(WP)?e.slice(7):e}function KP(e,t){let n=GP(e),r=HP[n]??UP,i=t?.[n]??t?.[e];return i===void 0?r:{...r,minWidthPx:i.minWidthPx??r.minWidthPx,...i.hardMinHeightPx===void 0?r.hardMinHeightPx===void 0?{}:{hardMinHeightPx:r.hardMinHeightPx}:{hardMinHeightPx:i.hardMinHeightPx}}}Object.keys(HP);function qP(e,t,n){let r=KP(e,n),i=(t.naturalHeightPx!==void 0&&Number.isFinite(t.naturalHeightPx)?t.naturalHeightPx:void 0)??r.estimateHeightPx(t),a=r.hardMinHeightPx===void 0?i:Math.max(r.hardMinHeightPx,i);return{sizeClass:r.sizeClass(t),minWidthPx:r.minWidthPx,naturalHeightPx:Math.round(a),hardMinHeightPx:r.hardMinHeightPx}}function JP(e,t){let n=GP(e);return HP[n]===void 0?(t?.[n]??t?.[e])?.hardMinHeightPx:KP(e,t).hardMinHeightPx}function YP(e,t){return KP(e,t).minWidthPx}function XP(e,t){let n=Number.isFinite(e)?e:t.card.coldDefaultHeightPx;return Math.min(t.card.maxHeightPx,Math.max(t.card.reportedHeightFloorPx,Math.round(n)))}function ZP(e,t,n){if(t>=e)return{kind:`natural`};if(t<=0||e<=0)return{kind:`scroll`};let r=t/e;return r>=n.card.minDisplayScale?{kind:`scaled`,factor:r}:{kind:`scroll`}}function QP(e,t){return e.width>0&&e.height>0&&t.width>0&&t.height>0&&e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function $P(e,t){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function eF(e,t,n){let r=[],i=e.find(e=>e.kind===`replica`),a=e=>e.kind===`selfView`&&e.layer===`overlay`&&i!==void 0&&$P(i.rect,e.rect),o=e=>e.kind===`card`&&e.layer===`overlay`&&e.sheet===!0;for(let a of e){let e=a.rect;if(Number.isInteger(e.x)&&Number.isInteger(e.y)&&Number.isInteger(e.width)&&Number.isInteger(e.height)||r.push({kind:`bounds`,tileId:a.id,message:`${a.id} has non-integer coordinates`}),(e.x<0||e.y<0||e.width<0||e.height<0||e.x+e.width>t.width||e.y+e.height>t.height)&&r.push({kind:`bounds`,tileId:a.id,message:`${a.id} rect exceeds the container`}),a.layer===`overlay`&&a.kind!==`selfView`&&!o(a)&&r.push({kind:`overlay-legality`,tileId:a.id,message:`only selfView or a sheet card may ride the overlay layer, got ${a.kind}`}),a.kind===`selfView`&&a.layer===`overlay`&&i!==void 0&&!$P(i.rect,a.rect)&&r.push({kind:`overlay-legality`,tileId:a.id,message:`selfView escapes the replica rect`}),(a.kind===`content`||a.kind===`replica`)&&(e.width<48||e.height<48)&&r.push({kind:`degenerate-surface`,tileId:a.id,message:`${a.kind} tile ${a.id} is ${e.width}x${e.height}px, below the 48px visible floor`}),a.kind===`card`){a.fit.kind===`scaled`&&(a.fit.factor<n.card.minDisplayScale||a.fit.factor>1)&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} scaled to ${a.fit.factor}, outside [${n.card.minDisplayScale}, 1]`}),e.height<n.card.reportedHeightFloorPx&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} box ${e.height}px is below the ${n.card.reportedHeightFloorPx}px report floor`});let t=a.component===void 0?void 0:JP(a.component,n.card.componentOverrides);t!==void 0&&e.height<t&&a.fit.kind!==`scroll`&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} box ${e.height}px is below its ${t}px hard min without scroll`});let i=a.component===void 0?void 0:YP(a.component,n.card.componentOverrides);i!==void 0&&e.width<i&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} box ${e.width}px is below its ${i}px min width`})}}for(let t of e)if(!(t.kind!==`content`&&t.kind!==`card`))for(let n of e)n.id!==t.id&&QP(t.rect,n.rect)&&(a(n)&&!o(t)||o(n)&&!o(t)||o(t)&&n.layer===`grid`||r.push({kind:`never-covered`,tileId:t.id,otherTileId:n.id,message:`${n.id} covers ${t.kind} tile ${t.id}`}));return r}var tF=(e,t,n)=>Math.min(n,Math.max(t,e));function nF(e,t){let n=t===`compact`;return{surfacePad:Math.round(n?e.insets.compactSurfacePadPx:e.insets.surfacePadPx),cardsPad:Math.round(n?e.insets.compactCardsPadPx:e.insets.cardsPadPx)}}function rF(e,t,n){return e===`canvas-dominant`&&t.width===`compact`?n.eviction.compactTakeoverMaxCards:n.eviction.maxVisibleCards}function iF(e,t,n){let r=[...e].sort((e,t)=>e.dispatchSeq-t.dispatchSeq),i=Math.floor(t);return r.length<=i?r:n===`evict-newest`?r.slice(0,i):r.slice(r.length-i)}function aF(e,t,n,r,i,a){let o=i??nF(n,r).cardsPad,s=Math.round(a??n.rail.widthPx),c=Math.max(1,Math.min(t-2*o,s-2*o));return{innerW:c,entries:e.map(e=>{let t=qP(e.component,{...e.contentOpts,naturalHeightPx:e.naturalHeightPx,widthPx:c,coldDefaultHeightPx:n.card.coldDefaultHeightPx},n.card.componentOverrides);return{card:e,constraints:t,clampedHeightPx:XP(t.naturalHeightPx,n)}})}}function oF(e,t){return`fraction`in e?e.fraction*t:e.px>=0?e.px:t+e.px}function sF(e,t,n,r){return e.name!==`rail`||`fraction`in t?t:r===`width`?{px:n.rail.widthPx}:{px:t.px<0?-n.rail.widthPx:t.px}}function cF(e,t,n,r,i,a){let o=n===`x`?t.width:t.height,s=[...e].sort((e,t)=>oF(n===`x`?e.x:e.y,o)-oF(n===`x`?t.x:t.y,o)),c=s.map(e=>n===`x`?sF(e,e.width,r,`width`):e.height),l=0,u=0;for(let e of c)`px`in e?l+=e.px:u+=e.fraction;let d=Math.max(0,o-l),f=c.map(e=>`px`in e?e.px:u>0?e.fraction/u*d:0);if(n===`y`&&i!==void 0){let e=s.findIndex((e,t)=>e.accepts.includes(`card`)&&`fraction`in(c[t]??e.height));if(e!==-1){let t=f[e]??0,n=i.shrinkToContent?Math.min(i.neededPx,Math.max(t,i.capPx)):tF(i.neededPx,t,Math.max(t,i.capPx)),r=0,a=0;c.forEach((t,n)=>{n!==e&&(`px`in t?r+=t.px:a+=f[n]??0)});let s=Math.max(0,o-r-n);f=f.map((t,r)=>{if(r===e)return n;let i=c[r];return i!==void 0&&`px`in i?t:a>0?t/a*s:0})}}if(n===`y`&&a!==void 0){let e=s.findIndex((e,t)=>e.accepts.includes(`content`)&&`fraction`in(c[t]??e.height)),t=s.findIndex((e,t)=>e.accepts.includes(`replica`)&&`fraction`in(c[t]??e.height));if(e!==-1&&t!==-1){let n=(f[e]??0)-a.maxPx;n>0&&(f[e]=a.maxPx,f[t]=(f[t]??0)+n)}}let p=s.map(e=>e.accepts.includes(`content`)||e.accepts.includes(`replica`)?48:0),m=p.reduce((e,t)=>e+t,0),h=m>o?o/m:1,g=f.map((e,t)=>Math.max(e,(p[t]??0)*h));if(g.reduce((e,t)=>e+t,0)>o){let e=g.map((e,t)=>e-(p[t]??0)*h),t=e.reduce((e,t)=>e+t,0),n=Math.max(0,o-m*h),r=t>0?n/t:0;f=g.map((t,n)=>(p[n]??0)*h+(e[n]??0)*r)}else f=g;let _=[0],v=0;for(let e of f)v+=e,_.push(tF(Math.round(v),0,o));return s.map((e,r)=>{let i=_[r]??0,a=_[r+1]??i;return{region:e,rect:n===`x`?{x:i,y:0,width:a-i,height:t.height}:{x:0,y:i,width:t.width,height:a-i}}})}function lF(e,t,n){let r=t.width,i=t.height,a=sF(e,e.width,n,`width`),o=sF(e,e.x,n,`x`),s=tF(Math.round(oF(o,r)),0,r),c=tF(Math.round(oF(e.y,i)),0,i);return{x:s,y:c,width:tF(Math.round(`fraction`in a?a.fraction*r:a.px),0,r-s),height:tF(Math.round(`fraction`in e.height?e.height.fraction*i:e.height.px),0,i-c)}}function uF(e,t,n,r,i){let a=e.regions.filter(e=>e.zBase<100),o=e=>`fraction`in e&&e.fraction===1;return a.length>1&&a.every(e=>o(e.height))?cF(a,t,`x`,n):a.length>1&&a.every(e=>o(e.width))?cF(a,t,`y`,n,r,i):a.map(e=>({region:e,rect:lF(e,t,n)}))}function dF(e,t,n,r,i,a,o,s,c,l,u){if(n!==null)return;let d=e.regions.filter(e=>e.zBase<100);if(!(d.length>1&&d.every(e=>`fraction`in e.width&&e.width.fraction===1)))return;let f=d.find(e=>e.accepts.includes(`card`)&&`fraction`in e.height);if(f===void 0||r.cards.length===0)return;let{innerW:p,entries:m}=aF(iF(r.cards,u,c.eviction.policy),i.width,c,l,void 0,c.card.stackMaxWidthPx),h=m.reduce((e,t)=>t.constraints.minWidthPx>p?e:Math.max(e,t.clampedHeightPx),0),{cardsPad:g}=nF(c,l),_=oF(f.y,i.height),v=d.every(e=>oF(e.y,i.height)<=_),y=v?Math.max(0,o-s):0,b=!v&&h>0;return{neededPx:h+2*g+(b?0:y),capPx:Math.round(c.card.stackBandMaxFraction*a.height),...b&&{shrinkToContent:b}}}function fF(e,t,n,r){if(t===null)return;let i=e.regions.filter(e=>e.zBase<100);if(!(i.length>1&&i.every(e=>`fraction`in e.width&&e.width.fraction===1)))return;let a=i.some(e=>e.accepts.includes(`content`)&&`fraction`in e.height),o=i.some(e=>e.accepts.includes(`replica`)&&`fraction`in e.height);if(!a||!o)return;let s=r.content.stackedAspect;if(!(!Number.isFinite(s)||s<=0))return{maxPx:Math.round(n.width/s)}}var pF=`bottom-left`;function mF(e,t,n,r,i){let a=t.endsWith(`right`)?e.x+e.width-n-r:e.x+n,o=t.startsWith(`bottom`)?e.y+e.height-n-i:e.y+n;return{x:Math.round(a),y:Math.round(o),width:r,height:i}}function hF(e,t,n,r){let i=Math.max(n.pip.minWidthPx,Math.round(e.width*.25)),a=r?e.height-t:Math.round((e.height-t)*16/9),o=Math.min(i,e.width-t,a),s=r?o:Math.round(o*9/16);return o<n.pip.minWidthPx||o<=0||s<=0?null:{w:o,h:s}}function gF(e,t,n){return t===null||!QP(e,t)?e:{...e,y:Math.round(t.y)-n-e.height}}function _F(e){if(typeof e!=`object`||!e)return!1;let t=e;return[`x`,`y`,`width`,`height`].every(e=>typeof t[e]==`number`&&Number.isFinite(t[e]))}function vF(e,t,n){let r=e;for(let e of t.filter(_F).sort((e,t)=>t.y-e.y))r=gF(r,e,n);return r}function yF(e,t,n){if(t<=0)return e;let r=Math.min(t,e.length);return n===`evict-newest`?e.slice(0,e.length-r):e.slice(r)}function bF(e,t,n,r,i,a){let o=n.callControls===!0?Math.round(a.insets.callControlsBottomPx):0,s=i.height-o,c=n.selfView&&n.prefs.hideSelfView!==!0,l=(n.replica||c?1:0)+(t.contentKind===null?0:1)+ +(n.cards.length>0)>=2?nF(a,r.width).surfacePad:0,u={width:Math.max(0,i.width-2*l),height:Math.max(0,i.height-2*l)},d=n.callControlsRect??(o>0?{x:0,y:s,width:i.width,height:o}:null);return{regions:uF(e,u,a,dF(e,t.state,t.contentKind,n,u,i,o,l,a,r.width,rF(t.state,r,a)),fF(e,t.contentKind,u,a)).map(e=>({...e,rect:{...e.rect,x:e.rect.x+l,y:e.rect.y+l}})).map(e=>d===null||!e.region.accepts.includes(`card`)||!(e.rect.x<d.x+d.width&&e.rect.x+e.rect.width>d.x)?e:{...e,rect:{...e.rect,height:Math.max(0,Math.min(e.rect.height,s-e.rect.y))}}),surfacePad:l,controlsInset:o,bandTopY:s}}function xF(e,t,n,r,i,a){let o=n.selfView&&n.prefs.hideSelfView!==!0,{regions:s,surfacePad:c,controlsInset:l,bandTopY:u}=bF(t,e,n,r,i,a),d=s.find(e=>e.region.accepts.includes(`replica`)),f=s.find(e=>e.region.accepts.includes(`content`)),p=s.find(e=>e.region.accepts.includes(`card`)),m=t.regions.find(e=>e.zBase>=100&&e.accepts.includes(`selfView`)),h=t.regions.find(e=>e.zBase>=100&&e.accepts.includes(`card`)),g=Math.round(a.rail.gutterPx),_=Math.round(a.pip.gapPaddingPx),v=[...n.cards].sort((e,t)=>e.dispatchSeq-t.dispatchSeq),y=rF(e.state,r,a),b=p?iF(n.cards,y,a.eviction.policy):h===void 0?[]:iF(n.cards,1,a.eviction.policy),x=s=>{let y={evictedCardIds:[],selfViewDropped:!1,replicaCollapsed:!1},x=[],S=null,C=!1,w=d!==void 0&&d.region.accepts.includes(`selfView`);if(d&&w&&(n.replica||o)){let e=d.rect,t=o&&!s.selfViewDropped;o&&s.selfViewDropped&&(y.selfViewDropped=!0);let r=+!!n.replica+ +!!t,i=Math.round(a.insets.participantsPadPx),c=Math.max(1,e.width-2*i),l=Math.round(c*9/16),u=e=>r*e+(r-1)*i;u(l)>e.height&&(l=Math.max(1,Math.floor((e.height-(r-1)*i)/r)),c=Math.min(Math.max(1,e.width-2*i),Math.round(l*16/9))),l=Math.max(l,Math.min(48,e.height)),c=Math.max(c,Math.min(48,e.width));let f=e.x+Math.round((e.width-c)/2),p=e.y+Math.round((e.height-u(l))/2);if(n.replica){let e={x:f,y:p,width:c,height:l};if(s.replicaCollapsed){let t=Math.min(l,Math.max(64,Math.round(l*.25)));e={...e,height:t},y.replicaCollapsed=!0}S={id:`replica`,kind:`replica`,rect:e,layer:`grid`,order:d.region.zBase,fit:{kind:`natural`},region:d.region.name},x.push(S),p+=l+i}t&&(x.push({id:`selfView`,kind:`selfView`,rect:{x:f,y:p,width:c,height:l},layer:`grid`,order:d.region.zBase,fit:{kind:`natural`},region:d.region.name}),C=!0)}else if(d&&(n.replica||o)){let e=!n.replica,t=d.rect;if(!e&&s.replicaCollapsed){let e=Math.min(t.height,Math.max(64,Math.round(t.height*.25)));t={...t,height:e},y.replicaCollapsed=!0}let r={id:e?`selfView`:`replica`,kind:e?`selfView`:`replica`,rect:t,layer:`grid`,order:d.region.zBase,fit:{kind:`natural`},region:d.region.name};x.push(r),e?C=!0:S=r}e.contentKind!==null&&f&&x.push({id:`content`,kind:`content`,rect:f.rect,layer:`grid`,order:f.region.zBase,fit:{kind:`natural`},region:f.region.name});let T=yF(b,s.extraEvictions,a.eviction.policy),E=new Set(T.map(e=>e.id));if(y.evictedCardIds=v.filter(e=>!E.has(e.id)).map(e=>e.id),p&&T.length>0){let e=p.rect,n=t.regions.filter(e=>e.zBase<100),i=n.length>1&&n.every(e=>`fraction`in e.width&&e.width.fraction===1),{innerW:o,entries:s}=aF(T,e.width,a,r.width,void 0,i?a.card.stackMaxWidthPx:void 0),c=e.x+Math.round((e.width-o)/2),l=e.height-g*(s.length-1),u=s.reduce((e,t)=>e+t.clampedHeightPx,0),d;if(u<=l)d=s.map(e=>e.clampedHeightPx);else{let e=l>0?l/u:0;d=s.map(t=>Math.max(a.card.reportedHeightFloorPx,Math.floor(t.clampedHeightPx*e)));let t=d.reduce((e,t)=>e+t,0)-Math.max(0,l);for(;t>0;){let e=-1;for(let t=0;t<d.length;t++){let n=d[t]??0;n>a.card.reportedHeightFloorPx&&(e===-1||n>(d[e]??0))&&(e=t)}if(e===-1)break;d[e]=(d[e]??0)-1,--t}}let f=d.reduce((e,t)=>e+t,0)+g*(s.length-1),m=e.y+Math.max(0,Math.round((e.height-f)/2));s.forEach((t,n)=>{let r=Math.min(m,e.y+e.height),i=Math.max(0,Math.min(d[n]??0,e.y+e.height-r)),s=ZP(t.clampedHeightPx,i,a),l=t.constraints.hardMinHeightPx;l!==void 0&&i<l&&s.kind!==`scroll`&&(s={kind:`scroll`}),x.push({id:t.card.id,kind:`card`,component:t.card.component,cardSizeClass:t.constraints.sizeClass,rect:{x:c,y:r,width:o,height:i},layer:`grid`,order:p.region.zBase+n,fit:s,region:p.region.name}),m=r+i+g})}let D=null;if(p===void 0&&h!==void 0&&T.length>0){let e={width:Math.max(0,i.width-2*c),height:Math.max(0,i.height-2*c)},t=lF(h,e,a),n={x:t.x+c,y:t.y+c,width:t.width,height:Math.max(0,Math.min(t.height,u-(t.y+c)))},{innerW:o,entries:s}=aF(T,n.width,a,r.width,0,a.card.stackMaxWidthPx),l=s[0];if(l!==void 0){let e=n.x+Math.round((n.width-o)/2),t=Math.max(0,Math.min(l.clampedHeightPx,n.height)),r=ZP(l.clampedHeightPx,t,a),i=l.constraints.hardMinHeightPx;i!==void 0&&t<i&&r.kind!==`scroll`&&(r={kind:`scroll`}),D={id:l.card.id,kind:`card`,component:l.card.component,cardSizeClass:l.constraints.sizeClass,rect:{x:e,y:n.y,width:o,height:t},layer:`overlay`,order:h.zBase,fit:r,region:h.name,sheet:!0},x.push(D)}}if(!C){if(o&&s.selfViewDropped)y.selfViewDropped=!0;else if(o){let t=e.suppressedPrefs.includes(`pipCorner`)?pF:n.prefs.pipCorner??`bottom-left`,o=n.callControlsVisible===!1?null:n.callControlsRect??(l>0?{x:0,y:u,width:i.width,height:l}:null),s=[...o===null?[]:[o],...D===null?[]:[D.rect],...n.chromeObstacles??[]];if(S){let e=S.rect,n=hF(e,_,a,r.width===`compact`),i=n===null?null:mF(e,t,_,n.w,n.h),o=i===null?null:vF(i,s,_),c=n!==null&&o!==null&&o.y>=e.y&&n.w+_<=e.width&&n.h+_<=e.height,l=n!==null&&e.width>0&&e.height>0?n.w*n.h/(e.width*e.height):1/0;o!==null&&c&&l<=a.pip.maxAreaRatio?x.push({id:`selfView`,kind:`selfView`,rect:o,layer:`overlay`,order:m?.zBase??100,fit:{kind:`natural`},region:m?.name??`pip`}):y.selfViewDropped=!0}else{let e=a.pip.minWidthPx,n=r.width===`compact`?e:Math.round(e*9/16),o={x:0,y:0,width:i.width,height:i.height},c=vF(mF(o,t,_,e,n),s,_),l=c.y>=0&&e+_<=o.width&&n+_<=o.height,u=x.some(e=>(e.kind===`content`||e.kind===`card`)&&QP(e.rect,c));l&&!u?x.push({id:`selfView`,kind:`selfView`,rect:c,layer:`overlay`,order:m?.zBase??100,fit:{kind:`natural`},region:m?.name??`pip`}):y.selfViewDropped=!0}}}return{tiles:x,degradations:y}},S={extraEvictions:0,selfViewDropped:!1,replicaCollapsed:!1},C=x(S),w=eF(C.tiles,i,a);for(let e of a.degradationLadder){if(w.length===0)break;if(e===`evict-cards`)for(;w.length>0&&S.extraEvictions<b.length;)S={...S,extraEvictions:S.extraEvictions+1},C=x(S),w=eF(C.tiles,i,a);else e===`drop-self-view`?C.tiles.some(e=>e.kind===`selfView`)&&(S={...S,selfViewDropped:!0},C=x(S),w=eF(C.tiles,i,a)):e===`collapse-replica`&&!S.replicaCollapsed&&C.tiles.some(e=>e.kind===`replica`)&&(S={...S,replicaCollapsed:!0},C=x(S),w=eF(C.tiles,i,a))}return C}function SF(e){if(!(e===void 0||e.length===0))return{...RP,...Object.fromEntries(e.map(e=>[e.id,e]))}}function CF(e,t,n,r){let i={width:Math.max(0,Math.round(e.container.widthPx)),height:Math.max(0,Math.round(e.container.heightPx))},a=VP(e,t,n),o=e.replica||e.selfView&&e.prefs.hideSelfView!==!0,s=BP(a.state,t,SF(r?.templates),void 0,o),{tiles:c,degradations:l}=xF(a,s,e,t,i,n);return{state:a.state,sizeClass:t,containerPx:i,templateId:s.id,tiles:c,degradations:l,suppressedPrefs:[...a.suppressedPrefs]}}var wF={compact:0,medium:1,expanded:2};function TF(e,t){return e.width===t.width&&e.height===t.height}function EF(e,t,n,r,i){let a=e.committedClass;if(a===null)return{committedClass:t,pendingClass:null,pendingSinceMs:null};if(TF(t,a))return{committedClass:a,pendingClass:null,pendingSinceMs:null};let o=Math.abs(wF[t.width]-wF[a.width]),s=e.lastResolution?.containerPx.width??null;return o>1||s===null||Math.abs(Math.round(n)-s)>=i.hysteresis.decisiveJumpPxDelta?{committedClass:t,pendingClass:null,pendingSinceMs:null}:e.pendingClass!==null&&e.pendingSinceMs!==null&&TF(e.pendingClass,t)?r-e.pendingSinceMs>=i.hysteresis.windowMs?{committedClass:t,pendingClass:null,pendingSinceMs:null}:{committedClass:a,pendingClass:e.pendingClass,pendingSinceMs:e.pendingSinceMs}:{committedClass:a,pendingClass:t,pendingSinceMs:r}}var DF=(e,t)=>e<t?-1:+(e>t);function OF(e,t){let n=new Map((e?.tiles??[]).map(e=>[e.id,e])),r=new Map(t.tiles.map(e=>[e.id,e])),i=[];for(let e of[...n.keys()].sort(DF))r.has(e)||i.push({type:`exit`,tileId:e});let a=[],o=[],s=[];for(let e of[...r.keys()].sort(DF)){let t=n.get(e);if(t===void 0){a.push({type:`enter`,tileId:e});continue}let i=r.get(e);if(t.layer!==i.layer){o.push(i.layer===`overlay`?{type:`promote`,tileId:e,toLayer:i.layer}:{type:`demote`,tileId:e,toLayer:i.layer});continue}let c=t.rect.x!==i.rect.x||t.rect.y!==i.rect.y,l=t.rect.width!==i.rect.width||t.rect.height!==i.rect.height;c?s.push({type:`move`,tileId:e,from:t.rect,to:i.rect}):l&&s.push({type:`resize`,tileId:e,from:t.rect,to:i.rect})}return[...i,...a,...o,...s]}function kF(e,t,n,r,i){let a=EF(e,LP(t.container,r),t.container.widthPx,n,r),o=CF(t,a.committedClass,r,i);return{resolution:o,transitions:OF(e.lastResolution,o),nextState:{committedClass:a.committedClass,pendingClass:a.pendingClass,pendingSinceMs:a.pendingSinceMs,lastResolution:o}}}var AF=`0.1.12`,jF=FP,MF=(()=>{try{return new URLSearchParams(globalThis.location?.search??``).get(`grid_enabled`)===`1`}catch{return!1}})(),NF=(()=>{try{return new URLSearchParams(globalThis.location?.search??``).get(`grid_debug`)===`1`}catch{return!1}})();function PF(e,t){return MF||e===!0||t===!0}function FF({instances:e,viewport:t,presence:n,callControlsBandPx:r,callControlsVisible:i,callControlsRect:a,reportedHeights:o}){return{container:{widthPx:t.width,heightPx:Math.round(Math.min(t.height,t.visualViewportHeight??t.height))},replica:n.hasPersonaVideo,selfView:n.hasSelfView,presentation:n.isPersonaPresenting?{}:null,userShare:n.isScreenSharing?{}:null,cards:e.map((e,t)=>({id:e.id,component:e.canvas_config.component,dispatchSeq:t+1,...o[e.id]===void 0?{}:{naturalHeightPx:o[e.id]}})),prefs:{},callControls:r>0,callControlsVisible:i??!0,...a===void 0?{}:{callControlsRect:a}}}var IF=16,LF=200,RF=zt(null);function zF(e){RF.peek()===null&&(console.error(`Magic Grid engine error; rendering the legacy layout.`,e),RF.value=(e instanceof Error?`${e.name}: ${e.message}`:String(e)).slice(0,LF))}function BF(){RF.peek()!==null&&(RF.value=null)}function VF({instances:e,viewport:t,presence:n,callControlsBandPx:r,callControlsVisible:i,callControlsRect:a,enabled:o}){let s=N(jF),c=N(null),[l,u]=j({}),[d,f]=j(null),p=F((e,t)=>{o&&u(n=>n[e]===t?n:{...n,[e]:t})},[o]);M(()=>{u(t=>{let n=new Set(e.map(e=>e.id)),r={};for(let[e,i]of Object.entries(t))n.has(e)&&(r[e]=i);return Object.keys(r).length===Object.keys(t).length?t:r})},[e]);let m=P(()=>FF({instances:e,viewport:t,presence:n,callControlsBandPx:r,callControlsVisible:i,callControlsRect:a,reportedHeights:l}),[e,t,n,r,i,a,l]);return M(()=>{if(!o||RF.peek()!==null)return;c.current===null&&(c.current=Date.now());let e=null,t=()=>{if(e=null,RF.peek()!==null)return;let n=Date.now()-(c.current??0),r;try{r=kF(s.current,m,n,IP)}catch(e){zF(e);return}if(s.current=r.nextState,f(r),r.nextState.pendingClass!==null){let i=r.nextState.pendingSinceMs===null?0:Math.max(0,n-r.nextState.pendingSinceMs);e=setTimeout(t,Math.max(IF,IP.hysteresis.windowMs-i+IF))}};return t(),()=>{e!==null&&clearTimeout(e)}},[o,m]),{resolution:o?d?.resolution??null:null,inputs:o?m:null,transitions:o?d?.transitions??[]:[],reportedHeights:l,recordNaturalHeight:p}}function HF(e,t,n){return n?e===null?`no-presence`:t.hasPersonaVideo?e.degradations.evictedCardIds.length>0?`card-dropped`:e.tiles.some(e=>e.kind===`card`&&e.fit.kind===`scroll`)?`card-overflow`:null:`no-persona-video`:`flag-off`}function UF(e,t){if(t!==null||e===null)return null;let n=e.tiles.find(e=>e.kind===`card`&&e.sheet===!0);return n===void 0?null:n.rect.y+n.rect.height}var WF={driving:!1,containerPx:null,replica:null,selfView:null,content:null,replicaCollapsed:!1};function GF(e,t,n){if(e===null)return WF;let r=t===null;if(!r&&!(t===`no-persona-video`&&n))return WF;let i=t=>e.tiles.find(e=>e.kind===t)?.rect??null;return{driving:r,containerPx:e.containerPx,replica:r?i(`replica`):null,selfView:i(`selfView`),content:r?i(`content`):null,replicaCollapsed:r?e.degradations.replicaCollapsed:!1}}function KF(e){return e.selfView===null?e.driving?`hidden`:`legacy`:`engine`}function qF(e,t){return e.containerPx===null||t.containerPx===null?!1:e.containerPx.width===t.containerPx.width&&e.containerPx.height===t.containerPx.height}var JF=`conversation.grid_status`,YF=6e4;function XF(e,t,n){return n?e&&t?`url+config+start`:e?`url+start`:t?`config+start`:`start`:e&&t?`both`:e?`url`:`config`}function ZF(e,t){return{message_type:`conversation`,event_type:JF,conversation_id:e,properties:t}}function QF(e){return{template_id:e.templateId,size_class:`${e.sizeClass.width}/${e.sizeClass.height}`,container:{w:e.containerPx.width,h:e.containerPx.height},cards:e.tiles.filter(e=>e.kind===`card`).length}}function $F(e){let{send:t,enabledVia:n,engineVersion:r=AF,now:i=Date.now,transitionDebounceMs:a=500,summaryIntervalMs:o=YF}=e,s=i(),c=!1,l=!1,u,d=null,f=null,p=!1,m=null,h=0,g=0,_={},v=null,y=e=>{try{t(e)}catch{}},b=(e,t)=>({v:1,kind:e,engine_version:r,enabled_via:n,bail:t,...v}),x=e=>{f=null;let t=u;if(t!==void 0&&e===t)return;let n=i();t===null&&m!==null&&(h+=n-m,m=null),e===null?m=n:_[e]=(_[e]??0)+1,t!==void 0&&(g+=1),e===null&&!p?(p=!0,y({...b(`first_drive`,null),...t===void 0?{}:{prev_bail:t}})):t!==void 0&&y({...b(`transition`,e),prev_bail:t}),u=e},S=e=>{let t=i(),n=h+(m===null?0:t-m);y({...b(`summary`,u??d??null),driving_ms:Math.round(n),total_ms:Math.round(t-s),bail_counts:{..._},transitions:g,...e?{final:!0}:{}})},C=setInterval(()=>S(!1),o);return{update(e,t){if(c)return;t!==null&&(v=QF(t));let n=f===null?u:d;n!==void 0&&e===n||(d=e,f!==null&&clearTimeout(f),f=setTimeout(()=>x(e),a))},error(e){c||l||(l=!0,y({...b(`error`,`engine-error`),error:e}))},dispose(){c||(c=!0,clearInterval(C),f!==null&&(clearTimeout(f),x(d)),S(!0))}}}function eI({enabled:e,enabledVia:t,bail:n,resolution:r,engineError:i}){let a=hh(),o=Hg(),s=I(J_),c=N({daily:a,meetingState:o,conversation:s});c.current={daily:a,meetingState:o,conversation:s};let l=N(null);M(()=>{if(!e)return;let n=$F({enabledVia:t,send:e=>{try{let t=c.current;if(!t.daily||t.meetingState!==`joined-meeting`)return;let n=t.conversation?.session.peek()?.conversationId;if(!n)return;t.daily.sendAppMessage(ZF(n,e),`*`)}catch{}}});return l.current=n,()=>{l.current=null,n.dispose()}},[e,t]),M(()=>{l.current?.update(n,r)},[n,r]),M(()=>{i!==null&&l.current?.error(i)},[i])}var tI=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},nI=(e,t)=>({classGroupId:e,validator:t}),rI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),iI=`-`,aI=[],oI=`arbitrary..`,sI=e=>{let t=uI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return lI(e);let n=e.split(iI);return cI(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?tI(i,t):t:i||aI}return n[e]||aI}}},cI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=cI(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(iI):e.slice(t).join(iI),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},lI=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?oI+r:void 0})(),uI=e=>{let{theme:t,classGroups:n}=e;return dI(n,t)},dI=(e,t)=>{let n=rI();for(let r in e){let i=e[r];fI(i,n,r,t)}return n},fI=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];pI(i,t,n,r)}},pI=(e,t,n,r)=>{if(typeof e==`string`){mI(e,t,n);return}if(typeof e==`function`){hI(e,t,n,r);return}gI(e,t,n,r)},mI=(e,t,n)=>{let r=e===``?t:_I(t,e);r.classGroupId=n},hI=(e,t,n,r)=>{if(vI(e)){fI(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(nI(n,e))},gI=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];fI(o,_I(t,a),n,r)}},_I=(e,t)=>{let n=e,r=t.split(iI),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=rI(),n.nextPart.set(t,i)),n=i}return n},vI=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,yI=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},bI=`!`,xI=`:`,SI=[],CI=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),wI=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===xI){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(bI)?(c=s.slice(0,-1),l=!0):s.startsWith(bI)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return CI(t,l,c,u)};if(t){let e=t+xI,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):CI(SI,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},TI=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},EI=e=>({cache:yI(e.cacheSize),parseClassName:wI(e),sortModifiers:TI(e),postfixLookupClassGroupIds:DI(e),...sI(e)}),DI=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},OI=/\s+/,kI=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(OI),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+bI:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},AI=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=jI(n))&&(i&&(i+=` `),i+=r);return i},jI=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=jI(e[r]))&&(n&&(n+=` `),n+=t);return n},MI=(e,...t)=>{let n,r,i,a,o=o=>(n=EI(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=kI(e,n);return i(e,a),a};return a=o,(...e)=>a(AI(...e))},NI=[],PI=e=>{let t=t=>t[e]||NI;return t.isThemeGetter=!0,t},FI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,II=/^\((?:(\w[\w-]*):)?(.+)\)$/i,LI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,RI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,UI=e=>LI.test(e),WI=e=>!!e&&!Number.isNaN(Number(e)),GI=e=>!!e&&Number.isInteger(Number(e)),KI=e=>e.endsWith(`%`)&&WI(e.slice(0,-1)),qI=e=>RI.test(e),JI=()=>!0,YI=e=>zI.test(e)&&!BI.test(e),XI=()=>!1,ZI=e=>VI.test(e),QI=e=>HI.test(e),$I=e=>!Q(e)&&!$(e),eL=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),tL=e=>gL(e,bL,XI),Q=e=>FI.test(e),nL=e=>gL(e,xL,YI),rL=e=>gL(e,SL,WI),iL=e=>gL(e,wL,JI),aL=e=>gL(e,CL,XI),oL=e=>gL(e,vL,XI),sL=e=>gL(e,yL,QI),cL=e=>gL(e,TL,ZI),$=e=>II.test(e),lL=e=>_L(e,xL),uL=e=>_L(e,CL),dL=e=>_L(e,vL),fL=e=>_L(e,bL),pL=e=>_L(e,yL),mL=e=>_L(e,TL,!0),hL=e=>_L(e,wL,!0),gL=(e,t,n)=>{let r=FI.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},_L=(e,t,n=!1)=>{let r=II.exec(e);return r?r[1]?t(r[1]):n:!1},vL=e=>e===`position`||e===`percentage`,yL=e=>e===`image`||e===`url`,bL=e=>e===`length`||e===`size`||e===`bg-size`,xL=e=>e===`length`,SL=e=>e===`number`,CL=e=>e===`family-name`,wL=e=>e===`number`||e===`weight`,TL=e=>e===`shadow`,EL=MI(()=>{let e=PI(`color`),t=PI(`font`),n=PI(`text`),r=PI(`font-weight`),i=PI(`tracking`),a=PI(`leading`),o=PI(`breakpoint`),s=PI(`container`),c=PI(`spacing`),l=PI(`radius`),u=PI(`shadow`),d=PI(`inset-shadow`),f=PI(`text-shadow`),p=PI(`drop-shadow`),m=PI(`blur`),h=PI(`perspective`),g=PI(`aspect`),_=PI(`ease`),v=PI(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[UI,`full`,`auto`,...w()],E=()=>[GI,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,GI,$,Q]},GI,$,Q],ee=()=>[GI,`auto`,$,Q],te=()=>[`auto`,`min`,`max`,`fr`,$,Q],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],O=()=>[`auto`,...w()],ie=()=>[UI,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[UI,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],k=()=>[UI,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],A=()=>[e,$,Q],oe=()=>[...b(),dL,oL,{position:[$,Q]}],se=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ce=()=>[`auto`,`cover`,`contain`,fL,tL,{size:[$,Q]}],le=()=>[KI,lL,nL],ue=()=>[``,`none`,`full`,l,$,Q],de=()=>[``,WI,lL,nL],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[WI,KI,dL,oL],he=()=>[``,`none`,m,$,Q],ge=()=>[`none`,WI,$,Q],_e=()=>[`none`,WI,$,Q],ve=()=>[WI,$,Q],ye=()=>[UI,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[qI],breakpoint:[qI],color:[JI],container:[qI],"drop-shadow":[qI],ease:[`in`,`out`,`in-out`],font:[$I],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[qI],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[qI],shadow:[qI],spacing:[`px`,WI],text:[qI],"text-shadow":[qI],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,UI,Q,$,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$,Q]}],"container-named":[eL],columns:[{columns:[WI,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[GI,`auto`,$,Q]}],basis:[{basis:[UI,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[WI,UI,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,WI,$,Q]}],shrink:[{shrink:[``,WI,$,Q]}],order:[{order:[GI,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...k()]}],"min-block-size":[{"min-block":[`auto`,...k()]}],"max-block-size":[{"max-block":[`none`,...k()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,lL,nL]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,hL,iL]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,KI,Q]}],"font-family":[{font:[uL,aL,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[WI,`none`,$,rL]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[WI,`from-font`,`auto`,$,nL]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[WI,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[GI,$,Q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},GI,$,Q],radial:[``,$,Q],conic:[GI,$,Q]},pL,sL]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":de()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[WI,$,Q]}],"outline-w":[{outline:[``,WI,lL,nL]}],"outline-color":[{outline:A()}],shadow:[{shadow:[``,`none`,u,mL,cL]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":[`none`,d,mL,cL]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:de()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[WI,nL]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":[`none`,f,mL,cL]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[WI,$,Q]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[WI]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[WI]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:he()}],brightness:[{brightness:[WI,$,Q]}],contrast:[{contrast:[WI,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,mL,cL]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:[``,WI,$,Q]}],"hue-rotate":[{"hue-rotate":[WI,$,Q]}],invert:[{invert:[``,WI,$,Q]}],saturate:[{saturate:[WI,$,Q]}],sepia:[{sepia:[``,WI,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[WI,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[WI,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,WI,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[WI,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,WI,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[WI,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[WI,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,WI,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[WI,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[WI,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[GI,$,Q]}],accent:[{accent:A()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...A()]}],"stroke-w":[{stroke:[WI,lL,nL,rL]}],stroke:[{stroke:[`none`,...A()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function DL({resolution:e,inputs:t,config:n,bailReason:r}){if(e===null||t===null)return null;let i=RP[e.templateId];if(i===void 0)return null;let a=r!==null,o=a?`border-warning/70 bg-warning/5`:`border-info/80 bg-info/5`,s=a?`bg-warning/85 text-warning-content`:`bg-info/85 text-info-content`,c=a?`border-warning`:`border-success`,l=a?`bg-warning/85 text-warning-content`:`bg-success/85 text-success-content`,u=t.userShare?`userShare`:t.presentation?`presentation`:null,{regions:d}=bF(i,{state:e.state,contentKind:u},t,e.sizeClass,e.containerPx,n);return L(`div`,{class:`pointer-events-none absolute inset-0 z-40`,"aria-hidden":`true`,children:[a&&L(`span`,{class:`absolute top-1 left-1/2 -translate-x-1/2 rounded bg-warning/90 px-2 py-0.5 font-mono text-[10px] text-warning-content`,children:[`engine plan only · legacy: `,r]}),d.map(e=>L(`div`,{class:EL(`absolute rounded-box border border-dashed`,o),style:{left:`${e.rect.x}px`,top:`${e.rect.y}px`,width:`${e.rect.width}px`,height:`${e.rect.height}px`},children:L(`span`,{class:EL(`absolute top-1 left-1 flex flex-col rounded px-1.5 py-0.5 font-mono text-[10px] leading-tight`,s),children:[L(`span`,{children:e.region.name}),L(`span`,{class:`opacity-75`,children:e.region.accepts.join(` · `)})]})},e.region.name)),e.tiles.map(e=>L(`div`,{class:EL(`absolute border`,c),style:{left:`${e.rect.x}px`,top:`${e.rect.y}px`,width:`${e.rect.width}px`,height:`${e.rect.height}px`},children:L(`span`,{class:EL(`absolute right-1 bottom-1 rounded px-1.5 py-0.5 font-mono text-[10px]`,l),children:[e.kind,` `,e.rect.width,`×`,e.rect.height]})},`tile-${e.id}`))]})}function OL(e){return{version:1,buildSha:AF,engineVersion:AF,config:IP,session:{containerPx:{width:Math.round(e.container.widthPx),height:Math.round(e.container.heightPx)},slots:{replica:e.replica,selfView:e.selfView,presentation:e.presentation!==null,userShare:e.userShare!==null,callControls:e.callControls,callControlsVisible:e.callControlsVisible??!0,...e.callControlsRect===void 0?{}:{callControlsRect:e.callControlsRect}},prefs:e.prefs,cards:e.cards}}}function kL({resolution:e,inputs:t,shadowing:n,bailReason:r,engineError:i=null}){let[a,o]=j(!1),s=N(null);if(M(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),e===null||t===null)return i===null?null:L(`div`,{class:`pointer-events-auto max-w-[22rem] rounded-box bg-base-100/95 p-3 font-mono text-[10px] leading-relaxed shadow-lg`,children:[L(`div`,{class:`mb-1 flex items-center justify-between gap-2`,children:[L(`span`,{class:`font-bold uppercase tracking-wide`,children:`magic grid`}),L(`span`,{class:`text-warning`,children:`observing`})]}),L(`dl`,{class:`grid grid-cols-[5.5rem_1fr] gap-x-2`,children:[L(`dt`,{class:`text-warning opacity-80`,children:`legacy`}),L(`dd`,{class:`text-warning`,children:r}),L(`dt`,{class:`text-error opacity-80`,children:`error`}),L(`dd`,{class:`text-error break-all`,children:i})]})]});let c=()=>{let e=JSON.stringify(OL(t),null,2);s.current!==null&&clearTimeout(s.current),navigator.clipboard?.writeText(e).then(()=>{o(!0),s.current=setTimeout(()=>o(!1),1500)},()=>o(!1))},l=e.degradations.evictedCardIds;return L(`div`,{class:`pointer-events-auto max-w-[22rem] rounded-box bg-base-100/95 p-3 font-mono text-[10px] leading-relaxed shadow-lg`,children:[L(`div`,{class:`mb-1 flex items-center justify-between gap-2`,children:[L(`span`,{class:`font-bold uppercase tracking-wide`,children:`magic grid`}),L(`span`,{class:n?`text-warning`:`text-success`,children:n?`observing`:`driving`})]}),L(`dl`,{class:`grid grid-cols-[5.5rem_1fr] gap-x-2`,children:[L(`dt`,{class:`opacity-60`,children:`state`}),L(`dd`,{children:e.state}),L(`dt`,{class:`opacity-60`,children:`template`}),L(`dd`,{children:e.templateId}),L(`dt`,{class:`opacity-60`,children:`class`}),L(`dd`,{children:[e.sizeClass.width,` / `,e.sizeClass.height]}),L(`dt`,{class:`opacity-60`,children:`container`}),L(`dd`,{children:[e.containerPx.width,`×`,e.containerPx.height]}),t.callControlsRect!==void 0&&L(k,{children:[L(`dt`,{class:`opacity-60`,children:`controls`}),L(`dd`,{children:[`x `,t.callControlsRect.x,`–`,t.callControlsRect.x+t.callControlsRect.width,t.callControlsVisible===!1?` · hidden`:` · shown`]})]}),L(`dt`,{class:`opacity-60`,children:`tiles`}),L(`dd`,{children:e.tiles.map(e=>`${e.kind}:${e.rect.width}×${e.rect.height}`).join(` `)||`none`}),l.length>0&&L(k,{children:[L(`dt`,{class:`text-error opacity-80`,children:`dropped`}),L(`dd`,{class:`text-error`,children:l.join(`, `)})]}),r!==null&&L(k,{children:[L(`dt`,{class:`text-warning opacity-80`,children:`legacy`}),L(`dd`,{class:`text-warning`,children:r})]}),i!==null&&L(k,{children:[L(`dt`,{class:`text-error opacity-80`,children:`error`}),L(`dd`,{class:`text-error break-all`,children:i})]})]}),L(`button`,{type:`button`,class:`btn btn-xs mt-2 w-full`,onClick:c,children:a?`copied`:`copy envelope for playground`})]})}var AL={effect:WF,animate:!1},jL=zt(AL),ML={presence:{phase:`connecting`},localId:null,isScreenSharing:!1,isPersonaPresenting:!1,hasPersonaVideo:!1,hasSelfView:!1};function NL(e,t){return e===null||t===null?e===t:e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PL(e,t){let n=e.containerPx===null||t.containerPx===null?e.containerPx===t.containerPx:e.containerPx.width===t.containerPx.width&&e.containerPx.height===t.containerPx.height;return e.driving===t.driving&&e.replicaCollapsed===t.replicaCollapsed&&n&&NL(e.replica,t.replica)&&NL(e.selfView,t.selfView)&&NL(e.content,t.content)}var FL=new Map;function IL({instances:e,viewport:t,callControlsBandPx:n,callPresence:r,callControlsVisible:i,callControlsRect:a,gridConfigEnabled:o,gridStartEnabled:s}){let c=PF(o,s)&&r!==void 0,l=r??ML,u=VF({instances:e,viewport:t,presence:l,callControlsBandPx:n,callControlsVisible:i,callControlsRect:a,enabled:c}),d=c?RF.value:null,f=d===null?HF(u.resolution,l,c):`engine-error`;eI({enabled:c,enabledVia:XF(MF,o===!0,s===!0),bail:f,resolution:u.resolution,engineError:d});let p=N(!1);l.presence.phase===`ready`?l.hasPersonaVideo&&(p.current=!0):p.current=!1;let m=!p.current,h;try{h=GF(u.resolution,f,m)}catch(e){zF(e),h=WF}let g=N(WF),_=qF(g.current,h);M(()=>{g.current=h,PL(jL.peek().effect,h)||(jL.value={effect:h,animate:_})}),M(()=>()=>{BF(),jL.peek()!==AL&&(jL.value=AL)},[]);let v=u.resolution,y=P(()=>{if(f!==null||v===null)return FL;try{let e=new Map;for(let t of v.tiles)t.kind===`card`&&e.set(t.id,t.rect);return e}catch(e){return zF(e),FL}},[f,v]),b=NF?L(`div`,{class:`contents`,"data-grid-debug":!0,children:[L(DL,{resolution:u.resolution,inputs:u.inputs,config:IP,bailReason:f}),L(`div`,{class:`pointer-events-none absolute bottom-4 left-4 z-50`,children:L(kL,{resolution:u.resolution,inputs:u.inputs,shadowing:f!==null,bailReason:f,engineError:d})})]}):null;return{cardRects:y,sheetBottomPx:UF(v,f),animate:_,recordNaturalHeight:u.recordNaturalHeight,debug:b}}var LL=[`left`,`top`,`width`,`height`].map(e=>`${e} ${bC}`).join(`, `);function RL(e,t){return{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`,transition:t&&!AC()?LL:`none`}}function zL({state:e}){return e.enabled?L(`details`,{class:`pointer-events-auto w-full max-w-md rounded-lg border border-base-300 bg-base-100/95 p-2 text-xs shadow-lg backdrop-blur`,children:[L(`summary`,{class:`cursor-pointer font-medium`,children:`Magic Canvas debug`}),L(`dl`,{class:`mt-2 grid gap-2`,children:[L(BL,{label:`iframe`,value:e.iframeLifecycleState}),L(BL,{label:`post`,value:e.lastInteractionPostResult}),L(BL,{label:`context`,value:e.lastModelContextUpdate}),L(BL,{label:`error`,value:e.lastError}),L(VL,{label:`tool_call`,value:e.lastToolCall}),L(VL,{label:`canvas_config`,value:e.parsedCanvasConfig})]})]}):null}function BL({label:e,value:t}){return t?L(`div`,{children:[L(`dt`,{class:`font-semibold`,children:e}),L(`dd`,{class:`break-words text-base-content/70`,children:t})]}):null}function VL({label:e,value:t}){return t===void 0?null:L(`div`,{children:[L(`dt`,{class:`font-semibold`,children:e}),L(`dd`,{children:L(`pre`,{class:`max-h-40 overflow-auto rounded bg-base-200 p-2 text-[10px] leading-relaxed`,children:JSON.stringify(t,null,2)})})]})}var HL=1e3,UL=5e3,WL=1200,GL=[2e3,6e3];async function KL(e,t,n){let r=new AbortController,i=globalThis.setTimeout(()=>r.abort(),UL);try{await xn(e,t,n,{signal:r.signal})}finally{globalThis.clearTimeout(i)}}function qL(e){return e instanceof _n&&e.status>=400&&e.status<500&&e.status!==408&&e.status!==429}function JL(e,t){console.error(`Magic Canvas interaction POST failed; this interaction may not have been recorded server-side.`,e),t({lastInteractionPostResult:`error`,lastError:xR(e).message})}function YL(e,t,n,r){(async()=>{let i;for(let a of GL){await new Promise(e=>setTimeout(e,a));try{await KL(e,t,n),r({lastInteractionPostResult:`recovered`,lastError:void 0});return}catch(e){if(i=e,qL(e))break}}JL(i,r)})()}var XL=2e3;function ZL(e){return e.correct_answer===void 0?WL:XL}var QL=48,$L=`allow-scripts`,eR={"canvas.scheduling_embed":`allow-scripts allow-same-origin allow-popups allow-forms`,"canvas.text":`allow-scripts allow-popups allow-popups-to-escape-sandbox`};function tR(e,t){if(!t.contentWindow||e.source!==t.contentWindow)return!1;let n=e.data;return!!n&&typeof n==`object`&&n?.jsonrpc===`2.0`}var nR=class{onmessage;onerror;onclose;#e;#t;constructor(e){this.#e=e}start(){let e=e=>{tR(e,this.#e)&&this.onmessage?.(e.data)};return this.#t=e,globalThis.addEventListener(`message`,e),Promise.resolve()}send(e){return this.#e.contentWindow?.postMessage(e,`*`),Promise.resolve()}close(){return this.#t&&globalThis.removeEventListener(`message`,this.#t),this.#t=void 0,this.onclose?.(),Promise.resolve()}};function rR(e){for(let t of fS)if(e.some(e=>_R(e)===t))return t;return null}function iR({onLayoutEffectChange:e,onRenderedSlotChange:t,debugEnabled:n=vR(),callPresence:r,callControlsVisible:i,callControlsRect:a,gridConfigEnabled:o,gridStartEnabled:s}={}){let{client:c}=mv(),{dataTheme:l,cssVars:u}=PP(),d=hh(),f=Hg(),[p,m]=j([]),[h,g]=pR(),[_,v]=j(()=>({enabled:n,iframeLifecycleState:`idle`})),y=IL({instances:p,viewport:g,callControlsBandPx:72,callPresence:r,callControlsVisible:i,callControlsRect:a,gridConfigEnabled:o,gridStartEnabled:s}),b=F(e=>{v(t=>({...t,...e}))},[]),x=F((e,t=`*`)=>{if(f!==`joined-meeting`){b({lastError:`Dropped Magic Canvas app message because the Daily meeting is not joined.`});return}d?.sendAppMessage(e,t)},[d,f,b]),S=P(()=>({theme:l.value===`dark`?`dark`:`light`,cssVars:u.value}),[l.value,u.value]);M(()=>{v(e=>e.enabled===n?e:{...e,enabled:n})},[n]),e_({onAppMessage:F(e=>{if(f!==`joined-meeting`){b({lastToolCall:e.data,iframeLifecycleState:`idle`,lastError:`Dropped Magic Canvas tool call because the Daily meeting is not joined.`});return}try{let t=aC(e.data);if(!t)return;m(e=>wS(e,t)),b({lastToolCall:e.data,parsedCanvasConfig:t.kind===`show`?t.instance.canvas_config:void 0,iframeLifecycleState:t.kind===`clear`?`closed`:`received`,lastError:void 0})}catch(e){b({iframeLifecycleState:`error`,lastError:xR(e).message})}},[f,b])});let C=p.map(e=>{let t=jS(e,g),n=t.display_mode===`fullscreen`?null:y.cardRects.get(e.id)??null;return{instance:e,layout:n===null?t:{...t,viable_slot:`safe-area-right`},gridRect:n}}),w=MS(C.map(({layout:e})=>e),g),T=[...C].reverse().find(({layout:e})=>e.display_mode===`fullscreen`)?.instance.tool_call_id;M(()=>{e?.(w)},[e,w.active,w.side,w.video_shift_x,w.backdrop.type,w.safe_area?.x,w.safe_area?.y,w.safe_area?.width,w.safe_area?.height]);let E=rR(C.map(({layout:e})=>e));M(()=>{t?.(E)},[t,E]);let D=p.length>0||_.enabled;return L(`div`,{ref:h,"data-magic-canvas-root":!0,class:`pointer-events-none absolute inset-0 z-30`,children:[D&&T&&L(`div`,{class:`absolute inset-0 bg-black/45`}),D&&!T&&y.sheetBottomPx!==null&&L(`div`,{"data-grid-sheet-scrim":!0,class:`absolute inset-x-0 top-0`,style:{height:Math.min(y.sheetBottomPx+64,g.height),backgroundImage:`linear-gradient(to bottom, rgb(0 0 0 / 0.45) calc(100% - 64px), rgb(0 0 0 / 0))`}}),D&&C.map(({instance:e,layout:t,gridRect:n})=>L(oR,{slot:_R(t),safeAreaTop:w.safe_area?.y,frameWidth:g.width,...n?{gridRect:n,gridAnimate:y.animate}:{},children:r=>L(sR,{availableHeight:r,client:c,gridDriven:n!==null,hostTheme:S,instance:e,layout:t,dimmed:!!(T&&T!==e.tool_call_id),onDebug:b,onNaturalHeightChange:y.recordNaturalHeight,onComplete:()=>{m(t=>t.filter(t=>t.id!==e.id))},onDisplayModeChange:t=>{m(n=>n.map(n=>n.tool_call_id===e.tool_call_id?{...n,layout:{...n.layout,display_mode:t}}:n))},sendAppMessage:x})},e.id)),D&&L(`div`,{class:`absolute right-4 bottom-24 @max-mobile:right-3 @max-mobile:bottom-20`,children:L(zL,{state:_})}),y.debug]})}var aR=16;function oR({slot:e,safeAreaTop:t,frameWidth:n,gridRect:r,gridAnimate:i=!1,children:a}){let[o,s]=mR(),c=a(r?r.height:e===`full`?void 0:s);if(r)return L(`div`,{ref:o,class:`pointer-events-auto absolute`,style:RL(r,i),"data-canvas-slot":e,"data-grid-driven":`true`,children:L(`div`,{class:`flex h-full w-full flex-col gap-2`,children:c})});if(e===`safe-area-left`||e===`safe-area-right`){let r=t==null?`1rem`:`${t*100}%`,i=n!=null&&n>0?Math.max(0,n-aR*2):void 0;return L(`div`,{ref:o,class:gR(e),style:{top:r,bottom:`72px`,maxWidth:i},"data-canvas-slot":e,children:L(`div`,{class:`my-auto flex w-full flex-col gap-2`,children:c})})}return L(`div`,{ref:o,class:gR(e),"data-canvas-slot":e,children:L(`div`,{class:`contents`,children:c})})}function sR({availableHeight:e,client:t,gridDriven:n=!1,hostTheme:r,instance:i,layout:a,dimmed:o,onDebug:s,onComplete:c,onDisplayModeChange:l,onNaturalHeightChange:u,sendAppMessage:d}){let f=N(null),p=N(null),m=N(e),h=N(320),g=N(r),_=N(i),v=N(a),y=N(-1),b=N(c),x=N(l),S=N(u),C=N(d),[w,T]=j(720);M(()=>{_.current=i},[i]),M(()=>{h.current=w,p.current?.setHostContext(dR(_.current,g.current,v.current,m.current,w))},[w]),M(()=>{m.current=e;let t=uR(r,f.current);g.current=t,p.current?.setHostContext(dR(_.current,t,v.current,e,h.current))},[e,r]),M(()=>{v.current=a,p.current?.setHostContext(dR(_.current,g.current,a,e,h.current))},[e,a]),M(()=>{b.current=c,x.current=l,S.current=u,C.current=d},[c,l,u,d]),M(()=>{let e=f.current;if(!e)return;let n=!1,r=null,a=null,o=null,c=null,l=new URL(i.canvas_config.sandbox_url,globalThis.location.href).href,u=e=>{n||s({iframeLifecycleState:`error`,lastError:xR(e).message})},d=()=>{if(n||!a)return;let e=_.current,t=kS(e,a);a=null,C.current({message_type:`conversation`,event_type:`conversation.append_llm_context`,conversation_id:e.conversation_id,properties:{context:t}}),s({lastModelContextUpdate:e.canvas_config.component,lastError:void 0})},w=()=>{if(r)return;if(e.src!==l){e.src;return}if(n||!e.contentWindow)return;let f=new MP(null,{name:`tavus-deployment`,version:`0.0.0`},{logging:{},message:{text:{},structuredContent:{}},updateModelContext:{text:{},structuredContent:{}}},{hostContext:dR(i,uR(g.current,e),v.current,m.current,h.current)});r=f,p.current=f,f.oninitialized=()=>{n||(s({iframeLifecycleState:`ready`}),y.current=_.current.revision,f.sendToolInput({arguments:_.current.arguments}).catch(u))},f.onsizechange=({height:e})=>{if(!n&&typeof e==`number`&&Number.isFinite(e)){let t=Math.min(Math.max(e,QL),720);T(t),S.current(_.current.id,t)}},f.onmessage=async e=>{let r=TS(e),i=OS(e);if(!r){if(i){let e=`Magic Canvas message included text without interaction metadata; no interaction row was recorded.`;return s({lastInteractionPostResult:`error`,lastError:e}),{isError:!0,code:`missing_interaction_metadata`,message:e}}return{}}let a=_.current,o=(()=>{try{let e=ES(a,r);return{interaction:e,request:oC(e)}}catch(e){return{error:e}}})();if(`error`in o){let e=xR(o.error).message;return s({lastInteractionPostResult:`error`,lastError:e}),{isError:!0,code:`interaction_normalization_failed`,message:e}}let{interaction:l,request:u}=o,d=!0;try{await KL(t,l.conversation_id,u.body)}catch(e){d=!1,qL(e)?JL(e,s):(console.warn(`Magic Canvas interaction POST failed; continuing without it and retrying in the background.`,e),s({lastInteractionPostResult:`failed_open`,lastError:xR(e).message}),YL(t,l.conversation_id,u.body,s))}if(n)return{};if(i)try{C.current({message_type:`conversation`,event_type:`conversation.respond`,conversation_id:a.conversation_id,properties:{text:i}})}catch(e){console.error(`Magic Canvas respond send failed.`,e),s({lastError:xR(e).message})}return d&&s({lastInteractionPostResult:`success`,lastError:void 0}),DS(l)&&(l.type===`submit`?(c&&clearTimeout(c),c=setTimeout(()=>{c=null,n||b.current()},ZL(a.arguments))):b.current()),{}},f.onupdatemodelcontext=async e=>(a=e,o||=setTimeout(()=>{o=null,d()},HL),{}),f.onrequestdisplaymode=async({mode:e})=>{let t=e===`fullscreen`?`fullscreen`:`inline`;return x.current(t),v.current={...v.current,display_mode:t,viable_slot:t===`fullscreen`?`full`:v.current.viable_slot},f.setHostContext(dR(_.current,g.current,v.current,m.current,h.current)),{mode:t}},f.connect(new nR(e)).then(()=>void 0).catch(u)};s({iframeLifecycleState:`mounting`,lastInteractionPostResult:void 0}),i.canvas_config.sandbox_url,e.src=i.canvas_config.sandbox_url;let E=()=>{w()};return e.addEventListener(`load`,E),w(),()=>{o&&=(clearTimeout(o),null),c&&=(clearTimeout(c),null),d(),n=!0,e.removeEventListener(`load`,E),p.current=null,s({iframeLifecycleState:`closed`}),r&&uS(r)}},[t,i.id,i.canvas_config.sandbox_url,s]),M(()=>{i.revision!==0&&(i.revision<=y.current||(y.current=i.revision,p.current?.sendToolInput({arguments:i.arguments}).catch(e=>{s({iframeLifecycleState:`error`,lastError:xR(e).message})})))},[i.arguments,i.revision,s]);let E=a.viable_slot===`full`||a.display_mode===`fullscreen`,D=E?null:fR(w,e),ee=D?.placeholderStyle,te=D?.cardStyle,ne=E?{height:`100%`}:D?.iframeStyle??{height:`${w}px`},re=[`pointer-events-auto w-full overflow-hidden rounded-box border-[length:var(--border)] border-base-300 bg-base-100 shadow-xl transition-[opacity,transform]`,E?`fixed inset-4 z-10 max-w-none`:n?`max-w-none`:`max-w-md`,o?`scale-[0.98] opacity-40`:``].filter(Boolean).join(` `),O=eR[i.canvas_config.component]??$L,ie=L(`div`,{class:re,style:te,"data-canvas-card":a.viable_slot,children:L(`iframe`,{ref:f,title:`${i.canvas_config.component} ${i.canvas_config.component_version}`,class:E?`block h-full w-full border-0 bg-transparent`:`block border-0 bg-transparent`,sandbox:O,style:ne})});return E?ie:L(`div`,{class:`block w-full`,style:ee,children:ie})}var cR=[`--color-base-100`,`--color-base-200`,`--color-base-300`,`--color-base-content`,`--color-primary`,`--color-error`];function lR(e){if(!e||typeof getComputedStyle!=`function`)return{};let t=getComputedStyle(e),n={};for(let e of cR){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return n}function uR(e,t){let n=lR(t);return Object.keys(n).length===0?e:{...e,cssVars:{...e.cssVars,...n}}}function dR(e,t,n,r,i){let a=sC(t,n),o=n.viable_slot===`full`||n.display_mode===`fullscreen`,s=o?void 0:yR(r),c=o?1:fR(i??0,r)?.displayScale??1;return{...e.canvas_config.host_context,...a,containerDimensions:{...bR(a.containerDimensions)?a.containerDimensions:{},...s===void 0?{}:{maxHeight:s},displayScale:c}}}function fR(e,t){if(t===void 0||!Number.isFinite(t)||t<=0)return null;let n=Math.min(e,720);if(n<=t)return{displayScale:1,placeholderStyle:{maxHeight:`${t}px`},cardStyle:void 0,iframeStyle:{width:`100%`,height:`${n}px`}};let r=t/n;return{displayScale:r,placeholderStyle:{height:`${n*r}px`,maxHeight:`${t}px`,overflow:`hidden`},cardStyle:{height:`${n}px`,transform:`scale(${r})`,transformOrigin:`top center`},iframeStyle:{width:`100%`,height:`${n}px`}}}function pR(){let e=N(null),[t,n]=j(()=>hR(null));return M(()=>{let t=()=>n(t=>{let n=hR(e.current);return t.width===n.width&&t.height===n.height&&t.visualViewportHeight===n.visualViewportHeight?t:n});t(),globalThis.addEventListener(`resize`,t),globalThis.visualViewport?.addEventListener(`resize`,t);let r;return typeof ResizeObserver<`u`&&e.current&&(r=new ResizeObserver(t),r.observe(e.current)),()=>{globalThis.removeEventListener(`resize`,t),globalThis.visualViewport?.removeEventListener(`resize`,t),r?.disconnect()}},[]),[e,t]}function mR(){let e=N(null),[t,n]=j();return M(()=>{let t=e.current;if(!t)return;let r=e=>{let r=e??t.getBoundingClientRect().height;!Number.isFinite(r)||r<=0||n(Math.floor(r))},i=()=>r();if(i(),typeof ResizeObserver>`u`)return globalThis.addEventListener(`resize`,i),()=>globalThis.removeEventListener(`resize`,i);let a=new ResizeObserver(e=>{r(e[0]?.contentRect.height)});return a.observe(t),()=>a.disconnect()},[]),[e,t]}function hR(e){let t=globalThis.visualViewport?.height,n=e?.getBoundingClientRect();if(n&&n.width>0&&n.height>0){let e=t===void 0?void 0:Math.max(0,(globalThis.innerHeight||0)-t);return{width:n.width,height:n.height,visualViewportHeight:e===void 0?void 0:Math.max(0,n.height-e)}}return{width:globalThis.innerWidth||1024,height:globalThis.innerHeight||768,visualViewportHeight:t}}function gR(e){let t=`absolute flex gap-2`;switch(e){case`safe-area-left`:return`${t} left-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;case`safe-area-right`:return`${t} right-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;case`safe-area-bottom`:return`${t} right-4 bottom-24 left-4 flex-col items-center justify-end @max-mobile:right-3 @max-mobile:bottom-20 @max-mobile:left-3`;case`full`:return`${t} inset-4 flex-col items-stretch justify-stretch`}}function _R(e){return e.display_mode===`fullscreen`&&e.preferred_slot!==`full`?e.preferred_slot:e.viable_slot}function vR(){return!1}function yR(e){return e===void 0||!Number.isFinite(e)||e<=0?720:Math.min(Math.floor(e),720)}function bR(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xR(e){return e instanceof Error?e:Error(String(e))}var SR=class extends A{state={errored:!1};componentDidCatch(e){this.props.onError(e),this.setState({errored:!0})}render(){return this.state.errored?null:this.props.children}},CR=1e4;function wR(e,t=CR){let[n,r]=j(!1),i=N(!1);return M(()=>{if(!e){r(!1);return}if(i.current)return;i.current=!0,r(!0);let n=setTimeout(()=>r(!1),t);return()=>clearTimeout(n)},[e,t]),n}function TR(e){let t=$h(),n=p_(t??``),r=!d_(t??``).isOff,i=Xx(e),a=i.phase===`ready`?i.replicaId:``,o=d_(a),s=!r&&(o.state===`playable`||o.state===`loading`),c=i.phase===`ready`&&!e&&!i.videoState.isOff,l=!e&&t!==null&&!n.isOff,u=i.phase!==`ready`||i.videoState.isOff;return P(()=>({presence:i,localId:t,isScreenSharing:r,isPersonaPresenting:s,hasPersonaVideo:c,hasSelfView:l}),[i.phase,a,u,t,r,s,c,l])}function ER(e,t,n){let[r,i]=j(!0);return M(()=>{if(!t)return;let n=e.current;if(!n||typeof matchMedia!=`function`)return;let r=matchMedia(`(hover: hover) and (pointer: fine)`),a=()=>{try{return n.matches(`:has(:focus-visible)`)}catch{return!1}},o=n.matches(`:hover`),s=()=>{i(!r.matches||o||a())},c=()=>{o=!0,s()},l=()=>{o=!1,s()};return n.addEventListener(`pointerenter`,c),n.addEventListener(`pointerleave`,l),n.addEventListener(`focusin`,s),n.addEventListener(`focusout`,s),r.addEventListener(`change`,s),s(),()=>{n.removeEventListener(`pointerenter`,c),n.removeEventListener(`pointerleave`,l),n.removeEventListener(`focusin`,s),n.removeEventListener(`focusout`,s),r.removeEventListener(`change`,s)}},[t,e,n]),r}function DR(e,t,n,r,i){let[a,o]=j(void 0);return M(()=>{if(!r)return;let i=e.current,a=t.current;if(!i||!a||typeof ResizeObserver>`u`)return;let s=()=>{let e=i.getBoundingClientRect(),t=1/0,r=-1/0;for(let e of a.children){let n=e.getBoundingClientRect();n.width!==0&&(t=Math.min(t,n.left),r=Math.max(r,n.right))}if(e.width===0||!Number.isFinite(t)||r<=t)return;let s={x:Math.round(t-e.left),y:Math.round(e.height-n),width:Math.round(r-t),height:n};o(e=>e!==void 0&&e.x===s.x&&e.y===s.y&&e.width===s.width&&e.height===s.height?e:s)},c=new ResizeObserver(s);c.observe(i),c.observe(a);for(let e of a.children)c.observe(e);return s(),()=>c.disconnect()},[r,e,t,n,i]),a}var OR=1e4;function kR({onTimeout:e,timeoutMs:t=OR,active:n=!0}){let r=Yx().length>0,[i,a]=j(!1),o=N(e);return M(()=>{o.current=e},[e]),M(()=>{if(!n||r){a(!1);return}let e=setTimeout(()=>{a(!0),o.current()},t);return()=>clearTimeout(e)},[n,r,t]),{hasJoined:r,timedOut:i}}function AR(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.message_type===`system`&&t.event_type===`system.shutdown`}function jR({onShutdown:e}){let t=N(e);M(()=>{t.current=e},[e]),e_({onAppMessage:F(e=>{AR(e?.data)&&t.current()},[])})}var MR=mn(`PiP`),NR=360,PR=280;function FR(){return globalThis.window!==void 0&&`documentPictureInPicture`in globalThis.window}function IR(e){let{enabled:t,active:n}=e,[r,i]=j(null),a=FR(),o=I(Kv),s=F(()=>{i(e=>(e&&!e.closed&&e.close(),null))},[]),c=F(async()=>{if(a&&!(!t||!n)&&!(r&&!r.closed))try{let e=await globalThis.window.documentPictureInPicture.requestWindow({width:NR,height:PR}),t=Ue.replace(/:host(?=[\s,{])/g,`:host, :root`),n=e.document.createElement(`style`);n.textContent=t,e.document.head.appendChild(n),e.document.body.style.margin=`0`,e.document.body.style.width=`100%`,e.document.body.style.height=`100vh`,e.document.body.style.overflow=`hidden`,e.addEventListener(`pagehide`,()=>{i(t=>t===e?null:t)},{once:!0}),i(e)}catch(e){MR.warn(`Failed to open PiP window`,e)}},[a,t,n,r]);return M(()=>{if(!t||!a||!n)return;let e=()=>{document.visibilityState===`hidden`?c():document.visibilityState===`visible`&&s()};document.addEventListener(`visibilitychange`,e);let r=[],i=null,o=`none`,l=!1;if(typeof navigator<`u`&&`mediaSession`in navigator){let e=navigator.mediaSession;i=e.metadata,o=e.playbackState;try{e.metadata=new MediaMetadata({title:`Tavus conversation`}),e.playbackState=`playing`,l=!0}catch(e){MR.warn(`mediaSession metadata setup failed`,e)}let t=(t,n)=>{try{e.setActionHandler(t,n),r.push(t)}catch(e){MR.warn(`mediaSession.${t} not supported`,e)}};t(`enterpictureinpicture`,()=>{c()}),t(`play`,()=>{}),t(`pause`,()=>{})}return()=>{if(document.removeEventListener(`visibilitychange`,e),typeof navigator<`u`&&`mediaSession`in navigator){let e=navigator.mediaSession;for(let t of r)try{e.setActionHandler(t,null)}catch{}if(l)try{e.metadata=i,e.playbackState=o}catch{}}}},[t,a,n,c,s]),M(()=>{(!n||!t)&&r&&!r.closed&&s()},[n,t,r,s]),M(()=>()=>{r&&!r.closed&&r.close()},[r]),M(()=>{if(!r||r.closed||!o)return;let e=()=>{r.document.body.setAttribute(`data-theme`,o.dataTheme.value);let e=o.cssVars.value;for(let[t,n]of Object.entries(e))r.document.body.style.setProperty(t,n)};e();let t=o.dataTheme.subscribe(()=>e()),n=o.cssVars.subscribe(()=>e());return()=>{t(),n()}},[r,o]),{pipWindow:r,isSupported:a,requestPipWindow:c,closePipWindow:s}}var LR=zt(null),RR={active:!1,video_shift_x:0,backdrop:{type:`snapshot_mirror`}},zR=ga(({id:e,showAudioWave:t=!0})=>{let n=p_(e).isOff;return L(`div`,{class:`relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n?`hidden`:``}`,children:[L(pg,{automirror:!0,sessionId:e,type:`video`,fit:`cover`,className:`w-full h-full object-cover ${n?`hidden`:``}`}),t&&L(`div`,{class:`absolute bottom-2 right-2`,children:L(Hx,{id:e})})]})}),BR=ga(()=>{let e=$h(),{isScreenSharing:t}=tx(),n=Yx()[0];return L(k,{children:[t&&n&&L(zR,{id:n}),e&&L(zR,{id:e,showAudioWave:!1})]})}),VR=ga(()=>L(`div`,{class:`absolute bottom-4 @max-mobile:bottom-20 left-4 flex flex-col items-end gap-2 z-20`,children:L(BR,{})})),HR=ga(({personaSessionId:e,localId:t,isScreenSharing:n,avatarOff:r,effect:i,animate:a})=>L(k,{children:[L(`div`,{class:`absolute inset-0 bg-base-200`}),i.content&&L(`div`,{class:`absolute overflow-hidden rounded-box bg-black`,style:RL(i.content,a),children:L(pg,{sessionId:n?t??``:e,type:`screenVideo`,fit:`contain`,className:`absolute inset-0 h-full w-full object-contain`})}),i.replica&&L(`div`,{class:EL(`absolute overflow-hidden`,i.replicaCollapsed&&`rounded-box`),style:RL(i.replica,a),children:L(eS,{personaSessionId:e,localSessionId:t,isScreenSharing:!1,avatarOff:r})})]})),UR=ga(()=>{let{effect:e,animate:t}=jL.value,n=$h();return n===null||e.selfView===null?null:L(`div`,{class:`absolute z-20 overflow-hidden rounded-box bg-black/30`,style:RL(e.selfView,t),children:L(pg,{automirror:!0,sessionId:n,type:`video`,fit:`cover`,className:`h-full w-full object-cover`})})}),WR=ga(({canvasRenderedSlot:e})=>{let t=KF(jL.value.effect);return t===`hidden`?null:t===`engine`?L(SR,{onError:zF,children:L(UR,{})}):e===`safe-area-bottom`?null:L(VR,{})}),GR=ga(()=>{let e=Yx()[0];return e?L(dg,{sessionId:e}):null}),KR=ga(e=>L(k,{children:[L(GR,{}),L(qR,{...e})]})),qR=ga(({isAudioOnly:e,presence:t,canvasLayoutEffect:n,canvasRenderedSlot:r})=>{let{presence:i,localId:a,isScreenSharing:o,isPersonaPresenting:s}=t,c=jL.value,l=n.active&&!o&&(!e||s);return i.phase===`left`?L(Bx,{}):i.phase===`connecting`?L(zx,{}):e&&!s?L(`div`,{class:`absolute inset-0 flex items-center justify-center`,children:L(Kx,{sessionId:i.replicaId})}):c.effect.driving?L(SR,{onError:zF,children:L(HR,{personaSessionId:i.replicaId,localId:a,isScreenSharing:o,avatarOff:i.videoState.isOff,effect:c.effect,animate:c.animate})}):s?L(BC,{personaSessionId:i.replicaId,isAudioOnly:e,avatarOff:i.videoState.isOff,canvasLayoutEffect:n,smartSidecarActive:l}):L(JR,{personaSessionId:i.replicaId,localId:a,isScreenSharing:o,avatarOff:i.videoState.isOff,smartSidecarActive:l,canvasLayoutEffect:n,canvasRenderedSlot:r})}),JR=ga(({personaSessionId:e,localId:t,isScreenSharing:n,avatarOff:r,smartSidecarActive:i,canvasLayoutEffect:a,canvasRenderedSlot:o})=>L(RC,{canvasLayoutEffect:a,smartSidecarActive:i,isScreenSharing:n,captureSnapshot:QR,personaMode:`auto`,renderedSlot:o,fill:i=>L(eS,{personaSessionId:e,localSessionId:t,isScreenSharing:n,avatarOff:r,videoRef:i})})),YR=ga(({items:e})=>{let[t,n]=j(!1),r=N(null);return M(()=>{if(!t)return;let e=e=>{r.current&&!e.composedPath().includes(r.current)&&n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,i)}},[t]),L(`div`,{ref:r,class:`relative`,children:[L(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-pressed":t,"aria-expanded":t,"aria-haspopup":`true`,"aria-label":t?`Close more controls`:`More controls`,class:`btn btn-control ${t?`btn-primary`:`btn-neutral`}`,children:L(fb,{name:`more`})}),t&&L(`div`,{role:`menu`,class:`absolute bottom-full mb-1 left-1/2 -translate-x-1/2 flex flex-row items-center gap-1 p-1 rounded-box bg-base-100 border border-base-300 shadow-lg z-30 whitespace-nowrap`,children:e})]})}),XR=ga(({items:e})=>e.length<=1?L(k,{children:e}):L(YR,{items:e})),ZR=ga(({onLeave:e})=>{let t=Hg(),{config:n}=mv(),{session:r,end:i}=Ex(),a=$h(),o=N(null),s=I(ry)?.frameRef??o,[c,l]=j(!1),u=Mb()===`full-screen`,[d,f]=j(!1),[p,m]=j(RR),[h,g]=j(null),_=wR(h!==null&&!c&&!u),v=N(null),y=N(null),b=r.value?.conversationUrl,x=n.value.customization.conversation,S=r.value?.magicGrid===!0,C=PF(x.magic_grid,S),w=ER(v,C,b),T=DR(v,y,72,C,b),E=x.modality===`audio`,D=TR(E),ee=x.modality===`chat`,te=x.modality===`video`,ne=x.enable_chat,re=x.enable_closed_captions,O=x.enable_picture_in_picture,{pipWindow:ie}=IR({enabled:O&&!ee,active:t===`joined-meeting`});M(()=>()=>{i()},[i]);let{camera:ae,requestCamera:k}=Rv(),{isCamMuted:A}=$b(),oe=ae.isGranted&&!A;M(()=>{te&&t===`joined-meeting`&&(LR.value=oe)},[te,t,oe]);let se=N(te&&!a&&LR.value===!0);M(()=>{t===`joined-meeting`&&se.current&&(se.current=!1,k())},[t,k]),M(()=>{(t===`left-meeting`||t===`error`)&&e()},[t,e]),M(()=>{let e=()=>{let e=s.current,t=e?.getRootNode(),n=t instanceof Document||t instanceof ShadowRoot?t:null;l(!!e&&n?.fullscreenElement===e)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let ce=F(()=>{let e=s.current;if(!e)return;let t=e.getRootNode();(t instanceof Document||t instanceof ShadowRoot?t:null)?.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.()},[]);F(()=>{f(e=>!e)},[]);let le=F(()=>{i()},[i]);if(kR({active:!ee&&t===`joined-meeting`,onTimeout:le}),jR({onShutdown:le}),!b)return null;if(ee)return L(Nx,{defaultOpen:!0,children:L(`div`,{class:`cvi-call-surface absolute inset-0`,children:L(Lx,{docked:!0,headerAction:L(`button`,{type:`button`,class:`btn btn-ghost btn-sm btn-circle text-base-content/60 hover:text-error`,onClick:le,"aria-label":`Leave conversation`,children:L(fb,{name:`leave`,size:20,"aria-label":`Leave conversation`})})})})});let ue=[L(Tx,{compact:!0},`screen-share`)];ne&&ue.push(L(Fx,{compact:!0},`chat`));let de=t===`left-meeting`;return L(Ox,{children:L(Nx,{children:L(cx,{children:[L(`div`,{class:`cvi-call-surface absolute inset-0${E?``:` cvi-video-surface`}`,ref:v,children:[L(`div`,{class:`relative w-full h-full z-[5]`,children:[L(KR,{isAudioOnly:E,presence:D,canvasLayoutEffect:p,canvasRenderedSlot:h}),!E&&L(WR,{canvasRenderedSlot:h}),L(iR,{debugEnabled:d,callPresence:D,callControlsVisible:w,callControlsRect:T,gridConfigEnabled:x.magic_grid,gridStartEnabled:S,onLayoutEffectChange:m,onRenderedSlotChange:g}),!u&&L(`div`,{class:`cvi-autohide absolute top-4 right-4 z-20`,"data-hidden":de,"data-pinned":_,children:L(Vx,{active:c,onToggle:ce,nudge:_,compact:!0})})]}),L(Lx,{}),L(jx,{}),L(`div`,{class:`cvi-autohide cvi-autohide-slide pointer-events-none absolute bottom-6 left-0 right-0 z-20`,"data-hidden":de,"aria-hidden":de,children:L(`div`,{class:`cvi-control-rail flex justify-center items-center gap-2 @max-mobile:gap-1`,"data-hidden":de,ref:y,children:[L(bx,{level:!0}),!E&&L(Sx,{}),re&&L(Ax,{}),L(XR,{items:ue}),L(`button`,{type:`button`,class:`btn btn-control btn-error`,onClick:le,"aria-label":`Leave call`,children:L(fb,{name:`leave`,"aria-label":`Leave Call`})})]})})]}),ie&&Na(L(Qx,{onLeave:le}),ie.document.body)]})})})});function QR(e){if(!e||e.readyState<2||!e.videoWidth||!e.videoHeight)return null;let t=document.createElement(`canvas`),n=Math.round(640*(e.videoHeight/e.videoWidth));t.width=640,t.height=n;let r=t.getContext(`2d`);if(!r)return null;r.drawImage(e,0,0,640,n);try{return t.toDataURL(`image/jpeg`,.82)}catch{return null}}function $R({message:e,class:t}){return L(`div`,{class:`w-max max-w-[min(20rem,80vw)] ${t??``}`,children:[L(`div`,{class:`px-4 py-2 rounded-box bg-neutral text-neutral-content text-sm font-medium shadow-lg text-center`,role:`status`,"aria-live":`polite`,children:e}),L(`svg`,{class:`absolute left-1/2 -translate-x-1/2 top-full text-neutral`,width:`16`,height:`8`,viewBox:`0 0 16 8`,"aria-hidden":`true`,children:L(`path`,{d:`M0 0 L8 8 L16 0 Z`,fill:`currentColor`})})]})}function ez(e,t,n){switch(t){case`granted`:return n?e?.cameraOptional??`Camera is optional — turn it on anytime.`:e?.ready??`You're all set — join whenever you're ready.`;case`blocked`:return e?.denied??`Microphone is blocked. Click the mic to see how to allow it.`;case`in-use`:return`Your microphone is in use by another app. Close it and try again.`;case`not-found`:return`No microphone found. Connect one to continue.`;case`unsupported`:return`This browser can't access your microphone.`;case`prompt`:return e?.prompt??`Allow microphone access to join.`;default:return e?.loading??`Getting your microphone ready...`}}var tz=ga(({text:e,isJoining:t=!1,onJoin:n,onCancel:r})=>{let i=hh(),{config:a}=mv(),{localSessionId:o,isCamMuted:s}=$b(),{mic:c,camera:l,requestMic:u,requestCamera:d}=Rv(),f=a.value.customization.conversation.modality===`video`,p=_b(a.value),m=gb(a.value);M(()=>{u()},[]);let h=c.isGranted,g=N(!1);M(()=>{!f||!h||g.current||l.isGranted||l.isBlocked||(g.current=!0,d())},[f,h,l.isGranted,l.isBlocked,d]);let _=f&&h&&!l.isGranted,v=ez(e,c.status,_);return L(cx,{children:L(`div`,{class:`absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]`,children:[l.isGranted&&!s?L(`div`,{class:`absolute inset-0 flex items-center justify-center bg-black overflow-hidden`,children:L(pg,{type:`video`,sessionId:o??``,mirror:!0,fit:`cover`,className:`w-full h-full object-cover!`})}):L(`div`,{class:`absolute inset-0 overflow-hidden bg-base-300`,children:[L(Sb,{variant:p.background,replica:m}),L(`div`,{class:`${Vb} backdrop-blur-xs`})]}),L(`div`,{class:`absolute bottom-6 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[90%]`,children:[v&&L($R,{message:v,class:`relative`}),L(`div`,{class:`flex flex-wrap items-center justify-center gap-1.5 @max-mobile:gap-1`,children:[L(`div`,{class:`flex items-center justify-center gap-1.5 shrink-0 @max-mobile:gap-1`,children:[L(bx,{level:!0}),f&&L(Sx,{})]}),L(Wb,{class:`btn-accent `,loading:t,disabled:!h,onClick:n,children:e?.join??`Join`}),L(`button`,{type:`button`,class:`btn btn-control ${c.isBlocked?`btn-error`:`btn-neutral`}`,onClick:()=>{i&&i.leave(),r?.()},"aria-label":e?.cancel??`Cancel`,title:e?.cancel??`Cancel`,children:L(fb,{name:`cancel`})})]})]})]})})}),nz=`Password required`,rz=`Enter the password to start this conversation.`,iz=`Password`,az=`Continue`;function oz({onSubmit:e,text:t,isSubmitting:n=!1,errorMessage:r}){let[i,a]=j(``),o=ct();return L(`div`,{class:`absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`${o}-title`,children:L(`form`,{onSubmit:t=>{t.preventDefault();let r=i.trim();!r||n||e(r)},class:`card bg-base-100 shadow-xl w-full max-w-sm`,children:L(`div`,{class:`card-body gap-3`,children:[L(`h3`,{id:`${o}-title`,class:`card-title text-base-content`,children:t?.title??nz}),L(`p`,{class:`text-sm text-base-content/70`,children:t?.description??rz}),L(`input`,{id:o,type:`password`,autocomplete:`current-password`,class:`input input-bordered w-full`,placeholder:t?.placeholder??iz,value:i,disabled:n,onInput:e=>a(e.target.value),autoFocus:!0}),r&&L(`p`,{class:`text-error text-xs`,role:`alert`,children:r}),L(Wb,{class:`btn-primary`,type:`submit`,disabled:!i.trim(),loading:n,children:t?.submit??az})]})})})}function sz({kind:e,status:t}){if(e===`camera`)return`Allow camera access to use video. Camera is optional.`;switch(t){case`blocked`:return`Microphone is blocked. Allow access in your browser settings to continue.`;case`in-use`:return`Your microphone is in use by another app. Close it and try again.`;case`not-found`:return`No microphone found. Connect one to continue.`;case`unsupported`:return`This browser can't access your microphone.`;default:return`Allow microphone access to start the conversation.`}}function cz({text:e,onStart:t,isStarting:n,permissionRequest:r}){let{config:i,deploymentId:a}=mv(),o=Mb()===`full-screen`,s=I(J_),c=_b(i.value),l=c.btn_title??e?.fallback_button??`Start the conversation`,u=i.value.customization.terms_content?.trim()??``,d=i.value.customization.terms_enabled===!0,f=u.length>0,p=f&&d,m=P(()=>p&&w_(a,u),[p,a,u]),h=p&&!m,g=i.value.has_password===!0,_=s?.password.value??null,v=g&&!_,y=ct(),[b,x]=j(m),S=n||p&&!b||v;return L(Ub,{title:c.title,description:c.description,overlay:v&&s?L(oz,{onSubmit:s.setPassword}):null,children:[L(`div`,{class:`relative`,children:[r&&L($R,{message:sz(r),class:`absolute bottom-full mb-3 z-20 ${o?`left-1/2 -translate-x-1/2`:`right-0`}`}),L(qb,{onClick:()=>{p&&b&&!m&&D_(a,u),t()},disabled:S,loading:n,children:l})]}),f&&L(`div`,{class:`max-w-xs text-center`,children:h?L(`label`,{for:y,class:`flex items-center gap-2 text-xs text-left cursor-pointer`,children:[L(`input`,{id:y,type:`checkbox`,class:`checkbox checkbox-secondary checkbox-xs mt-0.5 shrink-0`,checked:b,onChange:e=>x(e.target.checked)}),L(`span`,{class:`leading-snug`,children:u})]}):L(`p`,{class:`text-xs leading-snug text-white/70`,children:u})})]})}function lz(...e){for(let t of e){let e=t?.trim();if(e)return e}}function uz(){let{config:e}=mv(),{haircheck:t}=e.value.customization;return P(()=>({prompt:lz(t.permission_request_description,t.permission_request_title),ready:lz(t.permission_granted_description,t.permission_granted_title),denied:lz(t.permission_denied_description,t.permission_denied_title),join:lz(t.join_button),cancel:lz(t.cancel_btn)}),[t])}function dz({flow:e,welcomeText:t,onUnavailableCancel:n}){let r=uz();switch(e.state){case`idle`:return L(cz,{text:t,onStart:()=>{e.start()},isStarting:e.isStarting,permissionRequest:e.permissionRequest});case`haircheck`:return L(tz,{text:r,onJoin:()=>{e.join()},onCancel:()=>e.cancel(),isJoining:e.isStarting});case`call`:return L(ZR,{onLeave:()=>e.leave()});case`ended`:return L(Qb,{isStarting:e.isStarting,onRestart:()=>{e.start()}});case`unavailable`:return L(Ab,{cause:e.unavailableCause??`busy`,canRetry:e.canRetry,onRetry:()=>{e.start()},onCancel:n});default:{let t=e.state;throw Error(`Unreachable flow state: ${String(t)}`)}}}var fz=Ae(null);function pz({children:e}){let{config:t}=I(_i),n=t.peek().customization?.widget,r=n?.expandable??`default`,i=on(r===`start-expanded`||r===`always`),a=on(n?.variant??`full`),o=on(n?.position??`bottom-right`),s=on(r),c=on(n?.avatar?.type??`orb`),l=N(r);pn(()=>{let e=t.value.customization?.widget,n=e?.expandable??`default`;a.value=e?.variant??`full`,o.value=e?.position??`bottom-right`,s.value=n,c.value=e?.avatar?.type??`orb`,l.current!==n&&(i.value=n===`start-expanded`||n===`always`,l.current=n)});let u=F(()=>{s.peek()!==`always`&&(i.value=!i.peek())},[i,s]),d=F(()=>{i.value=!0},[i]),f=F(()=>{s.peek()!==`always`&&(i.value=!1)},[i,s]),p=I(fv);pn(()=>{p&&(p.hostVisible.value=i.value)});let m=I(h_),h=m?.flowSignal.value??`idle`,g=m?.isStarting??!1;M(()=>{(g||h===`haircheck`||h===`call`)&&(i.value=!0)},[g,h,i]);let _=I(Uv)?.shadowHost.value??null;M(()=>{if(_)return Object.assign(_,{open:d,close:f}),()=>{delete _.open,delete _.close}},[_,d,f]);let v=P(()=>({expanded:i,variant:a,position:o,expandable:s,avatarType:c,toggle:u,expand:d,collapse:f}),[i,a,o,s,c,u,d,f]);return L(fz.Provider,{value:v,children:e})}function mz(){let{config:e}=mv(),t=e.value.customization.branding;return e.value.show_tavus_branding!==!1&&!t?.hide_tavus_badge?L(hz,{}):t?.logo||t?.text?L(gz,{logo:t.logo,text:t.text}):null}function hz(){let{isDark:e}=PP(),t=e.value?`white`:`#140206`;return L(`a`,{href:`https://tavus.io`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center gap-1 text-xs text-base-content/50 hover:text-base-content/80 transition-colors`,children:[L(`svg`,{viewBox:`0 0 488 452`,class:`h-2.5 w-2.5 shrink-0`,fill:`none`,"aria-hidden":`true`,children:[L(`path`,{d:`M160 152V208H104V152H160Z`,fill:t}),L(`path`,{"fill-rule":`evenodd`,"clip-rule":`evenodd`,d:`M488 270.5L436 285L451 326L418.766 346L441 360L423 392L435 452H0V0H394.766L488 270.5ZM24 24V428H216.2L209 392L227 360L204.766 346L237 326L222 285L274 270.5L189.038 24H24ZM352 152C336.536 152 324 164.536 324 180C324 195.464 336.536 208 352 208C367.464 208 380 195.464 380 180C380 164.536 367.464 152 352 152Z`,fill:t})]}),L(`span`,{children:[`Powered by `,L(`span`,{class:`underline`,children:`Tavus`})]})]})}function gz({logo:e,text:t}){return L(`div`,{class:`inline-flex items-center gap-1 text-xs text-base-content/50`,children:[e?L(`img`,{src:e,alt:t||`Branding`,class:`h-2.5 shrink-0`}):null,t?L(`span`,{children:t}):null]})}var _z={title:`Hi! Want to chat?`,btn_title:`Start conversation`};function vz(){let{config:e}=mv(),t=e.value.customization.widget?.text;return P(()=>({title:t?.title||_z.title,btn_title:t?.btn_title||_z.btn_title}),[t])}function yz(){let e=I(fz);if(!e)throw Error(`useWidgetUI must be used within WidgetUIProvider`);return e}var bz={xs:`w-6 h-6`,sm:`w-8 h-8`,md:`w-10 h-10`,lg:`w-16 h-16`},xz={xs:`w-3 h-3`,sm:`w-4 h-4`,md:`w-5 h-5`,lg:`w-8 h-8`};function Sz({size:e=`md`,className:t=``}){let{avatarType:n}=yz(),{config:r}=mv(),i=gb(r.value);return(_b(r.value).background.type===`replica`||n.value===`image`)&&i?L(`div`,{class:`relative ${bz[e]} rounded-box overflow-hidden bg-base-300 ${t}`,children:L(xb,{replica:i})}):L(`div`,{class:`relative ${bz[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,children:L(`span`,{class:`${xz[e]} rounded-full bg-primary animate-pulse`})})}function Cz({variant:e}){let{toggle:t}=yz(),n=vz();return e===`tiny`?L(`button`,{type:`button`,onClick:t,"aria-label":n.btn_title,class:`rounded-box overflow-hidden shadow-xl hover:shadow-2xl transition-shadow cursor-pointer`,children:L(Sz,{size:`lg`})}):e===`compact`?L(`button`,{type:`button`,onClick:t,"aria-label":n.btn_title,class:`group flex items-center gap-2.5 py-2.5 pl-2.5 pr-8 rounded-box bg-base-100 text-base-content border border-base-300 shadow-lg hover:shadow-xl transition-shadow cursor-pointer text-left`,children:[L(Sz,{size:`md`}),L(`span`,{class:`flex flex-col gap-0.5`,children:[L(`span`,{class:`text-base font-medium leading-tight`,children:n.title}),L(`span`,{class:`text-sm text-base-content/60 leading-tight`,children:n.btn_title})]})]}):L(`button`,{type:`button`,onClick:t,"aria-label":n.btn_title,class:`flex flex-col gap-3 p-3 w-64 rounded-box bg-base-100 text-base-content border border-base-300 shadow-xl hover:shadow-2xl transition-shadow cursor-pointer text-left`,children:[L(`div`,{class:`flex items-center gap-2.5`,children:[L(Sz,{size:`md`}),L(`span`,{class:`text-sm font-medium leading-snug`,children:n.title})]}),L(`span`,{class:`btn btn-primary btn-sm w-full pointer-events-none gap-2 flex items-center`,children:[L(fb,{name:`cam`,size:16}),L(`span`,{className:`leading-4`,children:n.btn_title})]})]})}var wz=`tavus:widget:greeting-dismissed`;function Tz({anchor:e}){let t=vz(),{variant:n,expand:r}=yz(),[i,a]=j(!1);M(()=>{if(n.value===`tiny`){try{if(sessionStorage.getItem(wz)===`1`)return}catch{}a(!0)}},[n]);let o=F(e=>{e.stopPropagation();try{sessionStorage.setItem(wz,`1`)}catch{}a(!1)},[]);if(!i)return null;let s=e===`right`?`right-[-6px] border-r border-b`:`left-[-6px] border-l border-t`,c=e===`right`?`-right-2`:`-left-2`;return L(`button`,{type:`button`,onClick:r,class:`relative max-w-56 rounded-box bg-base-100 text-base-content shadow-lg border border-base-300 px-3 py-2 text-sm text-left cursor-pointer animate-[tavusFadeUp_240ms_ease-out] hover:bg-base-200 transition-colors`,children:[L(`p`,{class:`leading-snug pr-3`,children:t.title}),L(`span`,{role:`button`,tabIndex:0,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&o(e)},class:`absolute -top-2 ${c} btn btn-ghost btn-circle btn-xs bg-base-100 border border-base-300 shadow-sm`,"aria-label":`Dismiss`,children:`×`}),L(`span`,{class:`absolute bottom-3 w-3 h-3 rotate-45 bg-base-100 border-base-300 ${s}`})]})}function Ez(){let e=I(Uv);if(!e)throw Error(`useHostBridge must be used within HostBridgeProvider`);return e}var Dz=`bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]`,Oz=`bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]`,kz=`p-1 flex-1 min-h-0`,Az=`p-1 flex-1 min-h-0`;function jz({variant:e,children:t,onClose:n,fullscreen:r}){let{expandable:i}=yz(),a=i.value!==`always`;return r?L(`div`,{class:Oz,children:[L(`div`,{class:`flex items-center justify-end gap-2 px-2.5 py-1.5 border-b border-base-300`,children:a&&L(`button`,{type:`button`,class:`btn btn-ghost btn-circle btn-xs`,onClick:n,"aria-label":`Close`,children:L(fb,{name:`close`,size:14})})}),L(`div`,{class:Az,children:t}),L(`div`,{class:`flex justify-end px-2.5`,children:L(mz,{})})]}):L(`div`,{class:`flex flex-col h-[min(34rem,calc(100dvh-3rem))]`,children:[L(`div`,{class:`${Dz} flex-1 overflow-hidden`,children:[L(`div`,{class:`flex items-center justify-end gap-2 px-2.5 pt-1.5 shrink-0`,children:a&&L(`button`,{type:`button`,class:`btn btn-ghost btn-circle btn-xs`,onClick:n,"aria-label":`Close`,children:L(fb,{name:`close`,size:14})})}),L(`div`,{class:kz,children:t})]}),L(`div`,{class:`flex justify-end pr-2 pt-1.5 shrink-0`,children:L(mz,{})})]})}var Mz=mn(`Widget`),Nz=`1rem`,Pz=480;function Fz(e,t,n){let r=e.state===`call`,i=r||e.state===`haircheck`||e.isStarting;e.cancel(),r&&e.leave(),i&&t(),n()}function Iz(){return typeof window>`u`?!1:window.innerWidth<=Pz}function Lz(e){switch(e){case`bottom-right`:return{bottom:Nz,right:Nz};case`bottom-left`:return{bottom:Nz,left:Nz};case`top-right`:return{top:Nz,right:Nz};case`top-left`:return{top:Nz,left:Nz};case`top`:return{top:Nz,left:`50%`,transform:`translateX(-50%)`};case`bottom`:return{bottom:Nz,left:`50%`,transform:`translateX(-50%)`}}}var Rz=[`top`,`bottom`,`left`,`right`,`transform`];function zz(e){return e===`bottom-left`||e===`top-left`?`left`:`right`}function Bz(){let{config:e,initError:t}=mv(),n=vz(),{expanded:r,position:i,variant:a,collapse:o}=yz(),{end:s}=Ex(),{shadowHost:c}=Ez(),l=jb(),u=on(Iz());M(()=>{if(typeof window>`u`)return;u.value=Iz();let e=()=>{u.value=Iz()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[u]);let d=P(()=>({fallback_button:n.btn_title}),[n.btn_title]),f=F(()=>{Fz(l,s,o)},[l,s,o]);if(pn(()=>{let e=c.value,t=i.value,n=r.value,a=n&&u.value;if(e){if(a)e.style.top=`0`,e.style.right=`0`,e.style.bottom=`0`,e.style.left=`0`,e.style.transform=``;else{let n=Lz(t);for(let t of Rz)e.style[t]=n[t]??``}e.dataset.tavusWidgetPosition=t,e.dataset.tavusWidgetExpanded=n?`true`:`false`,e.dataset.tavusWidgetFullscreen=a?`true`:`false`,e.dataset.tavusWidgetSmall=u.value?`true`:`false`}}),t.value)return Mz.error(`Widget cannot initialize (init request failed):`,t.value),null;if(e.value.is_available===!1&&e.value.unavailable_reason===`total_limit`)return Mz.error(`Widget is unavailable (total_limit reached) — not rendering`),null;if(!r.value){let e=zz(i.value),t=e===`right`?`flex items-end gap-2 justify-end`:`flex items-end gap-2 flex-row-reverse justify-end`,n=e===`right`?`justify-end pr-2`:`justify-start pl-2`;return L(`div`,{class:`flex flex-col`,children:[L(`div`,{class:t,children:[L(Tz,{anchor:e}),L(Cz,{variant:a.value})]}),L(`div`,{class:`flex ${n} pt-1.5`,children:L(mz,{})})]})}return e.value.is_available===!1?L(jz,{variant:a.value,fullscreen:u.value,onClose:f,children:L(iy,{children:L(Ab,{cause:e.value.unavailable_reason??`daily_limit`,canRetry:!1,onRetry:()=>{}})})}):L(jz,{variant:a.value,fullscreen:u.value,onClose:f,children:L(iy,{children:L(dz,{flow:l,welcomeText:d,onUnavailableCancel:()=>l.restart()})})})}var Vz=`:host {
|
|
164
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:J().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:J().optional().describe(`User's timezone in IANA format.`),userAgent:J().optional().describe(`Host application identifier.`),platform:Yk([Z(`web`),Z(`desktop`),Z(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:X({touch:Uk().optional().describe(`Whether the device supports touch input.`),hover:Uk().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:X({top:Vk().describe(`Top safe area inset in pixels.`),right:Vk().describe(`Right safe area inset in pixels.`),bottom:Vk().describe(`Bottom safe area inset in pixels.`),left:Vk().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();X({method:Z(`ui/notifications/host-context-changed`),params:OP.describe(`Partial context update containing only changed fields.`)});var kP=X({method:Z(`ui/update-model-context`),params:X({content:Y(nN).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:Qk(J(),Kk().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),AP=X({method:Z(`ui/initialize`),params:X({appInfo:Kj.describe(`App identification (name and version).`),appCapabilities:SP.describe(`Features and capabilities this app provides.`),protocolVersion:J().describe(`Protocol version this app supports.`)})});X({protocolVersion:J().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Kj.describe(`Host application identification and version.`),hostCapabilities:xP.describe(`Features and capabilities provided by the host.`),hostContext:OP.describe(`Rich context about the host environment.`)}).passthrough();var jP=[sP],MP=class extends oP{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_baseReplaceRequestHandler=this.replaceRequestHandler;replaceRequestHandler=(e,t)=>{this._baseReplaceRequestHandler(e,(e,n)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${e.method}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),t(e,n)))};eventSchemas={sizechange:hP,sandboxready:fP,initialized:CP,requestteardown:bP,loggingmessage:yN};constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._capabilities=n,this.addEventListener(`initialized`,()=>{this._initializedReceived=!0}),this._hostContext=r?.hostContext||{},this.setRequestHandler(AP,e=>this._oninitialize(e)),this.setRequestHandler(nM,(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler(wP,e=>({mode:this._hostContext.displayMode??`inline`}))}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler(`sizechange`)}set onsizechange(e){this.setEventHandler(`sizechange`,e)}get onsandboxready(){return this.getEventHandler(`sandboxready`)}set onsandboxready(e){this.setEventHandler(`sandboxready`,e)}get oninitialized(){return this.getEventHandler(`initialized`)}set oninitialized(e){this.setEventHandler(`initialized`,e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced(`onmessage`,this._onmessage,e),this._onmessage=e,this.replaceRequestHandler(DP,async(e,t)=>{if(!this._onmessage)throw Error(`No onmessage handler set`);return this._onmessage(e.params,t)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced(`onopenlink`,this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler(dP,async(e,t)=>{if(!this._onopenlink)throw Error(`No onopenlink handler set`);return this._onopenlink(e.params,t)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced(`ondownloadfile`,this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler(EP,async(e,t)=>{if(!this._ondownloadfile)throw Error(`No ondownloadfile handler set`);return this._ondownloadfile(e.params,t)})}get onrequestteardown(){return this.getEventHandler(`requestteardown`)}set onrequestteardown(e){this.setEventHandler(`requestteardown`,e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced(`onrequestdisplaymode`,this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler(wP,async(e,t)=>{if(!this._onrequestdisplaymode)throw Error(`No onrequestdisplaymode handler set`);return this._onrequestdisplaymode(e.params,t)})}get onloggingmessage(){return this.getEventHandler(`loggingmessage`)}set onloggingmessage(e){this.setEventHandler(`loggingmessage`,e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced(`onupdatemodelcontext`,this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler(kP,async(e,t)=>{if(!this._onupdatemodelcontext)throw Error(`No onupdatemodelcontext handler set`);return this._onupdatemodelcontext(e.params,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(pN,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}set oncreatesamplingmessage(e){this.setRequestHandler(DN,async(t,n)=>e(t.params,n))}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced(`onlistresources`,this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler(kM,async(e,t)=>{if(!this._onlistresources)throw Error(`No onlistresources handler set`);return this._onlistresources(e.params,t)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced(`onlistresourcetemplates`,this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler(jM,async(e,t)=>{if(!this._onlistresourcetemplates)throw Error(`No onlistresourcetemplates handler set`);return this._onlistresourcetemplates(e.params,t)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced(`onreadresource`,this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler(FM,async(e,t)=>{if(!this._onreadresource)throw Error(`No onreadresource handler set`);return this._onreadresource(e.params,t)})}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced(`onlistprompts`,this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler(KM,async(e,t)=>{if(!this._onlistprompts)throw Error(`No onlistprompts handler set`);return this._onlistprompts(e.params,t)})}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}assertTaskCapability(e){throw Error(`Tasks are not supported in MCP Apps`)}assertTaskHandlerCapability(e){throw Error(`Task handlers are not supported in MCP Apps`)}getCapabilities(){return this._capabilities}async _oninitialize(e){let t=e.params.protocolVersion;return this._appInfo!==void 0&&console.warn(`[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.`),this._appCapabilities=e.params.appCapabilities,this._appInfo=e.params.appInfo,{protocolVersion:jP.includes(t)?t:sP,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];NP(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},vP,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:`tools/call`,params:e},dN,t)}listTools(e,t){return this.request({method:`tools/list`,params:e},uN,t)}async connect(e){if(this.transport)throw Error(`AppBridge is already connected. Call close() before connecting again.`);if(this._initializedReceived=!1,this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},dN,{signal:t.signal}),e.tools.listChanged&&this._client.setNotificationHandler(mN,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},AM,{signal:t.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},MM,{signal:t.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},IM,{signal:t.signal}),e.resources.listChanged&&this._client.setNotificationHandler(LM,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},qM,{signal:t.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(aN,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function NP(e,t){return JSON.stringify(e)===JSON.stringify(t)}function PP(){let e=I(Kv);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}var FP={committedClass:null,pendingClass:null,pendingSinceMs:null,lastResolution:null},IP={classes:{widthCompactMaxPx:767,widthMediumMaxPx:1023,heightShortMaxPx:479},hysteresis:{windowMs:250,decisiveJumpPxDelta:200},rail:{widthPx:448,insetPx:16,gutterPx:24},sidecar:{minViewportWidthPx:900,maxVideoShiftPx:360,maxVideoShiftFraction:.3},card:{maxHeightPx:720,reportedHeightFloorPx:48,coldDefaultHeightPx:320,minDisplayScale:.85,layoutDefaultMinHeightPx:240,stackBandMaxFraction:.6,stackMaxWidthPx:600,componentOverrides:{}},content:{stackedAspect:16/9},pip:{gapPaddingPx:24,minWidthPx:128,maxAreaRatio:.35},motion:{layoutTransitionMs:560},insets:{callControlsBottomPx:72,participantsPadPx:16,cardsPadPx:16,surfacePadPx:16,compactCardsPadPx:8,compactSurfacePadPx:8},eviction:{policy:`evict-oldest`,maxVisibleCards:2,compactTakeoverMaxCards:1},degradationLadder:[`evict-cards`,`drop-self-view`,`collapse-replica`]};function LP(e,t){let n=Math.round(e.widthPx),r=Math.round(e.heightPx);return{width:n<=t.classes.widthCompactMaxPx?`compact`:n<=t.classes.widthMediumMaxPx?`medium`:`expanded`,height:r<=t.classes.heightShortMaxPx?`short`:`regular`}}var RP={idle:{id:`idle`,regions:[]},"conversation-full":{id:`conversation-full`,regions:[{name:`stage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.72},width:{fraction:.24},height:{fraction:.24},accepts:[`selfView`],zBase:100}]},"canvas-rail":{id:`canvas-rail`,soloVariant:`canvas-solo`,regions:[{name:`stage`,x:{px:0},y:{px:0},width:{fraction:.62},height:{fraction:1},accepts:[`replica`],zBase:0},{name:`rail`,x:{px:-448},y:{px:0},width:{px:448},height:{fraction:1},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.38},y:{fraction:.72},width:{fraction:.2},height:{fraction:.24},accepts:[`selfView`],zBase:100}]},"canvas-stack":{id:`canvas-stack`,soloVariant:`canvas-solo`,regions:[{name:`canvasBand`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.38},accepts:[`card`],zBase:0},{name:`stage`,x:{fraction:0},y:{fraction:.38},width:{fraction:1},height:{fraction:.62},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.76},width:{fraction:.24},height:{fraction:.2},accepts:[`selfView`],zBase:100}]},"canvas-sheet":{id:`canvas-sheet`,soloVariant:`canvas-solo`,regions:[{name:`stage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.55},accepts:[`replica`],zBase:0},{name:`canvasSheet`,x:{fraction:0},y:{fraction:.55},width:{fraction:1},height:{fraction:.45},accepts:[`card`],zBase:10},{name:`pip`,x:{fraction:.66},y:{fraction:.33},width:{fraction:.3},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"content-columns":{id:`content-columns`,soloVariant:`content-solo`,regions:[{name:`replicaColumn`,x:{fraction:0},y:{fraction:0},width:{fraction:.25},height:{fraction:1},accepts:[`replica`,`selfView`],zBase:0},{name:`contentStage`,x:{fraction:.25},y:{fraction:0},width:{fraction:.75},height:{fraction:1},accepts:[`content`],zBase:0},{name:`pip`,x:{fraction:.02},y:{fraction:.76},width:{fraction:.2},height:{fraction:.2},accepts:[`selfView`],zBase:100}]},"content-stack":{id:`content-stack`,soloVariant:`content-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.62},accepts:[`content`],zBase:0},{name:`replicaBand`,x:{fraction:0},y:{fraction:.62},width:{fraction:1},height:{fraction:.38},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.74},width:{fraction:.24},height:{fraction:.22},accepts:[`selfView`],zBase:100}]},"content-stack-compact":{id:`content-stack-compact`,soloVariant:`content-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.58},accepts:[`content`],zBase:0},{name:`replicaStrip`,x:{fraction:0},y:{fraction:.58},width:{fraction:1},height:{fraction:.42},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.66},y:{fraction:.78},width:{fraction:.3},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"content-sheet-compact":{id:`content-sheet-compact`,soloVariant:`content-sheet-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.58},accepts:[`content`],zBase:0},{name:`replicaStrip`,x:{fraction:0},y:{fraction:.58},width:{fraction:1},height:{fraction:.42},accepts:[`replica`],zBase:0},{name:`cardSheet`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`card`],zBase:100},{name:`pip`,x:{fraction:.66},y:{fraction:.78},width:{fraction:.3},height:{fraction:.18},accepts:[`selfView`],zBase:110}]},"content-rail":{id:`content-rail`,soloVariant:`content-rail-solo`,regions:[{name:`replicaColumn`,x:{fraction:0},y:{fraction:0},width:{fraction:.22},height:{fraction:1},accepts:[`replica`,`selfView`],zBase:0},{name:`contentStage`,x:{fraction:.22},y:{fraction:0},width:{fraction:.48},height:{fraction:1},accepts:[`content`],zBase:0},{name:`rail`,x:{px:-448},y:{px:0},width:{px:448},height:{fraction:1},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.02},y:{fraction:.78},width:{fraction:.18},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"content-stack-canvas":{id:`content-stack-canvas`,soloVariant:`content-sheet-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.5},accepts:[`content`],zBase:0},{name:`replicaBand`,x:{fraction:0},y:{fraction:.5},width:{fraction:1},height:{fraction:.22},accepts:[`replica`],zBase:0},{name:`canvasBand`,x:{fraction:0},y:{fraction:.72},width:{fraction:1},height:{fraction:.28},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.72},y:{fraction:.52},width:{fraction:.24},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"canvas-takeover-columns":{id:`canvas-takeover-columns`,soloVariant:`canvas-solo`,regions:[{name:`replicaColumn`,x:{fraction:0},y:{fraction:0},width:{fraction:.24},height:{fraction:1},accepts:[`replica`,`selfView`],zBase:0},{name:`canvasStage`,x:{fraction:.24},y:{fraction:0},width:{fraction:.76},height:{fraction:1},accepts:[`card`],zBase:0},{name:`pip`,x:{fraction:.02},y:{fraction:.78},width:{fraction:.18},height:{fraction:.18},accepts:[`selfView`],zBase:100}]},"canvas-takeover-strip":{id:`canvas-takeover-strip`,soloVariant:`canvas-solo`,regions:[{name:`canvasStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.78},accepts:[`card`],zBase:0},{name:`replicaStrip`,x:{fraction:0},y:{fraction:.78},width:{fraction:1},height:{fraction:.22},accepts:[`replica`],zBase:0},{name:`pip`,x:{fraction:.66},y:{fraction:.8},width:{fraction:.3},height:{fraction:.16},accepts:[`selfView`],zBase:100}]},"canvas-solo":{id:`canvas-solo`,regions:[{name:`canvasStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`card`],zBase:0}]},"content-solo":{id:`content-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:1},accepts:[`content`],zBase:0}]},"content-rail-solo":{id:`content-rail-solo`,regions:[{name:`contentStage`,x:{px:0},y:{px:0},width:{fraction:1},height:{fraction:1},accepts:[`content`],zBase:0},{name:`rail`,x:{px:-448},y:{px:0},width:{px:448},height:{fraction:1},accepts:[`card`],zBase:0}]},"content-sheet-solo":{id:`content-sheet-solo`,regions:[{name:`contentStage`,x:{fraction:0},y:{fraction:0},width:{fraction:1},height:{fraction:.62},accepts:[`content`],zBase:0},{name:`canvasBand`,x:{fraction:0},y:{fraction:.62},width:{fraction:1},height:{fraction:.38},accepts:[`card`],zBase:10}]}},zP={idle:{compact:{short:`idle`,regular:`idle`},medium:{short:`idle`,regular:`idle`},expanded:{short:`idle`,regular:`idle`}},conversation:{compact:{short:`conversation-full`,regular:`conversation-full`},medium:{short:`conversation-full`,regular:`conversation-full`},expanded:{short:`conversation-full`,regular:`conversation-full`}},"conversation-canvas":{compact:{short:`canvas-sheet`,regular:`canvas-sheet`},medium:{short:`canvas-rail`,regular:`canvas-stack`},expanded:{short:`canvas-rail`,regular:`canvas-rail`}},"content-focus":{compact:{short:`content-stack-compact`,regular:`content-stack-compact`},medium:{short:`content-columns`,regular:`content-stack`},expanded:{short:`content-columns`,regular:`content-columns`}},"content-plus-canvas":{compact:{short:`content-sheet-compact`,regular:`content-sheet-compact`},medium:{short:`content-rail`,regular:`content-stack-canvas`},expanded:{short:`content-rail`,regular:`content-rail`}},"canvas-dominant":{compact:{short:`canvas-takeover-strip`,regular:`canvas-takeover-strip`},medium:{short:`canvas-takeover-columns`,regular:`canvas-takeover-columns`},expanded:{short:`canvas-takeover-columns`,regular:`canvas-takeover-columns`}}};function BP(e,t,n=RP,r=zP,i=!0){let a=r[e][t.width][t.height],o=n[a];if(!o)throw Error(`Template matrix references missing template id: ${a}`);if(!i&&o.soloVariant!==void 0){let e=n[o.soloVariant];if(!e)throw Error(`soloVariant references missing template id: ${o.soloVariant}`);return e}return o}function VP(e,t,n){let r=[],{prefs:i}=e,a=e.userShare?`userShare`:e.presentation?`presentation`:null,o=e.cards.length>0,s=t.width===`compact`;return i.pipCorner!==void 0&&s&&r.push(`pipCorner`),a===null?(i.expandCanvas&&!o&&r.push(`expandCanvas`),o&&(i.expandCanvas||s)?{state:`canvas-dominant`,suppressedPrefs:r,contentKind:null}:o?{state:`conversation-canvas`,suppressedPrefs:r,contentKind:null}:e.replica||e.selfView?{state:`conversation`,suppressedPrefs:r,contentKind:null}:{state:`idle`,suppressedPrefs:r,contentKind:null}):(i.expandCanvas&&r.push(`expandCanvas`),{state:o?`content-plus-canvas`:`content-focus`,suppressedPrefs:r,contentKind:a})}var HP={alert:{minWidthPx:220,sizeClass:()=>`S`,estimateHeightPx:e=>e.charCount===void 0?120:Math.min(400,Math.round(90+e.charCount*.26))},input:{minWidthPx:220,sizeClass:()=>`S`,estimateHeightPx:()=>182},question:{minWidthPx:240,sizeClass:e=>{let t=e.optionCount??4;return t<=2?`S`:t>=10?`L`:`M`},estimateHeightPx:e=>{let t=e.optionCount??4;return 72+t*48+(t-1)*8+64}},text:{minWidthPx:220,sizeClass:e=>(e.charCount??400)>1500?`L`:`M`,estimateHeightPx:e=>{let t=e.charCount??400,n=Math.max(1,e.widthPx/8);return Math.max(100,Math.round(t/n*22+40))}},chart:{minWidthPx:260,sizeClass:()=>`M`,estimateHeightPx:e=>Math.round(e.widthPx*(260/480))+90},calendar:{minWidthPx:320,sizeClass:e=>e.slotCount===void 0?`M`:`L`,estimateHeightPx:e=>e.slotCount===void 0?470:64+e.slotCount*48},image:{minWidthPx:240,sizeClass:()=>`M`,estimateHeightPx:e=>Math.round((Math.min(e.widthPx,520)-36)*(9/16))+95+((e.imageCount??1)>1?44:0)},scheduling_embed:{minWidthPx:320,hardMinHeightPx:640,sizeClass:()=>`L`,estimateHeightPx:()=>640}},UP={minWidthPx:240,sizeClass:()=>`M`,estimateHeightPx:e=>e.coldDefaultHeightPx??320},WP=`canvas.`;function GP(e){return e.startsWith(WP)?e.slice(7):e}function KP(e,t){let n=GP(e),r=HP[n]??UP,i=t?.[n]??t?.[e];return i===void 0?r:{...r,minWidthPx:i.minWidthPx??r.minWidthPx,...i.hardMinHeightPx===void 0?r.hardMinHeightPx===void 0?{}:{hardMinHeightPx:r.hardMinHeightPx}:{hardMinHeightPx:i.hardMinHeightPx}}}Object.keys(HP);function qP(e,t,n){let r=KP(e,n),i=(t.naturalHeightPx!==void 0&&Number.isFinite(t.naturalHeightPx)?t.naturalHeightPx:void 0)??r.estimateHeightPx(t),a=r.hardMinHeightPx===void 0?i:Math.max(r.hardMinHeightPx,i);return{sizeClass:r.sizeClass(t),minWidthPx:r.minWidthPx,naturalHeightPx:Math.round(a),hardMinHeightPx:r.hardMinHeightPx}}function JP(e,t){let n=GP(e);return HP[n]===void 0?(t?.[n]??t?.[e])?.hardMinHeightPx:KP(e,t).hardMinHeightPx}function YP(e,t){return KP(e,t).minWidthPx}function XP(e,t){let n=Number.isFinite(e)?e:t.card.coldDefaultHeightPx;return Math.min(t.card.maxHeightPx,Math.max(t.card.reportedHeightFloorPx,Math.round(n)))}function ZP(e,t,n){if(t>=e)return{kind:`natural`};if(t<=0||e<=0)return{kind:`scroll`};let r=t/e;return r>=n.card.minDisplayScale?{kind:`scaled`,factor:r}:{kind:`scroll`}}function QP(e,t){return e.width>0&&e.height>0&&t.width>0&&t.height>0&&e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function $P(e,t){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function eF(e,t,n){let r=[],i=e.find(e=>e.kind===`replica`),a=e=>e.kind===`selfView`&&e.layer===`overlay`&&i!==void 0&&$P(i.rect,e.rect),o=e=>e.kind===`card`&&e.layer===`overlay`&&e.sheet===!0;for(let a of e){let e=a.rect;if(Number.isInteger(e.x)&&Number.isInteger(e.y)&&Number.isInteger(e.width)&&Number.isInteger(e.height)||r.push({kind:`bounds`,tileId:a.id,message:`${a.id} has non-integer coordinates`}),(e.x<0||e.y<0||e.width<0||e.height<0||e.x+e.width>t.width||e.y+e.height>t.height)&&r.push({kind:`bounds`,tileId:a.id,message:`${a.id} rect exceeds the container`}),a.layer===`overlay`&&a.kind!==`selfView`&&!o(a)&&r.push({kind:`overlay-legality`,tileId:a.id,message:`only selfView or a sheet card may ride the overlay layer, got ${a.kind}`}),a.kind===`selfView`&&a.layer===`overlay`&&i!==void 0&&!$P(i.rect,a.rect)&&r.push({kind:`overlay-legality`,tileId:a.id,message:`selfView escapes the replica rect`}),(a.kind===`content`||a.kind===`replica`)&&(e.width<48||e.height<48)&&r.push({kind:`degenerate-surface`,tileId:a.id,message:`${a.kind} tile ${a.id} is ${e.width}x${e.height}px, below the 48px visible floor`}),a.kind===`card`){a.fit.kind===`scaled`&&(a.fit.factor<n.card.minDisplayScale||a.fit.factor>1)&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} scaled to ${a.fit.factor}, outside [${n.card.minDisplayScale}, 1]`}),e.height<n.card.reportedHeightFloorPx&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} box ${e.height}px is below the ${n.card.reportedHeightFloorPx}px report floor`});let t=a.component===void 0?void 0:JP(a.component,n.card.componentOverrides);t!==void 0&&e.height<t&&a.fit.kind!==`scroll`&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} box ${e.height}px is below its ${t}px hard min without scroll`});let i=a.component===void 0?void 0:YP(a.component,n.card.componentOverrides);i!==void 0&&e.width<i&&r.push({kind:`min-content`,tileId:a.id,message:`card ${a.id} box ${e.width}px is below its ${i}px min width`})}}for(let t of e)if(!(t.kind!==`content`&&t.kind!==`card`))for(let n of e)n.id!==t.id&&QP(t.rect,n.rect)&&(a(n)&&!o(t)||o(n)&&!o(t)||o(t)&&n.layer===`grid`||r.push({kind:`never-covered`,tileId:t.id,otherTileId:n.id,message:`${n.id} covers ${t.kind} tile ${t.id}`}));return r}var tF=(e,t,n)=>Math.min(n,Math.max(t,e));function nF(e,t){let n=t===`compact`;return{surfacePad:Math.round(n?e.insets.compactSurfacePadPx:e.insets.surfacePadPx),cardsPad:Math.round(n?e.insets.compactCardsPadPx:e.insets.cardsPadPx)}}function rF(e,t,n){return e===`canvas-dominant`&&t.width===`compact`?n.eviction.compactTakeoverMaxCards:n.eviction.maxVisibleCards}function iF(e,t,n){let r=[...e].sort((e,t)=>e.dispatchSeq-t.dispatchSeq),i=Math.floor(t);return r.length<=i?r:n===`evict-newest`?r.slice(0,i):r.slice(r.length-i)}function aF(e,t,n,r,i,a){let o=i??nF(n,r).cardsPad,s=Math.round(a??n.rail.widthPx),c=Math.max(1,Math.min(t-2*o,s-2*o));return{innerW:c,entries:e.map(e=>{let t=qP(e.component,{...e.contentOpts,naturalHeightPx:e.naturalHeightPx,widthPx:c,coldDefaultHeightPx:n.card.coldDefaultHeightPx},n.card.componentOverrides);return{card:e,constraints:t,clampedHeightPx:XP(t.naturalHeightPx,n)}})}}function oF(e,t){return`fraction`in e?e.fraction*t:e.px>=0?e.px:t+e.px}function sF(e,t,n,r){return e.name!==`rail`||`fraction`in t?t:r===`width`?{px:n.rail.widthPx}:{px:t.px<0?-n.rail.widthPx:t.px}}function cF(e,t,n,r,i,a){let o=n===`x`?t.width:t.height,s=[...e].sort((e,t)=>oF(n===`x`?e.x:e.y,o)-oF(n===`x`?t.x:t.y,o)),c=s.map(e=>n===`x`?sF(e,e.width,r,`width`):e.height),l=0,u=0;for(let e of c)`px`in e?l+=e.px:u+=e.fraction;let d=Math.max(0,o-l),f=c.map(e=>`px`in e?e.px:u>0?e.fraction/u*d:0);if(n===`y`&&i!==void 0){let e=s.findIndex((e,t)=>e.accepts.includes(`card`)&&`fraction`in(c[t]??e.height));if(e!==-1){let t=f[e]??0,n=i.shrinkToContent?Math.min(i.neededPx,Math.max(t,i.capPx)):tF(i.neededPx,t,Math.max(t,i.capPx)),r=0,a=0;c.forEach((t,n)=>{n!==e&&(`px`in t?r+=t.px:a+=f[n]??0)});let s=Math.max(0,o-r-n);f=f.map((t,r)=>{if(r===e)return n;let i=c[r];return i!==void 0&&`px`in i?t:a>0?t/a*s:0})}}if(n===`y`&&a!==void 0){let e=s.findIndex((e,t)=>e.accepts.includes(`content`)&&`fraction`in(c[t]??e.height)),t=s.findIndex((e,t)=>e.accepts.includes(`replica`)&&`fraction`in(c[t]??e.height));if(e!==-1&&t!==-1){let n=(f[e]??0)-a.maxPx;n>0&&(f[e]=a.maxPx,f[t]=(f[t]??0)+n)}}let p=s.map(e=>e.accepts.includes(`content`)||e.accepts.includes(`replica`)?48:0),m=p.reduce((e,t)=>e+t,0),h=m>o?o/m:1,g=f.map((e,t)=>Math.max(e,(p[t]??0)*h));if(g.reduce((e,t)=>e+t,0)>o){let e=g.map((e,t)=>e-(p[t]??0)*h),t=e.reduce((e,t)=>e+t,0),n=Math.max(0,o-m*h),r=t>0?n/t:0;f=g.map((t,n)=>(p[n]??0)*h+(e[n]??0)*r)}else f=g;let _=[0],v=0;for(let e of f)v+=e,_.push(tF(Math.round(v),0,o));return s.map((e,r)=>{let i=_[r]??0,a=_[r+1]??i;return{region:e,rect:n===`x`?{x:i,y:0,width:a-i,height:t.height}:{x:0,y:i,width:t.width,height:a-i}}})}function lF(e,t,n){let r=t.width,i=t.height,a=sF(e,e.width,n,`width`),o=sF(e,e.x,n,`x`),s=tF(Math.round(oF(o,r)),0,r),c=tF(Math.round(oF(e.y,i)),0,i);return{x:s,y:c,width:tF(Math.round(`fraction`in a?a.fraction*r:a.px),0,r-s),height:tF(Math.round(`fraction`in e.height?e.height.fraction*i:e.height.px),0,i-c)}}function uF(e,t,n,r,i){let a=e.regions.filter(e=>e.zBase<100),o=e=>`fraction`in e&&e.fraction===1;return a.length>1&&a.every(e=>o(e.height))?cF(a,t,`x`,n):a.length>1&&a.every(e=>o(e.width))?cF(a,t,`y`,n,r,i):a.map(e=>({region:e,rect:lF(e,t,n)}))}function dF(e,t,n,r,i,a,o,s,c,l,u){if(n!==null)return;let d=e.regions.filter(e=>e.zBase<100);if(!(d.length>1&&d.every(e=>`fraction`in e.width&&e.width.fraction===1)))return;let f=d.find(e=>e.accepts.includes(`card`)&&`fraction`in e.height);if(f===void 0||r.cards.length===0)return;let{innerW:p,entries:m}=aF(iF(r.cards,u,c.eviction.policy),i.width,c,l,void 0,c.card.stackMaxWidthPx),h=m.reduce((e,t)=>t.constraints.minWidthPx>p?e:Math.max(e,t.clampedHeightPx),0),{cardsPad:g}=nF(c,l),_=oF(f.y,i.height),v=d.every(e=>oF(e.y,i.height)<=_),y=v?Math.max(0,o-s):0,b=!v&&h>0;return{neededPx:h+2*g+(b?0:y),capPx:Math.round(c.card.stackBandMaxFraction*a.height),...b&&{shrinkToContent:b}}}function fF(e,t,n,r){if(t===null)return;let i=e.regions.filter(e=>e.zBase<100);if(!(i.length>1&&i.every(e=>`fraction`in e.width&&e.width.fraction===1)))return;let a=i.some(e=>e.accepts.includes(`content`)&&`fraction`in e.height),o=i.some(e=>e.accepts.includes(`replica`)&&`fraction`in e.height);if(!a||!o)return;let s=r.content.stackedAspect;if(!(!Number.isFinite(s)||s<=0))return{maxPx:Math.round(n.width/s)}}var pF=`bottom-left`;function mF(e,t,n,r,i){let a=t.endsWith(`right`)?e.x+e.width-n-r:e.x+n,o=t.startsWith(`bottom`)?e.y+e.height-n-i:e.y+n;return{x:Math.round(a),y:Math.round(o),width:r,height:i}}function hF(e,t,n,r){let i=Math.max(n.pip.minWidthPx,Math.round(e.width*.25)),a=r?e.height-t:Math.round((e.height-t)*16/9),o=Math.min(i,e.width-t,a),s=r?o:Math.round(o*9/16);return o<n.pip.minWidthPx||o<=0||s<=0?null:{w:o,h:s}}function gF(e,t,n){return t===null||!QP(e,t)?e:{...e,y:Math.round(t.y)-n-e.height}}function _F(e){if(typeof e!=`object`||!e)return!1;let t=e;return[`x`,`y`,`width`,`height`].every(e=>typeof t[e]==`number`&&Number.isFinite(t[e]))}function vF(e,t,n){let r=e;for(let e of t.filter(_F).sort((e,t)=>t.y-e.y))r=gF(r,e,n);return r}function yF(e,t,n){if(t<=0)return e;let r=Math.min(t,e.length);return n===`evict-newest`?e.slice(0,e.length-r):e.slice(r)}function bF(e,t,n,r,i,a){let o=n.callControls===!0?Math.round(a.insets.callControlsBottomPx):0,s=i.height-o,c=n.selfView&&n.prefs.hideSelfView!==!0,l=(n.replica||c?1:0)+(t.contentKind===null?0:1)+ +(n.cards.length>0)>=2?nF(a,r.width).surfacePad:0,u={width:Math.max(0,i.width-2*l),height:Math.max(0,i.height-2*l)},d=n.callControlsRect??(o>0?{x:0,y:s,width:i.width,height:o}:null);return{regions:uF(e,u,a,dF(e,t.state,t.contentKind,n,u,i,o,l,a,r.width,rF(t.state,r,a)),fF(e,t.contentKind,u,a)).map(e=>({...e,rect:{...e.rect,x:e.rect.x+l,y:e.rect.y+l}})).map(e=>d===null||!e.region.accepts.includes(`card`)||!(e.rect.x<d.x+d.width&&e.rect.x+e.rect.width>d.x)?e:{...e,rect:{...e.rect,height:Math.max(0,Math.min(e.rect.height,s-e.rect.y))}}),surfacePad:l,controlsInset:o,bandTopY:s}}function xF(e,t,n,r,i,a){let o=n.selfView&&n.prefs.hideSelfView!==!0,{regions:s,surfacePad:c,controlsInset:l,bandTopY:u}=bF(t,e,n,r,i,a),d=s.find(e=>e.region.accepts.includes(`replica`)),f=s.find(e=>e.region.accepts.includes(`content`)),p=s.find(e=>e.region.accepts.includes(`card`)),m=t.regions.find(e=>e.zBase>=100&&e.accepts.includes(`selfView`)),h=t.regions.find(e=>e.zBase>=100&&e.accepts.includes(`card`)),g=Math.round(a.rail.gutterPx),_=Math.round(a.pip.gapPaddingPx),v=[...n.cards].sort((e,t)=>e.dispatchSeq-t.dispatchSeq),y=rF(e.state,r,a),b=p?iF(n.cards,y,a.eviction.policy):h===void 0?[]:iF(n.cards,1,a.eviction.policy),x=s=>{let y={evictedCardIds:[],selfViewDropped:!1,replicaCollapsed:!1},x=[],S=null,C=!1,w=d!==void 0&&d.region.accepts.includes(`selfView`);if(d&&w&&(n.replica||o)){let e=d.rect,t=o&&!s.selfViewDropped;o&&s.selfViewDropped&&(y.selfViewDropped=!0);let r=+!!n.replica+ +!!t,i=Math.round(a.insets.participantsPadPx),c=Math.max(1,e.width-2*i),l=Math.round(c*9/16),u=e=>r*e+(r-1)*i;u(l)>e.height&&(l=Math.max(1,Math.floor((e.height-(r-1)*i)/r)),c=Math.min(Math.max(1,e.width-2*i),Math.round(l*16/9))),l=Math.max(l,Math.min(48,e.height)),c=Math.max(c,Math.min(48,e.width));let f=e.x+Math.round((e.width-c)/2),p=e.y+Math.round((e.height-u(l))/2);if(n.replica){let e={x:f,y:p,width:c,height:l};if(s.replicaCollapsed){let t=Math.min(l,Math.max(64,Math.round(l*.25)));e={...e,height:t},y.replicaCollapsed=!0}S={id:`replica`,kind:`replica`,rect:e,layer:`grid`,order:d.region.zBase,fit:{kind:`natural`},region:d.region.name},x.push(S),p+=l+i}t&&(x.push({id:`selfView`,kind:`selfView`,rect:{x:f,y:p,width:c,height:l},layer:`grid`,order:d.region.zBase,fit:{kind:`natural`},region:d.region.name}),C=!0)}else if(d&&(n.replica||o)){let e=!n.replica,t=d.rect;if(!e&&s.replicaCollapsed){let e=Math.min(t.height,Math.max(64,Math.round(t.height*.25)));t={...t,height:e},y.replicaCollapsed=!0}let r={id:e?`selfView`:`replica`,kind:e?`selfView`:`replica`,rect:t,layer:`grid`,order:d.region.zBase,fit:{kind:`natural`},region:d.region.name};x.push(r),e?C=!0:S=r}e.contentKind!==null&&f&&x.push({id:`content`,kind:`content`,rect:f.rect,layer:`grid`,order:f.region.zBase,fit:{kind:`natural`},region:f.region.name});let T=yF(b,s.extraEvictions,a.eviction.policy),E=new Set(T.map(e=>e.id));if(y.evictedCardIds=v.filter(e=>!E.has(e.id)).map(e=>e.id),p&&T.length>0){let e=p.rect,n=t.regions.filter(e=>e.zBase<100),i=n.length>1&&n.every(e=>`fraction`in e.width&&e.width.fraction===1),{innerW:o,entries:s}=aF(T,e.width,a,r.width,void 0,i?a.card.stackMaxWidthPx:void 0),c=e.x+Math.round((e.width-o)/2),l=e.height-g*(s.length-1),u=s.reduce((e,t)=>e+t.clampedHeightPx,0),d;if(u<=l)d=s.map(e=>e.clampedHeightPx);else{let e=l>0?l/u:0;d=s.map(t=>Math.max(a.card.reportedHeightFloorPx,Math.floor(t.clampedHeightPx*e)));let t=d.reduce((e,t)=>e+t,0)-Math.max(0,l);for(;t>0;){let e=-1;for(let t=0;t<d.length;t++){let n=d[t]??0;n>a.card.reportedHeightFloorPx&&(e===-1||n>(d[e]??0))&&(e=t)}if(e===-1)break;d[e]=(d[e]??0)-1,--t}}let f=d.reduce((e,t)=>e+t,0)+g*(s.length-1),m=e.y+Math.max(0,Math.round((e.height-f)/2));s.forEach((t,n)=>{let r=Math.min(m,e.y+e.height),i=Math.max(0,Math.min(d[n]??0,e.y+e.height-r)),s=ZP(t.clampedHeightPx,i,a),l=t.constraints.hardMinHeightPx;l!==void 0&&i<l&&s.kind!==`scroll`&&(s={kind:`scroll`}),x.push({id:t.card.id,kind:`card`,component:t.card.component,cardSizeClass:t.constraints.sizeClass,rect:{x:c,y:r,width:o,height:i},layer:`grid`,order:p.region.zBase+n,fit:s,region:p.region.name}),m=r+i+g})}let D=null;if(p===void 0&&h!==void 0&&T.length>0){let e={width:Math.max(0,i.width-2*c),height:Math.max(0,i.height-2*c)},t=lF(h,e,a),n={x:t.x+c,y:t.y+c,width:t.width,height:Math.max(0,Math.min(t.height,u-(t.y+c)))},{innerW:o,entries:s}=aF(T,n.width,a,r.width,0,a.card.stackMaxWidthPx),l=s[0];if(l!==void 0){let e=n.x+Math.round((n.width-o)/2),t=Math.max(0,Math.min(l.clampedHeightPx,n.height)),r=ZP(l.clampedHeightPx,t,a),i=l.constraints.hardMinHeightPx;i!==void 0&&t<i&&r.kind!==`scroll`&&(r={kind:`scroll`}),D={id:l.card.id,kind:`card`,component:l.card.component,cardSizeClass:l.constraints.sizeClass,rect:{x:e,y:n.y,width:o,height:t},layer:`overlay`,order:h.zBase,fit:r,region:h.name,sheet:!0},x.push(D)}}if(!C){if(o&&s.selfViewDropped)y.selfViewDropped=!0;else if(o){let t=e.suppressedPrefs.includes(`pipCorner`)?pF:n.prefs.pipCorner??`bottom-left`,o=n.callControlsVisible===!1?null:n.callControlsRect??(l>0?{x:0,y:u,width:i.width,height:l}:null),s=[...o===null?[]:[o],...D===null?[]:[D.rect],...n.chromeObstacles??[]];if(S){let e=S.rect,n=hF(e,_,a,r.width===`compact`),i=n===null?null:mF(e,t,_,n.w,n.h),o=i===null?null:vF(i,s,_),c=n!==null&&o!==null&&o.y>=e.y&&n.w+_<=e.width&&n.h+_<=e.height,l=n!==null&&e.width>0&&e.height>0?n.w*n.h/(e.width*e.height):1/0;o!==null&&c&&l<=a.pip.maxAreaRatio?x.push({id:`selfView`,kind:`selfView`,rect:o,layer:`overlay`,order:m?.zBase??100,fit:{kind:`natural`},region:m?.name??`pip`}):y.selfViewDropped=!0}else{let e=a.pip.minWidthPx,n=r.width===`compact`?e:Math.round(e*9/16),o={x:0,y:0,width:i.width,height:i.height},c=vF(mF(o,t,_,e,n),s,_),l=c.y>=0&&e+_<=o.width&&n+_<=o.height,u=x.some(e=>(e.kind===`content`||e.kind===`card`)&&QP(e.rect,c));l&&!u?x.push({id:`selfView`,kind:`selfView`,rect:c,layer:`overlay`,order:m?.zBase??100,fit:{kind:`natural`},region:m?.name??`pip`}):y.selfViewDropped=!0}}}return{tiles:x,degradations:y}},S={extraEvictions:0,selfViewDropped:!1,replicaCollapsed:!1},C=x(S),w=eF(C.tiles,i,a);for(let e of a.degradationLadder){if(w.length===0)break;if(e===`evict-cards`)for(;w.length>0&&S.extraEvictions<b.length;)S={...S,extraEvictions:S.extraEvictions+1},C=x(S),w=eF(C.tiles,i,a);else e===`drop-self-view`?C.tiles.some(e=>e.kind===`selfView`)&&(S={...S,selfViewDropped:!0},C=x(S),w=eF(C.tiles,i,a)):e===`collapse-replica`&&!S.replicaCollapsed&&C.tiles.some(e=>e.kind===`replica`)&&(S={...S,replicaCollapsed:!0},C=x(S),w=eF(C.tiles,i,a))}return C}function SF(e){if(!(e===void 0||e.length===0))return{...RP,...Object.fromEntries(e.map(e=>[e.id,e]))}}function CF(e,t,n,r){let i={width:Math.max(0,Math.round(e.container.widthPx)),height:Math.max(0,Math.round(e.container.heightPx))},a=VP(e,t,n),o=e.replica||e.selfView&&e.prefs.hideSelfView!==!0,s=BP(a.state,t,SF(r?.templates),void 0,o),{tiles:c,degradations:l}=xF(a,s,e,t,i,n);return{state:a.state,sizeClass:t,containerPx:i,templateId:s.id,tiles:c,degradations:l,suppressedPrefs:[...a.suppressedPrefs]}}var wF={compact:0,medium:1,expanded:2};function TF(e,t){return e.width===t.width&&e.height===t.height}function EF(e,t,n,r,i){let a=e.committedClass;if(a===null)return{committedClass:t,pendingClass:null,pendingSinceMs:null};if(TF(t,a))return{committedClass:a,pendingClass:null,pendingSinceMs:null};let o=Math.abs(wF[t.width]-wF[a.width]),s=e.lastResolution?.containerPx.width??null;return o>1||s===null||Math.abs(Math.round(n)-s)>=i.hysteresis.decisiveJumpPxDelta?{committedClass:t,pendingClass:null,pendingSinceMs:null}:e.pendingClass!==null&&e.pendingSinceMs!==null&&TF(e.pendingClass,t)?r-e.pendingSinceMs>=i.hysteresis.windowMs?{committedClass:t,pendingClass:null,pendingSinceMs:null}:{committedClass:a,pendingClass:e.pendingClass,pendingSinceMs:e.pendingSinceMs}:{committedClass:a,pendingClass:t,pendingSinceMs:r}}var DF=(e,t)=>e<t?-1:+(e>t);function OF(e,t){let n=new Map((e?.tiles??[]).map(e=>[e.id,e])),r=new Map(t.tiles.map(e=>[e.id,e])),i=[];for(let e of[...n.keys()].sort(DF))r.has(e)||i.push({type:`exit`,tileId:e});let a=[],o=[],s=[];for(let e of[...r.keys()].sort(DF)){let t=n.get(e);if(t===void 0){a.push({type:`enter`,tileId:e});continue}let i=r.get(e);if(t.layer!==i.layer){o.push(i.layer===`overlay`?{type:`promote`,tileId:e,toLayer:i.layer}:{type:`demote`,tileId:e,toLayer:i.layer});continue}let c=t.rect.x!==i.rect.x||t.rect.y!==i.rect.y,l=t.rect.width!==i.rect.width||t.rect.height!==i.rect.height;c?s.push({type:`move`,tileId:e,from:t.rect,to:i.rect}):l&&s.push({type:`resize`,tileId:e,from:t.rect,to:i.rect})}return[...i,...a,...o,...s]}function kF(e,t,n,r,i){let a=EF(e,LP(t.container,r),t.container.widthPx,n,r),o=CF(t,a.committedClass,r,i);return{resolution:o,transitions:OF(e.lastResolution,o),nextState:{committedClass:a.committedClass,pendingClass:a.pendingClass,pendingSinceMs:a.pendingSinceMs,lastResolution:o}}}var AF=`0.1.12`,jF=FP,MF=(()=>{try{return new URLSearchParams(globalThis.location?.search??``).get(`grid_enabled`)===`1`}catch{return!1}})(),NF=(()=>{try{return new URLSearchParams(globalThis.location?.search??``).get(`grid_debug`)===`1`}catch{return!1}})();function PF(e,t){return MF||e===!0||t===!0}function FF({instances:e,viewport:t,presence:n,callControlsBandPx:r,callControlsVisible:i,callControlsRect:a,reportedHeights:o}){return{container:{widthPx:t.width,heightPx:Math.round(Math.min(t.height,t.visualViewportHeight??t.height))},replica:n.hasPersonaVideo,selfView:n.hasSelfView,presentation:n.isPersonaPresenting?{}:null,userShare:n.isScreenSharing?{}:null,cards:e.map((e,t)=>({id:e.id,component:e.canvas_config.component,dispatchSeq:t+1,...o[e.id]===void 0?{}:{naturalHeightPx:o[e.id]}})),prefs:{},callControls:r>0,callControlsVisible:i??!0,...a===void 0?{}:{callControlsRect:a}}}var IF=16,LF=200,RF=zt(null);function zF(e){RF.peek()===null&&(console.error(`Magic Grid engine error; rendering the legacy layout.`,e),RF.value=(e instanceof Error?`${e.name}: ${e.message}`:String(e)).slice(0,LF))}function BF(){RF.peek()!==null&&(RF.value=null)}function VF({instances:e,viewport:t,presence:n,callControlsBandPx:r,callControlsVisible:i,callControlsRect:a,enabled:o}){let s=N(jF),c=N(null),[l,u]=j({}),[d,f]=j(null),p=F((e,t)=>{o&&u(n=>n[e]===t?n:{...n,[e]:t})},[o]);M(()=>{u(t=>{let n=new Set(e.map(e=>e.id)),r={};for(let[e,i]of Object.entries(t))n.has(e)&&(r[e]=i);return Object.keys(r).length===Object.keys(t).length?t:r})},[e]);let m=P(()=>FF({instances:e,viewport:t,presence:n,callControlsBandPx:r,callControlsVisible:i,callControlsRect:a,reportedHeights:l}),[e,t,n,r,i,a,l]);return M(()=>{if(!o||RF.peek()!==null)return;c.current===null&&(c.current=Date.now());let e=null,t=()=>{if(e=null,RF.peek()!==null)return;let n=Date.now()-(c.current??0),r;try{r=kF(s.current,m,n,IP)}catch(e){zF(e);return}if(s.current=r.nextState,f(r),r.nextState.pendingClass!==null){let i=r.nextState.pendingSinceMs===null?0:Math.max(0,n-r.nextState.pendingSinceMs);e=setTimeout(t,Math.max(IF,IP.hysteresis.windowMs-i+IF))}};return t(),()=>{e!==null&&clearTimeout(e)}},[o,m]),{resolution:o?d?.resolution??null:null,inputs:o?m:null,transitions:o?d?.transitions??[]:[],reportedHeights:l,recordNaturalHeight:p}}function HF(e,t,n){return n?e===null?`no-presence`:t.hasPersonaVideo?e.degradations.evictedCardIds.length>0?`card-dropped`:e.tiles.some(e=>e.kind===`card`&&e.fit.kind===`scroll`)?`card-overflow`:null:`no-persona-video`:`flag-off`}function UF(e,t){if(t!==null||e===null)return null;let n=e.tiles.find(e=>e.kind===`card`&&e.sheet===!0);return n===void 0?null:n.rect.y+n.rect.height}var WF={driving:!1,containerPx:null,replica:null,selfView:null,content:null,replicaCollapsed:!1};function GF(e,t,n){if(e===null)return WF;let r=t===null;if(!r&&!(t===`no-persona-video`&&n))return WF;let i=t=>e.tiles.find(e=>e.kind===t)?.rect??null;return{driving:r,containerPx:e.containerPx,replica:r?i(`replica`):null,selfView:i(`selfView`),content:r?i(`content`):null,replicaCollapsed:r?e.degradations.replicaCollapsed:!1}}function KF(e){return e.selfView===null?e.driving?`hidden`:`legacy`:`engine`}function qF(e,t){return e.containerPx===null||t.containerPx===null?!1:e.containerPx.width===t.containerPx.width&&e.containerPx.height===t.containerPx.height}var JF=`conversation.grid_status`,YF=6e4;function XF(e,t,n){return n?e&&t?`url+config+start`:e?`url+start`:t?`config+start`:`start`:e&&t?`both`:e?`url`:`config`}function ZF(e,t){return{message_type:`conversation`,event_type:JF,conversation_id:e,properties:t}}function QF(e){return{template_id:e.templateId,size_class:`${e.sizeClass.width}/${e.sizeClass.height}`,container:{w:e.containerPx.width,h:e.containerPx.height},cards:e.tiles.filter(e=>e.kind===`card`).length}}function $F(e){let{send:t,enabledVia:n,engineVersion:r=AF,now:i=Date.now,transitionDebounceMs:a=500,summaryIntervalMs:o=YF}=e,s=i(),c=!1,l=!1,u,d=null,f=null,p=!1,m=null,h=0,g=0,_={},v=null,y=e=>{try{t(e)}catch{}},b=(e,t)=>({v:1,kind:e,engine_version:r,enabled_via:n,bail:t,...v}),x=e=>{f=null;let t=u;if(t!==void 0&&e===t)return;let n=i();t===null&&m!==null&&(h+=n-m,m=null),e===null?m=n:_[e]=(_[e]??0)+1,t!==void 0&&(g+=1),e===null&&!p?(p=!0,y({...b(`first_drive`,null),...t===void 0?{}:{prev_bail:t}})):t!==void 0&&y({...b(`transition`,e),prev_bail:t}),u=e},S=e=>{let t=i(),n=h+(m===null?0:t-m);y({...b(`summary`,u??d??null),driving_ms:Math.round(n),total_ms:Math.round(t-s),bail_counts:{..._},transitions:g,...e?{final:!0}:{}})},C=setInterval(()=>S(!1),o);return{update(e,t){if(c)return;t!==null&&(v=QF(t));let n=f===null?u:d;n!==void 0&&e===n||(d=e,f!==null&&clearTimeout(f),f=setTimeout(()=>x(e),a))},error(e){c||l||(l=!0,y({...b(`error`,`engine-error`),error:e}))},dispose(){c||(c=!0,clearInterval(C),f!==null&&(clearTimeout(f),x(d)),S(!0))}}}function eI({enabled:e,enabledVia:t,bail:n,resolution:r,engineError:i}){let a=hh(),o=Hg(),s=I(J_),c=N({daily:a,meetingState:o,conversation:s});c.current={daily:a,meetingState:o,conversation:s};let l=N(null);M(()=>{if(!e)return;let n=$F({enabledVia:t,send:e=>{try{let t=c.current;if(!t.daily||t.meetingState!==`joined-meeting`)return;let n=t.conversation?.session.peek()?.conversationId;if(!n)return;t.daily.sendAppMessage(ZF(n,e),`*`)}catch{}}});return l.current=n,()=>{l.current=null,n.dispose()}},[e,t]),M(()=>{l.current?.update(n,r)},[n,r]),M(()=>{i!==null&&l.current?.error(i)},[i])}var tI=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},nI=(e,t)=>({classGroupId:e,validator:t}),rI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),iI=`-`,aI=[],oI=`arbitrary..`,sI=e=>{let t=uI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return lI(e);let n=e.split(iI);return cI(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?tI(i,t):t:i||aI}return n[e]||aI}}},cI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=cI(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(iI):e.slice(t).join(iI),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},lI=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?oI+r:void 0})(),uI=e=>{let{theme:t,classGroups:n}=e;return dI(n,t)},dI=(e,t)=>{let n=rI();for(let r in e){let i=e[r];fI(i,n,r,t)}return n},fI=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];pI(i,t,n,r)}},pI=(e,t,n,r)=>{if(typeof e==`string`){mI(e,t,n);return}if(typeof e==`function`){hI(e,t,n,r);return}gI(e,t,n,r)},mI=(e,t,n)=>{let r=e===``?t:_I(t,e);r.classGroupId=n},hI=(e,t,n,r)=>{if(vI(e)){fI(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(nI(n,e))},gI=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];fI(o,_I(t,a),n,r)}},_I=(e,t)=>{let n=e,r=t.split(iI),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=rI(),n.nextPart.set(t,i)),n=i}return n},vI=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,yI=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},bI=`!`,xI=`:`,SI=[],CI=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),wI=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===xI){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(bI)?(c=s.slice(0,-1),l=!0):s.startsWith(bI)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return CI(t,l,c,u)};if(t){let e=t+xI,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):CI(SI,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},TI=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},EI=e=>({cache:yI(e.cacheSize),parseClassName:wI(e),sortModifiers:TI(e),postfixLookupClassGroupIds:DI(e),...sI(e)}),DI=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},OI=/\s+/,kI=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(OI),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+bI:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},AI=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=jI(n))&&(i&&(i+=` `),i+=r);return i},jI=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=jI(e[r]))&&(n&&(n+=` `),n+=t);return n},MI=(e,...t)=>{let n,r,i,a,o=o=>(n=EI(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=kI(e,n);return i(e,a),a};return a=o,(...e)=>a(AI(...e))},NI=[],PI=e=>{let t=t=>t[e]||NI;return t.isThemeGetter=!0,t},FI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,II=/^\((?:(\w[\w-]*):)?(.+)\)$/i,LI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,RI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,UI=e=>LI.test(e),WI=e=>!!e&&!Number.isNaN(Number(e)),GI=e=>!!e&&Number.isInteger(Number(e)),KI=e=>e.endsWith(`%`)&&WI(e.slice(0,-1)),qI=e=>RI.test(e),JI=()=>!0,YI=e=>zI.test(e)&&!BI.test(e),XI=()=>!1,ZI=e=>VI.test(e),QI=e=>HI.test(e),$I=e=>!Q(e)&&!$(e),eL=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),tL=e=>gL(e,bL,XI),Q=e=>FI.test(e),nL=e=>gL(e,xL,YI),rL=e=>gL(e,SL,WI),iL=e=>gL(e,wL,JI),aL=e=>gL(e,CL,XI),oL=e=>gL(e,vL,XI),sL=e=>gL(e,yL,QI),cL=e=>gL(e,TL,ZI),$=e=>II.test(e),lL=e=>_L(e,xL),uL=e=>_L(e,CL),dL=e=>_L(e,vL),fL=e=>_L(e,bL),pL=e=>_L(e,yL),mL=e=>_L(e,TL,!0),hL=e=>_L(e,wL,!0),gL=(e,t,n)=>{let r=FI.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},_L=(e,t,n=!1)=>{let r=II.exec(e);return r?r[1]?t(r[1]):n:!1},vL=e=>e===`position`||e===`percentage`,yL=e=>e===`image`||e===`url`,bL=e=>e===`length`||e===`size`||e===`bg-size`,xL=e=>e===`length`,SL=e=>e===`number`,CL=e=>e===`family-name`,wL=e=>e===`number`||e===`weight`,TL=e=>e===`shadow`,EL=MI(()=>{let e=PI(`color`),t=PI(`font`),n=PI(`text`),r=PI(`font-weight`),i=PI(`tracking`),a=PI(`leading`),o=PI(`breakpoint`),s=PI(`container`),c=PI(`spacing`),l=PI(`radius`),u=PI(`shadow`),d=PI(`inset-shadow`),f=PI(`text-shadow`),p=PI(`drop-shadow`),m=PI(`blur`),h=PI(`perspective`),g=PI(`aspect`),_=PI(`ease`),v=PI(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[UI,`full`,`auto`,...w()],E=()=>[GI,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,GI,$,Q]},GI,$,Q],ee=()=>[GI,`auto`,$,Q],te=()=>[`auto`,`min`,`max`,`fr`,$,Q],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],O=()=>[`auto`,...w()],ie=()=>[UI,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[UI,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],k=()=>[UI,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],A=()=>[e,$,Q],oe=()=>[...b(),dL,oL,{position:[$,Q]}],se=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ce=()=>[`auto`,`cover`,`contain`,fL,tL,{size:[$,Q]}],le=()=>[KI,lL,nL],ue=()=>[``,`none`,`full`,l,$,Q],de=()=>[``,WI,lL,nL],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[WI,KI,dL,oL],he=()=>[``,`none`,m,$,Q],ge=()=>[`none`,WI,$,Q],_e=()=>[`none`,WI,$,Q],ve=()=>[WI,$,Q],ye=()=>[UI,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[qI],breakpoint:[qI],color:[JI],container:[qI],"drop-shadow":[qI],ease:[`in`,`out`,`in-out`],font:[$I],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[qI],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[qI],shadow:[qI],spacing:[`px`,WI],text:[qI],"text-shadow":[qI],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,UI,Q,$,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$,Q]}],"container-named":[eL],columns:[{columns:[WI,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[GI,`auto`,$,Q]}],basis:[{basis:[UI,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[WI,UI,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,WI,$,Q]}],shrink:[{shrink:[``,WI,$,Q]}],order:[{order:[GI,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...k()]}],"min-block-size":[{"min-block":[`auto`,...k()]}],"max-block-size":[{"max-block":[`none`,...k()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,lL,nL]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,hL,iL]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,KI,Q]}],"font-family":[{font:[uL,aL,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[WI,`none`,$,rL]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[WI,`from-font`,`auto`,$,nL]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[WI,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[GI,$,Q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},GI,$,Q],radial:[``,$,Q],conic:[GI,$,Q]},pL,sL]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":de()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[WI,$,Q]}],"outline-w":[{outline:[``,WI,lL,nL]}],"outline-color":[{outline:A()}],shadow:[{shadow:[``,`none`,u,mL,cL]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":[`none`,d,mL,cL]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:de()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[WI,nL]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":[`none`,f,mL,cL]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[WI,$,Q]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[WI]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[WI]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:he()}],brightness:[{brightness:[WI,$,Q]}],contrast:[{contrast:[WI,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,mL,cL]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:[``,WI,$,Q]}],"hue-rotate":[{"hue-rotate":[WI,$,Q]}],invert:[{invert:[``,WI,$,Q]}],saturate:[{saturate:[WI,$,Q]}],sepia:[{sepia:[``,WI,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[WI,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[WI,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,WI,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[WI,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,WI,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[WI,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[WI,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,WI,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[WI,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[WI,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[GI,$,Q]}],accent:[{accent:A()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...A()]}],"stroke-w":[{stroke:[WI,lL,nL,rL]}],stroke:[{stroke:[`none`,...A()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function DL({resolution:e,inputs:t,config:n,bailReason:r}){if(e===null||t===null)return null;let i=RP[e.templateId];if(i===void 0)return null;let a=r!==null,o=a?`border-warning/70 bg-warning/5`:`border-info/80 bg-info/5`,s=a?`bg-warning/85 text-warning-content`:`bg-info/85 text-info-content`,c=a?`border-warning`:`border-success`,l=a?`bg-warning/85 text-warning-content`:`bg-success/85 text-success-content`,u=t.userShare?`userShare`:t.presentation?`presentation`:null,{regions:d}=bF(i,{state:e.state,contentKind:u},t,e.sizeClass,e.containerPx,n);return L(`div`,{class:`pointer-events-none absolute inset-0 z-40`,"aria-hidden":`true`,children:[a&&L(`span`,{class:`absolute top-1 left-1/2 -translate-x-1/2 rounded bg-warning/90 px-2 py-0.5 font-mono text-[10px] text-warning-content`,children:[`engine plan only · legacy: `,r]}),d.map(e=>L(`div`,{class:EL(`absolute rounded-box border border-dashed`,o),style:{left:`${e.rect.x}px`,top:`${e.rect.y}px`,width:`${e.rect.width}px`,height:`${e.rect.height}px`},children:L(`span`,{class:EL(`absolute top-1 left-1 flex flex-col rounded px-1.5 py-0.5 font-mono text-[10px] leading-tight`,s),children:[L(`span`,{children:e.region.name}),L(`span`,{class:`opacity-75`,children:e.region.accepts.join(` · `)})]})},e.region.name)),e.tiles.map(e=>L(`div`,{class:EL(`absolute border`,c),style:{left:`${e.rect.x}px`,top:`${e.rect.y}px`,width:`${e.rect.width}px`,height:`${e.rect.height}px`},children:L(`span`,{class:EL(`absolute right-1 bottom-1 rounded px-1.5 py-0.5 font-mono text-[10px]`,l),children:[e.kind,` `,e.rect.width,`×`,e.rect.height]})},`tile-${e.id}`))]})}function OL(e){return{version:1,buildSha:AF,engineVersion:AF,config:IP,session:{containerPx:{width:Math.round(e.container.widthPx),height:Math.round(e.container.heightPx)},slots:{replica:e.replica,selfView:e.selfView,presentation:e.presentation!==null,userShare:e.userShare!==null,callControls:e.callControls,callControlsVisible:e.callControlsVisible??!0,...e.callControlsRect===void 0?{}:{callControlsRect:e.callControlsRect}},prefs:e.prefs,cards:e.cards}}}function kL({resolution:e,inputs:t,shadowing:n,bailReason:r,engineError:i=null}){let[a,o]=j(!1),s=N(null);if(M(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),e===null||t===null)return i===null?null:L(`div`,{class:`pointer-events-auto max-w-[22rem] rounded-box bg-base-100/95 p-3 font-mono text-[10px] leading-relaxed shadow-lg`,children:[L(`div`,{class:`mb-1 flex items-center justify-between gap-2`,children:[L(`span`,{class:`font-bold uppercase tracking-wide`,children:`magic grid`}),L(`span`,{class:`text-warning`,children:`observing`})]}),L(`dl`,{class:`grid grid-cols-[5.5rem_1fr] gap-x-2`,children:[L(`dt`,{class:`text-warning opacity-80`,children:`legacy`}),L(`dd`,{class:`text-warning`,children:r}),L(`dt`,{class:`text-error opacity-80`,children:`error`}),L(`dd`,{class:`text-error break-all`,children:i})]})]});let c=()=>{let e=JSON.stringify(OL(t),null,2);s.current!==null&&clearTimeout(s.current),navigator.clipboard?.writeText(e).then(()=>{o(!0),s.current=setTimeout(()=>o(!1),1500)},()=>o(!1))},l=e.degradations.evictedCardIds;return L(`div`,{class:`pointer-events-auto max-w-[22rem] rounded-box bg-base-100/95 p-3 font-mono text-[10px] leading-relaxed shadow-lg`,children:[L(`div`,{class:`mb-1 flex items-center justify-between gap-2`,children:[L(`span`,{class:`font-bold uppercase tracking-wide`,children:`magic grid`}),L(`span`,{class:n?`text-warning`:`text-success`,children:n?`observing`:`driving`})]}),L(`dl`,{class:`grid grid-cols-[5.5rem_1fr] gap-x-2`,children:[L(`dt`,{class:`opacity-60`,children:`state`}),L(`dd`,{children:e.state}),L(`dt`,{class:`opacity-60`,children:`template`}),L(`dd`,{children:e.templateId}),L(`dt`,{class:`opacity-60`,children:`class`}),L(`dd`,{children:[e.sizeClass.width,` / `,e.sizeClass.height]}),L(`dt`,{class:`opacity-60`,children:`container`}),L(`dd`,{children:[e.containerPx.width,`×`,e.containerPx.height]}),t.callControlsRect!==void 0&&L(k,{children:[L(`dt`,{class:`opacity-60`,children:`controls`}),L(`dd`,{children:[`x `,t.callControlsRect.x,`–`,t.callControlsRect.x+t.callControlsRect.width,t.callControlsVisible===!1?` · hidden`:` · shown`]})]}),L(`dt`,{class:`opacity-60`,children:`tiles`}),L(`dd`,{children:e.tiles.map(e=>`${e.kind}:${e.rect.width}×${e.rect.height}`).join(` `)||`none`}),l.length>0&&L(k,{children:[L(`dt`,{class:`text-error opacity-80`,children:`dropped`}),L(`dd`,{class:`text-error`,children:l.join(`, `)})]}),r!==null&&L(k,{children:[L(`dt`,{class:`text-warning opacity-80`,children:`legacy`}),L(`dd`,{class:`text-warning`,children:r})]}),i!==null&&L(k,{children:[L(`dt`,{class:`text-error opacity-80`,children:`error`}),L(`dd`,{class:`text-error break-all`,children:i})]})]}),L(`button`,{type:`button`,class:`btn btn-xs mt-2 w-full`,onClick:c,children:a?`copied`:`copy envelope for playground`})]})}var AL={effect:WF,animate:!1},jL=zt(AL),ML={presence:{phase:`connecting`},localId:null,isScreenSharing:!1,isPersonaPresenting:!1,hasPersonaVideo:!1,hasSelfView:!1};function NL(e,t){return e===null||t===null?e===t:e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PL(e,t){let n=e.containerPx===null||t.containerPx===null?e.containerPx===t.containerPx:e.containerPx.width===t.containerPx.width&&e.containerPx.height===t.containerPx.height;return e.driving===t.driving&&e.replicaCollapsed===t.replicaCollapsed&&n&&NL(e.replica,t.replica)&&NL(e.selfView,t.selfView)&&NL(e.content,t.content)}var FL=new Map;function IL({instances:e,viewport:t,callControlsBandPx:n,callPresence:r,callControlsVisible:i,callControlsRect:a,gridConfigEnabled:o,gridStartEnabled:s}){let c=PF(o,s)&&r!==void 0,l=r??ML,u=VF({instances:e,viewport:t,presence:l,callControlsBandPx:n,callControlsVisible:i,callControlsRect:a,enabled:c}),d=c?RF.value:null,f=d===null?HF(u.resolution,l,c):`engine-error`;eI({enabled:c,enabledVia:XF(MF,o===!0,s===!0),bail:f,resolution:u.resolution,engineError:d});let p=N(!1);l.presence.phase===`ready`?l.hasPersonaVideo&&(p.current=!0):p.current=!1;let m=!p.current,h;try{h=GF(u.resolution,f,m)}catch(e){zF(e),h=WF}let g=N(WF),_=qF(g.current,h);M(()=>{g.current=h,PL(jL.peek().effect,h)||(jL.value={effect:h,animate:_})}),M(()=>()=>{BF(),jL.peek()!==AL&&(jL.value=AL)},[]);let v=u.resolution,y=P(()=>{if(f!==null||v===null)return FL;try{let e=new Map;for(let t of v.tiles)t.kind===`card`&&e.set(t.id,t.rect);return e}catch(e){return zF(e),FL}},[f,v]),b=NF?L(`div`,{class:`contents`,"data-grid-debug":!0,children:[L(DL,{resolution:u.resolution,inputs:u.inputs,config:IP,bailReason:f}),L(`div`,{class:`pointer-events-none absolute bottom-4 left-4 z-50`,children:L(kL,{resolution:u.resolution,inputs:u.inputs,shadowing:f!==null,bailReason:f,engineError:d})})]}):null;return{cardRects:y,sheetBottomPx:UF(v,f),animate:_,recordNaturalHeight:u.recordNaturalHeight,debug:b}}var LL=[`left`,`top`,`width`,`height`].map(e=>`${e} ${bC}`).join(`, `);function RL(e,t){return{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`,transition:t&&!AC()?LL:`none`}}function zL({state:e}){return e.enabled?L(`details`,{class:`pointer-events-auto w-full max-w-md rounded-lg border border-base-300 bg-base-100/95 p-2 text-xs shadow-lg backdrop-blur`,children:[L(`summary`,{class:`cursor-pointer font-medium`,children:`Magic Canvas debug`}),L(`dl`,{class:`mt-2 grid gap-2`,children:[L(BL,{label:`iframe`,value:e.iframeLifecycleState}),L(BL,{label:`post`,value:e.lastInteractionPostResult}),L(BL,{label:`context`,value:e.lastModelContextUpdate}),L(BL,{label:`error`,value:e.lastError}),L(VL,{label:`tool_call`,value:e.lastToolCall}),L(VL,{label:`canvas_config`,value:e.parsedCanvasConfig})]})]}):null}function BL({label:e,value:t}){return t?L(`div`,{children:[L(`dt`,{class:`font-semibold`,children:e}),L(`dd`,{class:`break-words text-base-content/70`,children:t})]}):null}function VL({label:e,value:t}){return t===void 0?null:L(`div`,{children:[L(`dt`,{class:`font-semibold`,children:e}),L(`dd`,{children:L(`pre`,{class:`max-h-40 overflow-auto rounded bg-base-200 p-2 text-[10px] leading-relaxed`,children:JSON.stringify(t,null,2)})})]})}var HL=1e3,UL=5e3,WL=1200,GL=[2e3,6e3];async function KL(e,t,n){let r=new AbortController,i=globalThis.setTimeout(()=>r.abort(),UL);try{await xn(e,t,n,{signal:r.signal})}finally{globalThis.clearTimeout(i)}}function qL(e){return e instanceof _n&&e.status>=400&&e.status<500&&e.status!==408&&e.status!==429}function JL(e,t){console.error(`Magic Canvas interaction POST failed; this interaction may not have been recorded server-side.`,e),t({lastInteractionPostResult:`error`,lastError:xR(e).message})}function YL(e,t,n,r){(async()=>{let i;for(let a of GL){await new Promise(e=>setTimeout(e,a));try{await KL(e,t,n),r({lastInteractionPostResult:`recovered`,lastError:void 0});return}catch(e){if(i=e,qL(e))break}}JL(i,r)})()}var XL=2e3;function ZL(e){return e.correct_answer===void 0?WL:XL}var QL=48,$L=`allow-scripts`,eR={"canvas.scheduling_embed":`allow-scripts allow-same-origin allow-popups allow-forms`,"canvas.text":`allow-scripts allow-popups allow-popups-to-escape-sandbox`};function tR(e,t){if(!t.contentWindow||e.source!==t.contentWindow)return!1;let n=e.data;return!!n&&typeof n==`object`&&n?.jsonrpc===`2.0`}var nR=class{onmessage;onerror;onclose;#e;#t;constructor(e){this.#e=e}start(){let e=e=>{tR(e,this.#e)&&this.onmessage?.(e.data)};return this.#t=e,globalThis.addEventListener(`message`,e),Promise.resolve()}send(e){return this.#e.contentWindow?.postMessage(e,`*`),Promise.resolve()}close(){return this.#t&&globalThis.removeEventListener(`message`,this.#t),this.#t=void 0,this.onclose?.(),Promise.resolve()}};function rR(e){for(let t of fS)if(e.some(e=>_R(e)===t))return t;return null}function iR({onLayoutEffectChange:e,onRenderedSlotChange:t,debugEnabled:n=vR(),callPresence:r,callControlsVisible:i,callControlsRect:a,gridConfigEnabled:o,gridStartEnabled:s}={}){let{client:c}=mv(),{dataTheme:l,cssVars:u}=PP(),d=hh(),f=Hg(),[p,m]=j([]),[h,g]=pR(),[_,v]=j(()=>({enabled:n,iframeLifecycleState:`idle`})),y=IL({instances:p,viewport:g,callControlsBandPx:72,callPresence:r,callControlsVisible:i,callControlsRect:a,gridConfigEnabled:o,gridStartEnabled:s}),b=F(e=>{v(t=>({...t,...e}))},[]),x=F((e,t=`*`)=>{if(f!==`joined-meeting`){b({lastError:`Dropped Magic Canvas app message because the Daily meeting is not joined.`});return}d?.sendAppMessage(e,t)},[d,f,b]),S=P(()=>({theme:l.value===`dark`?`dark`:`light`,cssVars:u.value}),[l.value,u.value]);M(()=>{v(e=>e.enabled===n?e:{...e,enabled:n})},[n]),e_({onAppMessage:F(e=>{if(f!==`joined-meeting`){b({lastToolCall:e.data,iframeLifecycleState:`idle`,lastError:`Dropped Magic Canvas tool call because the Daily meeting is not joined.`});return}try{let t=aC(e.data);if(!t)return;m(e=>wS(e,t)),b({lastToolCall:e.data,parsedCanvasConfig:t.kind===`show`?t.instance.canvas_config:void 0,iframeLifecycleState:t.kind===`clear`?`closed`:`received`,lastError:void 0})}catch(e){b({iframeLifecycleState:`error`,lastError:xR(e).message})}},[f,b])});let C=p.map(e=>{let t=jS(e,g),n=t.display_mode===`fullscreen`?null:y.cardRects.get(e.id)??null;return{instance:e,layout:n===null?t:{...t,viable_slot:`safe-area-right`},gridRect:n}}),w=MS(C.map(({layout:e})=>e),g),T=[...C].reverse().find(({layout:e})=>e.display_mode===`fullscreen`)?.instance.tool_call_id;M(()=>{e?.(w)},[e,w.active,w.side,w.video_shift_x,w.backdrop.type,w.safe_area?.x,w.safe_area?.y,w.safe_area?.width,w.safe_area?.height]);let E=rR(C.map(({layout:e})=>e));M(()=>{t?.(E)},[t,E]);let D=p.length>0||_.enabled;return L(`div`,{ref:h,"data-magic-canvas-root":!0,class:`pointer-events-none absolute inset-0 z-30`,children:[D&&T&&L(`div`,{class:`absolute inset-0 bg-black/45`}),D&&!T&&y.sheetBottomPx!==null&&L(`div`,{"data-grid-sheet-scrim":!0,class:`absolute inset-x-0 top-0`,style:{height:Math.min(y.sheetBottomPx+64,g.height),backgroundImage:`linear-gradient(to bottom, rgb(0 0 0 / 0.45) calc(100% - 64px), rgb(0 0 0 / 0))`}}),D&&C.map(({instance:e,layout:t,gridRect:n})=>L(oR,{slot:_R(t),safeAreaTop:w.safe_area?.y,frameWidth:g.width,...n?{gridRect:n,gridAnimate:y.animate}:{},children:r=>L(sR,{availableHeight:r,client:c,gridDriven:n!==null,hostTheme:S,instance:e,layout:t,dimmed:!!(T&&T!==e.tool_call_id),onDebug:b,onNaturalHeightChange:y.recordNaturalHeight,onComplete:()=>{m(t=>t.filter(t=>t.id!==e.id))},onDisplayModeChange:t=>{m(n=>n.map(n=>n.tool_call_id===e.tool_call_id?{...n,layout:{...n.layout,display_mode:t}}:n))},sendAppMessage:x})},e.id)),D&&L(`div`,{class:`absolute right-4 bottom-24 @max-mobile:right-3 @max-mobile:bottom-20`,children:L(zL,{state:_})}),y.debug]})}var aR=16;function oR({slot:e,safeAreaTop:t,frameWidth:n,gridRect:r,gridAnimate:i=!1,children:a}){let[o,s]=mR(),c=a(r?r.height:e===`full`?void 0:s);if(r)return L(`div`,{ref:o,class:`pointer-events-auto absolute`,style:RL(r,i),"data-canvas-slot":e,"data-grid-driven":`true`,children:L(`div`,{class:`flex h-full w-full flex-col gap-2`,children:c})});if(e===`safe-area-left`||e===`safe-area-right`){let r=t==null?`1rem`:`${t*100}%`,i=n!=null&&n>0?Math.max(0,n-aR*2):void 0;return L(`div`,{ref:o,class:gR(e),style:{top:r,bottom:`72px`,maxWidth:i},"data-canvas-slot":e,children:L(`div`,{class:`my-auto flex w-full flex-col gap-2`,children:c})})}return L(`div`,{ref:o,class:gR(e),"data-canvas-slot":e,children:L(`div`,{class:`contents`,children:c})})}function sR({availableHeight:e,client:t,gridDriven:n=!1,hostTheme:r,instance:i,layout:a,dimmed:o,onDebug:s,onComplete:c,onDisplayModeChange:l,onNaturalHeightChange:u,sendAppMessage:d}){let f=N(null),p=N(null),m=N(e),h=N(320),g=N(r),_=N(i),v=N(a),y=N(-1),b=N(c),x=N(l),S=N(u),C=N(d),[w,T]=j(720);M(()=>{_.current=i},[i]),M(()=>{h.current=w,p.current?.setHostContext(dR(_.current,g.current,v.current,m.current,w))},[w]),M(()=>{m.current=e;let t=uR(r,f.current);g.current=t,p.current?.setHostContext(dR(_.current,t,v.current,e,h.current))},[e,r]),M(()=>{v.current=a,p.current?.setHostContext(dR(_.current,g.current,a,e,h.current))},[e,a]),M(()=>{b.current=c,x.current=l,S.current=u,C.current=d},[c,l,u,d]),M(()=>{let e=f.current;if(!e)return;let n=!1,r=null,a=null,o=null,c=null,l=new URL(i.canvas_config.sandbox_url,globalThis.location.href).href,u=e=>{n||s({iframeLifecycleState:`error`,lastError:xR(e).message})},d=()=>{if(n||!a)return;let e=_.current,t=kS(e,a);a=null,C.current({message_type:`conversation`,event_type:`conversation.append_llm_context`,conversation_id:e.conversation_id,properties:{context:t}}),s({lastModelContextUpdate:e.canvas_config.component,lastError:void 0})},w=()=>{if(r)return;if(e.src!==l){e.src;return}if(n||!e.contentWindow)return;let f=new MP(null,{name:`tavus-deployment`,version:`0.0.0`},{logging:{},message:{text:{},structuredContent:{}},updateModelContext:{text:{},structuredContent:{}}},{hostContext:dR(i,uR(g.current,e),v.current,m.current,h.current)});r=f,p.current=f,f.oninitialized=()=>{n||(s({iframeLifecycleState:`ready`}),y.current=_.current.revision,f.sendToolInput({arguments:_.current.arguments}).catch(u))},f.onsizechange=({height:e})=>{if(!n&&typeof e==`number`&&Number.isFinite(e)){let t=Math.min(Math.max(e,QL),720);T(t),S.current(_.current.id,t)}},f.onmessage=async e=>{let r=TS(e),i=OS(e);if(!r){if(i){let e=`Magic Canvas message included text without interaction metadata; no interaction row was recorded.`;return s({lastInteractionPostResult:`error`,lastError:e}),{isError:!0,code:`missing_interaction_metadata`,message:e}}return{}}let a=_.current,o=(()=>{try{let e=ES(a,r);return{interaction:e,request:oC(e)}}catch(e){return{error:e}}})();if(`error`in o){let e=xR(o.error).message;return s({lastInteractionPostResult:`error`,lastError:e}),{isError:!0,code:`interaction_normalization_failed`,message:e}}let{interaction:l,request:u}=o,d=!0;try{await KL(t,l.conversation_id,u.body)}catch(e){d=!1,qL(e)?JL(e,s):(console.warn(`Magic Canvas interaction POST failed; continuing without it and retrying in the background.`,e),s({lastInteractionPostResult:`failed_open`,lastError:xR(e).message}),YL(t,l.conversation_id,u.body,s))}if(n)return{};if(i)try{C.current({message_type:`conversation`,event_type:`conversation.respond`,conversation_id:a.conversation_id,properties:{text:i}})}catch(e){console.error(`Magic Canvas respond send failed.`,e),s({lastError:xR(e).message})}return d&&s({lastInteractionPostResult:`success`,lastError:void 0}),DS(l)&&(l.type===`submit`?(c&&clearTimeout(c),c=setTimeout(()=>{c=null,n||b.current()},ZL(a.arguments))):b.current()),{}},f.onupdatemodelcontext=async e=>(a=e,o||=setTimeout(()=>{o=null,d()},HL),{}),f.onrequestdisplaymode=async({mode:e})=>{let t=e===`fullscreen`?`fullscreen`:`inline`;return x.current(t),v.current={...v.current,display_mode:t,viable_slot:t===`fullscreen`?`full`:v.current.viable_slot},f.setHostContext(dR(_.current,g.current,v.current,m.current,h.current)),{mode:t}},f.connect(new nR(e)).then(()=>void 0).catch(u)};s({iframeLifecycleState:`mounting`,lastInteractionPostResult:void 0}),i.canvas_config.sandbox_url,e.src=i.canvas_config.sandbox_url;let E=()=>{w()};return e.addEventListener(`load`,E),w(),()=>{o&&=(clearTimeout(o),null),c&&=(clearTimeout(c),null),d(),n=!0,e.removeEventListener(`load`,E),p.current=null,s({iframeLifecycleState:`closed`}),r&&uS(r)}},[t,i.id,i.canvas_config.sandbox_url,s]),M(()=>{i.revision!==0&&(i.revision<=y.current||(y.current=i.revision,p.current?.sendToolInput({arguments:i.arguments}).catch(e=>{s({iframeLifecycleState:`error`,lastError:xR(e).message})})))},[i.arguments,i.revision,s]);let E=a.viable_slot===`full`||a.display_mode===`fullscreen`,D=E?null:fR(w,e),ee=D?.placeholderStyle,te=D?.cardStyle,ne=E?{height:`100%`}:D?.iframeStyle??{height:`${w}px`},re=[`pointer-events-auto w-full overflow-hidden rounded-box border-[length:var(--border)] border-base-300 bg-base-100 shadow-xl transition-[opacity,transform]`,E?`fixed inset-4 z-10 max-w-none`:n?`max-w-none`:`max-w-md`,o?`scale-[0.98] opacity-40`:``].filter(Boolean).join(` `),O=eR[i.canvas_config.component]??$L,ie=L(`div`,{class:re,style:te,"data-canvas-card":a.viable_slot,children:L(`iframe`,{ref:f,title:`${i.canvas_config.component} ${i.canvas_config.component_version}`,class:E?`block h-full w-full border-0 bg-transparent`:`block border-0 bg-transparent`,sandbox:O,style:ne})});return E?ie:L(`div`,{class:`block w-full`,style:ee,children:ie})}var cR=[`--color-base-100`,`--color-base-200`,`--color-base-300`,`--color-base-content`,`--color-primary`,`--color-error`];function lR(e){if(!e||typeof getComputedStyle!=`function`)return{};let t=getComputedStyle(e),n={};for(let e of cR){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return n}function uR(e,t){let n=lR(t);return Object.keys(n).length===0?e:{...e,cssVars:{...e.cssVars,...n}}}function dR(e,t,n,r,i){let a=sC(t,n),o=n.viable_slot===`full`||n.display_mode===`fullscreen`,s=o?void 0:yR(r),c=o?1:fR(i??0,r)?.displayScale??1;return{...e.canvas_config.host_context,...a,containerDimensions:{...bR(a.containerDimensions)?a.containerDimensions:{},...s===void 0?{}:{maxHeight:s},displayScale:c}}}function fR(e,t){if(t===void 0||!Number.isFinite(t)||t<=0)return null;let n=Math.min(e,720);if(n<=t)return{displayScale:1,placeholderStyle:{maxHeight:`${t}px`},cardStyle:void 0,iframeStyle:{width:`100%`,height:`${n}px`}};let r=t/n;return{displayScale:r,placeholderStyle:{height:`${n*r}px`,maxHeight:`${t}px`,overflow:`hidden`},cardStyle:{height:`${n}px`,transform:`scale(${r})`,transformOrigin:`top center`},iframeStyle:{width:`100%`,height:`${n}px`}}}function pR(){let e=N(null),[t,n]=j(()=>hR(null));return M(()=>{let t=()=>n(t=>{let n=hR(e.current);return t.width===n.width&&t.height===n.height&&t.visualViewportHeight===n.visualViewportHeight?t:n});t(),globalThis.addEventListener(`resize`,t),globalThis.visualViewport?.addEventListener(`resize`,t);let r;return typeof ResizeObserver<`u`&&e.current&&(r=new ResizeObserver(t),r.observe(e.current)),()=>{globalThis.removeEventListener(`resize`,t),globalThis.visualViewport?.removeEventListener(`resize`,t),r?.disconnect()}},[]),[e,t]}function mR(){let e=N(null),[t,n]=j();return M(()=>{let t=e.current;if(!t)return;let r=e=>{let r=e??t.getBoundingClientRect().height;!Number.isFinite(r)||r<=0||n(Math.floor(r))},i=()=>r();if(i(),typeof ResizeObserver>`u`)return globalThis.addEventListener(`resize`,i),()=>globalThis.removeEventListener(`resize`,i);let a=new ResizeObserver(e=>{r(e[0]?.contentRect.height)});return a.observe(t),()=>a.disconnect()},[]),[e,t]}function hR(e){let t=globalThis.visualViewport?.height,n=e?.getBoundingClientRect();if(n&&n.width>0&&n.height>0){let e=t===void 0?void 0:Math.max(0,(globalThis.innerHeight||0)-t);return{width:n.width,height:n.height,visualViewportHeight:e===void 0?void 0:Math.max(0,n.height-e)}}return{width:globalThis.innerWidth||1024,height:globalThis.innerHeight||768,visualViewportHeight:t}}function gR(e){let t=`absolute flex gap-2`;switch(e){case`safe-area-left`:return`${t} left-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;case`safe-area-right`:return`${t} right-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;case`safe-area-bottom`:return`${t} right-4 bottom-24 left-4 flex-col items-center justify-end @max-mobile:right-3 @max-mobile:bottom-20 @max-mobile:left-3`;case`full`:return`${t} inset-4 flex-col items-stretch justify-stretch`}}function _R(e){return e.display_mode===`fullscreen`&&e.preferred_slot!==`full`?e.preferred_slot:e.viable_slot}function vR(){return!1}function yR(e){return e===void 0||!Number.isFinite(e)||e<=0?720:Math.min(Math.floor(e),720)}function bR(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xR(e){return e instanceof Error?e:Error(String(e))}var SR=class extends A{state={errored:!1};componentDidCatch(e){this.props.onError(e),this.setState({errored:!0})}render(){return this.state.errored?null:this.props.children}},CR=1e4;function wR(e,t=CR){let[n,r]=j(!1),i=N(!1);return M(()=>{if(!e){r(!1);return}if(i.current)return;i.current=!0,r(!0);let n=setTimeout(()=>r(!1),t);return()=>clearTimeout(n)},[e,t]),n}function TR(e){let t=$h(),n=p_(t??``),r=!d_(t??``).isOff,i=Xx(e),a=i.phase===`ready`?i.replicaId:``,o=d_(a),s=!r&&(o.state===`playable`||o.state===`loading`),c=i.phase===`ready`&&!e&&!i.videoState.isOff,l=!e&&t!==null&&!n.isOff,u=i.phase!==`ready`||i.videoState.isOff;return P(()=>({presence:i,localId:t,isScreenSharing:r,isPersonaPresenting:s,hasPersonaVideo:c,hasSelfView:l}),[i.phase,a,u,t,r,s,c,l])}function ER(e,t,n){let[r,i]=j(!0);return M(()=>{if(!t)return;let n=e.current;if(!n||typeof matchMedia!=`function`)return;let r=matchMedia(`(hover: hover) and (pointer: fine)`),a=()=>{try{return n.matches(`:has(:focus-visible)`)}catch{return!1}},o=n.matches(`:hover`),s=()=>{i(!r.matches||o||a())},c=()=>{o=!0,s()},l=()=>{o=!1,s()};return n.addEventListener(`pointerenter`,c),n.addEventListener(`pointerleave`,l),n.addEventListener(`focusin`,s),n.addEventListener(`focusout`,s),r.addEventListener(`change`,s),s(),()=>{n.removeEventListener(`pointerenter`,c),n.removeEventListener(`pointerleave`,l),n.removeEventListener(`focusin`,s),n.removeEventListener(`focusout`,s),r.removeEventListener(`change`,s)}},[t,e,n]),r}function DR(e,t,n,r,i){let[a,o]=j(void 0);return M(()=>{if(!r)return;let i=e.current,a=t.current;if(!i||!a||typeof ResizeObserver>`u`)return;let s=()=>{let e=i.getBoundingClientRect(),t=1/0,r=-1/0;for(let e of a.children){let n=e.getBoundingClientRect();n.width!==0&&(t=Math.min(t,n.left),r=Math.max(r,n.right))}if(e.width===0||!Number.isFinite(t)||r<=t)return;let s={x:Math.round(t-e.left),y:Math.round(e.height-n),width:Math.round(r-t),height:n};o(e=>e!==void 0&&e.x===s.x&&e.y===s.y&&e.width===s.width&&e.height===s.height?e:s)},c=new ResizeObserver(s);c.observe(i),c.observe(a);for(let e of a.children)c.observe(e);return s(),()=>c.disconnect()},[r,e,t,n,i]),a}var OR=1e4;function kR({onTimeout:e,timeoutMs:t=OR,active:n=!0}){let r=Yx().length>0,[i,a]=j(!1),o=N(e);return M(()=>{o.current=e},[e]),M(()=>{if(!n||r){a(!1);return}let e=setTimeout(()=>{a(!0),o.current()},t);return()=>clearTimeout(e)},[n,r,t]),{hasJoined:r,timedOut:i}}function AR(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.message_type===`system`&&t.event_type===`system.shutdown`}function jR({onShutdown:e}){let t=N(e);M(()=>{t.current=e},[e]),e_({onAppMessage:F(e=>{AR(e?.data)&&t.current()},[])})}var MR=mn(`PiP`),NR=360,PR=280;function FR(){return globalThis.window!==void 0&&`documentPictureInPicture`in globalThis.window}function IR(e){let{enabled:t,active:n}=e,[r,i]=j(null),a=FR(),o=I(Kv),s=F(()=>{i(e=>(e&&!e.closed&&e.close(),null))},[]),c=F(async()=>{if(a&&!(!t||!n)&&!(r&&!r.closed))try{let e=await globalThis.window.documentPictureInPicture.requestWindow({width:NR,height:PR}),t=Ue.replace(/:host(?=[\s,{])/g,`:host, :root`),n=e.document.createElement(`style`);n.textContent=t,e.document.head.appendChild(n),e.document.body.style.margin=`0`,e.document.body.style.width=`100%`,e.document.body.style.height=`100vh`,e.document.body.style.overflow=`hidden`,e.addEventListener(`pagehide`,()=>{i(t=>t===e?null:t)},{once:!0}),i(e)}catch(e){MR.warn(`Failed to open PiP window`,e)}},[a,t,n,r]);return M(()=>{if(!t||!a||!n)return;let e=()=>{document.visibilityState===`hidden`?c():document.visibilityState===`visible`&&s()};document.addEventListener(`visibilitychange`,e);let r=[],i=null,o=`none`,l=!1;if(typeof navigator<`u`&&`mediaSession`in navigator){let e=navigator.mediaSession;i=e.metadata,o=e.playbackState;try{e.metadata=new MediaMetadata({title:`Tavus conversation`}),e.playbackState=`playing`,l=!0}catch(e){MR.warn(`mediaSession metadata setup failed`,e)}let t=(t,n)=>{try{e.setActionHandler(t,n),r.push(t)}catch(e){MR.warn(`mediaSession.${t} not supported`,e)}};t(`enterpictureinpicture`,()=>{c()}),t(`play`,()=>{}),t(`pause`,()=>{})}return()=>{if(document.removeEventListener(`visibilitychange`,e),typeof navigator<`u`&&`mediaSession`in navigator){let e=navigator.mediaSession;for(let t of r)try{e.setActionHandler(t,null)}catch{}if(l)try{e.metadata=i,e.playbackState=o}catch{}}}},[t,a,n,c,s]),M(()=>{(!n||!t)&&r&&!r.closed&&s()},[n,t,r,s]),M(()=>()=>{r&&!r.closed&&r.close()},[r]),M(()=>{if(!r||r.closed||!o)return;let e=()=>{r.document.body.setAttribute(`data-theme`,o.dataTheme.value);let e=o.cssVars.value;for(let[t,n]of Object.entries(e))r.document.body.style.setProperty(t,n)};e();let t=o.dataTheme.subscribe(()=>e()),n=o.cssVars.subscribe(()=>e());return()=>{t(),n()}},[r,o]),{pipWindow:r,isSupported:a,requestPipWindow:c,closePipWindow:s}}var LR=zt(null),RR={active:!1,video_shift_x:0,backdrop:{type:`snapshot_mirror`}},zR=ga(({id:e,showAudioWave:t=!0})=>{let n=p_(e).isOff;return L(`div`,{class:`relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n?`hidden`:``}`,children:[L(pg,{automirror:!0,sessionId:e,type:`video`,fit:`cover`,className:`w-full h-full object-cover ${n?`hidden`:``}`}),t&&L(`div`,{class:`absolute bottom-2 right-2`,children:L(Hx,{id:e})})]})}),BR=ga(()=>{let e=$h(),{isScreenSharing:t}=tx(),n=Yx()[0];return L(k,{children:[t&&n&&L(zR,{id:n}),e&&L(zR,{id:e,showAudioWave:!1})]})}),VR=ga(()=>L(`div`,{class:`absolute bottom-4 @max-mobile:bottom-20 left-4 flex flex-col items-end gap-2 z-20`,children:L(BR,{})})),HR=ga(({personaSessionId:e,localId:t,isScreenSharing:n,avatarOff:r,effect:i,animate:a})=>L(k,{children:[L(`div`,{class:`absolute inset-0 bg-base-200`}),i.content&&L(`div`,{class:`absolute overflow-hidden rounded-box bg-black`,style:RL(i.content,a),children:L(pg,{sessionId:n?t??``:e,type:`screenVideo`,fit:`contain`,className:`absolute inset-0 h-full w-full object-contain`})}),i.replica&&L(`div`,{class:EL(`absolute overflow-hidden`,i.replicaCollapsed&&`rounded-box`),style:RL(i.replica,a),children:L(eS,{personaSessionId:e,localSessionId:t,isScreenSharing:!1,avatarOff:r})})]})),UR=ga(()=>{let{effect:e,animate:t}=jL.value,n=$h();return n===null||e.selfView===null?null:L(`div`,{class:`absolute z-20 overflow-hidden rounded-box bg-black/30`,style:RL(e.selfView,t),children:L(pg,{automirror:!0,sessionId:n,type:`video`,fit:`cover`,className:`h-full w-full object-cover`})})}),WR=ga(({canvasRenderedSlot:e})=>{let t=KF(jL.value.effect);return t===`hidden`?null:t===`engine`?L(SR,{onError:zF,children:L(UR,{})}):e===`safe-area-bottom`?null:L(VR,{})}),GR=ga(()=>{let e=Yx()[0];return e?L(dg,{sessionId:e}):null}),KR=ga(e=>L(k,{children:[L(GR,{}),L(qR,{...e})]})),qR=ga(({isAudioOnly:e,presence:t,canvasLayoutEffect:n,canvasRenderedSlot:r})=>{let{presence:i,localId:a,isScreenSharing:o,isPersonaPresenting:s}=t,c=jL.value,l=n.active&&!o&&(!e||s);return i.phase===`left`?L(Bx,{}):i.phase===`connecting`?L(zx,{}):e&&!s?L(`div`,{class:`absolute inset-0 flex items-center justify-center`,children:L(Kx,{sessionId:i.replicaId})}):c.effect.driving?L(SR,{onError:zF,children:L(HR,{personaSessionId:i.replicaId,localId:a,isScreenSharing:o,avatarOff:i.videoState.isOff,effect:c.effect,animate:c.animate})}):s?L(BC,{personaSessionId:i.replicaId,isAudioOnly:e,avatarOff:i.videoState.isOff,canvasLayoutEffect:n,smartSidecarActive:l}):L(JR,{personaSessionId:i.replicaId,localId:a,isScreenSharing:o,avatarOff:i.videoState.isOff,smartSidecarActive:l,canvasLayoutEffect:n,canvasRenderedSlot:r})}),JR=ga(({personaSessionId:e,localId:t,isScreenSharing:n,avatarOff:r,smartSidecarActive:i,canvasLayoutEffect:a,canvasRenderedSlot:o})=>L(RC,{canvasLayoutEffect:a,smartSidecarActive:i,isScreenSharing:n,captureSnapshot:QR,personaMode:`auto`,renderedSlot:o,fill:i=>L(eS,{personaSessionId:e,localSessionId:t,isScreenSharing:n,avatarOff:r,videoRef:i})})),YR=ga(({items:e})=>{let[t,n]=j(!1),r=N(null);return M(()=>{if(!t)return;let e=e=>{r.current&&!e.composedPath().includes(r.current)&&n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,i)}},[t]),L(`div`,{ref:r,class:`relative`,children:[L(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-pressed":t,"aria-expanded":t,"aria-haspopup":`true`,"aria-label":t?`Close more controls`:`More controls`,class:`btn btn-control ${t?`btn-primary`:`btn-neutral`}`,children:L(fb,{name:`more`})}),t&&L(`div`,{role:`menu`,class:`absolute bottom-full mb-1 left-1/2 -translate-x-1/2 flex flex-row items-center gap-1 p-1 rounded-box bg-base-100 border border-base-300 shadow-lg z-30 whitespace-nowrap`,children:e})]})}),XR=ga(({items:e})=>e.length<=1?L(k,{children:e}):L(YR,{items:e})),ZR=ga(({onLeave:e})=>{let t=Hg(),{config:n}=mv(),{session:r,end:i}=Ex(),a=$h(),o=N(null),s=I(ry)?.frameRef??o,[c,l]=j(!1),u=Mb()===`full-screen`,[d,f]=j(!1),[p,m]=j(RR),[h,g]=j(null),_=n.value.customization.conversation,v=wR(_.show_fullscreen_hint&&h!==null&&!c&&!u),y=N(null),b=N(null),x=r.value?.conversationUrl,S=r.value?.magicGrid===!0,C=PF(_.magic_grid,S),w=ER(y,C,x),T=DR(y,b,72,C,x),E=_.modality===`audio`,D=TR(E),ee=_.modality===`chat`,te=_.modality===`video`,ne=_.enable_chat,re=_.enable_closed_captions,O=_.enable_picture_in_picture,{pipWindow:ie}=IR({enabled:O&&!ee,active:t===`joined-meeting`});M(()=>()=>{i()},[i]);let{camera:ae,requestCamera:k}=Rv(),{isCamMuted:A}=$b(),oe=ae.isGranted&&!A;M(()=>{te&&t===`joined-meeting`&&(LR.value=oe)},[te,t,oe]);let se=N(te&&!a&&LR.value===!0);M(()=>{t===`joined-meeting`&&se.current&&(se.current=!1,k())},[t,k]),M(()=>{(t===`left-meeting`||t===`error`)&&e()},[t,e]),M(()=>{let e=()=>{let e=s.current,t=e?.getRootNode(),n=t instanceof Document||t instanceof ShadowRoot?t:null;l(!!e&&n?.fullscreenElement===e)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let ce=F(()=>{let e=s.current;if(!e)return;let t=e.getRootNode();(t instanceof Document||t instanceof ShadowRoot?t:null)?.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.()},[]);F(()=>{f(e=>!e)},[]);let le=F(()=>{i()},[i]);if(kR({active:!ee&&t===`joined-meeting`,onTimeout:le}),jR({onShutdown:le}),!x)return null;if(ee)return L(Nx,{defaultOpen:!0,children:L(`div`,{class:`cvi-call-surface absolute inset-0`,children:L(Lx,{docked:!0,headerAction:L(`button`,{type:`button`,class:`btn btn-ghost btn-sm btn-circle text-base-content/60 hover:text-error`,onClick:le,"aria-label":`Leave conversation`,children:L(fb,{name:`leave`,size:20,"aria-label":`Leave conversation`})})})})});let ue=[L(Tx,{compact:!0},`screen-share`)];ne&&ue.push(L(Fx,{compact:!0},`chat`));let de=t===`left-meeting`;return L(Ox,{children:L(Nx,{children:L(cx,{children:[L(`div`,{class:`cvi-call-surface absolute inset-0${E?``:` cvi-video-surface`}`,ref:y,children:[L(`div`,{class:`relative w-full h-full z-[5]`,children:[L(KR,{isAudioOnly:E,presence:D,canvasLayoutEffect:p,canvasRenderedSlot:h}),!E&&L(WR,{canvasRenderedSlot:h}),L(iR,{debugEnabled:d,callPresence:D,callControlsVisible:w,callControlsRect:T,gridConfigEnabled:_.magic_grid,gridStartEnabled:S,onLayoutEffectChange:m,onRenderedSlotChange:g}),!u&&L(`div`,{class:`cvi-autohide absolute top-4 right-4 z-20`,"data-hidden":de,"data-pinned":v,children:L(Vx,{active:c,onToggle:ce,nudge:v,compact:!0})})]}),L(Lx,{}),L(jx,{}),L(`div`,{class:`cvi-autohide cvi-autohide-slide pointer-events-none absolute bottom-6 left-0 right-0 z-20`,"data-hidden":de,"aria-hidden":de,children:L(`div`,{class:`cvi-control-rail flex justify-center items-center gap-2 @max-mobile:gap-1`,"data-hidden":de,ref:b,children:[L(bx,{level:!0}),!E&&L(Sx,{}),re&&L(Ax,{}),L(XR,{items:ue}),L(`button`,{type:`button`,class:`btn btn-control btn-error`,onClick:le,"aria-label":`Leave call`,children:L(fb,{name:`leave`,"aria-label":`Leave Call`})})]})})]}),ie&&Na(L(Qx,{onLeave:le}),ie.document.body)]})})})});function QR(e){if(!e||e.readyState<2||!e.videoWidth||!e.videoHeight)return null;let t=document.createElement(`canvas`),n=Math.round(640*(e.videoHeight/e.videoWidth));t.width=640,t.height=n;let r=t.getContext(`2d`);if(!r)return null;r.drawImage(e,0,0,640,n);try{return t.toDataURL(`image/jpeg`,.82)}catch{return null}}function $R({message:e,class:t}){return L(`div`,{class:`w-max max-w-[min(20rem,80vw)] ${t??``}`,children:[L(`div`,{class:`px-4 py-2 rounded-box bg-neutral text-neutral-content text-sm font-medium shadow-lg text-center`,role:`status`,"aria-live":`polite`,children:e}),L(`svg`,{class:`absolute left-1/2 -translate-x-1/2 top-full text-neutral`,width:`16`,height:`8`,viewBox:`0 0 16 8`,"aria-hidden":`true`,children:L(`path`,{d:`M0 0 L8 8 L16 0 Z`,fill:`currentColor`})})]})}function ez(e,t,n){switch(t){case`granted`:return n?e?.cameraOptional??`Camera is optional — turn it on anytime.`:e?.ready??`You're all set — join whenever you're ready.`;case`blocked`:return e?.denied??`Microphone is blocked. Click the mic to see how to allow it.`;case`in-use`:return`Your microphone is in use by another app. Close it and try again.`;case`not-found`:return`No microphone found. Connect one to continue.`;case`unsupported`:return`This browser can't access your microphone.`;case`prompt`:return e?.prompt??`Allow microphone access to join.`;default:return e?.loading??`Getting your microphone ready...`}}var tz=ga(({text:e,isJoining:t=!1,onJoin:n,onCancel:r})=>{let i=hh(),{config:a}=mv(),{localSessionId:o,isCamMuted:s}=$b(),{mic:c,camera:l,requestMic:u,requestCamera:d}=Rv(),f=a.value.customization.conversation.modality===`video`,p=_b(a.value),m=gb(a.value);M(()=>{u()},[]);let h=c.isGranted,g=N(!1);M(()=>{!f||!h||g.current||l.isGranted||l.isBlocked||(g.current=!0,d())},[f,h,l.isGranted,l.isBlocked,d]);let _=f&&h&&!l.isGranted,v=ez(e,c.status,_);return L(cx,{children:L(`div`,{class:`absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]`,children:[l.isGranted&&!s?L(`div`,{class:`absolute inset-0 flex items-center justify-center bg-black overflow-hidden`,children:L(pg,{type:`video`,sessionId:o??``,mirror:!0,fit:`cover`,className:`w-full h-full object-cover!`})}):L(`div`,{class:`absolute inset-0 overflow-hidden bg-base-300`,children:[L(Sb,{variant:p.background,replica:m}),L(`div`,{class:`${Vb} backdrop-blur-xs`})]}),L(`div`,{class:`absolute bottom-6 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[90%]`,children:[v&&L($R,{message:v,class:`relative`}),L(`div`,{class:`flex flex-wrap items-center justify-center gap-1.5 @max-mobile:gap-1`,children:[L(`div`,{class:`flex items-center justify-center gap-1.5 shrink-0 @max-mobile:gap-1`,children:[L(bx,{level:!0}),f&&L(Sx,{})]}),L(Wb,{class:`btn-accent `,loading:t,disabled:!h,onClick:n,children:e?.join??`Join`}),L(`button`,{type:`button`,class:`btn btn-control ${c.isBlocked?`btn-error`:`btn-neutral`}`,onClick:()=>{i&&i.leave(),r?.()},"aria-label":e?.cancel??`Cancel`,title:e?.cancel??`Cancel`,children:L(fb,{name:`cancel`})})]})]})]})})}),nz=`Password required`,rz=`Enter the password to start this conversation.`,iz=`Password`,az=`Continue`;function oz({onSubmit:e,text:t,isSubmitting:n=!1,errorMessage:r}){let[i,a]=j(``),o=ct();return L(`div`,{class:`absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`${o}-title`,children:L(`form`,{onSubmit:t=>{t.preventDefault();let r=i.trim();!r||n||e(r)},class:`card bg-base-100 shadow-xl w-full max-w-sm`,children:L(`div`,{class:`card-body gap-3`,children:[L(`h3`,{id:`${o}-title`,class:`card-title text-base-content`,children:t?.title??nz}),L(`p`,{class:`text-sm text-base-content/70`,children:t?.description??rz}),L(`input`,{id:o,type:`password`,autocomplete:`current-password`,class:`input input-bordered w-full`,placeholder:t?.placeholder??iz,value:i,disabled:n,onInput:e=>a(e.target.value),autoFocus:!0}),r&&L(`p`,{class:`text-error text-xs`,role:`alert`,children:r}),L(Wb,{class:`btn-primary`,type:`submit`,disabled:!i.trim(),loading:n,children:t?.submit??az})]})})})}function sz({kind:e,status:t}){if(e===`camera`)return`Allow camera access to use video. Camera is optional.`;switch(t){case`blocked`:return`Microphone is blocked. Allow access in your browser settings to continue.`;case`in-use`:return`Your microphone is in use by another app. Close it and try again.`;case`not-found`:return`No microphone found. Connect one to continue.`;case`unsupported`:return`This browser can't access your microphone.`;default:return`Allow microphone access to start the conversation.`}}function cz({text:e,onStart:t,isStarting:n,permissionRequest:r}){let{config:i,deploymentId:a}=mv(),o=Mb()===`full-screen`,s=I(J_),c=_b(i.value),l=c.btn_title??e?.fallback_button??`Start the conversation`,u=i.value.customization.terms_content?.trim()??``,d=i.value.customization.terms_enabled===!0,f=u.length>0,p=f&&d,m=P(()=>p&&w_(a,u),[p,a,u]),h=p&&!m,g=i.value.has_password===!0,_=s?.password.value??null,v=g&&!_,y=ct(),[b,x]=j(m),S=n||p&&!b||v;return L(Ub,{title:c.title,description:c.description,overlay:v&&s?L(oz,{onSubmit:s.setPassword}):null,children:[L(`div`,{class:`relative`,children:[r&&L($R,{message:sz(r),class:`absolute bottom-full mb-3 z-20 ${o?`left-1/2 -translate-x-1/2`:`right-0`}`}),L(qb,{onClick:()=>{p&&b&&!m&&D_(a,u),t()},disabled:S,loading:n,children:l})]}),f&&L(`div`,{class:`max-w-xs text-center`,children:h?L(`label`,{for:y,class:`flex items-center gap-2 text-xs text-left cursor-pointer`,children:[L(`input`,{id:y,type:`checkbox`,class:`checkbox checkbox-secondary checkbox-xs mt-0.5 shrink-0`,checked:b,onChange:e=>x(e.target.checked)}),L(`span`,{class:`leading-snug`,children:u})]}):L(`p`,{class:`text-xs leading-snug text-white/70`,children:u})})]})}function lz(...e){for(let t of e){let e=t?.trim();if(e)return e}}function uz(){let{config:e}=mv(),{haircheck:t}=e.value.customization;return P(()=>({prompt:lz(t.permission_request_description,t.permission_request_title),ready:lz(t.permission_granted_description,t.permission_granted_title),denied:lz(t.permission_denied_description,t.permission_denied_title),join:lz(t.join_button),cancel:lz(t.cancel_btn)}),[t])}function dz({flow:e,welcomeText:t,onUnavailableCancel:n}){let r=uz();switch(e.state){case`idle`:return L(cz,{text:t,onStart:()=>{e.start()},isStarting:e.isStarting,permissionRequest:e.permissionRequest});case`haircheck`:return L(tz,{text:r,onJoin:()=>{e.join()},onCancel:()=>e.cancel(),isJoining:e.isStarting});case`call`:return L(ZR,{onLeave:()=>e.leave()});case`ended`:return L(Qb,{isStarting:e.isStarting,onRestart:()=>{e.start()}});case`unavailable`:return L(Ab,{cause:e.unavailableCause??`busy`,canRetry:e.canRetry,onRetry:()=>{e.start()},onCancel:n});default:{let t=e.state;throw Error(`Unreachable flow state: ${String(t)}`)}}}var fz=Ae(null);function pz({children:e}){let{config:t}=I(_i),n=t.peek().customization?.widget,r=n?.expandable??`default`,i=on(r===`start-expanded`||r===`always`),a=on(n?.variant??`full`),o=on(n?.position??`bottom-right`),s=on(r),c=on(n?.avatar?.type??`orb`),l=N(r);pn(()=>{let e=t.value.customization?.widget,n=e?.expandable??`default`;a.value=e?.variant??`full`,o.value=e?.position??`bottom-right`,s.value=n,c.value=e?.avatar?.type??`orb`,l.current!==n&&(i.value=n===`start-expanded`||n===`always`,l.current=n)});let u=F(()=>{s.peek()!==`always`&&(i.value=!i.peek())},[i,s]),d=F(()=>{i.value=!0},[i]),f=F(()=>{s.peek()!==`always`&&(i.value=!1)},[i,s]),p=I(fv);pn(()=>{p&&(p.hostVisible.value=i.value)});let m=I(h_),h=m?.flowSignal.value??`idle`,g=m?.isStarting??!1;M(()=>{(g||h===`haircheck`||h===`call`)&&(i.value=!0)},[g,h,i]);let _=I(Uv)?.shadowHost.value??null;M(()=>{if(_)return Object.assign(_,{open:d,close:f}),()=>{delete _.open,delete _.close}},[_,d,f]);let v=P(()=>({expanded:i,variant:a,position:o,expandable:s,avatarType:c,toggle:u,expand:d,collapse:f}),[i,a,o,s,c,u,d,f]);return L(fz.Provider,{value:v,children:e})}function mz(){let{config:e}=mv(),t=e.value.customization.branding;return e.value.show_tavus_branding!==!1&&!t?.hide_tavus_badge?L(hz,{}):t?.logo||t?.text?L(gz,{logo:t.logo,text:t.text}):null}function hz(){let{isDark:e}=PP(),t=e.value?`white`:`#140206`;return L(`a`,{href:`https://tavus.io`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center gap-1 text-xs text-base-content/50 hover:text-base-content/80 transition-colors`,children:[L(`svg`,{viewBox:`0 0 488 452`,class:`h-2.5 w-2.5 shrink-0`,fill:`none`,"aria-hidden":`true`,children:[L(`path`,{d:`M160 152V208H104V152H160Z`,fill:t}),L(`path`,{"fill-rule":`evenodd`,"clip-rule":`evenodd`,d:`M488 270.5L436 285L451 326L418.766 346L441 360L423 392L435 452H0V0H394.766L488 270.5ZM24 24V428H216.2L209 392L227 360L204.766 346L237 326L222 285L274 270.5L189.038 24H24ZM352 152C336.536 152 324 164.536 324 180C324 195.464 336.536 208 352 208C367.464 208 380 195.464 380 180C380 164.536 367.464 152 352 152Z`,fill:t})]}),L(`span`,{children:[`Powered by `,L(`span`,{class:`underline`,children:`Tavus`})]})]})}function gz({logo:e,text:t}){return L(`div`,{class:`inline-flex items-center gap-1 text-xs text-base-content/50`,children:[e?L(`img`,{src:e,alt:t||`Branding`,class:`h-2.5 shrink-0`}):null,t?L(`span`,{children:t}):null]})}var _z={title:`Hi! Want to chat?`,btn_title:`Start conversation`};function vz(){let{config:e}=mv(),t=e.value.customization.widget?.text;return P(()=>({title:t?.title||_z.title,btn_title:t?.btn_title||_z.btn_title}),[t])}function yz(){let e=I(fz);if(!e)throw Error(`useWidgetUI must be used within WidgetUIProvider`);return e}var bz={xs:`w-6 h-6`,sm:`w-8 h-8`,md:`w-10 h-10`,lg:`w-16 h-16`},xz={xs:`w-3 h-3`,sm:`w-4 h-4`,md:`w-5 h-5`,lg:`w-8 h-8`};function Sz({size:e=`md`,className:t=``}){let{avatarType:n}=yz(),{config:r}=mv(),i=gb(r.value);return(_b(r.value).background.type===`replica`||n.value===`image`)&&i?L(`div`,{class:`relative ${bz[e]} rounded-box overflow-hidden bg-base-300 ${t}`,children:L(xb,{replica:i})}):L(`div`,{class:`relative ${bz[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,children:L(`span`,{class:`${xz[e]} rounded-full bg-primary animate-pulse`})})}function Cz({variant:e}){let{toggle:t}=yz(),n=vz();return e===`tiny`?L(`button`,{type:`button`,onClick:t,"aria-label":n.btn_title,class:`rounded-box overflow-hidden shadow-xl hover:shadow-2xl transition-shadow cursor-pointer`,children:L(Sz,{size:`lg`})}):e===`compact`?L(`button`,{type:`button`,onClick:t,"aria-label":n.btn_title,class:`group flex items-center gap-2.5 py-2.5 pl-2.5 pr-8 rounded-box bg-base-100 text-base-content border border-base-300 shadow-lg hover:shadow-xl transition-shadow cursor-pointer text-left`,children:[L(Sz,{size:`md`}),L(`span`,{class:`flex flex-col gap-0.5`,children:[L(`span`,{class:`text-base font-medium leading-tight`,children:n.title}),L(`span`,{class:`text-sm text-base-content/60 leading-tight`,children:n.btn_title})]})]}):L(`button`,{type:`button`,onClick:t,"aria-label":n.btn_title,class:`flex flex-col gap-3 p-3 w-64 rounded-box bg-base-100 text-base-content border border-base-300 shadow-xl hover:shadow-2xl transition-shadow cursor-pointer text-left`,children:[L(`div`,{class:`flex items-center gap-2.5`,children:[L(Sz,{size:`md`}),L(`span`,{class:`text-sm font-medium leading-snug`,children:n.title})]}),L(`span`,{class:`btn btn-primary btn-sm w-full pointer-events-none gap-2 flex items-center`,children:[L(fb,{name:`cam`,size:16}),L(`span`,{className:`leading-4`,children:n.btn_title})]})]})}var wz=`tavus:widget:greeting-dismissed`;function Tz({anchor:e}){let t=vz(),{variant:n,expand:r}=yz(),[i,a]=j(!1);M(()=>{if(n.value===`tiny`){try{if(sessionStorage.getItem(wz)===`1`)return}catch{}a(!0)}},[n]);let o=F(e=>{e.stopPropagation();try{sessionStorage.setItem(wz,`1`)}catch{}a(!1)},[]);if(!i)return null;let s=e===`right`?`right-[-6px] border-r border-b`:`left-[-6px] border-l border-t`,c=e===`right`?`-right-2`:`-left-2`;return L(`button`,{type:`button`,onClick:r,class:`relative max-w-56 rounded-box bg-base-100 text-base-content shadow-lg border border-base-300 px-3 py-2 text-sm text-left cursor-pointer animate-[tavusFadeUp_240ms_ease-out] hover:bg-base-200 transition-colors`,children:[L(`p`,{class:`leading-snug pr-3`,children:t.title}),L(`span`,{role:`button`,tabIndex:0,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&o(e)},class:`absolute -top-2 ${c} btn btn-ghost btn-circle btn-xs bg-base-100 border border-base-300 shadow-sm`,"aria-label":`Dismiss`,children:`×`}),L(`span`,{class:`absolute bottom-3 w-3 h-3 rotate-45 bg-base-100 border-base-300 ${s}`})]})}function Ez(){let e=I(Uv);if(!e)throw Error(`useHostBridge must be used within HostBridgeProvider`);return e}var Dz=`bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]`,Oz=`bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]`,kz=`p-1 flex-1 min-h-0`,Az=`p-1 flex-1 min-h-0`;function jz({variant:e,children:t,onClose:n,fullscreen:r}){let{expandable:i}=yz(),a=i.value!==`always`;return r?L(`div`,{class:Oz,children:[L(`div`,{class:`flex items-center justify-end gap-2 px-2.5 py-1.5 border-b border-base-300`,children:a&&L(`button`,{type:`button`,class:`btn btn-ghost btn-circle btn-xs`,onClick:n,"aria-label":`Close`,children:L(fb,{name:`close`,size:14})})}),L(`div`,{class:Az,children:t}),L(`div`,{class:`flex justify-end px-2.5`,children:L(mz,{})})]}):L(`div`,{class:`flex flex-col h-[min(34rem,calc(100dvh-3rem))]`,children:[L(`div`,{class:`${Dz} flex-1 overflow-hidden`,children:[L(`div`,{class:`flex items-center justify-end gap-2 px-2.5 pt-1.5 shrink-0`,children:a&&L(`button`,{type:`button`,class:`btn btn-ghost btn-circle btn-xs`,onClick:n,"aria-label":`Close`,children:L(fb,{name:`close`,size:14})})}),L(`div`,{class:kz,children:t})]}),L(`div`,{class:`flex justify-end pr-2 pt-1.5 shrink-0`,children:L(mz,{})})]})}var Mz=mn(`Widget`),Nz=`1rem`,Pz=480;function Fz(e,t,n){let r=e.state===`call`,i=r||e.state===`haircheck`||e.isStarting;e.cancel(),r&&e.leave(),i&&t(),n()}function Iz(){return typeof window>`u`?!1:window.innerWidth<=Pz}function Lz(e){switch(e){case`bottom-right`:return{bottom:Nz,right:Nz};case`bottom-left`:return{bottom:Nz,left:Nz};case`top-right`:return{top:Nz,right:Nz};case`top-left`:return{top:Nz,left:Nz};case`top`:return{top:Nz,left:`50%`,transform:`translateX(-50%)`};case`bottom`:return{bottom:Nz,left:`50%`,transform:`translateX(-50%)`}}}var Rz=[`top`,`bottom`,`left`,`right`,`transform`];function zz(e){return e===`bottom-left`||e===`top-left`?`left`:`right`}function Bz(){let{config:e,initError:t}=mv(),n=vz(),{expanded:r,position:i,variant:a,collapse:o}=yz(),{end:s}=Ex(),{shadowHost:c}=Ez(),l=jb(),u=on(Iz());M(()=>{if(typeof window>`u`)return;u.value=Iz();let e=()=>{u.value=Iz()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[u]);let d=P(()=>({fallback_button:n.btn_title}),[n.btn_title]),f=F(()=>{Fz(l,s,o)},[l,s,o]);if(pn(()=>{let e=c.value,t=i.value,n=r.value,a=n&&u.value;if(e){if(a)e.style.top=`0`,e.style.right=`0`,e.style.bottom=`0`,e.style.left=`0`,e.style.transform=``;else{let n=Lz(t);for(let t of Rz)e.style[t]=n[t]??``}e.dataset.tavusWidgetPosition=t,e.dataset.tavusWidgetExpanded=n?`true`:`false`,e.dataset.tavusWidgetFullscreen=a?`true`:`false`,e.dataset.tavusWidgetSmall=u.value?`true`:`false`}}),t.value)return Mz.error(`Widget cannot initialize (init request failed):`,t.value),null;if(e.value.is_available===!1&&e.value.unavailable_reason===`total_limit`)return Mz.error(`Widget is unavailable (total_limit reached) — not rendering`),null;if(!r.value){let e=zz(i.value),t=e===`right`?`flex items-end gap-2 justify-end`:`flex items-end gap-2 flex-row-reverse justify-end`,n=e===`right`?`justify-end pr-2`:`justify-start pl-2`;return L(`div`,{class:`flex flex-col`,children:[L(`div`,{class:t,children:[L(Tz,{anchor:e}),L(Cz,{variant:a.value})]}),L(`div`,{class:`flex ${n} pt-1.5`,children:L(mz,{})})]})}return e.value.is_available===!1?L(jz,{variant:a.value,fullscreen:u.value,onClose:f,children:L(iy,{children:L(Ab,{cause:e.value.unavailable_reason??`daily_limit`,canRetry:!1,onRetry:()=>{}})})}):L(jz,{variant:a.value,fullscreen:u.value,onClose:f,children:L(iy,{children:L(dz,{flow:l,welcomeText:d,onUnavailableCancel:()=>l.restart()})})})}var Vz=`:host {
|
|
165
165
|
display: block;
|
|
166
166
|
position: fixed;
|
|
167
167
|
z-index: 50;
|
package/dist/index.mjs
CHANGED
|
@@ -5589,6 +5589,10 @@ var wn = /* @__PURE__ */ a(((e) => {
|
|
|
5589
5589
|
type: "boolean",
|
|
5590
5590
|
default: !1
|
|
5591
5591
|
},
|
|
5592
|
+
show_fullscreen_hint: {
|
|
5593
|
+
type: "boolean",
|
|
5594
|
+
default: !0
|
|
5595
|
+
},
|
|
5592
5596
|
unique_memory_tag: {
|
|
5593
5597
|
type: "boolean",
|
|
5594
5598
|
default: !0
|
|
@@ -32104,7 +32108,7 @@ var aR = zt(null), oR = {
|
|
|
32104
32108
|
})]
|
|
32105
32109
|
});
|
|
32106
32110
|
}), vR = ga(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(k, { children: e }) : /* @__PURE__ */ L(_R, { items: e })), yR = ga(({ onLeave: e }) => {
|
|
32107
|
-
let t = Hg(), { config: n } = mv(), { session: r, end: i } = Ex(), a = $h(), o = N(null), s = I(ry)?.frameRef ?? o, [c, l] = j(!1), u = Mb() === "full-screen", [d, f] = j(!1), [p, m] = j(oR), [h, g] = j(null), _ = KL(h !== null && !c && !u),
|
|
32111
|
+
let t = Hg(), { config: n } = mv(), { session: r, end: i } = Ex(), a = $h(), o = N(null), s = I(ry)?.frameRef ?? o, [c, l] = j(!1), u = Mb() === "full-screen", [d, f] = j(!1), [p, m] = j(oR), [h, g] = j(null), _ = n.value.customization.conversation, v = KL(_.show_fullscreen_hint && h !== null && !c && !u), y = N(null), b = N(null), x = r.value?.conversationUrl, S = r.value?.magicGrid === !0, C = nF(_.magic_grid, S), w = JL(y, C, x), T = YL(y, b, 72, C, x), E = _.modality === "audio", D = qL(E), ee = _.modality === "chat", te = _.modality === "video", ne = _.enable_chat, re = _.enable_closed_captions, O = _.enable_picture_in_picture, { pipWindow: ie } = iR({
|
|
32108
32112
|
enabled: O && !ee,
|
|
32109
32113
|
active: t === "joined-meeting"
|
|
32110
32114
|
});
|
|
@@ -32146,7 +32150,7 @@ var aR = zt(null), oR = {
|
|
|
32146
32150
|
if (ZL({
|
|
32147
32151
|
active: !ee && t === "joined-meeting",
|
|
32148
32152
|
onTimeout: le
|
|
32149
|
-
}), $L({ onShutdown: le }), !
|
|
32153
|
+
}), $L({ onShutdown: le }), !x) return null;
|
|
32150
32154
|
if (ee) return /* @__PURE__ */ L(Nx, {
|
|
32151
32155
|
defaultOpen: !0,
|
|
32152
32156
|
children: /* @__PURE__ */ L("div", {
|
|
@@ -32172,7 +32176,7 @@ var aR = zt(null), oR = {
|
|
|
32172
32176
|
let de = t === "left-meeting";
|
|
32173
32177
|
return /* @__PURE__ */ L(Ox, { children: /* @__PURE__ */ L(Nx, { children: /* @__PURE__ */ L(cx, { children: [/* @__PURE__ */ L("div", {
|
|
32174
32178
|
class: `cvi-call-surface absolute inset-0${E ? "" : " cvi-video-surface"}`,
|
|
32175
|
-
ref:
|
|
32179
|
+
ref: y,
|
|
32176
32180
|
children: [
|
|
32177
32181
|
/* @__PURE__ */ L("div", {
|
|
32178
32182
|
class: "relative w-full h-full z-[5]",
|
|
@@ -32189,7 +32193,7 @@ var aR = zt(null), oR = {
|
|
|
32189
32193
|
callPresence: D,
|
|
32190
32194
|
callControlsVisible: w,
|
|
32191
32195
|
callControlsRect: T,
|
|
32192
|
-
gridConfigEnabled:
|
|
32196
|
+
gridConfigEnabled: _.magic_grid,
|
|
32193
32197
|
gridStartEnabled: S,
|
|
32194
32198
|
onLayoutEffectChange: m,
|
|
32195
32199
|
onRenderedSlotChange: g
|
|
@@ -32197,11 +32201,11 @@ var aR = zt(null), oR = {
|
|
|
32197
32201
|
!u && /* @__PURE__ */ L("div", {
|
|
32198
32202
|
class: "cvi-autohide absolute top-4 right-4 z-20",
|
|
32199
32203
|
"data-hidden": de,
|
|
32200
|
-
"data-pinned":
|
|
32204
|
+
"data-pinned": v,
|
|
32201
32205
|
children: /* @__PURE__ */ L(Vx, {
|
|
32202
32206
|
active: c,
|
|
32203
32207
|
onToggle: ce,
|
|
32204
|
-
nudge:
|
|
32208
|
+
nudge: v,
|
|
32205
32209
|
compact: !0
|
|
32206
32210
|
})
|
|
32207
32211
|
})
|
|
@@ -32216,7 +32220,7 @@ var aR = zt(null), oR = {
|
|
|
32216
32220
|
children: /* @__PURE__ */ L("div", {
|
|
32217
32221
|
class: "cvi-control-rail flex justify-center items-center gap-2 @max-mobile:gap-1",
|
|
32218
32222
|
"data-hidden": de,
|
|
32219
|
-
ref:
|
|
32223
|
+
ref: b,
|
|
32220
32224
|
children: [
|
|
32221
32225
|
/* @__PURE__ */ L(bx, { level: !0 }),
|
|
32222
32226
|
!E && /* @__PURE__ */ L(Sx, {}),
|