@marketrix.ai/widget 3.8.461 → 3.8.462

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/widget.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import*as e from"react";import t,{createContext as n,createElement as r,forwardRef as o,useCallback as i,useContext as s,useEffect as a,useImperativeHandle as c,useLayoutEffect as l,useMemo as d,useRef as u,useState as p,useSyncExternalStore as h}from"react";import{createRoot as f}from"react-dom/client";import{Fragment as m,jsx as g,jsxs as y}from"react/jsx-runtime";import*as b from"react-dom";function v(e){return Array.isArray(e)?e:null==e?[]:[e]}var w="orpc",x=class extends Error{constructor(...e){super(...e),this.name="AbortError"}};function k(e){let t;return()=>{if(t)return t.result;const n=e();return t={result:n},n}}function S(){return globalThis["__@orpc/shared@1.15.0/otel/config__"]}function _(e,t={},n){return(S()?.tracer)?.startSpan(e,t,n)}function E(e,t,n={}){if(!e)return;const r=function(e){if(e instanceof Error){const t={message:e.message,name:e.name,stack:e.stack};return!("code"in e)||"string"!=typeof e.code&&"number"!=typeof e.code||(t.code=e.code),t}return{message:String(e)}}(t);e.recordException(r),n.signal?.aborted&&n.signal.reason===t||e.setStatus({code:2,message:r.message})}async function C({name:e,context:t,...n},r){const o=S()?.tracer;if(!o)return r();const i=async e=>{try{return await r(e)}catch(t){throw E(e,t,n),t}finally{e.end()}};return t?o.startActiveSpan(e,n,t,i):o.startActiveSpan(e,n,i)}async function I(e,t){const n=S();if(!e||!n)return t();const r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function T(e){return!(!e||"object"!=typeof e)&&("next"in e&&"function"==typeof e.next&&Symbol.asyncIterator in e&&"function"==typeof e[Symbol.asyncIterator])}var z=Symbol.asyncDispose??Symbol.for("asyncDispose"),M=class{#e=!1;#t=!1;#n;#r;constructor(e,t){this.#n=t,this.#r=function(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}(async()=>{if(this.#e)return{done:!0,value:void 0};try{const t=await e();return t.done&&(this.#e=!0),t}catch(t){throw this.#e=!0,t}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n("next"))}})}next(){return this.#r()}async return(e){return this.#e=!0,this.#t||(this.#t=!0,await this.#n("return")),{done:!0,value:e}}async throw(e){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n("throw")),e}async[z](){this.#e=!0,this.#t||(this.#t=!0,await this.#n("dispose"))}[Symbol.asyncIterator](){return this}};function O({name:e,...t},n){let r;return new M(async()=>{r??=_(e);try{const e=await I(r,()=>n.next());return r?.addEvent(e.done?"completed":"yielded"),e}catch(o){throw E(r,o,t),o}},async e=>{try{"next"!==e&&await I(r,()=>n.return?.())}catch(o){throw E(r,o,t),o}finally{r?.end()}})}function R(e,t,n){const r=(t,o)=>{const i=e[o];return i?i({...t,next:(e=t)=>r(e,o+1)}):n(t)};return r(t,0)}function N(e){if(e)return JSON.parse(e)}function A(e){return JSON.stringify(e)}function P(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function D(e){return!!e&&("object"==typeof e||"function"==typeof e)}function $(e,...t){return"function"==typeof e?e(...t):e}function L(e){return new Proxy(e,{get(e,t,n){const r=Reflect.get(e,t,n);return"then"!==t||"function"!=typeof r?r:new Proxy(r,{apply(t,n,r){if(2!==r.length||r.some(e=>{return!("function"==typeof(t=e)&&j.test(t.toString()));var t}))return Reflect.apply(t,n,r);let o=!0;r[0].call(n,L(new Proxy(e,{get:(e,t,n)=>{if(!o||"then"!==t)return Reflect.get(e,t,n);o=!1}})))}})}})}var j=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;var F,U=/* @__PURE__ */new Set(["bind","valueOf","toString","toJSON"]),W={BAD_REQUEST:{status:400,message:"Bad Request"},UNAUTHORIZED:{status:401,message:"Unauthorized"},FORBIDDEN:{status:403,message:"Forbidden"},NOT_FOUND:{status:404,message:"Not Found"},METHOD_NOT_SUPPORTED:{status:405,message:"Method Not Supported"},NOT_ACCEPTABLE:{status:406,message:"Not Acceptable"},TIMEOUT:{status:408,message:"Request Timeout"},CONFLICT:{status:409,message:"Conflict"},PRECONDITION_FAILED:{status:412,message:"Precondition Failed"},PAYLOAD_TOO_LARGE:{status:413,message:"Payload Too Large"},UNSUPPORTED_MEDIA_TYPE:{status:415,message:"Unsupported Media Type"},UNPROCESSABLE_CONTENT:{status:422,message:"Unprocessable Content"},TOO_MANY_REQUESTS:{status:429,message:"Too Many Requests"},CLIENT_CLOSED_REQUEST:{status:499,message:"Client Closed Request"},INTERNAL_SERVER_ERROR:{status:500,message:"Internal Server Error"},NOT_IMPLEMENTED:{status:501,message:"Not Implemented"},BAD_GATEWAY:{status:502,message:"Bad Gateway"},SERVICE_UNAVAILABLE:{status:503,message:"Service Unavailable"},GATEWAY_TIMEOUT:{status:504,message:"Gateway Timeout"}};var B=class e extends Error{defined;code;status;data;static{const t=Symbol.for("__@orpc/client@1.15.0/error/ORPC_ERROR_CONSTRUCTORS__");globalThis[t]??=/* @__PURE__ */new WeakSet,(F=globalThis[t]).add(e)}constructor(e,...t){const n=function(e){return e[0]??{}}(t);if(void 0!==n.status&&!H(n.status))throw new Error("[ORPCError] Invalid error status code.");const r=function(e,t){return t||W[e]?.message||e}(e,n.message);super(r,n),this.code=e,this.status=function(e,t){return t??W[e]?.status??500}(e,n.status),this.defined=n.defined??!1,this.data=n.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(F.has(this)){const t=function(e){return D(e)?Object.getPrototypeOf(e)?.constructor:null}(e);if(t&&F.has(t))return!0}return super[Symbol.hasInstance](e)}};function H(e){return e<200||e>=400}function Z(e){if(!P(e))return!1;const t=["defined","code","status","message","data"];return!Object.keys(e).some(e=>!t.includes(e))&&("defined"in e&&"boolean"==typeof e.defined&&"code"in e&&"string"==typeof e.code&&"status"in e&&"number"==typeof e.status&&H(e.status)&&"message"in e&&"string"==typeof e.message)}function q(e,t={}){return new B(e.code,{...t,...e})}var V=class extends TypeError{},G=class extends TypeError{},Y=class extends Error{data;constructor(e){super(e?.message??"An error event was received",e),this.data=e?.data}},J=/\r\n|\r(?!\n)|\n/,X=/(?:\r\n|\r(?!\n)|\n){2}/,K=/(?:\r\n|\r(?!\n)|\n){2}/g;function Q(e){const t={data:void 0,event:void 0,id:void 0,retry:void 0,comments:[]};for(const n of e.split(J)){if(""===n)continue;const e=n.indexOf(":"),r=-1===e?"":n.slice(32===n.charCodeAt(e+1)?e+2:e+1);if(0!==e)switch(-1===e?n:n.slice(0,e)){case"data":t.data=void 0===t.data?r:`${t.data}\n${r}`;break;case"event":t.event=r;break;case"id":t.id=r;break;case"retry":{const e=Number.parseInt(r,10);e>=0&&e.toString()===r&&(t.retry=e);break}}else t.comments.push(r)}return t}var ee=class{constructor(e={}){this.options=e}pending=[];tail="";discardLeadingLF=!1;feed(e){if(""===e)return;if(this.discardLeadingLF&&(this.discardLeadingLF=!1,10===e.charCodeAt(0)&&""===(e=e.slice(1))))return;const t=this.tail+e;if(!X.test(t))return this.pending.push(e),void(this.tail=t.slice(-3));this.pending.push(e);const n=1===this.pending.length?e:this.pending.join(""),r=n.length-t.length,o=[];let i=0;for(const a of t.matchAll(K))o.push(n.slice(i,r+a.index)),i=r+a.index+a[0].length;const s=n.slice(i);this.pending.length=0,this.tail=s.slice(-3),""===s?this.discardLeadingLF=13===e.charCodeAt(e.length-1):this.pending.push(s);for(const a of o){const e=Q(a);this.options.onEvent&&this.options.onEvent(e)}}end(){if(0!==this.pending.length)throw new G("Event Iterator ended before complete")}},te=class extends TransformStream{constructor(){let e;super({start(t){e=new ee({onEvent:e=>{t.enqueue(e)}})},transform(t){e.feed(t)},flush(){e.end()}})}},ne=/\r\n|[\n\r]/,re=/\r\n|[\n\r]/g;function oe(e){return ne.test(e)}function ie(e){if(oe(e))throw new V("Event's id must not contain a carriage return or newline character")}function se(e){if(!Number.isInteger(e)||e<0)throw new V("Event's retry must be a integer and >= 0")}function ae(e){if(oe(e))throw new V("Event's comment must not contain a carriage return or newline character")}function ce(e){let t="";var n;return t+=function(e){let t="";for(const n of e??[])ae(n),t+=`: ${n}\n`;return t}(e.comments),void 0!==e.event&&(!function(e){if(oe(e))throw new V("Event's event must not contain a carriage return or newline character")}(e.event),t+=`event: ${e.event}\n`),void 0!==e.retry&&(se(e.retry),t+=`retry: ${e.retry}\n`),void 0!==e.id&&(ie(e.id),t+=`id: ${e.id}\n`),t+=void 0===(n=e.data)?"":`data: ${n.replace(re,"\ndata: ")}\n`,t+="\n",t}var le=Symbol("ORPC_EVENT_SOURCE_META");function de(e,t){if(void 0===t.id&&void 0===t.retry&&!t.comments?.length)return e;if(void 0!==t.id&&ie(t.id),void 0!==t.retry&&se(t.retry),void 0!==t.comments)for(const n of t.comments)ae(n);return new Proxy(e,{get:(e,n,r)=>n===le?t:Reflect.get(e,n,r)})}function ue(e){return D(e)?Reflect.get(e,le):void 0}function pe(e){const t=e.match(/filename\*=(UTF-8'')?([^;]*)/i);if(t&&"string"==typeof t[2])return function(e){try{return decodeURIComponent(e)}catch{return e}}(t[2]);const n=e.match(/filename="((?:\\"|[^"])*)"/i);return n&&"string"==typeof n[1]?n[1].replace(/\\"/g,'"'):void 0}function he(e,t){const n=async e=>{let n=await t.error(e);if(n!==e){const t=ue(e);t&&D(n)&&(n=de(n,t))}return n};return new M(async()=>{const{done:r,value:o}=await(async()=>{try{return await e.next()}catch(t){throw await n(t)}})();let i=await t.value(o,r);if(i!==o){const e=ue(o);e&&D(i)&&(i=de(i,e))}return{done:r,value:i}},async()=>{try{await(e.return?.())}catch(t){throw await n(t)}})}function fe(e,t={}){const n=t.path??[];return L(new Proxy(async(...[t,r={}])=>await e.call(n,t,function(e){return{...e,context:e.context??{}}}(r)),{get:(r,o)=>"string"!=typeof o||U.has(o)?Reflect.get(r,o):fe(e,{...t,path:[...n,o]})}))}function me(e,t={}){return C({name:"parse_standard_body",signal:t.signal},async()=>{const n=e.headers.get("content-disposition");if("string"==typeof n){const t=pe(n)??"blob",r=await e.blob();return new File([r],t,{type:r.type})}const r=e.headers.get("content-type");if(!r||r.startsWith("application/json")){return N(await e.text())}if(r.startsWith("multipart/form-data"))return await e.formData();if(r.startsWith("application/x-www-form-urlencoded")){const t=await e.text();return new URLSearchParams(t)}if(r.startsWith("text/event-stream"))return function(e,t={}){const n=(e?.pipeThrough(new TextDecoderStream).pipeThrough(new te))?.getReader();let r,o=!1;return new M(async()=>{r??=_("consume_event_iterator_stream");try{for(;;){if(void 0===n)return{done:!0,value:void 0};const{done:e,value:t}=await I(r,()=>n.read());if(e){if(o)throw new x("Stream was cancelled");return{done:!0,value:void 0}}switch(t.event){case"message":{let e=N(t.data);return D(e)&&(e=de(e,t)),r?.addEvent("message"),{done:!1,value:e}}case"error":{let e=new Y({data:N(t.data)});throw e=de(e,t),r?.addEvent("error"),e}case"done":{let e=N(t.data);return D(e)&&(e=de(e,t)),r?.addEvent("done"),{done:!0,value:e}}default:r?.addEvent("maybe_keepalive")}}}catch(e){throw e instanceof Y||E(r,e,t),e}},async e=>{try{"next"!==e&&(o=!0,r?.addEvent("cancelled")),await I(r,()=>n?.cancel())}catch(i){throw E(r,i,t),i}finally{r?.end()}})}(e.body,t);if(r.startsWith("text/plain"))return await e.text();const o=await e.blob();return new File([o],"blob",{type:o.type})})}function ge(e,t,n={}){if(e instanceof ReadableStream)return e;const r=t.get("content-disposition");return t.delete("content-type"),t.delete("content-disposition"),void 0!==e?e instanceof Blob?(t.set("content-type",e.type),t.set("content-length",e.size.toString()),t.set("content-disposition",r??function(e,t="inline"){return`${t}; filename="${e.replace(/[^\x20-\x7E]/g,"_").replace(/"/g,'\\"')}"; filename*=utf-8''${encodeURIComponent(e).replace(/['()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)))}`}(e instanceof File?e.name:"blob")),e):e instanceof FormData||e instanceof URLSearchParams?e:T(e)?(t.set("content-type","text/event-stream"),function(e,t={}){const n=t.eventIteratorKeepAliveEnabled??!0,r=t.eventIteratorKeepAliveInterval??5e3,o=t.eventIteratorKeepAliveComment??"",i=t.eventIteratorInitialCommentEnabled??!0,s=t.eventIteratorInitialComment??"";let a,c,l=!1;return new ReadableStream({start(e){c=_("stream_event_iterator"),i&&e.enqueue(ce({comments:[s]}))},async pull(t){try{n&&(a=setInterval(()=>{t.enqueue(ce({comments:[o]})),c?.addEvent("keepalive")},r));const i=await I(c,()=>e.next());if(clearInterval(a),l)return;const s=ue(i.value);if(!i.done||void 0!==i.value||void 0!==s){const e=i.done?"done":"message";t.enqueue(ce({...s,event:e,data:A(i.value)})),c?.addEvent(e)}i.done&&(t.close(),c?.end())}catch(i){if(clearInterval(a),l)return;i instanceof Y?(t.enqueue(ce({...ue(i),event:"error",data:A(i.data)})),c?.addEvent("error"),t.close()):(E(c,i),t.error(i)),c?.end()}},async cancel(){try{l=!0,clearInterval(a),c?.addEvent("cancelled"),await I(c,()=>e.return?.())}catch(t){throw E(c,t),t}finally{c?.end()}}}).pipeThrough(new TextEncoderStream)}(e,n)):(t.set("content-type","application/json"),A(e)):void 0}function ye(e,t={}){return e.forEach((e,n)=>{Array.isArray(t[n])?t[n].push(e):void 0!==t[n]?t[n]=[t[n],e]:t[n]=e}),t}function be(e,t={}){const n=function(e,t=new Headers){for(const[n,r]of Object.entries(e))if(Array.isArray(r))for(const e of r)t.append(n,e);else void 0!==r&&t.append(n,r);return t}(e.headers),r=ge(e.body,n,t);return new Request(e.url,{signal:e.signal,method:e.method,headers:n,body:r})}var ve=class{plugins;constructor(e=[]){this.plugins=[...e].sort((e,t)=>(e.order??0)-(t.order??0))}init(e){for(const t of this.plugins)t.init?.(e)}},we=class{constructor(e,t,n={}){this.codec=e,this.sender=t,new ve(n.plugins).init(n),this.interceptors=v(n.interceptors),this.clientInterceptors=v(n.clientInterceptors)}interceptors;clientInterceptors;call(e,t,n){return C({name:`${w}.${e.join("/")}`,signal:n.signal},r=>(r?.setAttribute("rpc.system",w),r?.setAttribute("rpc.method",e.join(".")),T(t)&&(t=O({name:"consume_event_iterator_input",signal:n.signal},t)),R(this.interceptors,{...n,path:e,input:t},async({path:e,input:t,...n})=>{const o=S();let i;const s=o?.trace.getActiveSpan()??r;s&&o&&(i=o?.trace.setSpan(o.context.active(),s));const a=await C({name:"encode_request",context:i},()=>this.codec.encode(e,t,n)),c=await R(this.clientInterceptors,{...n,input:t,path:e,request:a},({input:e,path:t,request:n,...r})=>C({name:"send_request",signal:r.signal,context:i},()=>this.sender.call(n,r,t,e))),l=await C({name:"decode_response",context:i},()=>this.codec.decode(c,n,e,t));return T(l)?O({name:"consume_event_iterator_output",signal:n.signal},l):l})))}},xe=0,ke=1,Se=2,_e=3,Ee=4,Ce=5,Ie=6,Te=7,ze=class{customSerializers;constructor(e={}){if(this.customSerializers=e.customJsonSerializers??[],this.customSerializers.length!==new Set(this.customSerializers.map(e=>e.type)).size)throw new Error("Custom serializer type must be unique.")}serialize(e,t=[],n=[],r=[],o=[]){for(const i of this.customSerializers)if(i.condition(e)){const s=this.serialize(i.serialize(e),t,n,r,o);return n.push([i.type,...t]),s}if(e instanceof Blob)return r.push(t),o.push(e),[e,n,r,o];if("bigint"==typeof e)return n.push([xe,...t]),[e.toString(),n,r,o];if(e instanceof Date)return n.push([ke,...t]),Number.isNaN(e.getTime())?[null,n,r,o]:[e.toISOString(),n,r,o];if(Number.isNaN(e))return n.push([Se,...t]),[null,n,r,o];if(e instanceof URL)return n.push([Ee,...t]),[e.toString(),n,r,o];if(e instanceof RegExp)return n.push([Ce,...t]),[e.toString(),n,r,o];if(e instanceof Set){const i=this.serialize(Array.from(e),t,n,r,o);return n.push([Ie,...t]),i}if(e instanceof Map){const i=this.serialize(Array.from(e.entries()),t,n,r,o);return n.push([Te,...t]),i}if(Array.isArray(e))return[e.map((e,i)=>void 0===e?(n.push([_e,...t,i]),null):this.serialize(e,[...t,i],n,r,o)[0]),n,r,o];if(P(e)){const i={};for(const s in e)"toJSON"===s&&"function"==typeof e[s]||(i[s]=this.serialize(e[s],[...t,s],n,r,o)[0]);return[i,n,r,o]}return[e,n,r,o]}deserialize(e,t,n,r){const o={data:e};n&&r&&n.forEach((e,t)=>{let n=o,i="data";e.forEach(e=>{if(n=n[i],i=e,!Object.hasOwn(n,i))throw new Error(`Security error: accessing non-existent path during deserialization. Path segment: ${i}`)}),n[i]=r(t)});for(const i of t){const e=i[0];let t=o,n="data";for(let r=1;r<i.length;r++)if(t=t[n],n=i[r],!Object.hasOwn(t,n))throw new Error(`Security error: accessing non-existent path during deserialization. Path segment: ${n}`);for(const r of this.customSerializers)if(r.type===e){t[n]=r.deserialize(t[n]);break}switch(e){case xe:t[n]=BigInt(t[n]);break;case ke:t[n]=new Date(t[n]??"Invalid Date");break;case Se:t[n]=NaN;break;case _e:t[n]=void 0;break;case Ee:t[n]=new URL(t[n]);break;case Ce:{const[,e,r]=t[n].match(/^\/(.*)\/([a-z]*)$/);t[n]=new RegExp(e,r);break}case Ie:t[n]=new Set(t[n]);break;case Te:t[n]=new Map(t[n])}}return o.data}};var Me,Oe=class{constructor(e,t){this.serializer=e,this.baseUrl=t.url,this.maxUrlLength=t.maxUrlLength??2083,this.fallbackMethod=t.fallbackMethod??"POST",this.expectedMethod=t.method??this.fallbackMethod,this.headers=t.headers??{}}baseUrl;maxUrlLength;fallbackMethod;expectedMethod;headers;async encode(e,t,n){let r=function(e){return"function"==typeof e.forEach?ye(e):e}(await $(this.headers,n,e,t));void 0!==n.lastEventId&&(r=function(e,t){const n={...e};for(const r in t)Array.isArray(t[r])?n[r]=[...v(n[r]),...t[r]]:void 0!==t[r]&&(Array.isArray(n[r])?n[r]=[...n[r],t[r]]:void 0!==n[r]?n[r]=[n[r],t[r]]:n[r]=t[r]);return n}(r,{"last-event-id":n.lastEventId}));const o=await $(this.expectedMethod,n,e,t),i=await $(this.baseUrl,n,e,t),s=new URL(i);s.pathname=`${s.pathname.replace(/\/$/,"")}${function(e){return`/${e.map(encodeURIComponent).join("/")}`}(e)}`;const a=this.serializer.serialize(t);if(!("GET"!==o||a instanceof FormData||T(a))){const i=await $(this.maxUrlLength,n,e,t),c=new URL(s);if(c.searchParams.append("data",A(a)),c.toString().length<=i)return{body:void 0,method:o,headers:r,url:c,signal:n.signal}}return{url:s,method:"GET"===o?this.fallbackMethod:o,headers:r,body:a,signal:n.signal}}async decode(e){const t=!H(e.status),n=await(async()=>{let t=!1;try{const n=await e.body();return t=!0,this.serializer.deserialize(n)}catch(n){if(!t)throw new Error("Cannot parse response body, please check the response body and content-type.",{cause:n});throw new Error("Invalid RPC response format.",{cause:n})}})();if(!t){if(Z(n))throw q(n);throw new B((r=e.status,Object.entries(W).find(([,e])=>e.status===r)?.[0]??"MALFORMED_ORPC_ERROR_RESPONSE"),{status:e.status,data:{...e,body:n}})}var r;return n}},Re=class{constructor(e){this.jsonSerializer=e}serialize(e){return T(e)?he(e,{value:async e=>this.#o(e,!1),error:async e=>{return new Y({data:this.#o((t=e,t instanceof B?t:new B("INTERNAL_SERVER_ERROR",{message:"Internal server error",cause:t})).toJSON(),!1),cause:e});var t}}):this.#o(e,!0)}#o(e,t){const[n,r,o,i]=this.jsonSerializer.serialize(e),s=0===r.length?void 0:r;if(!t||0===i.length)return{json:n,meta:s};const a=new FormData;return a.set("data",A({json:n,meta:s,maps:o})),i.forEach((e,t)=>{a.set(t.toString(),e)}),a}deserialize(e){return T(e)?he(e,{value:async e=>this.#i(e),error:async e=>{if(!(e instanceof Y))return e;const t=this.#i(e.data);return Z(t)?q(t,{cause:e}):new Y({data:t,cause:e})}}):this.#i(e)}#i(e){if(void 0===e)return;if(!(e instanceof FormData))return this.jsonSerializer.deserialize(e.json,e.meta??[]);const t=JSON.parse(e.get("data"));return this.jsonSerializer.deserialize(t.json,t.meta??[],t.maps,t=>e.get(t.toString()))}},Ne=class extends we{constructor(e,t){const n=new ze(t),r=new Re(n);super(new Oe(r,t),e,t)}},Ae=class extends ve{initRuntimeAdapter(e){for(const t of this.plugins)t.initRuntimeAdapter?.(e)}},Pe=class{fetch;toFetchRequestOptions;adapterInterceptors;constructor(e){new Ae(e.plugins).initRuntimeAdapter(e),this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=e,this.adapterInterceptors=v(e.adapterInterceptors)}async call(e,t,n,r){const o=be(e,this.toFetchRequestOptions);return function(e,t={}){return{body:k(()=>me(e,t)),status:e.status,get headers(){const t=ye(e.headers);return Object.defineProperty(this,"headers",{value:t,writable:!0}),t},set headers(e){Object.defineProperty(this,"headers",{value:e,writable:!0})}}}(await R(this.adapterInterceptors,{...t,request:o,path:n,input:r,init:{redirect:"manual"}},({request:e,path:t,input:n,init:r,...o})=>this.fetch(e,r,o,t,n)),{signal:o.signal})}},De=class extends Ne{constructor(e){super(new Pe(e),e)}};function $e(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:/* @__PURE__ */new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const o=s.prototype,i=Object.keys(o);for(let e=0;e<i.length;e++){const t=i[e];t in n||(n[t]=o[t].bind(n))}}const o=n?.Parent??Object;class i extends o{}function s(e){var t;const o=n?.Parent?new i:this;r(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const n of o._zod.deferred)n();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var Le=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},je=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Me=globalThis).__zod_globalConfig??(Me.__zod_globalConfig={});var Fe=globalThis.__zod_globalConfig;function Ue(e){return e&&Object.assign(Fe,e),Fe}function We(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function Be(e,t){return"bigint"==typeof t?t.toString():t}function He(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ze(e){return null==e}function qe(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var Ve=/* @__PURE__*/Symbol("evaluating");function Ge(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ve)return void 0===r&&(r=Ve,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ye(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Je(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Xe(e){return JSON.stringify(e)}var Ke="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Qe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var et=/* @__PURE__*/He(()=>{if(Fe.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function tt(e){if(!1===Qe(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==Qe(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function nt(e){return tt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var rt=/* @__PURE__*/new Set(["string","number","symbol"]);function ot(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function st(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}var at={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ct(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function lt(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function dt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ut(e){return"string"==typeof e?e:e?.message}function pt(e,t,n){const r=e.message?e.message:ut(e.inst?._zod.def?.error?.(e))??ut(t?.error?.(e))??ut(n.customError?.(e))??ut(n.localeError?.(e))??"Invalid input",{inst:o,continue:i,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function ht(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ft(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}var mt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Be,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},gt=$e("$ZodError",mt),yt=$e("$ZodError",mt,{Parent:Error});var bt=e=>(t,n,r,o)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Le;if(s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>pt(e,i,Ue())));throw Ke(t,o?.callee),t}return s.value},vt=e=>async(t,n,r,o)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>pt(e,i,Ue())));throw Ke(t,o?.callee),t}return s.value},wt=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Le;return i.issues.length?{success:!1,error:new(e??gt)(i.issues.map(e=>pt(e,o,Ue())))}:{success:!0,data:i.value}},xt=/* @__PURE__*/wt(yt),kt=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>pt(e,o,Ue())))}:{success:!0,data:i.value}},St=/* @__PURE__*/kt(yt),_t=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return bt(e)(t,n,o)},Et=e=>(t,n,r)=>bt(e)(t,n,r),Ct=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return vt(e)(t,n,o)},It=e=>async(t,n,r)=>vt(e)(t,n,r),Tt=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return wt(e)(t,n,o)},zt=e=>(t,n,r)=>wt(e)(t,n,r),Mt=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return kt(e)(t,n,o)},Ot=e=>async(t,n,r)=>kt(e)(t,n,r),Rt=/^[cC][0-9a-z]{6,}$/,Nt=/^[0-9a-z]+$/,At=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pt=/^[0-9a-vA-V]{20}$/,Dt=/^[A-Za-z0-9]{27}$/,$t=/^[a-zA-Z0-9_-]{21}$/,Lt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,jt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ft=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ut=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Wt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ht=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Zt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vt=/^[A-Za-z0-9_-]*$/,Gt=/^https?$/,Yt=/^\+[1-9]\d{6,14}$/,Jt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Xt=/*@__PURE__*/new RegExp(`^${Jt}$`);function Kt(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}var Qt=/^-?\d+$/,en=/^-?\d+(?:\.\d+)?$/,tn=/^(?:true|false)$/i,nn=/^[^A-Z]*$/,rn=/^[^a-z]*$/,on=/*@__PURE__*/$e("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sn={number:"number",bigint:"bigint",object:"date"},an=/*@__PURE__*/$e("$ZodCheckLessThan",(e,t)=>{on.init(e,t);const n=sn[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=/*@__PURE__*/$e("$ZodCheckGreaterThan",(e,t)=>{on.init(e,t);const n=sn[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=/*@__PURE__*/$e("$ZodCheckMultipleOf",(e,t)=>{on.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value!==BigInt(0):0!==function(e,t){const n=e/t,r=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}(n.value,t.value))&&n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dn=/*@__PURE__*/$e("$ZodCheckNumberFormat",(e,t)=>{on.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,i]=at[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=o,r.maximum=i,n&&(r.pattern=Qt)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),un=/*@__PURE__*/$e("$ZodCheckMaxLength",(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ze(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const o=ht(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=/*@__PURE__*/$e("$ZodCheckMinLength",(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ze(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const o=ht(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hn=/*@__PURE__*/$e("$ZodCheckLengthEquals",(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ze(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,o=r.length;if(o===t.length)return;const i=ht(r),s=o>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),fn=/*@__PURE__*/$e("$ZodCheckStringFormat",(e,t)=>{var n,r;on.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=/* @__PURE__ */new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mn=/*@__PURE__*/$e("$ZodCheckRegex",(e,t)=>{fn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gn=/*@__PURE__*/$e("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nn),fn.init(e,t)}),yn=/*@__PURE__*/$e("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rn),fn.init(e,t)}),bn=/*@__PURE__*/$e("$ZodCheckIncludes",(e,t)=>{on.init(e,t);const n=ot(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vn=/*@__PURE__*/$e("$ZodCheckStartsWith",(e,t)=>{on.init(e,t);const n=new RegExp(`^${ot(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wn=/*@__PURE__*/$e("$ZodCheckEndsWith",(e,t)=>{on.init(e,t);const n=new RegExp(`.*${ot(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),xn=/*@__PURE__*/$e("$ZodCheckOverwrite",(e,t)=>{on.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),kn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const o of r)this.content.push(o)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}},Sn={major:4,minor:4,patch:3},_n=/*@__PURE__*/$e("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const t of o._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,o=ct(e);for(const i of t){if(i._zod.def.when){if(lt(e))continue;if(!i._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,s=i._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new Le;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(o||(o=ct(e,t)))});else{if(e.issues.length===t)continue;o||(o=ct(e,t))}}return r?r.then(()=>e):e},n=(n,o,i)=>{if(ct(n))return n.aborted=!0,n;const s=t(o,r,i);if(s instanceof Promise){if(!1===i.async)throw new Le;return s.then(t=>e._zod.parse(t,i))}return e._zod.parse(s,i)};e._zod.run=(o,i)=>{if(i.skipChecks)return e._zod.parse(o,i);if("backward"===i.direction){const t=e._zod.parse({value:o.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,o,i)):n(t,o,i)}const s=e._zod.parse(o,i);if(s instanceof Promise){if(!1===i.async)throw new Le;return s.then(e=>t(e,r,i))}return t(s,r,i)}}Ge(e,"~standard",()=>({validate:t=>{try{const n=xt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return St(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),En=/*@__PURE__*/$e("$ZodString",(e,t)=>{var n;_n.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Cn=/*@__PURE__*/$e("$ZodStringFormat",(e,t)=>{fn.init(e,t),En.init(e,t)}),In=/*@__PURE__*/$e("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=jt),Cn.init(e,t)}),Tn=/*@__PURE__*/$e("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ft(e))}else t.pattern??(t.pattern=Ft());Cn.init(e,t)}),zn=/*@__PURE__*/$e("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ut),Cn.init(e,t)}),Mn=/*@__PURE__*/$e("$ZodURL",(e,t)=>{Cn.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Gt.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const o=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),On=/*@__PURE__*/$e("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Cn.init(e,t)}),Rn=/*@__PURE__*/$e("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=$t),Cn.init(e,t)}),Nn=/*@__PURE__*/$e("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rt),Cn.init(e,t)}),An=/*@__PURE__*/$e("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nt),Cn.init(e,t)}),Pn=/*@__PURE__*/$e("$ZodULID",(e,t)=>{t.pattern??(t.pattern=At),Cn.init(e,t)}),Dn=/*@__PURE__*/$e("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Pt),Cn.init(e,t)}),$n=/*@__PURE__*/$e("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Dt),Cn.init(e,t)}),Ln=/*@__PURE__*/$e("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Kt({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Jt}T(?:${r})$`)}(t)),Cn.init(e,t)}),jn=/*@__PURE__*/$e("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Xt),Cn.init(e,t)}),Fn=/*@__PURE__*/$e("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Kt(t)}$`)),Cn.init(e,t)}),Un=/*@__PURE__*/$e("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Lt),Cn.init(e,t)}),Wn=/*@__PURE__*/$e("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wt),Cn.init(e,t),e._zod.bag.format="ipv4"}),Bn=/*@__PURE__*/$e("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Bt),Cn.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Hn=/*@__PURE__*/$e("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ht),Cn.init(e,t)}),Zn=/*@__PURE__*/$e("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Zt),Cn.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function qn(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Vn=/*@__PURE__*/$e("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qt),Cn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{qn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});var Gn=/*@__PURE__*/$e("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Vt),Cn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!Vt.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return qn(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Yn=/*@__PURE__*/$e("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Yt),Cn.init(e,t)});var Jn=/*@__PURE__*/$e("$ZodJWT",(e,t)=>{Cn.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Xn=/*@__PURE__*/$e("$ZodNumber",(e,t)=>{_n.init(e,t),e._zod.pattern=e._zod.bag.pattern??en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Kn=/*@__PURE__*/$e("$ZodNumberFormat",(e,t)=>{dn.init(e,t),Xn.init(e,t)}),Qn=/*@__PURE__*/$e("$ZodBoolean",(e,t)=>{_n.init(e,t),e._zod.pattern=tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),er=/*@__PURE__*/$e("$ZodUnknown",(e,t)=>{_n.init(e,t),e._zod.parse=e=>e}),tr=/*@__PURE__*/$e("$ZodNever",(e,t)=>{_n.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),nr=/*@__PURE__*/$e("$ZodDate",(e,t)=>{_n.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(s){}const o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function rr(e,t,n){e.issues.length&&t.issues.push(...dt(n,e.issues)),t.value[n]=e.value}var or=/*@__PURE__*/$e("$ZodArray",(e,t)=>{_n.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let e=0;e<o.length;e++){const s=o[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?i.push(a.then(t=>rr(t,n,e))):rr(a,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function ir(e,t,n,r,o,i){const s=n in r;if(e.issues.length){if(o&&i&&!s)return;t.issues.push(...dt(n,e.issues))}s||o?void 0===e.value?s&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function sr(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ar(e,t,n,r,o,i){const s=[],a=o.keySet,c=o.catchall._zod,l=c.def.type,d="optional"===c.optin,u="optional"===c.optout;for(const p in t){if("__proto__"===p)continue;if(a.has(p))continue;if("never"===l){s.push(p);continue}const o=c.run({value:t[p],issues:[]},r);o instanceof Promise?e.push(o.then(e=>ir(e,n,p,t,d,u))):ir(o,n,p,t,d,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}var cr=/*@__PURE__*/$e("$ZodObject",(e,t)=>{if(_n.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const n=He(()=>sr(t));Ge(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */new Set);for(const e of r.values)n[t].add(e)}}return n});const r=Qe,o=t.catchall;let i;e._zod.parse=(t,s)=>{i??(i=n.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],l=i.shape;for(const e of i.keys){const n=l[e],r="optional"===n._zod.optin,o="optional"===n._zod.optout,i=n._zod.run({value:a[e],issues:[]},s);i instanceof Promise?c.push(i.then(n=>ir(n,t,e,a,r,o))):ir(i,t,e,a,r,o)}return o?ar(c,a,t,s,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),lr=/*@__PURE__*/$e("$ZodObjectJIT",(e,t)=>{cr.init(e,t);const n=e._zod.parse,r=He(()=>sr(t));let o;const i=Qe,s=!Fe.jitless,a=s&&et.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=r.value);const p=d.value;return i(p)?s&&a&&!1===u?.async&&!0!==u.jitless?(o||(o=(e=>{const t=new kn(["shape","payload","ctx"]),n=r.value,o=e=>{const t=Xe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const r of n.keys)i[r]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const n=i[r],s=Xe(r),a=e[r],c="optional"===a?._zod?.optin,l="optional"===a?._zod?.optout;t.write(`const ${n} = ${o(r)};`),c&&l?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):c?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${s} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${s}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${s}] = undefined;\n } else {\n newResult[${s}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),d=o(d,u),c?ar([],p,d,u,l,e):d):n(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function dr(e,t,n,r){for(const i of e)if(0===i.issues.length)return t.value=i.value,t;const o=e.filter(e=>!ct(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>pt(e,r,Ue())))}),t)}var ur=/*@__PURE__*/$e("$ZodUnion",(e,t)=>{_n.init(e,t),Ge(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Ge(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Ge(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ge(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>qe(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>dr(t,r,e,o)):dr(s,r,e,o)}}),pr=/*@__PURE__*/$e("$ZodIntersection",(e,t)=>{_n.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,o=t.left._zod.run({value:r,issues:[]},n),i=t.right._zod.run({value:r,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([t,n])=>fr(e,t,n)):fr(e,o,i)}});function hr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(tt(e)&&tt(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),o={...e,...t};for(const i of r){const n=hr(e[i],t[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};o[i]=n.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=hr(e[r],t[r]);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function fr(e,t,n){const r=/* @__PURE__ */new Map;let o;for(const a of t.issues)if("unrecognized_keys"===a.code){o??(o=a);for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(a);for(const a of n.issues)if("unrecognized_keys"===a.code)for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(a);const i=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(i.length&&o&&e.issues.push({...o,keys:i}),ct(e))return e;const s=hr(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var mr=/*@__PURE__*/$e("$ZodRecord",(e,t)=>{_n.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!tt(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const a=/* @__PURE__ */new Set;for(const l of s)if("string"==typeof l||"number"==typeof l||"symbol"==typeof l){a.add("number"==typeof l?l.toString():l);const s=t.keyType._zod.run({value:l,issues:[]},r);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>pt(e,r,Ue())),input:l,path:[l],inst:e});continue}const c=s.value,d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?i.push(d.then(e=>{e.issues.length&&n.issues.push(...dt(l,e.issues)),n.value[c]=e.value})):(d.issues.length&&n.issues.push(...dt(l,d.issues)),n.value[c]=d.value)}let c;for(const e in o)a.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const s of Reflect.ownKeys(o)){if("__proto__"===s)continue;if(!Object.prototype.propertyIsEnumerable.call(o,s))continue;let a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&en.test(s)&&a.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?n.value[s]=o[s]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>pt(e,r,Ue())),input:s,path:[s],inst:e});continue}const c=t.valueType._zod.run({value:o[s],issues:[]},r);c instanceof Promise?i.push(c.then(e=>{e.issues.length&&n.issues.push(...dt(s,e.issues)),n.value[a.value]=e.value})):(c.issues.length&&n.issues.push(...dt(s,c.issues)),n.value[a.value]=c.value)}}return i.length?Promise.all(i).then(()=>n):n}}),gr=/*@__PURE__*/$e("$ZodEnum",(e,t)=>{_n.init(e,t);const n=We(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>rt.has(typeof e)).map(e=>"string"==typeof e?ot(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return r.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),yr=/*@__PURE__*/$e("$ZodLiteral",(e,t)=>{if(_n.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?ot(e):e?ot(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),br=/*@__PURE__*/$e("$ZodTransform",(e,t)=>{_n.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new je(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n.fallback=!0,n));if(o instanceof Promise)throw new Le;return n.value=o,n.fallback=!0,n}});function vr(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var wr=/*@__PURE__*/$e("$ZodOptional",(e,t)=>{_n.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ge(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,void 0]):void 0),Ge(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${qe(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(e=>vr(e,r)):vr(o,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),xr=/*@__PURE__*/$e("$ZodExactOptional",(e,t)=>{wr.init(e,t),Ge(e._zod,"values",()=>t.innerType._zod.values),Ge(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),kr=/*@__PURE__*/$e("$ZodNullable",(e,t)=>{_n.init(e,t),Ge(e._zod,"optin",()=>t.innerType._zod.optin),Ge(e._zod,"optout",()=>t.innerType._zod.optout),Ge(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${qe(e.source)}|null)$`):void 0}),Ge(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Sr=/*@__PURE__*/$e("$ZodDefault",(e,t)=>{_n.init(e,t),e._zod.optin="optional",Ge(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>_r(e,t)):_r(r,t)}});function _r(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var Er=/*@__PURE__*/$e("$ZodPrefault",(e,t)=>{_n.init(e,t),e._zod.optin="optional",Ge(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Cr=/*@__PURE__*/$e("$ZodNonOptional",(e,t)=>{_n.init(e,t),Ge(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(t=>Ir(t,e)):Ir(o,e)}});function Ir(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Tr=/*@__PURE__*/$e("$ZodCatch",(e,t)=>{_n.init(e,t),e._zod.optin="optional",Ge(e._zod,"optout",()=>t.innerType._zod.optout),Ge(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>pt(e,n,Ue()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>pt(e,n,Ue()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),zr=/*@__PURE__*/$e("$ZodPipe",(e,t)=>{_n.init(e,t),Ge(e._zod,"values",()=>t.in._zod.values),Ge(e._zod,"optin",()=>t.in._zod.optin),Ge(e._zod,"optout",()=>t.out._zod.optout),Ge(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Mr(e,t.in,n)):Mr(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Mr(e,t.out,n)):Mr(r,t.out,n)}});function Mr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Or=/*@__PURE__*/$e("$ZodReadonly",(e,t)=>{_n.init(e,t),Ge(e._zod,"propValues",()=>t.innerType._zod.propValues),Ge(e._zod,"values",()=>t.innerType._zod.values),Ge(e._zod,"optin",()=>t.innerType?._zod?.optin),Ge(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Rr):Rr(r)}});function Rr(e){return e.value=Object.freeze(e.value),e}var Nr,Ar=/*@__PURE__*/$e("$ZodCustom",(e,t)=>{on.init(e,t),_n.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(t=>Pr(t,n,r,e));Pr(o,n,r,e)}});function Pr(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ft(e))}}var Dr=class{constructor(){this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(Nr=globalThis).__zod_globalRegistry??(Nr.__zod_globalRegistry=new Dr);var $r=globalThis.__zod_globalRegistry;function Lr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...st(t)})}function jr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...st(t)})}function Fr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...st(t)})}function Ur(e,t){return new an({check:"less_than",...st(t),value:e,inclusive:!1})}function Wr(e,t){return new an({check:"less_than",...st(t),value:e,inclusive:!0})}function Br(e,t){return new cn({check:"greater_than",...st(t),value:e,inclusive:!1})}function Hr(e,t){return new cn({check:"greater_than",...st(t),value:e,inclusive:!0})}function Zr(e,t){return new ln({check:"multiple_of",...st(t),value:e})}function qr(e,t){return new un({check:"max_length",...st(t),maximum:e})}function Vr(e,t){return new pn({check:"min_length",...st(t),minimum:e})}function Gr(e,t){return new hn({check:"length_equals",...st(t),length:e})}function Yr(e){return new xn({check:"overwrite",tx:e})}function Jr(e,t){const n=new on({check:"custom",...st(t)});return n._zod.check=e,n}function Xr(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??$r,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:/* @__PURE__ */new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Kr(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,i=t.processors[o.type];if(!i)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);i(e,t,n,r)}const i=e._zod.parent;i&&(s.ref||(s.ref=i),Kr(i,t,r),t.seen.get(i).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),"input"===t.io&&to(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Qr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=/* @__PURE__ */new Map;for(const i of e.seen.entries()){const t=e.metadataRegistry.get(i[0])?.id;if(t){const e=r.get(t);if(e&&e!==i[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,i[0])}}const o=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:o,defId:i}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,o=e.external.uri??(e=>e);if(n)return{ref:o(n)};const i=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=i,{defId:i,ref:`${o("__shared")}#/${r}/${i}`}}if(t[1]===n)return{ref:"#"};const o=`#/${r}/`,i=t[1].schema.id??"__schema"+e.counter++;return{defId:i,ref:o+i}})(t);r.def={...r.schema},i&&(r.defId=i);const s=r.schema;for(const e in s)delete s[e];s.$ref=o};if("throw"===e.cycles)for(const i of e.seen.entries()){const e=i[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const n=i[1];if(t!==i[0]){if(e.external){const n=e.external.registry.get(i[0])?.id;if(t!==i[0]&&n){o(i);continue}}(e.metadataRegistry.get(i[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&o(i)}else o(i)}}function eo(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const o=n.def??n.schema,i={...o},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(o,a):(o.allOf=o.allOf??[],o.allOf.push(a)),Object.assign(o,i),t._zod.parent===s)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in i||delete o[e]);if(a.$ref&&n.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(o[e])===JSON.stringify(n.def[e])&&delete o[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(o.$ref=t.schema.$ref,t.def))for(const e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}e.override({zodSchema:t,jsonSchema:o,path:n.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const o={};if("draft-2020-12"===e.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(n)}Object.assign(o,n.def??n.schema);const i=e.metadataRegistry.get(t)?.id;void 0!==i&&o.id===i&&delete o.id;const s=e.external?.defs??{};for(const c of e.seen.entries()){const e=c[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?o.$defs=s:o.definitions=s);try{const n=JSON.parse(JSON.stringify(o));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:no(t,"input",e.processors),output:no(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(a){throw new Error("Error converting schema to JSON.")}}function to(e,t){const n=t??{seen:/* @__PURE__ */new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return to(r.element,n);if("set"===r.type)return to(r.valueType,n);if("lazy"===r.type)return to(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return to(r.innerType,n);if("intersection"===r.type)return to(r.left,n)||to(r.right,n);if("record"===r.type||"map"===r.type)return to(r.keyType,n)||to(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||(to(r.in,n)||to(r.out,n));if("object"===r.type){for(const e in r.shape)if(to(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(to(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(to(e,n))return!0;return!(!r.rest||!to(r.rest,n))}return!1}var no=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=Xr({...o??{},target:i,io:t,processors:n});return Kr(e,s),Qr(s,e),eo(s,e)},ro={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oo=(e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r);t.seen.get(e).ref=o.innerType},io=/*@__PURE__*/$e("ZodISODateTime",(e,t)=>{Ln.init(e,t),Ao.init(e,t)});function so(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...st(t)})}(io,e)}var ao=/*@__PURE__*/$e("ZodISODate",(e,t)=>{jn.init(e,t),Ao.init(e,t)});function co(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...st(t)})}(ao,e)}var lo=/*@__PURE__*/$e("ZodISOTime",(e,t)=>{Fn.init(e,t),Ao.init(e,t)});function uo(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...st(t)})}(lo,e)}var po=/*@__PURE__*/$e("ZodISODuration",(e,t)=>{Un.init(e,t),Ao.init(e,t)});function ho(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...st(t)})}(po,e)}var fo=(e,t)=>{gt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,o=[])=>{for(const i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>r({issues:e},[...o,...i.path]));else if("invalid_key"===i.code)r({issues:i.issues},[...o,...i.path]);else if("invalid_element"===i.code)r({issues:i.issues},[...o,...i.path]);else{const e=[...o,...i.path];if(0===e.length)n._errors.push(t(i));else{let r=n,o=0;for(;o<e.length;){const n=e[o];o!==e.length-1?r[n]=r[n]||{_errors:[]}:(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(i))),r=r[n],o++}}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Be,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Be,2)}},isEmpty:{get:()=>0===e.issues.length}})},mo=/*@__PURE__*/$e("ZodError",fo,{Parent:Error}),go=/* @__PURE__ */bt(mo),yo=/* @__PURE__ */vt(mo),bo=/* @__PURE__ */wt(mo),vo=/* @__PURE__ */kt(mo),wo=/* @__PURE__ */_t(mo),xo=/* @__PURE__ */Et(mo),ko=/* @__PURE__ */Ct(mo),So=/* @__PURE__ */It(mo),_o=/* @__PURE__ */Tt(mo),Eo=/* @__PURE__ */zt(mo),Co=/* @__PURE__ */Mt(mo),Io=/* @__PURE__ */Ot(mo),To=/* @__PURE__ */new WeakMap;function zo(e,t,n){const r=Object.getPrototypeOf(e);let o=To.get(r);if(o||(o=/* @__PURE__ */new Set,To.set(r,o)),!o.has(t)){o.add(t);for(const e in n){const t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Mo=/*@__PURE__*/$e("ZodType",(e,t)=>(_n.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:no(e,"input"),output:no(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=Xr({...n,processors:t});return Kr(e,r),Qr(r,e),eo(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>go(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>bo(e,t,n),e.parseAsync=async(t,n)=>yo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>vo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>wo(e,t,n),e.decode=(t,n)=>xo(e,t,n),e.encodeAsync=async(t,n)=>ko(e,t,n),e.decodeAsync=async(t,n)=>So(e,t,n),e.safeEncode=(t,n)=>_o(e,t,n),e.safeDecode=(t,n)=>Eo(e,t,n),e.safeEncodeAsync=async(t,n)=>Co(e,t,n),e.safeDecodeAsync=async(t,n)=>Io(e,t,n),zo(e,"ZodType",{check(...e){const t=this.def;return this.clone(Je(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return it(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...st(n)})}(Di,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const n=/* @__PURE__ */Jr(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(ft(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(ft(r))}},e(t.value,t)),t);return n}(e,t)}(e,t))},overwrite(e){return this.check(Yr(e))},optional(){return Ei(this)},exactOptional(){return new Ci({type:"optional",innerType:this})},nullable(){return Ti(this)},nullish(){return Ei(Ti(this))},nonoptional(e){return function(e,t){return new Oi({type:"nonoptional",innerType:e,...st(t)})}(this,e)},array(){return pi(this)},or(e){return gi([this,e])},and(e){return new yi({type:"intersection",left:this,right:e})},transform(e){return Ai(this,new Si({type:"transform",transform:e}))},default(e){return t=e,new zi({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():nt(t)}});var t},prefault(e){return t=e,new Mi({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():nt(t)}});var t},catch(e){return new Ri({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return Ai(this,e)},readonly(){return new Pi({type:"readonly",innerType:this})},describe(e){const t=this.clone();return $r.add(t,{description:e}),t},meta(...e){if(0===e.length)return $r.get(this);const t=this.clone();return $r.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>$r.get(e)?.description,configurable:!0}),e)),Oo=/*@__PURE__*/$e("_ZodString",(e,t)=>{En.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:o,maximum:i,format:s,patterns:a,contentEncoding:c}=e._zod.bag;if("number"==typeof o&&(r.minLength=o),"number"==typeof i&&(r.maxLength=i),s&&(r.format=ro[s]??s,""===r.format&&delete r.format,"time"===s&&delete r.format),c&&(r.contentEncoding=c),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,zo(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new mn({check:"string_format",format:"regex",...st(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new bn({check:"string_format",format:"includes",...st(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new vn({check:"string_format",format:"starts_with",...st(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new wn({check:"string_format",format:"ends_with",...st(t),suffix:e})}(...e))},min(...e){return this.check(Vr(...e))},max(...e){return this.check(qr(...e))},length(...e){return this.check(Gr(...e))},nonempty(...e){return this.check(Vr(1,...e))},lowercase(e){return this.check(function(e){return new gn({check:"string_format",format:"lowercase",...st(e)})}(e))},uppercase(e){return this.check(function(e){return new yn({check:"string_format",format:"uppercase",...st(e)})}(e))},trim(){return this.check(/* @__PURE__ */Yr(e=>e.trim()))},normalize(...e){return this.check(function(e){/* @__PURE__ */
2
- return Yr(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(/* @__PURE__ */Yr(e=>e.toLowerCase()))},toUpperCase(){return this.check(/* @__PURE__ */Yr(e=>e.toUpperCase()))},slugify(){return this.check(/* @__PURE__ */Yr(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),Ro=/*@__PURE__*/$e("ZodString",(e,t)=>{En.init(e,t),Oo.init(e,t),e.email=t=>e.check(Lr(Po,t)),e.url=t=>e.check(Fr(Lo,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...st(t)})}(Qo,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...st(t)})}(jo,t)),e.guid=t=>e.check(jr(Do,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...st(t)})}($o,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...st(t)})}($o,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...st(t)})}($o,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...st(t)})}($o,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...st(t)})}(Fo,t)),e.guid=t=>e.check(jr(Do,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...st(t)})}(Uo,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...st(t)})}(Wo,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...st(t)})}(Bo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...st(t)})}(Jo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...st(t)})}(Xo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...st(t)})}(Ho,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...st(t)})}(Zo,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...st(t)})}(qo,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...st(t)})}(Vo,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...st(t)})}(Go,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...st(t)})}(Yo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...st(t)})}(Ko,t)),e.datetime=t=>e.check(so(t)),e.date=t=>e.check(co(t)),e.time=t=>e.check(uo(t)),e.duration=t=>e.check(ho(t))});function No(e){return function(e,t){return new e({type:"string",...st(t)})}(Ro,e)}var Ao=/*@__PURE__*/$e("ZodStringFormat",(e,t)=>{Cn.init(e,t),Oo.init(e,t)}),Po=/*@__PURE__*/$e("ZodEmail",(e,t)=>{zn.init(e,t),Ao.init(e,t)});var Do=/*@__PURE__*/$e("ZodGUID",(e,t)=>{In.init(e,t),Ao.init(e,t)}),$o=/*@__PURE__*/$e("ZodUUID",(e,t)=>{Tn.init(e,t),Ao.init(e,t)}),Lo=/*@__PURE__*/$e("ZodURL",(e,t)=>{Mn.init(e,t),Ao.init(e,t)});var jo=/*@__PURE__*/$e("ZodEmoji",(e,t)=>{On.init(e,t),Ao.init(e,t)}),Fo=/*@__PURE__*/$e("ZodNanoID",(e,t)=>{Rn.init(e,t),Ao.init(e,t)}),Uo=/*@__PURE__*/$e("ZodCUID",(e,t)=>{Nn.init(e,t),Ao.init(e,t)}),Wo=/*@__PURE__*/$e("ZodCUID2",(e,t)=>{An.init(e,t),Ao.init(e,t)}),Bo=/*@__PURE__*/$e("ZodULID",(e,t)=>{Pn.init(e,t),Ao.init(e,t)}),Ho=/*@__PURE__*/$e("ZodXID",(e,t)=>{Dn.init(e,t),Ao.init(e,t)}),Zo=/*@__PURE__*/$e("ZodKSUID",(e,t)=>{$n.init(e,t),Ao.init(e,t)}),qo=/*@__PURE__*/$e("ZodIPv4",(e,t)=>{Wn.init(e,t),Ao.init(e,t)}),Vo=/*@__PURE__*/$e("ZodIPv6",(e,t)=>{Bn.init(e,t),Ao.init(e,t)}),Go=/*@__PURE__*/$e("ZodCIDRv4",(e,t)=>{Hn.init(e,t),Ao.init(e,t)}),Yo=/*@__PURE__*/$e("ZodCIDRv6",(e,t)=>{Zn.init(e,t),Ao.init(e,t)}),Jo=/*@__PURE__*/$e("ZodBase64",(e,t)=>{Vn.init(e,t),Ao.init(e,t)}),Xo=/*@__PURE__*/$e("ZodBase64URL",(e,t)=>{Gn.init(e,t),Ao.init(e,t)}),Ko=/*@__PURE__*/$e("ZodE164",(e,t)=>{Yn.init(e,t),Ao.init(e,t)}),Qo=/*@__PURE__*/$e("ZodJWT",(e,t)=>{Jn.init(e,t),Ao.init(e,t)}),ei=/*@__PURE__*/$e("ZodNumber",(e,t)=>{Xn.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:o,maximum:i,format:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.type="number";const d="number"==typeof l&&l>=(o??Number.NEGATIVE_INFINITY),u="number"==typeof c&&c<=(i??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:"number"==typeof o&&(r.minimum=o),u?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:"number"==typeof i&&(r.maximum=i),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),zo(e,"ZodNumber",{gt(e,t){return this.check(Br(e,t))},gte(e,t){return this.check(Hr(e,t))},min(e,t){return this.check(Hr(e,t))},lt(e,t){return this.check(Ur(e,t))},lte(e,t){return this.check(Wr(e,t))},max(e,t){return this.check(Wr(e,t))},int(e){return this.check(ri(e))},safe(e){return this.check(ri(e))},positive(e){return this.check(Br(0,e))},nonnegative(e){return this.check(Hr(0,e))},negative(e){return this.check(Ur(0,e))},nonpositive(e){return this.check(Wr(0,e))},multipleOf(e,t){return this.check(Zr(e,t))},step(e,t){return this.check(Zr(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ti(e){return function(e,t){return new e({type:"number",checks:[],...st(t)})}(ei,e)}var ni=/*@__PURE__*/$e("ZodNumberFormat",(e,t)=>{Kn.init(e,t),ei.init(e,t)});function ri(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...st(t)})}(ni,e)}var oi=/*@__PURE__*/$e("ZodBoolean",(e,t)=>{Qn.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function ii(e){return function(e,t){return new e({type:"boolean",...st(t)})}(oi,e)}var si=/*@__PURE__*/$e("ZodUnknown",(e,t)=>{er.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function ai(){return new si({type:"unknown"})}var ci=/*@__PURE__*/$e("ZodNever",(e,t)=>{tr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function li(e){return function(e,t){return new e({type:"never",...st(t)})}(ci,e)}var di=/*@__PURE__*/$e("ZodDate",(e,t)=>{nr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")})(0,e),e.min=(t,n)=>e.check(Hr(t,n)),e.max=(t,n)=>e.check(Wr(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}),ui=/*@__PURE__*/$e("ZodArray",(e,t)=>{or.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(o.minItems=s),"number"==typeof a&&(o.maxItems=a),o.type="array",o.items=Kr(i.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,zo(e,"ZodArray",{min(e,t){return this.check(Vr(e,t))},nonempty(e){return this.check(Vr(1,e))},max(e,t){return this.check(qr(e,t))},length(e,t){return this.check(Gr(e,t))},unwrap(){return this.element}})});function pi(e,t){return function(e,t,n){return new e({type:"array",element:t,...st(n)})}(ui,e,t)}var hi=/*@__PURE__*/$e("ZodObject",(e,t)=>{lr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const l in s)o.properties[l]=Kr(s[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(s)),c=new Set([...a].filter(e=>{const n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));c.size>0&&(o.required=Array.from(c)),"never"===i.catchall?._zod.def.type?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Kr(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(o.additionalProperties=!1)})(e,t,n,r),Ge(e,"shape",()=>t.shape),zo(e,"ZodObject",{keyof(){return xi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ai()})},loose(){return this.clone({...this._zod.def,catchall:ai()})},strict(){return this.clone({...this._zod.def,catchall:li()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!tt(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return it(e,Je(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ye(this,"shape",n),n}}))}(this,e)},safeExtend(e){return function(e,t){if(!tt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return it(e,Je(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ye(this,"shape",n),n}}))}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return it(e,Je(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ye(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return it(e,Je(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ye(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return it(e,Je(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ye(this,"shape",r),r},checks:[]}))}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return it(t,Je(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)o[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Ye(this,"shape",o),o},checks:[]}))}(_i,this,e[0])},required(...e){return t=Oi,n=this,r=e[0],it(n,Je(n._zod.def,{get shape(){const e=n._zod.def.shape,o={...e};if(r)for(const n in r){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);r[n]&&(o[n]=new t({type:"nonoptional",innerType:e[n]}))}else for(const n in e)o[n]=new t({type:"nonoptional",innerType:e[n]});return Ye(this,"shape",o),o}}));var t,n,r}})});function fi(e,t){const n={type:"object",shape:e??{},...st(t)};return new hi(n)}var mi=/*@__PURE__*/$e("ZodUnion",(e,t)=>{ur.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=!1===o.inclusive,s=o.options.map((e,n)=>Kr(e,t,{...r,path:[...r.path,i?"oneOf":"anyOf",n]}));i?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});function gi(e,t){return new mi({type:"union",options:e,...st(t)})}var yi=/*@__PURE__*/$e("ZodIntersection",(e,t)=>{pr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=Kr(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=Kr(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length;n.allOf=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]]})(e,t,n,r)});var bi=/*@__PURE__*/$e("ZodRecord",(e,t)=>{mr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const s=i.keyType,a=s._zod.bag?.patterns;if("loose"===i.mode&&a&&a.size>0){const e=Kr(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const t of a)o.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(o.propertyNames=Kr(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Kr(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=s._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(o.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function vi(e,t,n){return t&&t._zod?new bi({type:"record",keyType:e,valueType:t,...st(n)}):new bi({type:"record",keyType:No(),valueType:e,...st(t)})}var wi=/*@__PURE__*/$e("ZodEnum",(e,t)=>{gr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=We(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new wi({...t,checks:[],...st(r),entries:o})},e.exclude=(e,r)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new wi({...t,checks:[],...st(r),entries:o})}});function xi(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new wi({type:"enum",entries:n,...st(t)})}var ki=/*@__PURE__*/$e("ZodLiteral",(e,t)=>{yr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,o=[];for(const i of r.values)if(void 0===i){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof i){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(i))}else o.push(i);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});var Si=/*@__PURE__*/$e("ZodTransform",(e,t)=>{br.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new je(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(ft(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(ft(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});var _i=/*@__PURE__*/$e("ZodOptional",(e,t)=>{wr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Ei(e){return new _i({type:"optional",innerType:e})}var Ci=/*@__PURE__*/$e("ZodExactOptional",(e,t)=>{xr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Ii=/*@__PURE__*/$e("ZodNullable",(e,t)=>{kr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=Kr(o.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ti(e){return new Ii({type:"nullable",innerType:e})}var zi=/*@__PURE__*/$e("ZodDefault",(e,t)=>{Sr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});var Mi=/*@__PURE__*/$e("ZodPrefault",(e,t)=>{Er.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Oi=/*@__PURE__*/$e("ZodNonOptional",(e,t)=>{Cr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Ri=/*@__PURE__*/$e("ZodCatch",(e,t)=>{Tr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;let i;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});var Ni=/*@__PURE__*/$e("ZodPipe",(e,t)=>{zr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s="input"===t.io?i?o.out:o.in:o.out;Kr(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function Ai(e,t){return new Ni({type:"pipe",in:e,out:t})}var Pi=/*@__PURE__*/$e("ZodReadonly",(e,t)=>{Or.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Di=/*@__PURE__*/$e("ZodCustom",(e,t)=>{Ar.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function $i(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...st(t)})}(ei,e)}function Li(e){return function(e,t){return new e({type:"date",coerce:!0,...st(t)})}(di,e)}var ji,Fi=xi(["created","active","suspended"]),Ui=fi({id:ti().optional(),created_at:Li().optional(),updated_at:Li().optional()}),Wi=(fi({id:$i()}),fi({slug:No()}),fi({widget_id:$i()}),fi({simulation_id:$i()}),fi({application_id:$i()}),fi({user_id:$i()}),fi({limit:$i().optional().default(50),offset:$i().optional().default(0)}),gi([ii(),No()]).transform(e=>"boolean"==typeof e?e:"true"===e||"false"!==e&&void 0).optional(),fi({success:function(e,t){return new ki({type:"literal",values:Array.isArray(e)?e:[e],...st(t)})}(!0)})),Bi=(Wi.extend({message:No()}),fi({name:No().min(1),params:vi(No(),ai()).default({}),result:vi(No(),ai()).default({})}),Fr(Lo,ji).refine(e=>/^https:\/\/hooks\.slack\.com\//.test(e),{message:"Slack webhook URL must start with https://hooks.slack.com/"}),fi({start:No(),end:No(),action:No()}).passthrough()),Hi=fi({id:No(),label:No(),purpose:No(),elements:pi(vi(No(),ai())).default([]),bbox:vi(No(),ai()).default({}),screenshot:No().default(""),embedding:pi(ti()).nullish()}).passthrough(),Zi=fi({id:No(),title:No(),url:No(),summary:No().default(""),screenshot:No().default(""),sections:pi(Hi).default([]),sequence_ids:pi(ti()).default([]),embedding:pi(ti()).nullish()}).passthrough(),qi=(fi({nodes:pi(Zi),edges:pi(Bi)}),xi(["free","startup","growth","enterprise"])),Vi=xi(["app","website"]),Gi=xi(["widget"]),Yi=(xi(["tell","show","do"]),xi(["password","oauth"])),Ji=xi(["admin","member"]),Xi=(Ui.extend({is_super:ii(),status:Fi,email:function(e){return Lr(Po,e)}(),external_id:No().nullish(),first_name:No().nullish(),last_name:No().nullish(),password:No().nullish(),image_url:No().nullish(),last_login_at:Li().nullish(),auth_method:Yi.nullish(),workspace_role:Ji.nullish()}),Ui.extend({name:No(),slug:No(),status:Fi,package:qi,ending_date:Li().nullish(),external_workspace_id:No().nullish(),slack_webhook_configured:ii().optional(),notify_all_members_on_question:ii().optional()}),Ui.extend({workspace_id:ti(),name:No(),slug:No(),type:Vi,url:No(),username:No().nullish(),password:No().nullish(),allowed_domains:pi(No()).default([])}).omit({password:!0}),fi({chip_mode:xi(["show","tell","do"]),chip_text:No()})),Ki=fi({widget_enabled:ii(),widget_appearance:xi(["default","hidden"]),widget_position:xi(["bottom_left","bottom_right","top_left","top_right"]),widget_header:No(),widget_body:No(),widget_greeting:No(),widget_greeting_toast:ii(),widget_recording:ii(),widget_feature_tell:ii(),widget_feature_show:ii(),widget_feature_do:ii(),widget_background_color:No(),widget_text_color:No(),widget_border_color:No(),widget_accent_color:No(),widget_secondary_color:No(),widget_border_radius:No(),widget_font_size:No(),widget_width:No(),widget_height:No(),widget_animation_duration:No(),widget_fade_duration:No(),widget_chips:pi(Xi)}),Qi=(Ui.extend({application_id:ti(),type:Gi,settings:Ki,status:Fi,marketrix_id:No(),marketrix_key:No(),snippet:No().nullish()}),xi(["user_login","url_visit","update_workspace","create_user","update_user","delete_user","create_application","update_application","delete_application","create_widget","update_widget","delete_widget","create_knowledge","update_knowledge","delete_knowledge","request_membership","invite_user","create_workspace","trial_started","trial_ending_soon","trial_ended","subscription_created","subscription_canceled","plan_changed","payment_succeeded","payment_failed","widget_question","qa_run_started","start_simulation","create_workflow","update_workflow","delete_workflow","toggle_workflow","slack_command","create_form","update_form","delete_form","duplicate_form","publish_form","unpublish_form","archive_form","submit_form_response","delete_form_response"])),es=fi({details:No().optional(),id:ti().optional(),type:No().optional(),name:No().optional(),target_user_id:ti().optional(),target_user_email:No().optional(),reason:No().optional(),ip_address:No().optional(),user_agent:No().optional(),widget_type:No().optional(),created_by:ti().optional()}).passthrough();Ui.extend({workspace_id:ti(),user_id:ti().nullable(),type:Qi,metadata:es.optional()}).partial().extend({type:Qi});function ts(e){return fe(new De({url:e}))}var ns="",rs=ts(""),os=new Proxy({},{get:(e,t)=>rs[t]}),is="marketrix_chat_context",ss={chat_id:null,messages:[],isTaskRunning:!1,currentMode:"tell",isOpen:!1,config:null,timestamp:0};function as(e){try{return"undefined"==typeof localStorage?null:localStorage.getItem(e)}catch(t){return null}}function cs(e,t){try{"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}catch(n){}}var ls,ds=new class{context=function(){const e=as(is);if(!e)return{...ss};try{const t={...ss,...JSON.parse(e)};if(Date.now()-t.timestamp<=6048e5)return t}catch(t){}return{...ss}}();getContext(){return this.context}updateContext(e){this.context={...this.context,...e,timestamp:Date.now()},cs(is,JSON.stringify(this.context))}getChatId(){const e="undefined"==typeof window?"":window.name;return e.trim()?(e!==this.context.chat_id&&this.updateContext({chat_id:e}),e):this.context.chat_id}setChatId(e){this.updateContext({chat_id:e}),"undefined"!=typeof window&&(window.name=e)}getConfig(){return this.context.config}setConfig(e){this.updateContext({config:e})}},us=new class{creation=null;async getOrCreateChatId(){const e=ds.getChatId();return e||(this.creation??=this.createChatId().finally(()=>{this.creation=null}),this.creation)}async createChatId(){const e=await os.chatCreate(void 0);if(!e)throw new Error("API returned empty chat ID");return ds.setChatId(e),e}},ps=Object.defineProperty,hs=(e,t,n)=>((e,t,n)=>t in e?ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),fs=/* @__PURE__ */(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e))(fs||{}),ms=/* @__PURE__ */(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(ms||{}),gs=/* @__PURE__ */(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(gs||{}),ys=/* @__PURE__ */(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ys||{}),bs=/* @__PURE__ */(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(bs||{}),vs=/* @__PURE__ */(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(vs||{}),ws=/* @__PURE__ */(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(ws||{}),xs={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ks={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ss={},_s={};function Es(e){if(Ss[e])return Ss[e];const t=globalThis[e],n=t.prototype,r=e in xs?xs[e]:void 0,o=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),i=e in ks?ks[e]:void 0,s=Boolean(i&&i.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(o&&s&&!globalThis.Zone)return Ss[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");r.style.display="none",document.body.appendChild(r);const o=r.contentWindow;if(!o)return t.prototype;const i=o[e].prototype;if(!i)return r.remove(),n;const s=navigator.userAgent;return s.includes("Safari")&&!s.includes("Chrome")?(r.classList.add("rr-block"),r.setAttribute("__rrwebUntaintedMutationObserver",""),_s[e]=()=>r.remove()):r.remove(),Ss[e]=i}catch{return n}}var Cs={};function Is(e,t,n){var r;const o=`${e}.${String(n)}`;if(Cs[o])return Cs[o].call(t);const i=Es(e),s=null==(r=Object.getOwnPropertyDescriptor(i,n))?void 0:r.get;return s?(Cs[o]=s,s.call(t)):t[n]}var Ts={};function zs(e,t,n){const r=`${e}.${String(n)}`;if(Ts[r])return Ts[r].bind(t);const o=Es(e)[n];return"function"!=typeof o?t[n]:(Ts[r]=o,o.bind(t))}function Ms(){return[Es("MutationObserver").constructor,_s.MutationObserver??(()=>{})]}var Os=Date.now;function Rs(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())||(Os=()=>/* @__PURE__ */(new Date).getTime());var Ns={ownerDocument:function(e){return Is("Node",e,"ownerDocument")},childNodes:function(e){return Is("Node",e,"childNodes")},parentNode:function(e){return Is("Node",e,"parentNode")},parentElement:function(e){return Is("Node",e,"parentElement")},textContent:function(e){return Is("Node",e,"textContent")},contains:function(e,t){return zs("Node",e,"contains")(t)},getRootNode:function(e){return zs("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Is("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Is("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Is("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Is("Element",e,"querySelectorAll")(t)},nowTimestamp:Os,mutationObserverCtor:Ms,patch:Rs};function As(e){return e.nodeType===e.ELEMENT_NODE}function Ps(e){const t=e&&"host"in e&&"mode"in e&&Ns.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Ns.shadowRoot(t)===e)}function Ds(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function $s(e){try{const n=e.rules||e.cssRules;if(!n)return null;let r=e.href;return!r&&e.ownerNode&&(r=e.ownerNode.baseURI),(t=Array.from(n,e=>Ls(e,r)).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(n){return null}var t}function Ls(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=$s(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(n){t=e.cssText}return e.styleSheet.href?Ys(t,e.styleSheet.href):t}{let n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t?Ys(n,t):n}}var js=class{constructor(){hs(this,"idNodeMap",/* @__PURE__ */new Map),hs(this,"nodeMetaMap",/* @__PURE__ */new WeakMap)}getId(e){var t;return e?(null==(t=this.getMeta(e))?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=/* @__PURE__ */new Map,this.nodeMetaMap=/* @__PURE__ */new WeakMap}};function Fs({element:e,maskInputOptions:t,tagName:n,type:r,value:o,maskInputFn:i}){let s=o||"";const a=r&&Us(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=i?i(s,e):"*".repeat(s.length)),s}function Us(e){return e.toLowerCase()}var Ws="__rrweb_original__";function Bs(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Us(t):null}function Hs(e,t){let n;try{n=new URL(e,t??window.location.href)}catch(o){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}var Zs=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,qs=/^(?:[a-z+]+:)?\/\//i,Vs=/^www\..*/i,Gs=/^(data:)([^,]*),(.*)/i;function Ys(e,t){return(e||"").replace(Zs,(e,n,r,o,i,s)=>{const a=r||i||s,c=n||o||"";if(!a)return e;if(qs.test(a)||Vs.test(a))return`url(${c}${a}${c})`;if(Gs.test(a))return`url(${c}${a}${c})`;if("/"===a[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${c})`;const l=a.split("#")[0],d=a.substring(l.length),u=t.split("#")[0].split("/"),p=l.split("/");u.pop();for(const t of p){if("."===t)continue;".."===t?u.pop():u.push(t)}return`url(${c}${u.join("/")}${d}${c})`})}function Js(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Xs(e,t){return function(e,t,n=!1){const r=Array.from(t.childNodes),o=[];let i=0;if(r.length>1&&e&&"string"==typeof e){let t=Js(e,n);const s=t.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&"string"==typeof r[a].textContent){const c=Js(r[a].textContent,n),l=100;let d=3;for(;d<c.length&&(c[d].match(/[a-zA-Z0-9]/)||-1!==c.indexOf(c.substring(0,d),1));d++);for(;d<c.length;d++){let u=c.substring(0,d),p=t.split(u),h=-1;if(2===p.length)h=p[0].length;else if(p.length>2&&""===p[0]&&""!==r[a-1].textContent)h=t.indexOf(u,1);else if(1===p.length){if(u=u.substring(0,u.length-1),p=t.split(u),p.length<=1)return o.push(e),o;d=101}else d===c.length-1&&(h=t.indexOf(u));if(p.length>=2&&d>l){const e=r[a-1].textContent;if(e&&"string"==typeof e){const n=Js(e).length;h=t.indexOf(u,n)}-1===h&&(h=p[0].length)}if(-1!==h){let a=Math.floor(h/s);for(;a>0&&a<e.length;){if(i+=1,i>50*r.length)return o.push(e),o;const c=Js(e.substring(0,a),n);if(c.length===h){o.push(e.substring(0,a)),e=e.substring(a),t=t.substring(h);break}c.length<h?a+=Math.max(1,Math.floor((h-c.length)/s)):a-=Math.max(1,Math.floor((c.length-h)*s))}break}}}}return o.push(e),o}(e,t).join("/* rr_split */")}var Ks,Qs,ea=1,ta=/* @__PURE__ */new RegExp("[^a-z0-9-_:]");function na(){return ea++}var ra=/^[^ \t\n\r\u000c]+/,oa=/^[, \t\n\r\u000c]+/;var ia=/* @__PURE__ */new WeakMap;function sa(e,t){return t&&""!==t.trim()?ca(e,t):t}function aa(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ca(e,t){let n=ia.get(e);if(n||(n=e.createElement("a"),ia.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function la(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]||"background"===n&&["table","td","th"].includes(t)?sa(e,r):"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}const o=[];for(;r(oa),!(n>=t.length);){let i=r(ra);if(","===i.slice(-1))i=sa(e,i.substring(0,i.length-1)),o.push(i);else{let r="";i=sa(e,i);let s=!1;for(;;){const e=t.charAt(n);if(""===e){o.push((i+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,o.push((i+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n?Ys(r,ca(e)):"object"===t&&"data"===n?sa(e,r):r:r}function da(e,t,n){return["video","audio"].includes(e)&&"autoplay"===t}function ua(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ua(Ns.parentNode(e),t,n);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!n&&ua(Ns.parentNode(e),t,n)}function pa(e,t,n,r){let o;if(As(e)){if(o=e,!Ns.childNodes(o).length)return!1}else{if(null===Ns.parentElement(e))return!1;o=Ns.parentElement(e)}try{if("string"==typeof t){if(r){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(ua(o,t,r))return!0;if(n)if(r){if(o.closest(n))return!0}else if(o.matches(n))return!0}catch(i){}return!1}function ha(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:s,inlineStylesheet:a,maskInputOptions:c={},maskTextFn:l,maskInputFn:d,dataURLOptions:u={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m=!1,cssCaptured:g=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:ws.Document,childNodes:[],compatMode:e.compatMode}:{type:ws.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:ws.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:i,maskInputOptions:s={},maskInputFn:a,dataURLOptions:c={},inlineImages:l,recordCanvas:d,keepIframeSrcFn:u,newlyAddedElement:p=!1,rootId:h}=t,f=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(r){}return!1}(e,r,o),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Us(e.tagName);return ta.test(t)?"div":t}(e);let g={};const y=e.attributes.length;for(let w=0;w<y;w++){const t=e.attributes[w];da(m,t.name,t.value)||(g[t.name]=la(n,m,Us(t.name),t.value))}if("link"===m&&i){const t=Array.from(n.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=$s(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if("style"===m&&e.sheet){let t=$s(e.sheet);t&&(e.childNodes.length>1&&(t=Xs(t,e)),g._cssText=t)}if(["input","textarea","select"].includes(m)){const t=e.value,n=e.checked;"radio"!==g.type&&"checkbox"!==g.type&&"submit"!==g.type&&"button"!==g.type&&t?g.value=Fs({element:e,type:Bs(e),tagName:m,value:t,maskInputOptions:s,maskInputFn:a}):n&&(g.checked=n)}"option"===m&&(e.selected&&!s.select?g.selected=!0:delete g.selected);"dialog"===m&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===m&&d)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const o=t.getImageData,i=Ws in o?o[Ws]:o;if(new Uint32Array(i.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(g.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){const t=e.toDataURL(c.type,c.quality),r=n.createElement("canvas");r.width=e.width,r.height=e.height,t!==r.toDataURL(c.type,c.quality)&&(g.rr_dataURL=t)}if("img"===m&&l){Ks||(Ks=n.createElement("canvas"),Qs=Ks.getContext("2d"));const t=e,r=(t.currentSrc||t.getAttribute("src"),t.crossOrigin),o=()=>{t.removeEventListener("load",o);try{Ks.width=t.naturalWidth,Ks.height=t.naturalHeight,Qs.drawImage(t,0,0),g.rr_dataURL=Ks.toDataURL(c.type,c.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o))}"anonymous"===t.crossOrigin&&(r?g.crossOrigin=r:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if(["audio","video"].includes(m)){const t=g;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop));if(f){const{width:t,height:n}=e.getBoundingClientRect();g={class:g.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==m||u(g.src)||(e.contentDocument||(g.rr_src=g.src),delete g.src);let b;try{customElements.get(m)&&(b=!0)}catch(v){}return{type:ws.Element,tagName:m,attributes:g,childNodes:[],isSVG:aa(e)||void 0,needBlock:f,rootId:h,isCustom:b}}(e,{doc:n,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:c,maskInputFn:d,dataURLOptions:u,inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:n,maskTextFn:r,rootId:o,cssCaptured:i}=t,s=Ns.parentNode(e),a=s&&s.tagName;let c="";const l="STYLE"===a||void 0,d="SCRIPT"===a||void 0;d?c="SCRIPT_PLACEHOLDER":i||(c=Ns.textContent(e),l&&c&&(c=Ys(c,ca(t.doc))));!l&&!d&&c&&n&&(c=r?r(c,Ns.parentElement(e)):c.replace(/[\S]/g,"*"));return{type:ws.Text,textContent:c||"",rootId:o}}(e,{doc:n,needsMask:s,maskTextFn:l,rootId:y,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:ws.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:ws.Comment,textContent:Ns.textContent(e)||"",rootId:y};default:return!1}}function fa(e){return null==e?"":e.toLowerCase()}function ma(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:e||{}}function ga(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:c=!1,inlineStylesheet:l=!0,maskInputOptions:d={},maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f={},inlineImages:m=!1,recordCanvas:g=!1,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:S=!1,cssCaptured:_=!1}=t;let{needsMask:E}=t,{preserveWhiteSpace:C=!0}=t;E||(E=pa(e,s,a,void 0===E));const I=ha(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:E,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,dataURLOptions:f,inlineImages:m,recordCanvas:g,keepIframeSrcFn:k,newlyAddedElement:S,cssCaptured:_});if(!I)return null;let T;T=r.hasNode(e)?r.getId(e):function(e,t){if(t.comment&&e.type===ws.Comment)return!0;if(e.type===ws.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===Hs(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(fa(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===fa(e.attributes.name)||"icon"===fa(e.attributes.rel)||"apple-touch-icon"===fa(e.attributes.rel)||"shortcut icon"===fa(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&fa(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(fa(e.attributes.property).match(/^(og|twitter|fb):/)||fa(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===fa(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===fa(e.attributes.name)||"googlebot"===fa(e.attributes.name)||"bingbot"===fa(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===fa(e.attributes.name)||"generator"===fa(e.attributes.name)||"framework"===fa(e.attributes.name)||"publisher"===fa(e.attributes.name)||"progid"===fa(e.attributes.name)||fa(e.attributes.property).match(/^article:/)||fa(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===fa(e.attributes.name)||"yandex-verification"===fa(e.attributes.name)||"csrf-token"===fa(e.attributes.name)||"p:domain_verify"===fa(e.attributes.name)||"verify-v1"===fa(e.attributes.name)||"verification"===fa(e.attributes.name)||"shopify-checkout-api-token"===fa(e.attributes.name)))return!0}}return!1}(I,h)||!C&&I.type===ws.Text&&!I.textContent.replace(/^\s+|\s+$/gm,"").length?-2:na();const z=Object.assign(I,{id:T});if(r.add(e,z),-2===T)return null;y&&y(e);let M=!c;if(z.type===ws.Element){M=M&&!z.needBlock,delete z.needBlock;const t=Ns.shadowRoot(e);t&&Ds(t)&&(z.isShadowHost=!0)}if((z.type===ws.Document||z.type===ws.Element)&&M){h.headWhitespace&&z.type===ws.Element&&"head"===z.tagName&&(C=!1);const t={doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:E,maskTextClass:s,maskTextSelector:a,skipChild:c,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:C,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:w,stylesheetLoadTimeout:x,keepIframeSrcFn:k,cssCaptured:!1};if(z.type===ws.Element&&"textarea"===z.tagName&&void 0!==z.attributes.value);else{z.type===ws.Element&&void 0!==z.attributes._cssText&&"string"==typeof z.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(Ns.childNodes(e))){const e=ga(n,t);e&&z.childNodes.push(e)}}let S=null;if(As(e)&&(S=Ns.shadowRoot(e)))for(const e of Array.from(Ns.childNodes(S))){const n=ga(e,t);n&&(Ds(S)&&(n.isShadow=!0),z.childNodes.push(n))}}const O=Ns.parentNode(e);return O&&Ps(O)&&Ds(O)&&(z.isShadow=!0),z.type===ws.Element&&"iframe"===z.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,i=!1;try{o=r.document.readyState}catch(a){return}if("complete"!==o){const r=setTimeout(()=>{i||(t(),i=!0)},n);return void e.addEventListener("load",()=>{clearTimeout(r),i=!0,t()})}const s="about:blank";if(r.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{const t=e.contentDocument;if(t&&b){const n=ga(t,{doc:t,mirror:r,blockClass:o,blockSelector:i,needsMask:E,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:C,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:w,stylesheetLoadTimeout:x,keepIframeSrcFn:k});n&&b(e,n)}},v),z.type===ws.Element&&"link"===z.tagName&&"string"==typeof z.attributes.rel&&("stylesheet"===z.attributes.rel||"preload"===z.attributes.rel&&"string"==typeof z.attributes.href&&"css"===Hs(z.attributes.href))&&function(e,t,n){let r,o=!1;try{r=e.sheet}catch(s){return}if(r)return;const i=setTimeout(()=>{o||(t(),o=!0)},n);e.addEventListener("load",()=>{clearTimeout(i),o=!0,t()})}(e,()=>{if(w){const t=ga(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:E,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:C,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:w,stylesheetLoadTimeout:x,keepIframeSrcFn:k});t&&w(e,t)}},x),z}var ya=class e{constructor(...e){hs(this,"parentElement",null),hs(this,"parentNode",null),hs(this,"ownerDocument"),hs(this,"firstChild",null),hs(this,"lastChild",null),hs(this,"previousSibling",null),hs(this,"nextSibling",null),hs(this,"ELEMENT_NODE",1),hs(this,"TEXT_NODE",3),hs(this,"nodeType"),hs(this,"nodeName"),hs(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function ba(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var va={map:{},getId:()=>-1,getNode:()=>null,removeNodeFromMap(){},has:()=>!1,reset(){}};function wa(e,t,n={}){let r=null,o=0;return function(...i){const s=Date.now();o||!1!==n.leading||(o=s);const a=t-(s-o),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=s,e.apply(c,i)):r||!1===n.trailing||(r=setTimeout(()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,i)},a))}}function xa(e,t,n,r,o=window){const i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>xa(e,t,i||{},!0)}function ka(e){var t,n,r,o;const i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:i.documentElement.scrollLeft||(null==i?void 0:i.body)&&(null==(t=Ns.parentElement(i.body))?void 0:t.scrollLeft)||(null==(n=null==i?void 0:i.body)?void 0:n.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==i?void 0:i.documentElement.scrollTop)||(null==i?void 0:i.body)&&(null==(r=Ns.parentElement(i.body))?void 0:r.scrollTop)||(null==(o=null==i?void 0:i.body)?void 0:o.scrollTop)||0}}function Sa(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function _a(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ea(e){return e?e.nodeType===e.ELEMENT_NODE?e:Ns.parentElement(e):null}function Ca(e,t,n,r){if(!e)return!1;const o=Ea(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(ua(o,t,r))return!0}catch(i){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function Ia(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function Ta(e,t){if(Ps(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=Ns.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||Ta(r,t))}function za(e){return Boolean(e.changedTouches)}function Ma(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Oa(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Ra(e){return!!e&&(e instanceof ya&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Ns.shadowRoot(e)))}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(va=new Proxy(va,{get:(e,t,n)=>Reflect.get(e,t,n)}));var Na=class{constructor(){hs(this,"id",1),hs(this,"styleIDMap",/* @__PURE__ */new WeakMap),hs(this,"idStyleMap",/* @__PURE__ */new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=/* @__PURE__ */new WeakMap,this.idStyleMap=/* @__PURE__ */new Map,this.id=1}generateId(){return this.id++}};function Aa(e){var t;let n=null;return"getRootNode"in e&&(null==(t=Ns.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ns.host(Ns.getRootNode(e))&&(n=Ns.host(Ns.getRootNode(e))),n}function Pa(e){const t=Ns.ownerDocument(e);if(!t)return!1;const n=function(e){let t,n=e;for(;t=Aa(n);)n=t;return n}(e);return Ns.contains(t,n)}function Da(e){const t=Ns.ownerDocument(e);return!!t&&(Ns.contains(t,e)||Pa(e))}function $a(e){return"__ln"in e}var La,ja=class{constructor(){hs(this,"length",0),hs(this,"head",null),hs(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$a(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&$a(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Fa=(e,t)=>`${e}@${t}`,Ua=class{constructor(){hs(this,"frozen",!1),hs(this,"locked",!1),hs(this,"texts",[]),hs(this,"attributes",[]),hs(this,"attributeMap",/* @__PURE__ */new WeakMap),hs(this,"removes",[]),hs(this,"mapRemoves",[]),hs(this,"movedMap",{}),hs(this,"addedSet",/* @__PURE__ */new Set),hs(this,"movedSet",/* @__PURE__ */new Set),hs(this,"droppedSet",/* @__PURE__ */new Set),hs(this,"removesSubTreeCache",/* @__PURE__ */new Set),hs(this,"mutationCb"),hs(this,"blockClass"),hs(this,"blockSelector"),hs(this,"maskTextClass"),hs(this,"maskTextSelector"),hs(this,"inlineStylesheet"),hs(this,"maskInputOptions"),hs(this,"maskTextFn"),hs(this,"maskInputFn"),hs(this,"keepIframeSrcFn"),hs(this,"recordCanvas"),hs(this,"inlineImages"),hs(this,"slimDOMOptions"),hs(this,"dataURLOptions"),hs(this,"doc"),hs(this,"mirror"),hs(this,"iframeManager"),hs(this,"stylesheetManager"),hs(this,"shadowDomManager"),hs(this,"canvasManager"),hs(this,"processedNodeManager"),hs(this,"unattachedDoc"),hs(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),hs(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=/* @__PURE__ */new Set,n=new ja,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{const i=Ns.parentNode(o);if(!i||!Da(o))return;let s=!1;if(o.nodeType===Node.TEXT_NODE){const e=i.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(i)&&(s=!0)}const a=Ps(i)?this.mirror.getId(Aa(o)):this.mirror.getId(i),c=r(o);if(-1===a||-1===c)return n.addNode(o);const l=ga(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Ma(e,this.mirror)&&this.iframeManager.addIframe(e),Oa(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Ra(o)&&this.shadowDomManager.addShadowRoot(Ns.shadowRoot(o),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:s});l&&(e.push({parentId:a,nextId:c,node:l}),t.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)Ba(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(Ns.parentNode(a))||o(a);for(const a of this.addedSet)Ha(this.droppedSet,a)||Ba(this.removesSubTreeCache,a,this.mirror)?Ha(this.movedSet,a)?o(a):this.droppedSet.add(a):o(a);let i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(Ns.parentNode(i.value)),n=r(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(Ns.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=Ns.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Ns.host(r);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),o(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,n=Ns.parentNode(t);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=/* @__PURE__ */new WeakMap,this.removes=[],this.addedSet=/* @__PURE__ */new Set,this.movedSet=/* @__PURE__ */new Set,this.droppedSet=/* @__PURE__ */new Set,this.removesSubTreeCache=/* @__PURE__ */new Set,this.movedMap={},this.mutationCb(s))}),hs(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const n=Array.from(Ns.childNodes(e),e=>Ns.textContent(e)||"").join("");t.attributes.value=Fs({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Bs(e),value:n,maskInputFn:this.maskInputFn})}),hs(this,"processMutation",e=>{if(!Ia(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Ns.textContent(e.target);Ca(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:pa(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Ea(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,o=e.target.getAttribute(r);if("value"===r){const e=Bs(n);o=Fs({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(Ca(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(o)){if(n.contentDocument)return;r="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!da(n.tagName,r))if(i.attributes[r]=la(this.doc,Us(n.tagName),Us(r),o),"style"===r){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),o=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?t:[t,o]:i._unchangedStyles[e]=[t,o]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===r&&"DIALOG"===n.tagName&&(n.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":if(Ca(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=Ps(e.target)?this.mirror.getId(Ns.host(e.target)):this.mirror.getId(e.target);Ca(e.target,this.blockClass,this.blockSelector,!1)||Ia(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Wa(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ta(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Fa(n,r)]?Wa(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!Ps(e.target)||!Ds(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),Ns.childNodes(e).forEach(e=>n.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),hs(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Ia(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Fa(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Ca(e,this.blockClass,this.blockSelector,!1)||(Ns.childNodes(e).forEach(e=>this.genAdds(e)),Ra(e)&&Ns.childNodes(Ns.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Wa(e,t){e.delete(t),Ns.childNodes(t).forEach(t=>Wa(e,t))}function Ba(e,t,n){return 0!==e.size&&function(e,t){const n=Ns.parentNode(t);return!!n&&e.has(n)}(e,t)}function Ha(e,t){return 0!==e.size&&Za(e,t)}function Za(e,t){const n=Ns.parentNode(t);return!!n&&(!!e.has(n)||Za(e,n))}var qa=e=>{if(!La)return e;return(...t)=>{try{return e(...t)}catch(n){if(La&&!0===La(n))return;throw n}}},Va=[];function Ga(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Ya(e,t){const n=new Ua;Va.push(n),n.init(e);const[r,o]=Ms(),i=new r(qa(n.processMutations.bind(n)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[i,o]}function Ja({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const s=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];let c=null;return Object.keys(gs).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(i=>{let s=Us(i);const l=(t=>i=>{const s=Ga(i);if(Ca(s,r,o,!0))return;let a=null,l=t;if("pointerType"in i){switch(i.pointerType){case"mouse":a=ys.Mouse;break;case"touch":a=ys.Touch;break;case"pen":a=ys.Pen}a===ys.Touch?gs[t]===gs.MouseDown?l="TouchStart":gs[t]===gs.MouseUp&&(l="TouchEnd"):ys.Pen}else za(i)&&(a=ys.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===ys.Touch||l.startsWith("Mouse")&&a===ys.Mouse)&&(a=null)):gs[t]===gs.Click&&(a=c,c=null);const d=za(i)?i.changedTouches[0]:i;if(!d)return;const u=n.getId(s),{clientX:p,clientY:h}=d;qa(e)({type:gs[l],id:u,x:p,y:h,...null!==a&&{pointerType:a}})})(i);if(window.PointerEvent)switch(gs[i]){case gs.MouseDown:case gs.MouseUp:s=s.replace("mouse","pointer");break;case gs.TouchStart:case gs.TouchEnd:return}a.push(ba(s,l,t))}),qa(()=>{a.forEach(e=>e())})}function Xa({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){return ba("scroll",qa(wa(qa(i=>{const s=Ga(i);if(!s||Ca(s,r,o,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=ka(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),i.scroll||100)),t)}var Ka=["INPUT","TEXTAREA","SELECT"],Qa=/* @__PURE__ */new WeakMap;function ec(e){return function e(t,n){if(oc("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||oc("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||oc("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||oc("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const r=Array.from(t.parentRule.cssRules).indexOf(t);return n.unshift(r),e(t.parentRule,n)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);n.unshift(e)}return n}(e,[])}function tc(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function nc({mirror:e,stylesheetManager:t},n){var r,o,i;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(Ns.host(n));const a="#document"===n.nodeName?null==(r=n.defaultView)?void 0:r.Document:null==(i=null==(o=n.ownerDocument)?void 0:o.defaultView)?void 0:i.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null==(e=c.get)?void 0:e.call(this)},set(e){var n;const r=null==(n=c.set)?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(o){}return r}}),qa(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})):()=>{}}function rc(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:h,customElementCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),i(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),p(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),h(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),f(...e)}}(e,t);let o=()=>{};e.recordDOM&&([r,o]=Ya(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=wa(qa(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),i),l=qa(wa(qa(e=>{const t=Ga(e),{clientX:n,clientY:o}=za(e)?e.changedTouches[0]:e;s||(s=Os()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Os()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?ms.Drag:e instanceof MouseEvent?ms.MouseMove:ms.TouchMove)}),o,{trailing:!1})),d=[ba("mousemove",l,n),ba("touchmove",l,n),ba("drag",l,n)];return qa(()=>{d.forEach(e=>e())})}(e),s=Ja(e),a=Xa(e),c=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return ba("resize",qa(wa(qa(()=>{const t=Sa(),o=_a();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)}),200)),t)}(e,{win:n}),l=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:i,ignoreSelector:s,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:d}){function u(e){let n=Ga(e);const l=e.isTrusted,u=n&&n.tagName;if(n&&"OPTION"===u&&(n=Ns.parentElement(n)),!n||!u||Ka.indexOf(u)<0||Ca(n,r,o,!0))return;if(n.classList.contains(i)||s&&n.matches(s))return;let h=n.value,f=!1;const m=Bs(n)||"";"radio"===m||"checkbox"===m?f=n.checked:(a[u.toLowerCase()]||a[m])&&(h=Fs({element:n,maskInputOptions:a,tagName:u,type:m,value:h,maskInputFn:c})),p(n,d?{text:h,isChecked:f,userTriggered:l}:{text:h,isChecked:f});const g=n.name;"radio"===m&&g&&f&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==n){const t=e.value;p(e,d?{text:t,isChecked:!f,userTriggered:!1}:{text:t,isChecked:!f})}})}function p(t,r){const o=Qa.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){Qa.set(t,r);const o=n.getId(t);qa(e)({...r,id:o})}}const h=("last"===l.input?["change"]:["input","change"]).map(e=>ba(e,qa(u),t)),f=t.defaultView;if(!f)return()=>{h.forEach(e=>e())};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),g=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...g.map(e=>xa(e[0],e[1],{set(){qa(u)({target:this,isTrusted:!1})}},!1,f))),qa(()=>{h.forEach(e=>e())})}(e),d=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:i}){const s=qa(i=>wa(qa(o=>{const s=Ga(o);if(!s||Ca(s,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:d,loop:u}=s;e({type:i,id:r.getId(s),currentTime:a,volume:c,muted:l,playbackRate:d,loop:u})}),o.media||500)),a=[ba("play",s(vs.Play),i),ba("pause",s(vs.Pause),i),ba("seeked",s(vs.Seeked),i),ba("volumechange",s(vs.VolumeChange),i),ba("ratechange",s(vs.RateChange),i)];return qa(()=>{a.forEach(e=>e())})}(e);let u=()=>{},p=()=>{},h=()=>{},f=()=>{};e.recordDOM&&(u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:qa((r,o,i)=>{const[s,a]=i,{id:c,styleId:l}=tc(o,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:a}]}),r.apply(o,i)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){const o=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[o,n])};const i=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:s}]}),r.apply(o,i)})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:s}),r.apply(o,i)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:s}),r.apply(o,i)})}));const c={};ic("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(ic("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),ic("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),ic("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach(([r,o])=>{l[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(l[r].insertRule,{apply:qa((r,o,i)=>{const[s,a]=i,{id:c,styleId:l}=tc(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:[...ec(o),a||0]}]}),r.apply(o,i)})}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ec(o),s]}]}),r.apply(o,i)})})}),qa(()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=i,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})})}(e,{win:n}),p=nc(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:qa((o,s,a)=>{var c;const[l,d,u]=a;if(n.has(l))return i.apply(s,[l,d,u]);const{id:p,styleId:h}=tc(null==(c=s.parentRule)?void 0:c.parentStyleSheet,t,r.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,set:{property:l,value:d,priority:u},index:ec(s.parentRule)}),o.apply(s,a)})});const s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:qa((o,i,a)=>{var c;const[l]=a;if(n.has(l))return s.apply(i,[l]);const{id:d,styleId:u}=tc(null==(c=i.parentRule)?void 0:c.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:l},index:ec(i.parentRule)}),o.apply(i,a)})}),qa(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(f=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=/* @__PURE__ */new WeakMap,i=n.FontFace;n.FontFace=function(e,t,n){const r=new i(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const s=Rs(t.fonts,"add",function(t){return function(n){return setTimeout(qa(()=>{const t=o.get(n);t&&(e(t),o.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=i}),r.push(s),qa(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:i}=e;let s=!0;const a=qa(()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const{startContainer:i,startOffset:s,endContainer:c,endOffset:l}=e.getRangeAt(t);Ca(i,r,o,!0)||Ca(c,r,o,!0)||a.push({start:n.getId(i),startOffset:s,end:n.getId(c),endOffset:l})}i({ranges:a})});return a(),ba("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?Rs(n.customElements,"define",function(e){return function(n,r,o){try{t({define:{name:n}})}catch(i){}return e.apply(this,[n,r,o])}}):()=>{}}(e),y=[];for(const b of e.plugins)y.push(b.observer(b.callback,n,b.options));return qa(()=>{Va.forEach(e=>e.reset()),r?.disconnect(),o(),i(),s(),a(),c(),l(),d(),u(),p(),h(),f(),m(),g(),y.forEach(e=>e())})}function oc(e){return void 0!==window[e]}function ic(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var sc=class{constructor(e){hs(this,"iframeIdToRemoteIdMap",/* @__PURE__ */new WeakMap),hs(this,"iframeRemoteIdToIdMap",/* @__PURE__ */new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let s=o.get(t);return s||(s=this.generateIdFn(),o.set(t,s),i.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=/* @__PURE__ */new WeakMap,void(this.iframeRemoteIdToIdMap=/* @__PURE__ */new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=/* @__PURE__ */new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=/* @__PURE__ */new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},ac=class{constructor(e){hs(this,"iframes",/* @__PURE__ */new WeakMap),hs(this,"crossOriginIframeMap",/* @__PURE__ */new WeakMap),hs(this,"crossOriginIframeMirror",new sc(na)),hs(this,"crossOriginIframeStyleMirror"),hs(this,"crossOriginIframeRootIdMap",/* @__PURE__ */new WeakMap),hs(this,"mirror"),hs(this,"mutationCb"),hs(this,"wrappedEmit"),hs(this,"loadListener"),hs(this,"stylesheetManager"),hs(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new sc(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case fs.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:fs.IncrementalSnapshot,data:{source:ms.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case fs.Meta:case fs.Load:case fs.DomContentLoaded:return!1;case fs.Plugin:return t;case fs.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case fs.IncrementalSnapshot:switch(t.data.source){case ms.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ms.Drag:case ms.TouchMove:case ms.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ms.ViewportResize:return!1;case ms.MediaInteraction:case ms.MouseInteraction:case ms.Scroll:case ms.CanvasMutation:case ms.Input:return this.replaceIds(t.data,e,["id"]),t;case ms.StyleSheetRule:case ms.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ms.Font:return t;case ms.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case ms.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===ws.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},cc=class{constructor(e){hs(this,"shadowDoms",/* @__PURE__ */new WeakSet),hs(this,"mutationCb"),hs(this,"scrollCb"),hs(this,"bypassOptions"),hs(this,"mirror"),hs(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Ds(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const[n]=Ya({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Xa({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(Ns.host(e))),this.restoreHandlers.push(nc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Rs(e.prototype,"attachShadow",function(e){return function(r){const o=e.call(this,r),i=Ns.shadowRoot(this);return i&&Da(this)&&n.addShadowRoot(i,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=/* @__PURE__ */new WeakSet}},lc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dc="undefined"==typeof Uint8Array?[]:/* @__PURE__ */new Uint8Array(256),uc=0;uc<64;uc++)dc[lc.charCodeAt(uc)]=uc;var pc=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=lc[n[t]>>2],o+=lc[(3&n[t])<<4|n[t+1]>>4],o+=lc[(15&n[t+1])<<2|n[t+2]>>6],o+=lc[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o},hc=/* @__PURE__ */new Map;var fc=(e,t,n)=>{if(!e||!yc(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=hc.get(e);return n||(n=/* @__PURE__ */new Map,hc.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function mc(e,t,n){if(e instanceof Array)return e.map(e=>mc(e,t,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:pc(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[mc(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[mc(e.data,t,n),e.width,e.height]}:yc(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:fc(e,t,n)}:e}var gc=(e,t,n)=>e.map(e=>mc(e,t,n)),yc=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function bc(e,t,n,r){const o=[];try{const i=Rs(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(o,...i){if(!Ca(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(i[0]&&"object"==typeof i[0]){const e=i[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[o,...i])}});o.push(i)}catch{}return()=>{o.forEach(e=>e())}}function vc(e,t,n,r,o,i){const s=[],a=Object.getOwnPropertyNames(e);for(const c of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const a=Rs(e,c,function(e){return function(...s){const a=e.apply(this,s);if(fc(a,i,this),"tagName"in this.canvas&&!Ca(this.canvas,r,o,!0)){const e=gc(s,i,this),r={type:t,property:c,args:e};n(this.canvas,r)}return a}});s.push(a)}catch{const r=xa(e,c,{set(e){n(this.canvas,{type:t,property:c,args:[e],setter:!0})}});s.push(r)}return s}var wc='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n',xc="undefined"!=typeof self&&self.Blob&&new Blob([wc],{type:"text/javascript;charset=utf-8"});function kc(e){let t;try{if(t=xc&&(self.URL||self.webkitURL).createObjectURL(xc),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(wc),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Sc,_c,Ec,Cc=class{constructor(e){hs(this,"pendingCanvasMutations",/* @__PURE__ */new Map),hs(this,"rafStamps",{latestId:0,invokeId:null}),hs(this,"mirror"),hs(this,"mutationCb"),hs(this,"resetObservers"),hs(this,"frozen",!1),hs(this,"locked",!1),hs(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:n,blockClass:r,blockSelector:o,recordCanvas:i,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(n,r,o),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,o,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,r,o){const i=bc(t,n,r,!0),s=/* @__PURE__ */new Map,a=new kc;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:i}=e.data;this.mutationCb({id:t,type:bs["2D"],commands:[{property:"clearRect",args:[0,0,o,i]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,d=0;const u=e=>{d&&e-d<c||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{Ca(t,n,r,!0)||e.push(t)}),e})().forEach(async e=>{var t;const n=this.mirror.getId(e);if(s.get(n))return;if(0===e.width||0===e.height)return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=await createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[r])})),l=requestAnimationFrame(u)};l=requestAnimationFrame(u),this.resetObservers=()=>{i(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=bc(e,t,n,!1),o=function(e,t,n,r){const o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of i)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const i=Rs(t.CanvasRenderingContext2D.prototype,s,function(o){return function(...i){return Ca(this.canvas,n,r,!0)||setTimeout(()=>{const n=gc(i,t,this);e(this.canvas,{type:bs["2D"],property:s,args:n})},0),o.apply(this,i)}});o.push(i)}catch{const n=xa(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:bs["2D"],property:s,args:[t],setter:!0})}});o.push(n)}return()=>{o.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),i=function(e,t,n,r){const o=[];return void 0!==t.WebGLRenderingContext&&o.push(...vc(t.WebGLRenderingContext.prototype,bs.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&o.push(...vc(t.WebGL2RenderingContext.prototype,bs.WebGL2,e,n,r,t)),()=>{o.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),o(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map(e=>{const{type:t,...n}=e;return n}),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}},Ic=class{constructor(e){hs(this,"trackedLinkElements",/* @__PURE__ */new WeakSet),hs(this,"mutationCb"),hs(this,"adoptedStyleSheetCb"),hs(this,"styleMirror",new Na),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const o of e){let e;this.styleMirror.has(o)?e=this.styleMirror.getId(o):(e=this.styleMirror.add(o),r.push({styleId:e,rules:Array.from(o.rules||CSSRule,(e,t)=>({rule:Ls(e,o.href),index:t}))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=/* @__PURE__ */new WeakSet}trackStylesheetInLinkElement(e){}},Tc=class{constructor(){hs(this,"nodeMap",/* @__PURE__ */new WeakMap),hs(this,"active",!1)}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=/* @__PURE__ */new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||/* @__PURE__ */new Set).add(t))}destroy(){}},zc=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(ls=e.contentWindow)?void 0:ls.Array.from)||Array.from,document.body.removeChild(e)}}catch(Zg){}var Mc=new js;function Oc(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:c="rr-mask",maskTextSelector:l=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:p,slimDOMOptions:h,maskInputFn:f,maskTextFn:m,hooks:g,packFn:y,sampling:b={},dataURLOptions:v={},mousemoveWait:w,recordDOM:x=!0,recordCanvas:k=!1,recordCrossOriginIframes:S=!1,recordAfter:_=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:E=!1,collectFonts:C=!1,inlineImages:I=!1,plugins:T,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:M=/* @__PURE__ */new Set([]),errorHandler:O}=e;La=O;const R=!S||window.parent===window;let N=!1;if(!R)try{window.parent.document&&(N=!1)}catch(q){N=!0}if(R&&!t)throw new Error("emit function is required");if(!R&&!N)return()=>{};void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),Mc.reset();const A=!0===u?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==p?p:{password:!0},P=ma(h);let D;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}();let $=0;const L=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!N&&(e=y(e)),e};Sc=(e,o)=>{var i;const s=e;if(s.timestamp=Os(),!(null==(i=Va[0])?void 0:i.isFrozen())||s.type===fs.FullSnapshot||s.type===fs.IncrementalSnapshot&&s.data.source===ms.Mutation||Va.forEach(e=>e.unfreeze()),R)t?.(L(s),o);else if(N){const e={type:"rrweb",event:L(s),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,"*")}if(s.type===fs.FullSnapshot)D=s,$=0;else if(s.type===fs.IncrementalSnapshot){if(s.data.source===ms.Mutation&&s.data.isAttachIframe)return;$++;const e=r&&$>=r,t=n&&s.timestamp-D.timestamp>n;(e||t)&&_c(!0)}};const j=e=>{Sc({type:fs.IncrementalSnapshot,data:{source:ms.Mutation,...e}})},F=e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.Scroll,...e}}),U=e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.CanvasMutation,...e}}),W=new Ic({mutationCb:j,adoptedStyleSheetCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.AdoptedStyleSheet,...e}})}),B=new ac({mirror:Mc,mutationCb:j,stylesheetManager:W,recordCrossOriginIframes:S,wrappedEmit:Sc});for(const G of T||[])G.getMirror&&G.getMirror({nodeMirror:Mc,crossOriginIframeMirror:B.crossOriginIframeMirror,crossOriginIframeStyleMirror:B.crossOriginIframeStyleMirror});const H=new Tc;Ec=new Cc({recordCanvas:k,mutationCb:U,win:window,blockClass:o,blockSelector:i,mirror:Mc,sampling:b.canvas,dataURLOptions:v});const Z=new cc({mutationCb:j,scrollCb:F,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:l,inlineStylesheet:d,maskInputOptions:A,dataURLOptions:v,maskTextFn:m,maskInputFn:f,recordCanvas:k,inlineImages:I,sampling:b,slimDOMOptions:P,iframeManager:B,stylesheetManager:W,canvasManager:Ec,keepIframeSrcFn:z,processedNodeManager:H},mirror:Mc});_c=(e=!1)=>{if(!x)return;Sc({type:fs.Meta,data:{href:window.location.href,width:_a(),height:Sa()}},e),W.reset(),Z.init(),Va.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new js,blockClass:r="rr-block",blockSelector:o=null,maskTextClass:i="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:c=!1,recordCanvas:l=!1,maskAllInputs:d=!1,maskTextFn:u,maskInputFn:p,slimDOM:h=!1,dataURLOptions:f,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:w,keepIframeSrcFn:x=()=>!1}=t;return ga(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:ma(h),dataURLOptions:f,inlineImages:c,recordCanvas:l,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:w,keepIframeSrcFn:x,newlyAddedElement:!1})}(document,{mirror:Mc,blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:l,inlineStylesheet:d,maskAllInputs:A,maskTextFn:m,maskInputFn:f,slimDOM:P,dataURLOptions:v,recordCanvas:k,inlineImages:I,onSerialize:e=>{Ma(e,Mc)&&B.addIframe(e),Oa(e,Mc)&&W.trackLinkElement(e),Ra(e)&&Z.addShadowRoot(Ns.shadowRoot(e),document)},onIframeLoad:(e,t)=>{B.attachIframe(e,t),Z.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:z});t&&(Sc({type:fs.FullSnapshot,data:{node:t,initialOffset:ka(window)}},e),Va.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,Mc.getId(document)))};try{const e=[],t=e=>{var t;return qa(rc)({mutationCb:j,mousemoveCb:(e,t)=>Sc({type:fs.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.MouseInteraction,...e}}),scrollCb:F,viewportResizeCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.ViewportResize,...e}}),inputCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.Input,...e}}),mediaInteractionCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.MediaInteraction,...e}}),styleSheetRuleCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.StyleSheetRule,...e}}),styleDeclarationCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.StyleDeclaration,...e}}),canvasMutationCb:U,fontCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.Font,...e}}),selectionCb:e=>{Sc({type:fs.IncrementalSnapshot,data:{source:ms.Selection,...e}})},customElementCb:e=>{Sc({type:fs.IncrementalSnapshot,data:{source:ms.CustomElement,...e}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:A,inlineStylesheet:d,sampling:b,recordDOM:x,recordCanvas:k,inlineImages:I,userTriggeredOnInput:E,collectFonts:C,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:z,blockSelector:i,slimDOMOptions:P,dataURLOptions:v,mirror:Mc,iframeManager:B,stylesheetManager:W,shadowDomManager:Z,processedNodeManager:H,canvasManager:Ec,ignoreCSSAttributes:M,plugins:(null==(t=null==T?void 0:T.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Sc({type:fs.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};B.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(r){}});const n=()=>{_c(),e.push(t(document)),zc=!0};return["interactive","complete"].includes(document.readyState)?n():(e.push(ba("DOMContentLoaded",()=>{Sc({type:fs.DomContentLoaded,data:{}}),"DOMContentLoaded"===_&&n()})),e.push(ba("load",()=>{Sc({type:fs.Load,data:{}}),"load"===_&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(t){String(t).toLowerCase().includes("cross-origin")}}),H.destroy(),zc=!1,La=void 0}}catch(V){}}Oc.addCustomEvent=(e,t)=>{if(!zc)throw new Error("please add custom event after start recording");Sc({type:fs.Custom,data:{tag:e,payload:t}})},Oc.freezePage=()=>{Va.forEach(e=>e.freeze())},Oc.takeFullSnapshot=e=>{if(!zc)throw new Error("please take full snapshot after start recording");_c(e)},Oc.mirror=Mc;var Rc=class{chatId;applicationId;events=[];sessionId=globalThis.crypto.randomUUID();stopRecording=null;flushTimer=null;flushPromise=Promise.resolve();stopped=!1;constructor(e,t){this.chatId=e,this.applicationId=t}async start(){this.stopRecording||this.stopped||(await os.widgetMessagePost({chat_id:this.chatId,command:{type:"rrweb/metadata",rrweb_session_id:this.sessionId,chat_id:this.chatId,application_id:this.applicationId,url:window.location.href,user_agent:navigator.userAgent,timestamp:Date.now(),viewport:{width:window.innerWidth,height:window.innerHeight}}}),this.stopped||(this.stopRecording=Oc({emit:e=>this.buffer(e),maskAllInputs:!0,maskTextClass:/^(rr-mask|mtx-mask)$/,blockClass:/^(rr-block|mtx-block)$/})))}stop(){this.stopped=!0,this.stopRecording?.(),this.stopRecording=null,this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=null,this.flush()}buffer(e){this.events.push(e),this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flush()},500))}flush(){return this.flushPromise=this.flushPromise.then(async()=>{this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=null;const e=this.events.splice(0);if(e.length)try{await os.widgetMessagePost({chat_id:this.chatId,command:{type:"rrweb/events",rrweb_session_id:this.sessionId,events:e}})}catch(t){this.events.unshift(...e)}}),this.flushPromise}},Nc=class e{static instance=null;abortController=null;chatId=null;status="disconnected";callbacks=/* @__PURE__ */new Set;isIntentionallyDisconnected=!1;reconnectAttempts=0;maxReconnectAttempts=10;reconnectDelay=1e3;maxReconnectDelay=3e4;reconnectTimer=null;connectionId=0;tabId=globalThis.crypto.randomUUID();registrationWaiters=/* @__PURE__ */new Set;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}addCallbacks(e){this.callbacks.add(e)}removeCallbacks(e){this.callbacks.delete(e)}isConnected(){return"registered"===this.status}canReconnect(){return null!==this.chatId&&!this.isIntentionallyDisconnected&&!this.isConnected()}reconnectNow(){this.canReconnect()&&null!==this.chatId&&(this.clearReconnectTimer(),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.connect(this.chatId).catch(console.error))}async waitUntilRegistered(){this.isConnected()||await new Promise((e,t)=>this.registrationWaiters.add({resolve:e,reject:t}))}async connect(e){if(this.isIntentionallyDisconnected=!1,this.chatId===e&&("connecting"===this.status||"connected"===this.status||"registered"===this.status))return;this.abortController&&(this.abortController.abort(),this.abortController=null),this.chatId=e,this.status="connecting";const t=++this.connectionId;this.abortController=new AbortController;const n=this.abortController.signal;try{const{mtxId:r,mtxKey:o}=ds.getConfig()??{},i=await os.widgetStream({chat_id:e,tab_id:this.tabId,...r&&o&&{marketrix_id:r,marketrix_key:o}},{signal:n});this.status="connected",this.consumeEvents(i,t)}catch(r){n.aborted||(this.status="error",this.notifyError(/* @__PURE__ */new Error("Stream connection failed")),this.scheduleReconnect())}}async consumeEvents(e,t){let n=!1;try{for await(const r of e){if(this.connectionId!==t){n=!0;break}this.handleMessage(r)}}catch(r){this.connectionId!==t?n=!0:this.isIntentionallyDisconnected||(this.status="error")}finally{n||this.connectionId!==t||this.isIntentionallyDisconnected||(this.status="disconnected",this.scheduleReconnect())}}disconnect(){this.isIntentionallyDisconnected=!0,this.clearReconnectTimer(),this.abortController&&(this.abortController.abort(),this.abortController=null),this.status="disconnected",this.chatId=null;for(const e of this.registrationWaiters)e.reject(/* @__PURE__ */new Error("Stream disconnected before registration"));this.registrationWaiters.clear()}send(e){return this.chatId?os.widgetMessagePost({chat_id:this.chatId,tab_id:this.tabId,command:e}).then(()=>{}).catch(e=>{throw this.notifyError(/* @__PURE__ */new Error(`Failed to send message: ${String(e)}`)),e}):Promise.reject(/* @__PURE__ */new Error("No active chat"))}notifyError(e){this.callbacks.forEach(t=>t.onError?.(e))}handleMessage(e){if(!this.isIntentionallyDisconnected&&"heartbeat"!==e.type){if("registered"===e.type&&e.chat_id===this.chatId){this.status="registered",this.reconnectAttempts=0,this.reconnectDelay=1e3;for(const e of this.registrationWaiters)e.resolve();this.registrationWaiters.clear()}"chat/error"===e.type&&"auth"===e.request_id&&(this.isIntentionallyDisconnected=!0,this.notifyError(/* @__PURE__ */new Error("Chat is unavailable — the widget credentials were rejected."))),this.callbacks.forEach(t=>t.onMessage?.(e))}}scheduleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return void this.notifyError(/* @__PURE__ */new Error("Could not reconnect to the assistant. Try again."));this.clearReconnectTimer(),this.reconnectAttempts++;const e=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1),this.maxReconnectDelay);this.reconnectTimer=setTimeout(()=>{!this.isIntentionallyDisconnected&&this.chatId&&this.connect(this.chatId).catch(console.error)},e)}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}};function Ac(e,t={}){return{...t,...e}}function Pc(e){return e.mtxId??(null!=e.mtxApp?String(e.mtxApp):"default")}function Dc(e){return e instanceof Error?e.message:"string"==typeof e?e:"Unknown error"}function $c(e,t){const n=new Error(e);return n.cause=t,n}async function Lc(e){const{mtxId:t,mtxKey:n}=e;if(!t||!n)throw new Error("Please provide mtxId + mtxKey");let r;try{({items:r}=await os.widgetSearch({marketrix_id:t,marketrix_key:n}))}catch(a){throw function(e,t){const n=Dc(e);return n.includes("Failed to fetch")||n.includes("ERR_CONNECTION_REFUSED")||n.includes("NetworkError")||n.includes("Network request failed")?$c(`Cannot connect to API server. Please ensure the API server is running at ${t.mtxApiHost||"configured API server"}. Error: ${n}`,e):$c(`Widget validation failed: ${n}`,e)}(a,e)}if(!r.length)throw new Error("Widget not found or invalid credentials");const o=r.find(e=>"widget"===e.type&&"active"===e.status);if(!o){const e=r.filter(e=>"widget"===e.type);if(e.length){const t=e.map(e=>e.status).join(", ");throw new Error(`Found widget(s) but none are active. Current status(es): ${t}. Please activate the widget in the dashboard.`)}const t=r.map(e=>e.type).join(", ");throw new Error(`No widget found. Found widget type(s): ${t}. Please create a widget.`)}if(!o.application_id)throw new Error("Widget missing application_id");try{await os.applicationGet({application_id:o.application_id})}catch(a){throw $c(`Failed to validate application: ${Dc(a)}`,a)}let i;try{i=await os.widgetDefaultGet({type:"widget"})}catch(a){throw $c(`Failed to fetch widget settings from API: ${Dc(a)}`,a)}const s=Ki.safeParse({...i,...o.settings});if(!s.success){const e=[...new Set(s.error.issues.map(e=>e.path.join(".")||"settings"))];throw new Error(`Widget settings are invalid: ${e.join(", ")}`)}return{...Ac(s.data,e),mtxApp:o.application_id}}var jc="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20361%20360'%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20display:%20none;%20fill:%20none;%20stroke:%20%23cdc9c2;%20stroke-width:%201.3px;%20}%20.st1%20{%20fill:%20%23fff;%20}%20.st2,%20.st3%20{%20fill:%20%237cffa6;%20}%20.st3%20{%20stroke:%20%237cffa6;%20stroke-width:%20.38px;%20}%20.st4%20{%20fill:%20%23101828;%20}%20%3c/style%3e%3c/defs%3e%3crect%20class='st4'%20x='.5'%20width='360'%20height='360'/%3e%3cpath%20class='st2'%20d='M83.37,209.58c15.35,0,27.8-12.45,27.8-27.8s-12.44-27.79-27.8-27.79-27.8,12.44-27.8,27.79,12.44,27.8,27.8,27.8Z'/%3e%3cpath%20class='st1'%20d='M85.86,68.28l152.45,223.44h67.29l-70.62-113.77,68.13-109.67h-67.29l-41.12,65.31-41.54-65.31h-67.29Z'/%3e%3cpath%20class='st3'%20d='M176.61,249.83l-35.08-51-57.82,92.71h66.85l26.05-41.7Z'/%3e%3crect%20class='st0'%20x='1.25'%20y='.65'%20width='358.7'%20height='358.7'%20rx='43.35'%20ry='43.35'/%3e%3c/svg%3e",Fc={none:"none",card:"0 1px 4px rgba(0,0,0,0.1)",section:"0 2px 8px rgba(0,0,0,0.06)",panel:"0 12px 40px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.08)",fab:"0 2px 8px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04)",button:"0 4px 6px -1px rgba(0,0,0,0.1)"},Uc={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",theme:"rounded-[var(--radius)]",pill:"rounded-full",circle:"rounded-full"},Wc={default:"text-foreground",muted:"text-foreground-muted",faint:"text-foreground-faint",primary:"text-primary",inherit:"text-inherit"},Bc={tight:"leading-tight",snug:"leading-snug",normal:"leading-normal",relaxed:"leading-relaxed"},Hc={info:{background:"#f0f9ff",border:"1px solid #bae6fd",titleColor:"#0c4a6e",bodyColor:"#0369a1",closeColor:"#7dd3fc",actionBackground:"#e0f2fe"},error:{background:"#fef2f2",border:"1px solid #fecaca",titleColor:"#b91c1c",bodyColor:"#b91c1c",closeColor:"#f87171",actionBackground:"#fee2e2"},neutral:{background:"rgba(255, 255, 255, 0.95)",border:"1px solid rgba(255, 255, 255, 0.2)",titleColor:"#1f2937",bodyColor:"#1f2937",closeColor:"#6b7280",actionBackground:"transparent"}};function Zc(e){if(e&&"none"!==e)return{boxShadow:Fc[e]}}var qc=2147483002,Vc=2147483001,Gc=2147483005,Yc=(e=/* @__PURE__ */new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Jc="-",Xc=[],Kc=e=>{const t=tl(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return el(e);const n=e.split(Jc),r=""===n[0]&&n.length>1?1:0;return Qc(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],o=n[e];return t?o?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(o,t):t:o||Xc}return n[e]||Xc}}},Qc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=Qc(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(Jc):e.slice(t).join(Jc),a=i.length;for(let c=0;c<a;c++){const e=i[c];if(e.validator(s))return e.classGroupId}},el=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),tl=e=>{const{theme:t,classGroups:n}=e;return nl(n,t)},nl=(e,t)=>{const n=Yc();for(const r in e){const o=e[r];rl(o,n,r,t)}return n},rl=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];ol(o,t,n,r)}},ol=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?al(e,t,n,r):sl(e,t,n,r):il(e,t,n)},il=(e,t,n)=>{(""===e?t:cl(t,e)).classGroupId=n},sl=(e,t,n,r)=>{ll(e)?rl(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},al=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];rl(i,cl(t,e),n,r)}},cl=(e,t)=>{let n=e;const r=t.split(Jc),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=Yc(),n.nextPart.set(e,t)),n=t}return n},ll=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,dl=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set(e,t){e in n?n[e]=t:o(e,t)}}},ul=[],pl=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),hl=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,i=0;const s=e.length;for(let d=0;d<s;d++){const s=e[d];if(0===r&&0===o){if(":"===s){t.push(e.slice(i,d)),i=d+1;continue}if("/"===s){n=d;continue}}"["===s?r++:"]"===s?r--:"("===s?o++:")"===s&&o--}const a=0===t.length?e:e.slice(i);let c=a,l=!1;a.endsWith("!")?(c=a.slice(0,-1),l=!0):a.startsWith("!")&&(c=a.slice(1),l=!0);return pl(t,l,c,n&&n>i?n-i:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):pl(ul,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},fl=e=>{const t=/* @__PURE__ */new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let o=0;o<e.length;o++){const i=e[o],s="["===i[0],a=t.has(i);s||a?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(i)):r.push(i)}return r.length>0&&(r.sort(),n.push(...r)),n}},ml=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},gl=/\s+/,yl=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=yl(e[r]))&&(n&&(n+=" "),n+=t);return n},bl=(e,...t)=>{let n,r,o,i;const s=e=>{const t=r(e);if(t)return t;const i=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i,postfixLookupClassGroupIds:s}=t,a=[],c=e.trim().split(gl);let l="";for(let d=c.length-1;d>=0;d-=1){const e=c[d],{isExternal:t,modifiers:u,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:f}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let m,g=!!f;if(g){m=r(h.substring(0,f));const e=m&&s[m]?r(h):void 0;e&&e!==m&&(m=e,g=!1)}else m=r(h);if(!m){if(!g){l=e+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=e+(l.length>0?" "+l:l);continue}g=!1}const y=0===u.length?"":1===u.length?u[0]:i(u).join(":"),b=p?y+"!":y,v=b+m;if(a.indexOf(v)>-1)continue;a.push(v);const w=o(m,g);for(let n=0;n<w.length;++n){const e=w[n];a.push(b+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return o(e,i),i};return i=a=>{const c=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:dl(e.cacheSize),parseClassName:hl(e),sortModifiers:fl(e),postfixLookupClassGroupIds:ml(e),...Kc(e)}))(c),r=n.cache.get,o=n.cache.set,i=s,s(a)},(...e)=>i(((...e)=>{let t,n,r=0,o="";for(;r<e.length;)(t=e[r++])&&(n=yl(t))&&(o&&(o+=" "),o+=n);return o})(...e))},vl=[],wl=e=>{const t=t=>t[e]||vl;return t.isThemeGetter=!0,t},xl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Sl=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_l=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,El=/\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$/,Cl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Il=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zl=e=>Sl.test(e),Ml=e=>!!e&&!Number.isNaN(Number(e)),Ol=e=>!!e&&Number.isInteger(Number(e)),Rl=e=>e.endsWith("%")&&Ml(e.slice(0,-1)),Nl=e=>_l.test(e),Al=()=>!0,Pl=e=>El.test(e)&&!Cl.test(e),Dl=()=>!1,$l=e=>Il.test(e),Ll=e=>Tl.test(e),jl=e=>!Wl(e)&&!Jl(e),Fl=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),Ul=e=>od(e,cd,Dl),Wl=e=>xl.test(e),Bl=e=>od(e,ld,Pl),Hl=e=>od(e,dd,Ml),Zl=e=>od(e,pd,Al),ql=e=>od(e,ud,Dl),Vl=e=>od(e,sd,Dl),Gl=e=>od(e,ad,Ll),Yl=e=>od(e,hd,$l),Jl=e=>kl.test(e),Xl=e=>id(e,ld),Kl=e=>id(e,ud),Ql=e=>id(e,sd),ed=e=>id(e,cd),td=e=>id(e,ad),nd=e=>id(e,hd,!0),rd=e=>id(e,pd,!0),od=(e,t,n)=>{const r=xl.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},id=(e,t,n=!1)=>{const r=kl.exec(e);return!!r&&(r[1]?t(r[1]):n)},sd=e=>"position"===e||"percentage"===e,ad=e=>"image"===e||"url"===e,cd=e=>"length"===e||"size"===e||"bg-size"===e,ld=e=>"length"===e,dd=e=>"number"===e,ud=e=>"family-name"===e,pd=e=>"number"===e||"weight"===e,hd=e=>"shadow"===e,fd=/*#__PURE__*/bl(()=>{const e=wl("color"),t=wl("font"),n=wl("text"),r=wl("font-weight"),o=wl("tracking"),i=wl("leading"),s=wl("breakpoint"),a=wl("container"),c=wl("spacing"),l=wl("radius"),d=wl("shadow"),u=wl("inset-shadow"),p=wl("text-shadow"),h=wl("drop-shadow"),f=wl("blur"),m=wl("perspective"),g=wl("aspect"),y=wl("ease"),b=wl("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Jl,Wl],w=()=>[Jl,Wl,c],x=()=>[zl,"full","auto",...w()],k=()=>[Ol,"none","subgrid",Jl,Wl],S=()=>["auto",{span:["full",Ol,Jl,Wl]},Ol,Jl,Wl],_=()=>[Ol,"auto",Jl,Wl],E=()=>["auto","min","max","fr",Jl,Wl],C=()=>["auto",...w()],I=()=>[zl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],T=()=>[zl,"screen","full","dvw","lvw","svw","min","max","fit",...w()],z=()=>[zl,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],M=()=>[e,Jl,Wl],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ql,Vl,{position:[Jl,Wl]}],R=()=>["auto","cover","contain",ed,Ul,{size:[Jl,Wl]}],N=()=>[Rl,Xl,Bl],A=()=>["","none","full",l,Jl,Wl],P=()=>["",Ml,Xl,Bl],D=()=>[Ml,Rl,Ql,Vl],$=()=>["","none",f,Jl,Wl],L=()=>["none",Ml,Jl,Wl],j=()=>["none",Ml,Jl,Wl],F=()=>[Ml,Jl,Wl],U=()=>[zl,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Nl],breakpoint:[Nl],color:[Al],container:[Nl],"drop-shadow":[Nl],ease:["in","out","in-out"],font:[jl],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Nl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Nl],shadow:[Nl],spacing:["px",Ml],text:[Nl],"text-shadow":[Nl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",zl,Wl,Jl,g]}],container:["container"],"container-type":[{"@container":["","normal","size",Jl,Wl]}],"container-named":[Fl],columns:[{columns:[Ml,Wl,Jl,a]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"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:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[Ol,"auto",Jl,Wl]}],basis:[{basis:[zl,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ml,zl,"auto","initial","none",Wl]}],grow:[{grow:["",Ml,Jl,Wl]}],shrink:[{shrink:["",Ml,Jl,Wl]}],order:[{order:[Ol,"first","last","none",Jl,Wl]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],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:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mbs:[{mbs:C()}],mbe:[{mbe:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...T()]}],"min-inline-size":[{"min-inline":["auto",...T()]}],"max-inline-size":[{"max-inline":["none",...T()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[a,"screen",...I()]}],"min-w":[{"min-w":[a,"screen","none",...I()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,Xl,Bl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,rd,Zl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Rl,Wl]}],"font-family":[{font:[Kl,ql,t]}],"font-features":[{"font-features":[Wl]}],"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:[o,Jl,Wl]}],"line-clamp":[{"line-clamp":[Ml,"none",Jl,Hl]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",Jl,Wl]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Jl,Wl]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Ml,"from-font","auto",Jl,Bl]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ml,"auto",Jl,Wl]}],"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:[Ol,Jl,Wl]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Jl,Wl]}],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",Jl,Wl]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ol,Jl,Wl],radial:["",Jl,Wl],conic:[Ol,Jl,Wl]},td,Gl]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:N()}],"gradient-via-pos":[{via:N()}],"gradient-to-pos":[{to:N()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-bs":[{"border-bs":P()}],"border-w-be":[{"border-be":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":P()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Ml,Jl,Wl]}],"outline-w":[{outline:["",Ml,Xl,Bl]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,nd,Yl]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",u,nd,Yl]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ml,Bl]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,nd,Yl]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ml,Jl,Wl]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"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":[Ml]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Jl,Wl]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Ml]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Jl,Wl]}],filter:[{filter:["","none",Jl,Wl]}],blur:[{blur:$()}],brightness:[{brightness:[Ml,Jl,Wl]}],contrast:[{contrast:[Ml,Jl,Wl]}],"drop-shadow":[{"drop-shadow":["","none",h,nd,Yl]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ml,Jl,Wl]}],"hue-rotate":[{"hue-rotate":[Ml,Jl,Wl]}],invert:[{invert:["",Ml,Jl,Wl]}],saturate:[{saturate:[Ml,Jl,Wl]}],sepia:[{sepia:["",Ml,Jl,Wl]}],"backdrop-filter":[{"backdrop-filter":["","none",Jl,Wl]}],"backdrop-blur":[{"backdrop-blur":$()}],"backdrop-brightness":[{"backdrop-brightness":[Ml,Jl,Wl]}],"backdrop-contrast":[{"backdrop-contrast":[Ml,Jl,Wl]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ml,Jl,Wl]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ml,Jl,Wl]}],"backdrop-invert":[{"backdrop-invert":["",Ml,Jl,Wl]}],"backdrop-opacity":[{"backdrop-opacity":[Ml,Jl,Wl]}],"backdrop-saturate":[{"backdrop-saturate":[Ml,Jl,Wl]}],"backdrop-sepia":[{"backdrop-sepia":["",Ml,Jl,Wl]}],"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",Jl,Wl]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ml,"initial",Jl,Wl]}],ease:[{ease:["linear","initial",y,Jl,Wl]}],delay:[{delay:[Ml,Jl,Wl]}],animate:[{animate:["none",b,Jl,Wl]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Jl,Wl]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:j()}],"scale-x":[{"scale-x":j()}],"scale-y":[{"scale-y":j()}],"scale-z":[{"scale-z":j()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Jl,Wl,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:U()}],"translate-x":[{"translate-x":U()}],"translate-y":[{"translate-y":U()}],"translate-z":[{"translate-z":U()}],"translate-none":["translate-none"],zoom:[{zoom:[Ol,Jl,Wl]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Jl,Wl]}],"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":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"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",Jl,Wl]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ml,Xl,Bl,Hl]}],stroke:[{stroke:["none",...M()]}],"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 md(...e){return fd(e.filter(Boolean).join(" "))}var gd={sm:"w-5 h-5",md:"w-8 h-8",lg:"w-12 h-12"};function yd(e){const{src:t,alt:n,elevation:r,fit:o="contain",size:i="md",rounded:s,className:a,style:c,ref:l,...d}=e,u="string"==typeof i,p=u?gd[i]:void 0,h=u?c:{width:i,height:i,...c};/* @__PURE__ */
3
- return g("img",{...d,ref:l,alt:n,className:md("flex-shrink-0","contain"===o?"object-contain":"object-cover",p,!0===s||"theme"===s?Uc.theme:"full"===s?Uc.pill:s?Uc[s]:void 0,a),src:t,style:{...Zc(r),...h}})}function bd(){return"undefined"!=typeof window}function vd(e){return xd(e)?(e.nodeName||"").toLowerCase():"#document"}function wd(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function xd(e){return!!bd()&&(e instanceof Node||e instanceof wd(e).Node)}function kd(e){return!!bd()&&(e instanceof Element||e instanceof wd(e).Element)}function Sd(e){return!!bd()&&(e instanceof HTMLElement||e instanceof wd(e).HTMLElement)}function _d(e){return!(!bd()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof wd(e).ShadowRoot)}function Ed(e){return/^(html|body|#document)$/.test(vd(e))}function Cd(e){return wd(e).getComputedStyle(e)}function Id(e){if("html"===vd(e))return e;const t=e.assignedSlot||e.parentNode||_d(e)&&e.host||function(e){var t;return null==(t=(xd(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}(e);return _d(t)?t.host:t}var Td={...e},zd={};function Md(t,n){const r=e.useRef(zd);return r.current===zd&&(r.current=t(n)),r}var Od=Td.useInsertionEffect,Rd=Od&&Od!==Td.useLayoutEffect?Od:e=>e();function Nd(e){const t=Md(Ad).current;return t.next=e,Rd(t.effect),t.trampoline}function Ad(){const e={next:void 0,callback:Pd,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Pd(){}var Dd="undefined"!=typeof document?e.useLayoutEffect:()=>{};function $d(e,t){return e&&!t?e:!e&&t?t:e||t?{...e,...t}:void 0}var Ld={};function jd(e,t,n,r,o){if(!(n||r||o||e))return Fd(t);let i=Fd(e);return t&&(i=Ud(i,t)),n&&(i=Ud(i,n)),r&&(i=Ud(i,r)),o&&(i=Ud(i,o)),i}function Fd(e){return Bd(e)?{...Hd(e,Ld)}:function(e){const t={...e};for(const n in t){const e=t[n];Wd(n,e)&&(t[n]=qd(e))}return t}(e)}function Ud(e,t){return Bd(t)?Hd(t,e):function(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":e[n]=$d(e.style,r);break;case"className":e[n]=Gd(e.className,r);break;default:Wd(n,r)?e[n]=Zd(e[n],r):e[n]=r}}return e}(e,t)}function Wd(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return 111===n&&110===r&&o>=65&&o<=90&&("function"==typeof t||void 0===t)}function Bd(e){return"function"==typeof e}function Hd(e,t){return Bd(e)?e(t):e??Ld}function Zd(e,t){return t?e?(...n)=>{const r=n[0];if(Yd(r)){const o=r;Vd(o);const i=t(...n);return o.baseUIHandlerPrevented||e?.(...n),i}const o=t(...n);return e?.(...n),o}:qd(t):e}function qd(e){return e?(...t)=>{const n=t[0];return Yd(n)&&Vd(n),e(...t)}:e}function Vd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Gd(e,t){return t?e?t+" "+e:t:e}function Yd(e){return null!=e&&"object"==typeof e&&"nativeEvent"in e}var Jd,Xd,Kd=(Jd="https://base-ui.com/production-error",Xd="Base UI",function(e,...t){const n=new URL(Jd);return n.searchParams.set("code",e.toString()),t.forEach(e=>n.searchParams.append("args[]",e)),`${Xd} error #${e}; visit ${n} for the full message.`}),Qd=/*#__PURE__*/e.createContext(void 0);function eu(e){return e?.ownerDocument||document}function tu(e,t,{detail:n=0}={}){e.dispatchEvent(new(wd(e).PointerEvent)("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function nu(t={}){const{disabled:n=!1,focusableWhenDisabled:r,tabIndex:o=0,native:i=!0,composite:s}=t,a=e.useRef(null),c=function(t=!1){const n=e.useContext(Qd);if(void 0===n&&!t)throw new Error(Kd(16));return n}(!0),l=s??void 0!==c,{props:d}=function(t){const{focusableWhenDisabled:n,disabled:r,composite:o=!1,tabIndex:i=0,isNativeButton:s}=t,a=o&&!1!==n,c=o&&!1===n;return{props:e.useMemo(()=>{const e={onKeyDown(e){r&&n&&"Tab"!==e.key&&e.preventDefault()}};return o||(e.tabIndex=i,!s&&r&&(e.tabIndex=n?i:-1)),(s&&(n||a)||!s&&r)&&(e["aria-disabled"]=r),!s||n&&!c||(e.disabled=r),e},[o,r,n,a,c,s,i])}}({focusableWhenDisabled:r,disabled:n,composite:l,tabIndex:o,isNativeButton:i}),u=e.useCallback(()=>{const e=a.current;ru(e)&&l&&n&&void 0===d.disabled&&e.disabled&&(e.disabled=!1)},[n,d.disabled,l]);return Dd(u,[u]),{getButtonProps:e.useCallback((e={})=>{const{onClick:t,onMouseDown:r,onKeyUp:o,onKeyDown:s,onPointerDown:a,...c}=e;return jd({onClick(e){n?e.preventDefault():t?.(e)},onMouseDown(e){n||r?.(e)},onKeyDown(e){if(n)return;if(Vd(e),s?.(e),e.baseUIHandlerPrevented)return;const t=e.target===e.currentTarget,r=e.currentTarget,o=ru(r),a=!i&&(Sd(c=r)&&"A"===c.tagName&&Boolean(c.href));var c;const d=t&&(i?o:!a),u="Enter"===e.key,p=" "===e.key,h=r.getAttribute("role"),f=h?.startsWith("menuitem")||"option"===h||"gridcell"===h;if(t&&l&&p){if(e.defaultPrevented&&f)return;return e.preventDefault(),void(i&&!o||(e.preventBaseUIHandler(),tu(r,e)))}d&&!i&&(p||u)?e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),tu(r,e))):t&&a&&p&&e.preventDefault()},onKeyUp(e){n||(Vd(e),o?.(e),e.target===e.currentTarget&&i&&l&&ru(e.currentTarget)&&" "===e.key?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||l||e.defaultPrevented||" "!==e.key||(e.preventBaseUIHandler(),tu(e.currentTarget,e)))},onPointerDown(e){n?e.preventDefault():a?.(e)}},i?{type:"button"}:{role:"button"},d,c)},[n,d,l,i]),buttonRef:Nd(e=>{a.current=e,u()})}}function ru(e){return Sd(e)&&"BUTTON"===e.tagName}function ou(e,t,n,r){const o=Md(iu).current;return function(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}(o,e,t,n,r)&&su(o,[e,t,n,r]),o.callback}function iu(){return{callback:null,cleanup:null,refs:[]}}function su(e,t){e.refs=t,t.every(e=>null==e)?e.callback=null:e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),null!=n){const r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){const o=t[e];if(null!=o)switch(typeof o){case"function":{const t=o(n);"function"==typeof t&&(r[e]=t);break}case"object":o.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){const n=t[e];if(null!=n)switch(typeof n){case"function":{const t=r[e];"function"==typeof t?t():n(null);break}case"object":n.current=null}}}}}}var au=parseInt(e.version,10);function cu(e){return au>=e}function lu(t){if(!/*#__PURE__*/e.isValidElement(t))return null;const n=t,r=n.props;return(cu(19)?r?.ref:n.ref)??null}function du(){}var uu=Object.freeze([]),pu=Object.freeze({});function hu(t,n,o={}){const i=n.render,s=function(e,t={}){const{className:n,style:r,render:o}=e,{state:i=pu,ref:s,props:a,stateAttributesMapping:c,enabled:l=!0}=t,d=l?function(e,t){return"function"==typeof e?e(t):e}(n,i):void 0,u=l?function(e,t){return"function"==typeof e?e(t):e}(r,i):void 0,p=l?function(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const e=t[r](o);null!=e&&Object.assign(n,e);continue}!0===o?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}(i,c):pu,h=l&&a?function(e){return Array.isArray(e)?function(e){if(0===e.length)return Ld;if(1===e.length)return Fd(e[0]);let t=Fd(e[0]);for(let n=1;n<e.length;n+=1)t=Ud(t,e[n]);return t}(e):jd(void 0,e)}(a):void 0,f=l?$d(p,h)??{}:pu;"undefined"!=typeof document&&(l?Array.isArray(s)?f.ref=function(e){const t=Md(iu).current;return function(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}(t,e)&&su(t,e),t.callback}([f.ref,lu(o),...s]):f.ref=ou(f.ref,lu(o),s):ou(null,null));if(!l)return pu;void 0!==d&&(f.className=Gd(f.className,d));void 0!==u&&(f.style=$d(f.style,u));return f}(n,o);return!1===o.enabled?null:function(t,n,o,i){if(n){if("function"==typeof n)return n(o,i);const t=jd(o,n.props);t.ref=o.ref;let r=n;return r?.$$typeof===fu&&(r=e.Children.toArray(n)[0]),/*#__PURE__*/e.cloneElement(r,t)}if(t&&"string"==typeof t)return function(t,n){return"button"===t?/*#__PURE__*/r("button",{type:"button",...n,key:n.key}):"img"===t?/*#__PURE__*/r("img",{alt:"",...n,key:n.key}):/*#__PURE__*/e.createElement(t,n)}(t,o);throw new Error(Kd(8))}(t,i,s,o.state??pu)}var fu=Symbol.for("react.lazy");var mu=/*#__PURE__*/e.forwardRef(function(e,t){const{render:n,className:r,disabled:o=!1,focusableWhenDisabled:i=!1,nativeButton:s=!0,style:a,...c}=e,{getButtonProps:l,buttonRef:d}=nu({disabled:o,focusableWhenDisabled:i,native:s});return hu("button",e,{state:{disabled:o},ref:[t,d],props:[c,l]})}),gu={primary:"bg-primary text-primary-foreground border-transparent hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground border-transparent hover:bg-secondary/80",ghost:"bg-transparent text-foreground border-border hover:bg-muted",bare:"bg-transparent text-inherit border-transparent hover:bg-transparent p-0 min-h-0",chip:"bg-secondary-bg text-foreground border-transparent hover:bg-primary hover:text-primary-foreground hover:border-primary",tab:"bg-transparent text-foreground-muted border-transparent hover:text-foreground hover:bg-transparent p-0 min-h-0"},yu={sm:"px-2 py-1 text-xs min-h-7",md:"px-4 py-2 text-sm min-h-9"},bu={default:"rounded-lg",theme:Uc.theme,pill:Uc.pill};function vu({active:e=!1,className:t,disabled:n,elevation:r,full:o,loading:i=!1,shape:s="default",size:a="md",stacked:c=!1,type:l="button",variant:d="primary",style:u,ref:p,...h}){const f=!["bare","tab"].includes(d),m=n||i;/* @__PURE__ */
4
- return g(mu,{...h,ref:p,className:md("inline-flex items-center justify-center gap-2 font-medium cursor-pointer transition-all focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",f&&"border",bu[s],gu[d],"bare"!==d&&"tab"!==d&&yu[a],c&&"flex-col gap-0.5","tab"===d&&"h-full min-w-0 flex-1",e&&"tab"===d&&"text-primary font-semibold",m&&"opacity-50 cursor-not-allowed pointer-events-none",i&&"opacity-70 cursor-wait pointer-events-none",o&&"w-full",t),"aria-busy":i?"true":void 0,"data-disabled":n?"true":"false","data-loading":i?"true":"false","data-size":a,"data-variant":d,disabled:m,style:{...Zc(r),...u},type:l})}var wu={none:"0","2xs":"1",xs:"0.5",sm:"1.5",md:"2",lg:"3",xl:"4","2xl":"6"},xu=/* @__PURE__ */new Set(["padding","paddingX","paddingY","paddingTop","paddingBottom","gap","align","justify","grow","shrink","position","inset","overflow","overflowY","width","height","minWidth","border","rounded","animate","hidden","as","style"]);function ku(e){const t=[];if(void 0!==e.padding&&t.push(`p-${wu[e.padding]}`),void 0!==e.paddingX&&t.push(`px-${wu[e.paddingX]}`),void 0!==e.paddingY&&t.push(`py-${wu[e.paddingY]}`),void 0!==e.paddingTop&&t.push(`pt-${wu[e.paddingTop]}`),void 0!==e.paddingBottom&&t.push(`pb-${wu[e.paddingBottom]}`),void 0!==e.gap&&t.push(`gap-${wu[e.gap]}`),void 0!==e.align&&t.push(`items-${e.align}`),void 0!==e.justify&&t.push(`justify-${e.justify}`),!0===e.grow&&t.push("flex-1"),!1===e.shrink&&t.push("flex-shrink-0"),void 0!==e.position&&t.push(e.position),void 0!==e.inset&&t.push("0"===e.inset?"inset-0":`inset-${wu[e.inset]}`),void 0!==e.overflow&&t.push(`overflow-${e.overflow}`),void 0!==e.overflowY&&t.push(`overflow-y-${e.overflowY}`),void 0!==e.width&&t.push(`w-${e.width}`),void 0!==e.height&&t.push(`h-${e.height}`),"0"===e.minWidth&&t.push("min-w-0"),void 0!==e.border&&!1!==e.border)if(!0===e.border)t.push("border","border-border");else{const n={top:"t",bottom:"b",left:"l",right:"r"}[e.border];t.push(`border-${n}`,"border-border")}return void 0!==e.rounded&&!1!==e.rounded&&(!0===e.rounded?t.push(Uc.theme):"full"===e.rounded?t.push(Uc.pill):t.push(Uc[e.rounded])),void 0!==e.animate&&"none"!==e.animate&&t.push({spin:"animate-spin",ping:"animate-ping",pulse:"animate-pulse",fadeIn:"animate-fade-in"}[e.animate]),!0===e.hidden&&t.push("hidden"),t.join(" ")}var Su={default:"",card:"bg-card text-card-foreground"},_u={none:"",card:"px-3 py-2",toast:"py-2 pl-2 pr-3"},Eu=o(function(e,t){const{as:n="div",background:r="default",className:o,elevation:i,paddingPreset:s="none",radius:a,style:c,...l}=e,d=ku(e),u=function(e){const t={};for(const n in e)xu.has(n)||(t[n]=e[n]);return t}(l);/* @__PURE__ */
2
+ return Yr(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(/* @__PURE__ */Yr(e=>e.toLowerCase()))},toUpperCase(){return this.check(/* @__PURE__ */Yr(e=>e.toUpperCase()))},slugify(){return this.check(/* @__PURE__ */Yr(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),Ro=/*@__PURE__*/$e("ZodString",(e,t)=>{En.init(e,t),Oo.init(e,t),e.email=t=>e.check(Lr(Po,t)),e.url=t=>e.check(Fr(Lo,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...st(t)})}(Qo,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...st(t)})}(jo,t)),e.guid=t=>e.check(jr(Do,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...st(t)})}($o,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...st(t)})}($o,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...st(t)})}($o,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...st(t)})}($o,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...st(t)})}(Fo,t)),e.guid=t=>e.check(jr(Do,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...st(t)})}(Uo,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...st(t)})}(Wo,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...st(t)})}(Bo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...st(t)})}(Jo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...st(t)})}(Xo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...st(t)})}(Ho,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...st(t)})}(Zo,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...st(t)})}(qo,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...st(t)})}(Vo,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...st(t)})}(Go,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...st(t)})}(Yo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...st(t)})}(Ko,t)),e.datetime=t=>e.check(so(t)),e.date=t=>e.check(co(t)),e.time=t=>e.check(uo(t)),e.duration=t=>e.check(ho(t))});function No(e){return function(e,t){return new e({type:"string",...st(t)})}(Ro,e)}var Ao=/*@__PURE__*/$e("ZodStringFormat",(e,t)=>{Cn.init(e,t),Oo.init(e,t)}),Po=/*@__PURE__*/$e("ZodEmail",(e,t)=>{zn.init(e,t),Ao.init(e,t)});var Do=/*@__PURE__*/$e("ZodGUID",(e,t)=>{In.init(e,t),Ao.init(e,t)}),$o=/*@__PURE__*/$e("ZodUUID",(e,t)=>{Tn.init(e,t),Ao.init(e,t)}),Lo=/*@__PURE__*/$e("ZodURL",(e,t)=>{Mn.init(e,t),Ao.init(e,t)});var jo=/*@__PURE__*/$e("ZodEmoji",(e,t)=>{On.init(e,t),Ao.init(e,t)}),Fo=/*@__PURE__*/$e("ZodNanoID",(e,t)=>{Rn.init(e,t),Ao.init(e,t)}),Uo=/*@__PURE__*/$e("ZodCUID",(e,t)=>{Nn.init(e,t),Ao.init(e,t)}),Wo=/*@__PURE__*/$e("ZodCUID2",(e,t)=>{An.init(e,t),Ao.init(e,t)}),Bo=/*@__PURE__*/$e("ZodULID",(e,t)=>{Pn.init(e,t),Ao.init(e,t)}),Ho=/*@__PURE__*/$e("ZodXID",(e,t)=>{Dn.init(e,t),Ao.init(e,t)}),Zo=/*@__PURE__*/$e("ZodKSUID",(e,t)=>{$n.init(e,t),Ao.init(e,t)}),qo=/*@__PURE__*/$e("ZodIPv4",(e,t)=>{Wn.init(e,t),Ao.init(e,t)}),Vo=/*@__PURE__*/$e("ZodIPv6",(e,t)=>{Bn.init(e,t),Ao.init(e,t)}),Go=/*@__PURE__*/$e("ZodCIDRv4",(e,t)=>{Hn.init(e,t),Ao.init(e,t)}),Yo=/*@__PURE__*/$e("ZodCIDRv6",(e,t)=>{Zn.init(e,t),Ao.init(e,t)}),Jo=/*@__PURE__*/$e("ZodBase64",(e,t)=>{Vn.init(e,t),Ao.init(e,t)}),Xo=/*@__PURE__*/$e("ZodBase64URL",(e,t)=>{Gn.init(e,t),Ao.init(e,t)}),Ko=/*@__PURE__*/$e("ZodE164",(e,t)=>{Yn.init(e,t),Ao.init(e,t)}),Qo=/*@__PURE__*/$e("ZodJWT",(e,t)=>{Jn.init(e,t),Ao.init(e,t)}),ei=/*@__PURE__*/$e("ZodNumber",(e,t)=>{Xn.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:o,maximum:i,format:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.type="number";const d="number"==typeof l&&l>=(o??Number.NEGATIVE_INFINITY),u="number"==typeof c&&c<=(i??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:"number"==typeof o&&(r.minimum=o),u?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:"number"==typeof i&&(r.maximum=i),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),zo(e,"ZodNumber",{gt(e,t){return this.check(Br(e,t))},gte(e,t){return this.check(Hr(e,t))},min(e,t){return this.check(Hr(e,t))},lt(e,t){return this.check(Ur(e,t))},lte(e,t){return this.check(Wr(e,t))},max(e,t){return this.check(Wr(e,t))},int(e){return this.check(ri(e))},safe(e){return this.check(ri(e))},positive(e){return this.check(Br(0,e))},nonnegative(e){return this.check(Hr(0,e))},negative(e){return this.check(Ur(0,e))},nonpositive(e){return this.check(Wr(0,e))},multipleOf(e,t){return this.check(Zr(e,t))},step(e,t){return this.check(Zr(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ti(e){return function(e,t){return new e({type:"number",checks:[],...st(t)})}(ei,e)}var ni=/*@__PURE__*/$e("ZodNumberFormat",(e,t)=>{Kn.init(e,t),ei.init(e,t)});function ri(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...st(t)})}(ni,e)}var oi=/*@__PURE__*/$e("ZodBoolean",(e,t)=>{Qn.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function ii(e){return function(e,t){return new e({type:"boolean",...st(t)})}(oi,e)}var si=/*@__PURE__*/$e("ZodUnknown",(e,t)=>{er.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function ai(){return new si({type:"unknown"})}var ci=/*@__PURE__*/$e("ZodNever",(e,t)=>{tr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function li(e){return function(e,t){return new e({type:"never",...st(t)})}(ci,e)}var di=/*@__PURE__*/$e("ZodDate",(e,t)=>{nr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")})(0,e),e.min=(t,n)=>e.check(Hr(t,n)),e.max=(t,n)=>e.check(Wr(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}),ui=/*@__PURE__*/$e("ZodArray",(e,t)=>{or.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(o.minItems=s),"number"==typeof a&&(o.maxItems=a),o.type="array",o.items=Kr(i.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,zo(e,"ZodArray",{min(e,t){return this.check(Vr(e,t))},nonempty(e){return this.check(Vr(1,e))},max(e,t){return this.check(qr(e,t))},length(e,t){return this.check(Gr(e,t))},unwrap(){return this.element}})});function pi(e,t){return function(e,t,n){return new e({type:"array",element:t,...st(n)})}(ui,e,t)}var hi=/*@__PURE__*/$e("ZodObject",(e,t)=>{lr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const l in s)o.properties[l]=Kr(s[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(s)),c=new Set([...a].filter(e=>{const n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));c.size>0&&(o.required=Array.from(c)),"never"===i.catchall?._zod.def.type?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Kr(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(o.additionalProperties=!1)})(e,t,n,r),Ge(e,"shape",()=>t.shape),zo(e,"ZodObject",{keyof(){return xi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ai()})},loose(){return this.clone({...this._zod.def,catchall:ai()})},strict(){return this.clone({...this._zod.def,catchall:li()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!tt(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return it(e,Je(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ye(this,"shape",n),n}}))}(this,e)},safeExtend(e){return function(e,t){if(!tt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return it(e,Je(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ye(this,"shape",n),n}}))}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return it(e,Je(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ye(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return it(e,Je(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ye(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return it(e,Je(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ye(this,"shape",r),r},checks:[]}))}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return it(t,Je(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)o[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Ye(this,"shape",o),o},checks:[]}))}(_i,this,e[0])},required(...e){return t=Oi,n=this,r=e[0],it(n,Je(n._zod.def,{get shape(){const e=n._zod.def.shape,o={...e};if(r)for(const n in r){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);r[n]&&(o[n]=new t({type:"nonoptional",innerType:e[n]}))}else for(const n in e)o[n]=new t({type:"nonoptional",innerType:e[n]});return Ye(this,"shape",o),o}}));var t,n,r}})});function fi(e,t){const n={type:"object",shape:e??{},...st(t)};return new hi(n)}var mi=/*@__PURE__*/$e("ZodUnion",(e,t)=>{ur.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=!1===o.inclusive,s=o.options.map((e,n)=>Kr(e,t,{...r,path:[...r.path,i?"oneOf":"anyOf",n]}));i?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});function gi(e,t){return new mi({type:"union",options:e,...st(t)})}var yi=/*@__PURE__*/$e("ZodIntersection",(e,t)=>{pr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=Kr(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=Kr(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length;n.allOf=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]]})(e,t,n,r)});var bi=/*@__PURE__*/$e("ZodRecord",(e,t)=>{mr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const s=i.keyType,a=s._zod.bag?.patterns;if("loose"===i.mode&&a&&a.size>0){const e=Kr(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const t of a)o.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(o.propertyNames=Kr(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Kr(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=s._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(o.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function vi(e,t,n){return t&&t._zod?new bi({type:"record",keyType:e,valueType:t,...st(n)}):new bi({type:"record",keyType:No(),valueType:e,...st(t)})}var wi=/*@__PURE__*/$e("ZodEnum",(e,t)=>{gr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=We(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new wi({...t,checks:[],...st(r),entries:o})},e.exclude=(e,r)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new wi({...t,checks:[],...st(r),entries:o})}});function xi(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new wi({type:"enum",entries:n,...st(t)})}var ki=/*@__PURE__*/$e("ZodLiteral",(e,t)=>{yr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,o=[];for(const i of r.values)if(void 0===i){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof i){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(i))}else o.push(i);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});var Si=/*@__PURE__*/$e("ZodTransform",(e,t)=>{br.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new je(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(ft(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(ft(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});var _i=/*@__PURE__*/$e("ZodOptional",(e,t)=>{wr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Ei(e){return new _i({type:"optional",innerType:e})}var Ci=/*@__PURE__*/$e("ZodExactOptional",(e,t)=>{xr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Ii=/*@__PURE__*/$e("ZodNullable",(e,t)=>{kr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=Kr(o.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ti(e){return new Ii({type:"nullable",innerType:e})}var zi=/*@__PURE__*/$e("ZodDefault",(e,t)=>{Sr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});var Mi=/*@__PURE__*/$e("ZodPrefault",(e,t)=>{Er.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Oi=/*@__PURE__*/$e("ZodNonOptional",(e,t)=>{Cr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Ri=/*@__PURE__*/$e("ZodCatch",(e,t)=>{Tr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;let i;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});var Ni=/*@__PURE__*/$e("ZodPipe",(e,t)=>{zr.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s="input"===t.io?i?o.out:o.in:o.out;Kr(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function Ai(e,t){return new Ni({type:"pipe",in:e,out:t})}var Pi=/*@__PURE__*/$e("ZodReadonly",(e,t)=>{Or.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r),t.seen.get(e).ref=o.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Di=/*@__PURE__*/$e("ZodCustom",(e,t)=>{Ar.init(e,t),Mo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function $i(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...st(t)})}(ei,e)}function Li(e){return function(e,t){return new e({type:"date",coerce:!0,...st(t)})}(di,e)}var ji,Fi=xi(["created","active","suspended"]),Ui=fi({id:ti().optional(),created_at:Li().optional(),updated_at:Li().optional()}),Wi=(fi({id:$i()}),fi({slug:No()}),fi({widget_id:$i()}),fi({simulation_id:$i()}),fi({application_id:$i()}),fi({user_id:$i()}),fi({limit:$i().optional().default(50),offset:$i().optional().default(0)}),gi([ii(),No()]).transform(e=>"boolean"==typeof e?e:"true"===e||"false"!==e&&void 0).optional(),fi({success:function(e,t){return new ki({type:"literal",values:Array.isArray(e)?e:[e],...st(t)})}(!0)})),Bi=(Wi.extend({message:No()}),fi({name:No().min(1),params:vi(No(),ai()).default({}),result:vi(No(),ai()).default({})}),Fr(Lo,ji).refine(e=>/^https:\/\/hooks\.slack\.com\//.test(e),{message:"Slack webhook URL must start with https://hooks.slack.com/"}),fi({start:No(),end:No(),action:No()}).passthrough()),Hi=fi({id:No(),label:No(),purpose:No(),elements:pi(vi(No(),ai())).default([]),bbox:vi(No(),ai()).default({}),screenshot:No().default(""),embedding:pi(ti()).nullish()}).passthrough(),Zi=fi({id:No(),title:No(),url:No(),summary:No().default(""),screenshot:No().default(""),sections:pi(Hi).default([]),sequence_ids:pi(ti()).default([]),embedding:pi(ti()).nullish()}).passthrough(),qi=(fi({nodes:pi(Zi),edges:pi(Bi)}),xi(["free","startup","growth","enterprise"])),Vi=xi(["app","website"]),Gi=xi(["widget"]),Yi=(xi(["tell","show","do"]),xi(["password","oauth"])),Ji=xi(["admin","member"]),Xi=(Ui.extend({is_super:ii(),status:Fi,email:function(e){return Lr(Po,e)}(),external_id:No().nullish(),first_name:No().nullish(),last_name:No().nullish(),password:No().nullish(),image_url:No().nullish(),last_login_at:Li().nullish(),auth_method:Yi.nullish(),workspace_role:Ji.nullish()}),Ui.extend({name:No(),slug:No(),status:Fi,package:qi,ending_date:Li().nullish(),external_workspace_id:No().nullish(),slack_webhook_configured:ii().optional(),notify_all_members_on_question:ii().optional()}),Ui.extend({workspace_id:ti(),name:No(),slug:No(),type:Vi,url:No(),username:No().nullish(),password:No().nullish(),allowed_domains:pi(No()).default([])}).omit({password:!0}),fi({chip_mode:xi(["show","tell","do"]),chip_text:No()})),Ki=fi({widget_enabled:ii(),widget_appearance:xi(["default","hidden"]),widget_position:xi(["bottom_left","bottom_right","top_left","top_right"]),widget_header:No(),widget_body:No(),widget_greeting:No(),widget_greeting_toast:ii(),widget_recording:ii(),widget_feature_tell:ii(),widget_feature_show:ii(),widget_feature_do:ii(),widget_background_color:No(),widget_text_color:No(),widget_border_color:No(),widget_accent_color:No(),widget_secondary_color:No(),widget_border_radius:No(),widget_font_size:No(),widget_width:No(),widget_height:No(),widget_animation_duration:No(),widget_fade_duration:No(),widget_chips:pi(Xi)}),Qi=(Ki.omit({widget_border_radius:!0,widget_font_size:!0,widget_animation_duration:!0,widget_fade_duration:!0}),Ui.extend({application_id:ti(),type:Gi,settings:Ki,status:Fi,marketrix_id:No(),marketrix_key:No(),snippet:No().nullish()}),xi(["user_login","url_visit","update_workspace","create_user","update_user","delete_user","create_application","update_application","delete_application","create_widget","update_widget","delete_widget","create_knowledge","update_knowledge","delete_knowledge","request_membership","invite_user","create_workspace","trial_started","trial_ending_soon","trial_ended","subscription_created","subscription_canceled","plan_changed","payment_succeeded","payment_failed","widget_question","qa_run_started","start_simulation","create_workflow","update_workflow","delete_workflow","toggle_workflow","slack_command","create_form","update_form","delete_form","duplicate_form","publish_form","unpublish_form","archive_form","submit_form_response","delete_form_response"])),es=fi({details:No().optional(),id:ti().optional(),type:No().optional(),name:No().optional(),target_user_id:ti().optional(),target_user_email:No().optional(),reason:No().optional(),ip_address:No().optional(),user_agent:No().optional(),widget_type:No().optional(),created_by:ti().optional()}).passthrough();Ui.extend({workspace_id:ti(),user_id:ti().nullable(),type:Qi,metadata:es.optional()}).partial().extend({type:Qi});function ts(e){return fe(new De({url:e}))}var ns="",rs=ts(""),os=new Proxy({},{get:(e,t)=>rs[t]}),is="marketrix_chat_context",ss={chat_id:null,messages:[],isTaskRunning:!1,currentMode:"tell",isOpen:!1,config:null,timestamp:0};function as(e){try{return"undefined"==typeof localStorage?null:localStorage.getItem(e)}catch(t){return null}}function cs(e,t){try{"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}catch(n){}}var ls,ds=new class{context=function(){const e=as(is);if(!e)return{...ss};try{const t={...ss,...JSON.parse(e)};if(Date.now()-t.timestamp<=6048e5)return t}catch(t){}return{...ss}}();getContext(){return this.context}updateContext(e){this.context={...this.context,...e,timestamp:Date.now()},cs(is,JSON.stringify(this.context))}getChatId(){const e="undefined"==typeof window?"":window.name;return e.trim()?(e!==this.context.chat_id&&this.updateContext({chat_id:e}),e):this.context.chat_id}setChatId(e){this.updateContext({chat_id:e}),"undefined"!=typeof window&&(window.name=e)}getConfig(){return this.context.config}setConfig(e){this.updateContext({config:e})}},us=new class{creation=null;async getOrCreateChatId(){const e=ds.getChatId();return e||(this.creation??=this.createChatId().finally(()=>{this.creation=null}),this.creation)}async createChatId(){const e=await os.chatCreate(void 0);if(!e)throw new Error("API returned empty chat ID");return ds.setChatId(e),e}},ps=Object.defineProperty,hs=(e,t,n)=>((e,t,n)=>t in e?ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),fs=/* @__PURE__ */(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e))(fs||{}),ms=/* @__PURE__ */(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(ms||{}),gs=/* @__PURE__ */(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(gs||{}),ys=/* @__PURE__ */(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ys||{}),bs=/* @__PURE__ */(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(bs||{}),vs=/* @__PURE__ */(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(vs||{}),ws=/* @__PURE__ */(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(ws||{}),xs={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ks={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ss={},_s={};function Es(e){if(Ss[e])return Ss[e];const t=globalThis[e],n=t.prototype,r=e in xs?xs[e]:void 0,o=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),i=e in ks?ks[e]:void 0,s=Boolean(i&&i.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(o&&s&&!globalThis.Zone)return Ss[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");r.style.display="none",document.body.appendChild(r);const o=r.contentWindow;if(!o)return t.prototype;const i=o[e].prototype;if(!i)return r.remove(),n;const s=navigator.userAgent;return s.includes("Safari")&&!s.includes("Chrome")?(r.classList.add("rr-block"),r.setAttribute("__rrwebUntaintedMutationObserver",""),_s[e]=()=>r.remove()):r.remove(),Ss[e]=i}catch{return n}}var Cs={};function Is(e,t,n){var r;const o=`${e}.${String(n)}`;if(Cs[o])return Cs[o].call(t);const i=Es(e),s=null==(r=Object.getOwnPropertyDescriptor(i,n))?void 0:r.get;return s?(Cs[o]=s,s.call(t)):t[n]}var Ts={};function zs(e,t,n){const r=`${e}.${String(n)}`;if(Ts[r])return Ts[r].bind(t);const o=Es(e)[n];return"function"!=typeof o?t[n]:(Ts[r]=o,o.bind(t))}function Ms(){return[Es("MutationObserver").constructor,_s.MutationObserver??(()=>{})]}var Os=Date.now;function Rs(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())||(Os=()=>/* @__PURE__ */(new Date).getTime());var Ns={ownerDocument:function(e){return Is("Node",e,"ownerDocument")},childNodes:function(e){return Is("Node",e,"childNodes")},parentNode:function(e){return Is("Node",e,"parentNode")},parentElement:function(e){return Is("Node",e,"parentElement")},textContent:function(e){return Is("Node",e,"textContent")},contains:function(e,t){return zs("Node",e,"contains")(t)},getRootNode:function(e){return zs("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Is("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Is("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Is("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Is("Element",e,"querySelectorAll")(t)},nowTimestamp:Os,mutationObserverCtor:Ms,patch:Rs};function As(e){return e.nodeType===e.ELEMENT_NODE}function Ps(e){const t=e&&"host"in e&&"mode"in e&&Ns.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Ns.shadowRoot(t)===e)}function Ds(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function $s(e){try{const n=e.rules||e.cssRules;if(!n)return null;let r=e.href;return!r&&e.ownerNode&&(r=e.ownerNode.baseURI),(t=Array.from(n,e=>Ls(e,r)).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(n){return null}var t}function Ls(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=$s(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(n){t=e.cssText}return e.styleSheet.href?Ys(t,e.styleSheet.href):t}{let n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t?Ys(n,t):n}}var js=class{constructor(){hs(this,"idNodeMap",/* @__PURE__ */new Map),hs(this,"nodeMetaMap",/* @__PURE__ */new WeakMap)}getId(e){var t;return e?(null==(t=this.getMeta(e))?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=/* @__PURE__ */new Map,this.nodeMetaMap=/* @__PURE__ */new WeakMap}};function Fs({element:e,maskInputOptions:t,tagName:n,type:r,value:o,maskInputFn:i}){let s=o||"";const a=r&&Us(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=i?i(s,e):"*".repeat(s.length)),s}function Us(e){return e.toLowerCase()}var Ws="__rrweb_original__";function Bs(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Us(t):null}function Hs(e,t){let n;try{n=new URL(e,t??window.location.href)}catch(o){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}var Zs=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,qs=/^(?:[a-z+]+:)?\/\//i,Vs=/^www\..*/i,Gs=/^(data:)([^,]*),(.*)/i;function Ys(e,t){return(e||"").replace(Zs,(e,n,r,o,i,s)=>{const a=r||i||s,c=n||o||"";if(!a)return e;if(qs.test(a)||Vs.test(a))return`url(${c}${a}${c})`;if(Gs.test(a))return`url(${c}${a}${c})`;if("/"===a[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${c})`;const l=a.split("#")[0],d=a.substring(l.length),u=t.split("#")[0].split("/"),p=l.split("/");u.pop();for(const t of p){if("."===t)continue;".."===t?u.pop():u.push(t)}return`url(${c}${u.join("/")}${d}${c})`})}function Js(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Xs(e,t){return function(e,t,n=!1){const r=Array.from(t.childNodes),o=[];let i=0;if(r.length>1&&e&&"string"==typeof e){let t=Js(e,n);const s=t.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&"string"==typeof r[a].textContent){const c=Js(r[a].textContent,n),l=100;let d=3;for(;d<c.length&&(c[d].match(/[a-zA-Z0-9]/)||-1!==c.indexOf(c.substring(0,d),1));d++);for(;d<c.length;d++){let u=c.substring(0,d),p=t.split(u),h=-1;if(2===p.length)h=p[0].length;else if(p.length>2&&""===p[0]&&""!==r[a-1].textContent)h=t.indexOf(u,1);else if(1===p.length){if(u=u.substring(0,u.length-1),p=t.split(u),p.length<=1)return o.push(e),o;d=101}else d===c.length-1&&(h=t.indexOf(u));if(p.length>=2&&d>l){const e=r[a-1].textContent;if(e&&"string"==typeof e){const n=Js(e).length;h=t.indexOf(u,n)}-1===h&&(h=p[0].length)}if(-1!==h){let a=Math.floor(h/s);for(;a>0&&a<e.length;){if(i+=1,i>50*r.length)return o.push(e),o;const c=Js(e.substring(0,a),n);if(c.length===h){o.push(e.substring(0,a)),e=e.substring(a),t=t.substring(h);break}c.length<h?a+=Math.max(1,Math.floor((h-c.length)/s)):a-=Math.max(1,Math.floor((c.length-h)*s))}break}}}}return o.push(e),o}(e,t).join("/* rr_split */")}var Ks,Qs,ea=1,ta=/* @__PURE__ */new RegExp("[^a-z0-9-_:]");function na(){return ea++}var ra=/^[^ \t\n\r\u000c]+/,oa=/^[, \t\n\r\u000c]+/;var ia=/* @__PURE__ */new WeakMap;function sa(e,t){return t&&""!==t.trim()?ca(e,t):t}function aa(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ca(e,t){let n=ia.get(e);if(n||(n=e.createElement("a"),ia.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function la(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]||"background"===n&&["table","td","th"].includes(t)?sa(e,r):"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}const o=[];for(;r(oa),!(n>=t.length);){let i=r(ra);if(","===i.slice(-1))i=sa(e,i.substring(0,i.length-1)),o.push(i);else{let r="";i=sa(e,i);let s=!1;for(;;){const e=t.charAt(n);if(""===e){o.push((i+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,o.push((i+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n?Ys(r,ca(e)):"object"===t&&"data"===n?sa(e,r):r:r}function da(e,t,n){return["video","audio"].includes(e)&&"autoplay"===t}function ua(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ua(Ns.parentNode(e),t,n);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!n&&ua(Ns.parentNode(e),t,n)}function pa(e,t,n,r){let o;if(As(e)){if(o=e,!Ns.childNodes(o).length)return!1}else{if(null===Ns.parentElement(e))return!1;o=Ns.parentElement(e)}try{if("string"==typeof t){if(r){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(ua(o,t,r))return!0;if(n)if(r){if(o.closest(n))return!0}else if(o.matches(n))return!0}catch(i){}return!1}function ha(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:s,inlineStylesheet:a,maskInputOptions:c={},maskTextFn:l,maskInputFn:d,dataURLOptions:u={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m=!1,cssCaptured:g=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:ws.Document,childNodes:[],compatMode:e.compatMode}:{type:ws.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:ws.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:i,maskInputOptions:s={},maskInputFn:a,dataURLOptions:c={},inlineImages:l,recordCanvas:d,keepIframeSrcFn:u,newlyAddedElement:p=!1,rootId:h}=t,f=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(r){}return!1}(e,r,o),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Us(e.tagName);return ta.test(t)?"div":t}(e);let g={};const y=e.attributes.length;for(let w=0;w<y;w++){const t=e.attributes[w];da(m,t.name,t.value)||(g[t.name]=la(n,m,Us(t.name),t.value))}if("link"===m&&i){const t=Array.from(n.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=$s(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if("style"===m&&e.sheet){let t=$s(e.sheet);t&&(e.childNodes.length>1&&(t=Xs(t,e)),g._cssText=t)}if(["input","textarea","select"].includes(m)){const t=e.value,n=e.checked;"radio"!==g.type&&"checkbox"!==g.type&&"submit"!==g.type&&"button"!==g.type&&t?g.value=Fs({element:e,type:Bs(e),tagName:m,value:t,maskInputOptions:s,maskInputFn:a}):n&&(g.checked=n)}"option"===m&&(e.selected&&!s.select?g.selected=!0:delete g.selected);"dialog"===m&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===m&&d)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const o=t.getImageData,i=Ws in o?o[Ws]:o;if(new Uint32Array(i.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(g.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){const t=e.toDataURL(c.type,c.quality),r=n.createElement("canvas");r.width=e.width,r.height=e.height,t!==r.toDataURL(c.type,c.quality)&&(g.rr_dataURL=t)}if("img"===m&&l){Ks||(Ks=n.createElement("canvas"),Qs=Ks.getContext("2d"));const t=e,r=(t.currentSrc||t.getAttribute("src"),t.crossOrigin),o=()=>{t.removeEventListener("load",o);try{Ks.width=t.naturalWidth,Ks.height=t.naturalHeight,Qs.drawImage(t,0,0),g.rr_dataURL=Ks.toDataURL(c.type,c.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o))}"anonymous"===t.crossOrigin&&(r?g.crossOrigin=r:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if(["audio","video"].includes(m)){const t=g;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop));if(f){const{width:t,height:n}=e.getBoundingClientRect();g={class:g.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==m||u(g.src)||(e.contentDocument||(g.rr_src=g.src),delete g.src);let b;try{customElements.get(m)&&(b=!0)}catch(v){}return{type:ws.Element,tagName:m,attributes:g,childNodes:[],isSVG:aa(e)||void 0,needBlock:f,rootId:h,isCustom:b}}(e,{doc:n,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:c,maskInputFn:d,dataURLOptions:u,inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:n,maskTextFn:r,rootId:o,cssCaptured:i}=t,s=Ns.parentNode(e),a=s&&s.tagName;let c="";const l="STYLE"===a||void 0,d="SCRIPT"===a||void 0;d?c="SCRIPT_PLACEHOLDER":i||(c=Ns.textContent(e),l&&c&&(c=Ys(c,ca(t.doc))));!l&&!d&&c&&n&&(c=r?r(c,Ns.parentElement(e)):c.replace(/[\S]/g,"*"));return{type:ws.Text,textContent:c||"",rootId:o}}(e,{doc:n,needsMask:s,maskTextFn:l,rootId:y,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:ws.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:ws.Comment,textContent:Ns.textContent(e)||"",rootId:y};default:return!1}}function fa(e){return null==e?"":e.toLowerCase()}function ma(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:e||{}}function ga(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:c=!1,inlineStylesheet:l=!0,maskInputOptions:d={},maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f={},inlineImages:m=!1,recordCanvas:g=!1,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:S=!1,cssCaptured:_=!1}=t;let{needsMask:E}=t,{preserveWhiteSpace:C=!0}=t;E||(E=pa(e,s,a,void 0===E));const I=ha(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:E,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,dataURLOptions:f,inlineImages:m,recordCanvas:g,keepIframeSrcFn:k,newlyAddedElement:S,cssCaptured:_});if(!I)return null;let T;T=r.hasNode(e)?r.getId(e):function(e,t){if(t.comment&&e.type===ws.Comment)return!0;if(e.type===ws.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===Hs(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(fa(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===fa(e.attributes.name)||"icon"===fa(e.attributes.rel)||"apple-touch-icon"===fa(e.attributes.rel)||"shortcut icon"===fa(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&fa(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(fa(e.attributes.property).match(/^(og|twitter|fb):/)||fa(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===fa(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===fa(e.attributes.name)||"googlebot"===fa(e.attributes.name)||"bingbot"===fa(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===fa(e.attributes.name)||"generator"===fa(e.attributes.name)||"framework"===fa(e.attributes.name)||"publisher"===fa(e.attributes.name)||"progid"===fa(e.attributes.name)||fa(e.attributes.property).match(/^article:/)||fa(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===fa(e.attributes.name)||"yandex-verification"===fa(e.attributes.name)||"csrf-token"===fa(e.attributes.name)||"p:domain_verify"===fa(e.attributes.name)||"verify-v1"===fa(e.attributes.name)||"verification"===fa(e.attributes.name)||"shopify-checkout-api-token"===fa(e.attributes.name)))return!0}}return!1}(I,h)||!C&&I.type===ws.Text&&!I.textContent.replace(/^\s+|\s+$/gm,"").length?-2:na();const z=Object.assign(I,{id:T});if(r.add(e,z),-2===T)return null;y&&y(e);let M=!c;if(z.type===ws.Element){M=M&&!z.needBlock,delete z.needBlock;const t=Ns.shadowRoot(e);t&&Ds(t)&&(z.isShadowHost=!0)}if((z.type===ws.Document||z.type===ws.Element)&&M){h.headWhitespace&&z.type===ws.Element&&"head"===z.tagName&&(C=!1);const t={doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:E,maskTextClass:s,maskTextSelector:a,skipChild:c,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:C,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:w,stylesheetLoadTimeout:x,keepIframeSrcFn:k,cssCaptured:!1};if(z.type===ws.Element&&"textarea"===z.tagName&&void 0!==z.attributes.value);else{z.type===ws.Element&&void 0!==z.attributes._cssText&&"string"==typeof z.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(Ns.childNodes(e))){const e=ga(n,t);e&&z.childNodes.push(e)}}let S=null;if(As(e)&&(S=Ns.shadowRoot(e)))for(const e of Array.from(Ns.childNodes(S))){const n=ga(e,t);n&&(Ds(S)&&(n.isShadow=!0),z.childNodes.push(n))}}const O=Ns.parentNode(e);return O&&Ps(O)&&Ds(O)&&(z.isShadow=!0),z.type===ws.Element&&"iframe"===z.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,i=!1;try{o=r.document.readyState}catch(a){return}if("complete"!==o){const r=setTimeout(()=>{i||(t(),i=!0)},n);return void e.addEventListener("load",()=>{clearTimeout(r),i=!0,t()})}const s="about:blank";if(r.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{const t=e.contentDocument;if(t&&b){const n=ga(t,{doc:t,mirror:r,blockClass:o,blockSelector:i,needsMask:E,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:C,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:w,stylesheetLoadTimeout:x,keepIframeSrcFn:k});n&&b(e,n)}},v),z.type===ws.Element&&"link"===z.tagName&&"string"==typeof z.attributes.rel&&("stylesheet"===z.attributes.rel||"preload"===z.attributes.rel&&"string"==typeof z.attributes.href&&"css"===Hs(z.attributes.href))&&function(e,t,n){let r,o=!1;try{r=e.sheet}catch(s){return}if(r)return;const i=setTimeout(()=>{o||(t(),o=!0)},n);e.addEventListener("load",()=>{clearTimeout(i),o=!0,t()})}(e,()=>{if(w){const t=ga(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:E,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:C,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:w,stylesheetLoadTimeout:x,keepIframeSrcFn:k});t&&w(e,t)}},x),z}var ya=class e{constructor(...e){hs(this,"parentElement",null),hs(this,"parentNode",null),hs(this,"ownerDocument"),hs(this,"firstChild",null),hs(this,"lastChild",null),hs(this,"previousSibling",null),hs(this,"nextSibling",null),hs(this,"ELEMENT_NODE",1),hs(this,"TEXT_NODE",3),hs(this,"nodeType"),hs(this,"nodeName"),hs(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function ba(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var va={map:{},getId:()=>-1,getNode:()=>null,removeNodeFromMap(){},has:()=>!1,reset(){}};function wa(e,t,n={}){let r=null,o=0;return function(...i){const s=Date.now();o||!1!==n.leading||(o=s);const a=t-(s-o),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=s,e.apply(c,i)):r||!1===n.trailing||(r=setTimeout(()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,i)},a))}}function xa(e,t,n,r,o=window){const i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>xa(e,t,i||{},!0)}function ka(e){var t,n,r,o;const i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:i.documentElement.scrollLeft||(null==i?void 0:i.body)&&(null==(t=Ns.parentElement(i.body))?void 0:t.scrollLeft)||(null==(n=null==i?void 0:i.body)?void 0:n.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==i?void 0:i.documentElement.scrollTop)||(null==i?void 0:i.body)&&(null==(r=Ns.parentElement(i.body))?void 0:r.scrollTop)||(null==(o=null==i?void 0:i.body)?void 0:o.scrollTop)||0}}function Sa(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function _a(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ea(e){return e?e.nodeType===e.ELEMENT_NODE?e:Ns.parentElement(e):null}function Ca(e,t,n,r){if(!e)return!1;const o=Ea(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(ua(o,t,r))return!0}catch(i){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function Ia(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function Ta(e,t){if(Ps(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=Ns.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||Ta(r,t))}function za(e){return Boolean(e.changedTouches)}function Ma(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Oa(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Ra(e){return!!e&&(e instanceof ya&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Ns.shadowRoot(e)))}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(va=new Proxy(va,{get:(e,t,n)=>Reflect.get(e,t,n)}));var Na=class{constructor(){hs(this,"id",1),hs(this,"styleIDMap",/* @__PURE__ */new WeakMap),hs(this,"idStyleMap",/* @__PURE__ */new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=/* @__PURE__ */new WeakMap,this.idStyleMap=/* @__PURE__ */new Map,this.id=1}generateId(){return this.id++}};function Aa(e){var t;let n=null;return"getRootNode"in e&&(null==(t=Ns.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ns.host(Ns.getRootNode(e))&&(n=Ns.host(Ns.getRootNode(e))),n}function Pa(e){const t=Ns.ownerDocument(e);if(!t)return!1;const n=function(e){let t,n=e;for(;t=Aa(n);)n=t;return n}(e);return Ns.contains(t,n)}function Da(e){const t=Ns.ownerDocument(e);return!!t&&(Ns.contains(t,e)||Pa(e))}function $a(e){return"__ln"in e}var La,ja=class{constructor(){hs(this,"length",0),hs(this,"head",null),hs(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$a(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&$a(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Fa=(e,t)=>`${e}@${t}`,Ua=class{constructor(){hs(this,"frozen",!1),hs(this,"locked",!1),hs(this,"texts",[]),hs(this,"attributes",[]),hs(this,"attributeMap",/* @__PURE__ */new WeakMap),hs(this,"removes",[]),hs(this,"mapRemoves",[]),hs(this,"movedMap",{}),hs(this,"addedSet",/* @__PURE__ */new Set),hs(this,"movedSet",/* @__PURE__ */new Set),hs(this,"droppedSet",/* @__PURE__ */new Set),hs(this,"removesSubTreeCache",/* @__PURE__ */new Set),hs(this,"mutationCb"),hs(this,"blockClass"),hs(this,"blockSelector"),hs(this,"maskTextClass"),hs(this,"maskTextSelector"),hs(this,"inlineStylesheet"),hs(this,"maskInputOptions"),hs(this,"maskTextFn"),hs(this,"maskInputFn"),hs(this,"keepIframeSrcFn"),hs(this,"recordCanvas"),hs(this,"inlineImages"),hs(this,"slimDOMOptions"),hs(this,"dataURLOptions"),hs(this,"doc"),hs(this,"mirror"),hs(this,"iframeManager"),hs(this,"stylesheetManager"),hs(this,"shadowDomManager"),hs(this,"canvasManager"),hs(this,"processedNodeManager"),hs(this,"unattachedDoc"),hs(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),hs(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=/* @__PURE__ */new Set,n=new ja,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{const i=Ns.parentNode(o);if(!i||!Da(o))return;let s=!1;if(o.nodeType===Node.TEXT_NODE){const e=i.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(i)&&(s=!0)}const a=Ps(i)?this.mirror.getId(Aa(o)):this.mirror.getId(i),c=r(o);if(-1===a||-1===c)return n.addNode(o);const l=ga(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Ma(e,this.mirror)&&this.iframeManager.addIframe(e),Oa(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Ra(o)&&this.shadowDomManager.addShadowRoot(Ns.shadowRoot(o),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:s});l&&(e.push({parentId:a,nextId:c,node:l}),t.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)Ba(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(Ns.parentNode(a))||o(a);for(const a of this.addedSet)Ha(this.droppedSet,a)||Ba(this.removesSubTreeCache,a,this.mirror)?Ha(this.movedSet,a)?o(a):this.droppedSet.add(a):o(a);let i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(Ns.parentNode(i.value)),n=r(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(Ns.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=Ns.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Ns.host(r);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),o(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,n=Ns.parentNode(t);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=/* @__PURE__ */new WeakMap,this.removes=[],this.addedSet=/* @__PURE__ */new Set,this.movedSet=/* @__PURE__ */new Set,this.droppedSet=/* @__PURE__ */new Set,this.removesSubTreeCache=/* @__PURE__ */new Set,this.movedMap={},this.mutationCb(s))}),hs(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const n=Array.from(Ns.childNodes(e),e=>Ns.textContent(e)||"").join("");t.attributes.value=Fs({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Bs(e),value:n,maskInputFn:this.maskInputFn})}),hs(this,"processMutation",e=>{if(!Ia(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Ns.textContent(e.target);Ca(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:pa(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Ea(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,o=e.target.getAttribute(r);if("value"===r){const e=Bs(n);o=Fs({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(Ca(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(o)){if(n.contentDocument)return;r="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!da(n.tagName,r))if(i.attributes[r]=la(this.doc,Us(n.tagName),Us(r),o),"style"===r){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),o=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?t:[t,o]:i._unchangedStyles[e]=[t,o]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===r&&"DIALOG"===n.tagName&&(n.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":if(Ca(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=Ps(e.target)?this.mirror.getId(Ns.host(e.target)):this.mirror.getId(e.target);Ca(e.target,this.blockClass,this.blockSelector,!1)||Ia(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Wa(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ta(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Fa(n,r)]?Wa(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!Ps(e.target)||!Ds(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),Ns.childNodes(e).forEach(e=>n.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),hs(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Ia(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Fa(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Ca(e,this.blockClass,this.blockSelector,!1)||(Ns.childNodes(e).forEach(e=>this.genAdds(e)),Ra(e)&&Ns.childNodes(Ns.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Wa(e,t){e.delete(t),Ns.childNodes(t).forEach(t=>Wa(e,t))}function Ba(e,t,n){return 0!==e.size&&function(e,t){const n=Ns.parentNode(t);return!!n&&e.has(n)}(e,t)}function Ha(e,t){return 0!==e.size&&Za(e,t)}function Za(e,t){const n=Ns.parentNode(t);return!!n&&(!!e.has(n)||Za(e,n))}var qa=e=>{if(!La)return e;return(...t)=>{try{return e(...t)}catch(n){if(La&&!0===La(n))return;throw n}}},Va=[];function Ga(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Ya(e,t){const n=new Ua;Va.push(n),n.init(e);const[r,o]=Ms(),i=new r(qa(n.processMutations.bind(n)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[i,o]}function Ja({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const s=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];let c=null;return Object.keys(gs).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(i=>{let s=Us(i);const l=(t=>i=>{const s=Ga(i);if(Ca(s,r,o,!0))return;let a=null,l=t;if("pointerType"in i){switch(i.pointerType){case"mouse":a=ys.Mouse;break;case"touch":a=ys.Touch;break;case"pen":a=ys.Pen}a===ys.Touch?gs[t]===gs.MouseDown?l="TouchStart":gs[t]===gs.MouseUp&&(l="TouchEnd"):ys.Pen}else za(i)&&(a=ys.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===ys.Touch||l.startsWith("Mouse")&&a===ys.Mouse)&&(a=null)):gs[t]===gs.Click&&(a=c,c=null);const d=za(i)?i.changedTouches[0]:i;if(!d)return;const u=n.getId(s),{clientX:p,clientY:h}=d;qa(e)({type:gs[l],id:u,x:p,y:h,...null!==a&&{pointerType:a}})})(i);if(window.PointerEvent)switch(gs[i]){case gs.MouseDown:case gs.MouseUp:s=s.replace("mouse","pointer");break;case gs.TouchStart:case gs.TouchEnd:return}a.push(ba(s,l,t))}),qa(()=>{a.forEach(e=>e())})}function Xa({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){return ba("scroll",qa(wa(qa(i=>{const s=Ga(i);if(!s||Ca(s,r,o,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=ka(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),i.scroll||100)),t)}var Ka=["INPUT","TEXTAREA","SELECT"],Qa=/* @__PURE__ */new WeakMap;function ec(e){return function e(t,n){if(oc("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||oc("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||oc("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||oc("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const r=Array.from(t.parentRule.cssRules).indexOf(t);return n.unshift(r),e(t.parentRule,n)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);n.unshift(e)}return n}(e,[])}function tc(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function nc({mirror:e,stylesheetManager:t},n){var r,o,i;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(Ns.host(n));const a="#document"===n.nodeName?null==(r=n.defaultView)?void 0:r.Document:null==(i=null==(o=n.ownerDocument)?void 0:o.defaultView)?void 0:i.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null==(e=c.get)?void 0:e.call(this)},set(e){var n;const r=null==(n=c.set)?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(o){}return r}}),qa(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})):()=>{}}function rc(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:h,customElementCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),i(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),p(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),h(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),f(...e)}}(e,t);let o=()=>{};e.recordDOM&&([r,o]=Ya(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=wa(qa(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),i),l=qa(wa(qa(e=>{const t=Ga(e),{clientX:n,clientY:o}=za(e)?e.changedTouches[0]:e;s||(s=Os()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Os()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?ms.Drag:e instanceof MouseEvent?ms.MouseMove:ms.TouchMove)}),o,{trailing:!1})),d=[ba("mousemove",l,n),ba("touchmove",l,n),ba("drag",l,n)];return qa(()=>{d.forEach(e=>e())})}(e),s=Ja(e),a=Xa(e),c=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return ba("resize",qa(wa(qa(()=>{const t=Sa(),o=_a();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)}),200)),t)}(e,{win:n}),l=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:i,ignoreSelector:s,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:d}){function u(e){let n=Ga(e);const l=e.isTrusted,u=n&&n.tagName;if(n&&"OPTION"===u&&(n=Ns.parentElement(n)),!n||!u||Ka.indexOf(u)<0||Ca(n,r,o,!0))return;if(n.classList.contains(i)||s&&n.matches(s))return;let h=n.value,f=!1;const m=Bs(n)||"";"radio"===m||"checkbox"===m?f=n.checked:(a[u.toLowerCase()]||a[m])&&(h=Fs({element:n,maskInputOptions:a,tagName:u,type:m,value:h,maskInputFn:c})),p(n,d?{text:h,isChecked:f,userTriggered:l}:{text:h,isChecked:f});const g=n.name;"radio"===m&&g&&f&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==n){const t=e.value;p(e,d?{text:t,isChecked:!f,userTriggered:!1}:{text:t,isChecked:!f})}})}function p(t,r){const o=Qa.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){Qa.set(t,r);const o=n.getId(t);qa(e)({...r,id:o})}}const h=("last"===l.input?["change"]:["input","change"]).map(e=>ba(e,qa(u),t)),f=t.defaultView;if(!f)return()=>{h.forEach(e=>e())};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),g=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...g.map(e=>xa(e[0],e[1],{set(){qa(u)({target:this,isTrusted:!1})}},!1,f))),qa(()=>{h.forEach(e=>e())})}(e),d=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:i}){const s=qa(i=>wa(qa(o=>{const s=Ga(o);if(!s||Ca(s,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:d,loop:u}=s;e({type:i,id:r.getId(s),currentTime:a,volume:c,muted:l,playbackRate:d,loop:u})}),o.media||500)),a=[ba("play",s(vs.Play),i),ba("pause",s(vs.Pause),i),ba("seeked",s(vs.Seeked),i),ba("volumechange",s(vs.VolumeChange),i),ba("ratechange",s(vs.RateChange),i)];return qa(()=>{a.forEach(e=>e())})}(e);let u=()=>{},p=()=>{},h=()=>{},f=()=>{};e.recordDOM&&(u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:qa((r,o,i)=>{const[s,a]=i,{id:c,styleId:l}=tc(o,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:a}]}),r.apply(o,i)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){const o=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[o,n])};const i=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:s}]}),r.apply(o,i)})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:s}),r.apply(o,i)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:s}),r.apply(o,i)})}));const c={};ic("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(ic("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),ic("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),ic("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach(([r,o])=>{l[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(l[r].insertRule,{apply:qa((r,o,i)=>{const[s,a]=i,{id:c,styleId:l}=tc(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:[...ec(o),a||0]}]}),r.apply(o,i)})}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:qa((r,o,i)=>{const[s]=i,{id:a,styleId:c}=tc(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ec(o),s]}]}),r.apply(o,i)})})}),qa(()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=i,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})})}(e,{win:n}),p=nc(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:qa((o,s,a)=>{var c;const[l,d,u]=a;if(n.has(l))return i.apply(s,[l,d,u]);const{id:p,styleId:h}=tc(null==(c=s.parentRule)?void 0:c.parentStyleSheet,t,r.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,set:{property:l,value:d,priority:u},index:ec(s.parentRule)}),o.apply(s,a)})});const s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:qa((o,i,a)=>{var c;const[l]=a;if(n.has(l))return s.apply(i,[l]);const{id:d,styleId:u}=tc(null==(c=i.parentRule)?void 0:c.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:l},index:ec(i.parentRule)}),o.apply(i,a)})}),qa(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(f=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=/* @__PURE__ */new WeakMap,i=n.FontFace;n.FontFace=function(e,t,n){const r=new i(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const s=Rs(t.fonts,"add",function(t){return function(n){return setTimeout(qa(()=>{const t=o.get(n);t&&(e(t),o.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=i}),r.push(s),qa(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:i}=e;let s=!0;const a=qa(()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const{startContainer:i,startOffset:s,endContainer:c,endOffset:l}=e.getRangeAt(t);Ca(i,r,o,!0)||Ca(c,r,o,!0)||a.push({start:n.getId(i),startOffset:s,end:n.getId(c),endOffset:l})}i({ranges:a})});return a(),ba("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?Rs(n.customElements,"define",function(e){return function(n,r,o){try{t({define:{name:n}})}catch(i){}return e.apply(this,[n,r,o])}}):()=>{}}(e),y=[];for(const b of e.plugins)y.push(b.observer(b.callback,n,b.options));return qa(()=>{Va.forEach(e=>e.reset()),r?.disconnect(),o(),i(),s(),a(),c(),l(),d(),u(),p(),h(),f(),m(),g(),y.forEach(e=>e())})}function oc(e){return void 0!==window[e]}function ic(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var sc=class{constructor(e){hs(this,"iframeIdToRemoteIdMap",/* @__PURE__ */new WeakMap),hs(this,"iframeRemoteIdToIdMap",/* @__PURE__ */new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let s=o.get(t);return s||(s=this.generateIdFn(),o.set(t,s),i.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=/* @__PURE__ */new WeakMap,void(this.iframeRemoteIdToIdMap=/* @__PURE__ */new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=/* @__PURE__ */new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=/* @__PURE__ */new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},ac=class{constructor(e){hs(this,"iframes",/* @__PURE__ */new WeakMap),hs(this,"crossOriginIframeMap",/* @__PURE__ */new WeakMap),hs(this,"crossOriginIframeMirror",new sc(na)),hs(this,"crossOriginIframeStyleMirror"),hs(this,"crossOriginIframeRootIdMap",/* @__PURE__ */new WeakMap),hs(this,"mirror"),hs(this,"mutationCb"),hs(this,"wrappedEmit"),hs(this,"loadListener"),hs(this,"stylesheetManager"),hs(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new sc(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case fs.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:fs.IncrementalSnapshot,data:{source:ms.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case fs.Meta:case fs.Load:case fs.DomContentLoaded:return!1;case fs.Plugin:return t;case fs.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case fs.IncrementalSnapshot:switch(t.data.source){case ms.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ms.Drag:case ms.TouchMove:case ms.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ms.ViewportResize:return!1;case ms.MediaInteraction:case ms.MouseInteraction:case ms.Scroll:case ms.CanvasMutation:case ms.Input:return this.replaceIds(t.data,e,["id"]),t;case ms.StyleSheetRule:case ms.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ms.Font:return t;case ms.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case ms.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===ws.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},cc=class{constructor(e){hs(this,"shadowDoms",/* @__PURE__ */new WeakSet),hs(this,"mutationCb"),hs(this,"scrollCb"),hs(this,"bypassOptions"),hs(this,"mirror"),hs(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Ds(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const[n]=Ya({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Xa({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(Ns.host(e))),this.restoreHandlers.push(nc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Rs(e.prototype,"attachShadow",function(e){return function(r){const o=e.call(this,r),i=Ns.shadowRoot(this);return i&&Da(this)&&n.addShadowRoot(i,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=/* @__PURE__ */new WeakSet}},lc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dc="undefined"==typeof Uint8Array?[]:/* @__PURE__ */new Uint8Array(256),uc=0;uc<64;uc++)dc[lc.charCodeAt(uc)]=uc;var pc=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=lc[n[t]>>2],o+=lc[(3&n[t])<<4|n[t+1]>>4],o+=lc[(15&n[t+1])<<2|n[t+2]>>6],o+=lc[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o},hc=/* @__PURE__ */new Map;var fc=(e,t,n)=>{if(!e||!yc(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=hc.get(e);return n||(n=/* @__PURE__ */new Map,hc.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function mc(e,t,n){if(e instanceof Array)return e.map(e=>mc(e,t,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:pc(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[mc(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[mc(e.data,t,n),e.width,e.height]}:yc(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:fc(e,t,n)}:e}var gc=(e,t,n)=>e.map(e=>mc(e,t,n)),yc=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function bc(e,t,n,r){const o=[];try{const i=Rs(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(o,...i){if(!Ca(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(i[0]&&"object"==typeof i[0]){const e=i[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[o,...i])}});o.push(i)}catch{}return()=>{o.forEach(e=>e())}}function vc(e,t,n,r,o,i){const s=[],a=Object.getOwnPropertyNames(e);for(const c of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const a=Rs(e,c,function(e){return function(...s){const a=e.apply(this,s);if(fc(a,i,this),"tagName"in this.canvas&&!Ca(this.canvas,r,o,!0)){const e=gc(s,i,this),r={type:t,property:c,args:e};n(this.canvas,r)}return a}});s.push(a)}catch{const r=xa(e,c,{set(e){n(this.canvas,{type:t,property:c,args:[e],setter:!0})}});s.push(r)}return s}var wc='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n',xc="undefined"!=typeof self&&self.Blob&&new Blob([wc],{type:"text/javascript;charset=utf-8"});function kc(e){let t;try{if(t=xc&&(self.URL||self.webkitURL).createObjectURL(xc),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(wc),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Sc,_c,Ec,Cc=class{constructor(e){hs(this,"pendingCanvasMutations",/* @__PURE__ */new Map),hs(this,"rafStamps",{latestId:0,invokeId:null}),hs(this,"mirror"),hs(this,"mutationCb"),hs(this,"resetObservers"),hs(this,"frozen",!1),hs(this,"locked",!1),hs(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:n,blockClass:r,blockSelector:o,recordCanvas:i,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(n,r,o),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,o,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,r,o){const i=bc(t,n,r,!0),s=/* @__PURE__ */new Map,a=new kc;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:i}=e.data;this.mutationCb({id:t,type:bs["2D"],commands:[{property:"clearRect",args:[0,0,o,i]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,d=0;const u=e=>{d&&e-d<c||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{Ca(t,n,r,!0)||e.push(t)}),e})().forEach(async e=>{var t;const n=this.mirror.getId(e);if(s.get(n))return;if(0===e.width||0===e.height)return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=await createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[r])})),l=requestAnimationFrame(u)};l=requestAnimationFrame(u),this.resetObservers=()=>{i(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=bc(e,t,n,!1),o=function(e,t,n,r){const o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of i)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const i=Rs(t.CanvasRenderingContext2D.prototype,s,function(o){return function(...i){return Ca(this.canvas,n,r,!0)||setTimeout(()=>{const n=gc(i,t,this);e(this.canvas,{type:bs["2D"],property:s,args:n})},0),o.apply(this,i)}});o.push(i)}catch{const n=xa(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:bs["2D"],property:s,args:[t],setter:!0})}});o.push(n)}return()=>{o.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),i=function(e,t,n,r){const o=[];return void 0!==t.WebGLRenderingContext&&o.push(...vc(t.WebGLRenderingContext.prototype,bs.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&o.push(...vc(t.WebGL2RenderingContext.prototype,bs.WebGL2,e,n,r,t)),()=>{o.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),o(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map(e=>{const{type:t,...n}=e;return n}),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}},Ic=class{constructor(e){hs(this,"trackedLinkElements",/* @__PURE__ */new WeakSet),hs(this,"mutationCb"),hs(this,"adoptedStyleSheetCb"),hs(this,"styleMirror",new Na),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const o of e){let e;this.styleMirror.has(o)?e=this.styleMirror.getId(o):(e=this.styleMirror.add(o),r.push({styleId:e,rules:Array.from(o.rules||CSSRule,(e,t)=>({rule:Ls(e,o.href),index:t}))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=/* @__PURE__ */new WeakSet}trackStylesheetInLinkElement(e){}},Tc=class{constructor(){hs(this,"nodeMap",/* @__PURE__ */new WeakMap),hs(this,"active",!1)}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=/* @__PURE__ */new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||/* @__PURE__ */new Set).add(t))}destroy(){}},zc=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(ls=e.contentWindow)?void 0:ls.Array.from)||Array.from,document.body.removeChild(e)}}catch(Zg){}var Mc=new js;function Oc(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:c="rr-mask",maskTextSelector:l=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:p,slimDOMOptions:h,maskInputFn:f,maskTextFn:m,hooks:g,packFn:y,sampling:b={},dataURLOptions:v={},mousemoveWait:w,recordDOM:x=!0,recordCanvas:k=!1,recordCrossOriginIframes:S=!1,recordAfter:_=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:E=!1,collectFonts:C=!1,inlineImages:I=!1,plugins:T,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:M=/* @__PURE__ */new Set([]),errorHandler:O}=e;La=O;const R=!S||window.parent===window;let N=!1;if(!R)try{window.parent.document&&(N=!1)}catch(q){N=!0}if(R&&!t)throw new Error("emit function is required");if(!R&&!N)return()=>{};void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),Mc.reset();const A=!0===u?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==p?p:{password:!0},P=ma(h);let D;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}();let $=0;const L=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!N&&(e=y(e)),e};Sc=(e,o)=>{var i;const s=e;if(s.timestamp=Os(),!(null==(i=Va[0])?void 0:i.isFrozen())||s.type===fs.FullSnapshot||s.type===fs.IncrementalSnapshot&&s.data.source===ms.Mutation||Va.forEach(e=>e.unfreeze()),R)t?.(L(s),o);else if(N){const e={type:"rrweb",event:L(s),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,"*")}if(s.type===fs.FullSnapshot)D=s,$=0;else if(s.type===fs.IncrementalSnapshot){if(s.data.source===ms.Mutation&&s.data.isAttachIframe)return;$++;const e=r&&$>=r,t=n&&s.timestamp-D.timestamp>n;(e||t)&&_c(!0)}};const j=e=>{Sc({type:fs.IncrementalSnapshot,data:{source:ms.Mutation,...e}})},F=e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.Scroll,...e}}),U=e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.CanvasMutation,...e}}),W=new Ic({mutationCb:j,adoptedStyleSheetCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.AdoptedStyleSheet,...e}})}),B=new ac({mirror:Mc,mutationCb:j,stylesheetManager:W,recordCrossOriginIframes:S,wrappedEmit:Sc});for(const G of T||[])G.getMirror&&G.getMirror({nodeMirror:Mc,crossOriginIframeMirror:B.crossOriginIframeMirror,crossOriginIframeStyleMirror:B.crossOriginIframeStyleMirror});const H=new Tc;Ec=new Cc({recordCanvas:k,mutationCb:U,win:window,blockClass:o,blockSelector:i,mirror:Mc,sampling:b.canvas,dataURLOptions:v});const Z=new cc({mutationCb:j,scrollCb:F,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:l,inlineStylesheet:d,maskInputOptions:A,dataURLOptions:v,maskTextFn:m,maskInputFn:f,recordCanvas:k,inlineImages:I,sampling:b,slimDOMOptions:P,iframeManager:B,stylesheetManager:W,canvasManager:Ec,keepIframeSrcFn:z,processedNodeManager:H},mirror:Mc});_c=(e=!1)=>{if(!x)return;Sc({type:fs.Meta,data:{href:window.location.href,width:_a(),height:Sa()}},e),W.reset(),Z.init(),Va.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new js,blockClass:r="rr-block",blockSelector:o=null,maskTextClass:i="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:c=!1,recordCanvas:l=!1,maskAllInputs:d=!1,maskTextFn:u,maskInputFn:p,slimDOM:h=!1,dataURLOptions:f,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:w,keepIframeSrcFn:x=()=>!1}=t;return ga(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:ma(h),dataURLOptions:f,inlineImages:c,recordCanvas:l,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:w,keepIframeSrcFn:x,newlyAddedElement:!1})}(document,{mirror:Mc,blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:l,inlineStylesheet:d,maskAllInputs:A,maskTextFn:m,maskInputFn:f,slimDOM:P,dataURLOptions:v,recordCanvas:k,inlineImages:I,onSerialize:e=>{Ma(e,Mc)&&B.addIframe(e),Oa(e,Mc)&&W.trackLinkElement(e),Ra(e)&&Z.addShadowRoot(Ns.shadowRoot(e),document)},onIframeLoad:(e,t)=>{B.attachIframe(e,t),Z.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:z});t&&(Sc({type:fs.FullSnapshot,data:{node:t,initialOffset:ka(window)}},e),Va.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,Mc.getId(document)))};try{const e=[],t=e=>{var t;return qa(rc)({mutationCb:j,mousemoveCb:(e,t)=>Sc({type:fs.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.MouseInteraction,...e}}),scrollCb:F,viewportResizeCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.ViewportResize,...e}}),inputCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.Input,...e}}),mediaInteractionCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.MediaInteraction,...e}}),styleSheetRuleCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.StyleSheetRule,...e}}),styleDeclarationCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.StyleDeclaration,...e}}),canvasMutationCb:U,fontCb:e=>Sc({type:fs.IncrementalSnapshot,data:{source:ms.Font,...e}}),selectionCb:e=>{Sc({type:fs.IncrementalSnapshot,data:{source:ms.Selection,...e}})},customElementCb:e=>{Sc({type:fs.IncrementalSnapshot,data:{source:ms.CustomElement,...e}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:A,inlineStylesheet:d,sampling:b,recordDOM:x,recordCanvas:k,inlineImages:I,userTriggeredOnInput:E,collectFonts:C,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:z,blockSelector:i,slimDOMOptions:P,dataURLOptions:v,mirror:Mc,iframeManager:B,stylesheetManager:W,shadowDomManager:Z,processedNodeManager:H,canvasManager:Ec,ignoreCSSAttributes:M,plugins:(null==(t=null==T?void 0:T.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Sc({type:fs.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};B.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(r){}});const n=()=>{_c(),e.push(t(document)),zc=!0};return["interactive","complete"].includes(document.readyState)?n():(e.push(ba("DOMContentLoaded",()=>{Sc({type:fs.DomContentLoaded,data:{}}),"DOMContentLoaded"===_&&n()})),e.push(ba("load",()=>{Sc({type:fs.Load,data:{}}),"load"===_&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(t){String(t).toLowerCase().includes("cross-origin")}}),H.destroy(),zc=!1,La=void 0}}catch(V){}}Oc.addCustomEvent=(e,t)=>{if(!zc)throw new Error("please add custom event after start recording");Sc({type:fs.Custom,data:{tag:e,payload:t}})},Oc.freezePage=()=>{Va.forEach(e=>e.freeze())},Oc.takeFullSnapshot=e=>{if(!zc)throw new Error("please take full snapshot after start recording");_c(e)},Oc.mirror=Mc;var Rc=class{chatId;applicationId;events=[];sessionId=globalThis.crypto.randomUUID();stopRecording=null;flushTimer=null;flushPromise=Promise.resolve();stopped=!1;constructor(e,t){this.chatId=e,this.applicationId=t}async start(){this.stopRecording||this.stopped||(await os.widgetMessagePost({chat_id:this.chatId,command:{type:"rrweb/metadata",rrweb_session_id:this.sessionId,chat_id:this.chatId,application_id:this.applicationId,url:window.location.href,user_agent:navigator.userAgent,timestamp:Date.now(),viewport:{width:window.innerWidth,height:window.innerHeight}}}),this.stopped||(this.stopRecording=Oc({emit:e=>this.buffer(e),maskAllInputs:!0,maskTextClass:/^(rr-mask|mtx-mask)$/,blockClass:/^(rr-block|mtx-block)$/})))}stop(){this.stopped=!0,this.stopRecording?.(),this.stopRecording=null,this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=null,this.flush()}buffer(e){this.events.push(e),this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flush()},500))}flush(){return this.flushPromise=this.flushPromise.then(async()=>{this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=null;const e=this.events.splice(0);if(e.length)try{await os.widgetMessagePost({chat_id:this.chatId,command:{type:"rrweb/events",rrweb_session_id:this.sessionId,events:e}})}catch(t){this.events.unshift(...e)}}),this.flushPromise}},Nc=class e{static instance=null;abortController=null;chatId=null;status="disconnected";callbacks=/* @__PURE__ */new Set;isIntentionallyDisconnected=!1;reconnectAttempts=0;maxReconnectAttempts=10;reconnectDelay=1e3;maxReconnectDelay=3e4;reconnectTimer=null;connectionId=0;tabId=globalThis.crypto.randomUUID();registrationWaiters=/* @__PURE__ */new Set;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}addCallbacks(e){this.callbacks.add(e)}removeCallbacks(e){this.callbacks.delete(e)}isConnected(){return"registered"===this.status}canReconnect(){return null!==this.chatId&&!this.isIntentionallyDisconnected&&!this.isConnected()}reconnectNow(){this.canReconnect()&&null!==this.chatId&&(this.clearReconnectTimer(),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.connect(this.chatId).catch(console.error))}async waitUntilRegistered(){this.isConnected()||await new Promise((e,t)=>this.registrationWaiters.add({resolve:e,reject:t}))}async connect(e){if(this.isIntentionallyDisconnected=!1,this.chatId===e&&("connecting"===this.status||"connected"===this.status||"registered"===this.status))return;this.abortController&&(this.abortController.abort(),this.abortController=null),this.chatId=e,this.status="connecting";const t=++this.connectionId;this.abortController=new AbortController;const n=this.abortController.signal;try{const{mtxId:r,mtxKey:o}=ds.getConfig()??{},i=await os.widgetStream({chat_id:e,tab_id:this.tabId,...r&&o&&{marketrix_id:r,marketrix_key:o}},{signal:n});this.status="connected",this.consumeEvents(i,t)}catch(r){n.aborted||(this.status="error",this.notifyError(/* @__PURE__ */new Error("Stream connection failed")),this.scheduleReconnect())}}async consumeEvents(e,t){let n=!1;try{for await(const r of e){if(this.connectionId!==t){n=!0;break}this.handleMessage(r)}}catch(r){this.connectionId!==t?n=!0:this.isIntentionallyDisconnected||(this.status="error")}finally{n||this.connectionId!==t||this.isIntentionallyDisconnected||(this.status="disconnected",this.scheduleReconnect())}}disconnect(){this.isIntentionallyDisconnected=!0,this.clearReconnectTimer(),this.abortController&&(this.abortController.abort(),this.abortController=null),this.status="disconnected",this.chatId=null;for(const e of this.registrationWaiters)e.reject(/* @__PURE__ */new Error("Stream disconnected before registration"));this.registrationWaiters.clear()}send(e){return this.chatId?os.widgetMessagePost({chat_id:this.chatId,tab_id:this.tabId,command:e}).then(()=>{}).catch(e=>{throw this.notifyError(/* @__PURE__ */new Error(`Failed to send message: ${String(e)}`)),e}):Promise.reject(/* @__PURE__ */new Error("No active chat"))}notifyError(e){this.callbacks.forEach(t=>t.onError?.(e))}handleMessage(e){if(!this.isIntentionallyDisconnected&&"heartbeat"!==e.type){if("registered"===e.type&&e.chat_id===this.chatId){this.status="registered",this.reconnectAttempts=0,this.reconnectDelay=1e3;for(const e of this.registrationWaiters)e.resolve();this.registrationWaiters.clear()}"chat/error"===e.type&&"auth"===e.request_id&&(this.isIntentionallyDisconnected=!0,this.notifyError(/* @__PURE__ */new Error("Chat is unavailable — the widget credentials were rejected."))),this.callbacks.forEach(t=>t.onMessage?.(e))}}scheduleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return void this.notifyError(/* @__PURE__ */new Error("Could not reconnect to the assistant. Try again."));this.clearReconnectTimer(),this.reconnectAttempts++;const e=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1),this.maxReconnectDelay);this.reconnectTimer=setTimeout(()=>{!this.isIntentionallyDisconnected&&this.chatId&&this.connect(this.chatId).catch(console.error)},e)}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}};function Ac(e,t={}){return{...t,...e}}function Pc(e){return e.mtxId??(null!=e.mtxApp?String(e.mtxApp):"default")}function Dc(e){return e instanceof Error?e.message:"string"==typeof e?e:"Unknown error"}function $c(e,t){const n=new Error(e);return n.cause=t,n}async function Lc(e){const{mtxId:t,mtxKey:n}=e;if(!t||!n)throw new Error("Please provide mtxId + mtxKey");let r;try{({items:r}=await os.widgetSearch({marketrix_id:t,marketrix_key:n}))}catch(a){throw function(e,t){const n=Dc(e);return n.includes("Failed to fetch")||n.includes("ERR_CONNECTION_REFUSED")||n.includes("NetworkError")||n.includes("Network request failed")?$c(`Cannot connect to API server. Please ensure the API server is running at ${t.mtxApiHost||"configured API server"}. Error: ${n}`,e):$c(`Widget validation failed: ${n}`,e)}(a,e)}if(!r.length)throw new Error("Widget not found or invalid credentials");const o=r.find(e=>"active"===e.status);if(!o){const e=r.map(e=>e.status).join(", ");throw new Error(`Found widget(s) but none are active. Current status(es): ${e}. Please activate the widget in the dashboard.`)}if(!o.application_id)throw new Error("Widget missing application_id");try{await os.applicationGet({application_id:o.application_id})}catch(a){throw $c(`Failed to validate application: ${Dc(a)}`,a)}let i;try{i=await os.widgetDefaultGet({type:"widget"})}catch(a){throw $c(`Failed to fetch widget settings from API: ${Dc(a)}`,a)}const s=Ki.safeParse({...i,...o.settings});if(!s.success){const e=[...new Set(s.error.issues.map(e=>e.path.join(".")||"settings"))];throw new Error(`Widget settings are invalid: ${e.join(", ")}`)}return{...Ac(s.data,e),mtxApp:o.application_id}}var jc="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20361%20360'%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20display:%20none;%20fill:%20none;%20stroke:%20%23cdc9c2;%20stroke-width:%201.3px;%20}%20.st1%20{%20fill:%20%23fff;%20}%20.st2,%20.st3%20{%20fill:%20%237cffa6;%20}%20.st3%20{%20stroke:%20%237cffa6;%20stroke-width:%20.38px;%20}%20.st4%20{%20fill:%20%23101828;%20}%20%3c/style%3e%3c/defs%3e%3crect%20class='st4'%20x='.5'%20width='360'%20height='360'/%3e%3cpath%20class='st2'%20d='M83.37,209.58c15.35,0,27.8-12.45,27.8-27.8s-12.44-27.79-27.8-27.79-27.8,12.44-27.8,27.79,12.44,27.8,27.8,27.8Z'/%3e%3cpath%20class='st1'%20d='M85.86,68.28l152.45,223.44h67.29l-70.62-113.77,68.13-109.67h-67.29l-41.12,65.31-41.54-65.31h-67.29Z'/%3e%3cpath%20class='st3'%20d='M176.61,249.83l-35.08-51-57.82,92.71h66.85l26.05-41.7Z'/%3e%3crect%20class='st0'%20x='1.25'%20y='.65'%20width='358.7'%20height='358.7'%20rx='43.35'%20ry='43.35'/%3e%3c/svg%3e",Fc={none:"none",card:"0 1px 4px rgba(0,0,0,0.1)",section:"0 2px 8px rgba(0,0,0,0.06)",panel:"0 12px 40px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.08)",fab:"0 2px 8px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04)",button:"0 4px 6px -1px rgba(0,0,0,0.1)"},Uc={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",theme:"rounded-[var(--radius)]",pill:"rounded-full",circle:"rounded-full"},Wc={default:"text-foreground",muted:"text-foreground-muted",faint:"text-foreground-faint",primary:"text-primary",inherit:"text-inherit"},Bc={tight:"leading-tight",snug:"leading-snug",normal:"leading-normal",relaxed:"leading-relaxed"},Hc={info:{background:"#f0f9ff",border:"1px solid #bae6fd",titleColor:"#0c4a6e",bodyColor:"#0369a1",closeColor:"#7dd3fc",actionBackground:"#e0f2fe"},error:{background:"#fef2f2",border:"1px solid #fecaca",titleColor:"#b91c1c",bodyColor:"#b91c1c",closeColor:"#f87171",actionBackground:"#fee2e2"},neutral:{background:"rgba(255, 255, 255, 0.95)",border:"1px solid rgba(255, 255, 255, 0.2)",titleColor:"#1f2937",bodyColor:"#1f2937",closeColor:"#6b7280",actionBackground:"transparent"}};function Zc(e){if(e&&"none"!==e)return{boxShadow:Fc[e]}}var qc=2147483002,Vc=2147483001,Gc=2147483005,Yc=(e=/* @__PURE__ */new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Jc="-",Xc=[],Kc=e=>{const t=tl(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return el(e);const n=e.split(Jc),r=""===n[0]&&n.length>1?1:0;return Qc(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],o=n[e];return t?o?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(o,t):t:o||Xc}return n[e]||Xc}}},Qc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=Qc(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(Jc):e.slice(t).join(Jc),a=i.length;for(let c=0;c<a;c++){const e=i[c];if(e.validator(s))return e.classGroupId}},el=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),tl=e=>{const{theme:t,classGroups:n}=e;return nl(n,t)},nl=(e,t)=>{const n=Yc();for(const r in e){const o=e[r];rl(o,n,r,t)}return n},rl=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];ol(o,t,n,r)}},ol=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?al(e,t,n,r):sl(e,t,n,r):il(e,t,n)},il=(e,t,n)=>{(""===e?t:cl(t,e)).classGroupId=n},sl=(e,t,n,r)=>{ll(e)?rl(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},al=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];rl(i,cl(t,e),n,r)}},cl=(e,t)=>{let n=e;const r=t.split(Jc),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=Yc(),n.nextPart.set(e,t)),n=t}return n},ll=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,dl=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set(e,t){e in n?n[e]=t:o(e,t)}}},ul=[],pl=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),hl=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,i=0;const s=e.length;for(let d=0;d<s;d++){const s=e[d];if(0===r&&0===o){if(":"===s){t.push(e.slice(i,d)),i=d+1;continue}if("/"===s){n=d;continue}}"["===s?r++:"]"===s?r--:"("===s?o++:")"===s&&o--}const a=0===t.length?e:e.slice(i);let c=a,l=!1;a.endsWith("!")?(c=a.slice(0,-1),l=!0):a.startsWith("!")&&(c=a.slice(1),l=!0);return pl(t,l,c,n&&n>i?n-i:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):pl(ul,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},fl=e=>{const t=/* @__PURE__ */new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let o=0;o<e.length;o++){const i=e[o],s="["===i[0],a=t.has(i);s||a?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(i)):r.push(i)}return r.length>0&&(r.sort(),n.push(...r)),n}},ml=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},gl=/\s+/,yl=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=yl(e[r]))&&(n&&(n+=" "),n+=t);return n},bl=(e,...t)=>{let n,r,o,i;const s=e=>{const t=r(e);if(t)return t;const i=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i,postfixLookupClassGroupIds:s}=t,a=[],c=e.trim().split(gl);let l="";for(let d=c.length-1;d>=0;d-=1){const e=c[d],{isExternal:t,modifiers:u,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:f}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let m,g=!!f;if(g){m=r(h.substring(0,f));const e=m&&s[m]?r(h):void 0;e&&e!==m&&(m=e,g=!1)}else m=r(h);if(!m){if(!g){l=e+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=e+(l.length>0?" "+l:l);continue}g=!1}const y=0===u.length?"":1===u.length?u[0]:i(u).join(":"),b=p?y+"!":y,v=b+m;if(a.indexOf(v)>-1)continue;a.push(v);const w=o(m,g);for(let n=0;n<w.length;++n){const e=w[n];a.push(b+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return o(e,i),i};return i=a=>{const c=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:dl(e.cacheSize),parseClassName:hl(e),sortModifiers:fl(e),postfixLookupClassGroupIds:ml(e),...Kc(e)}))(c),r=n.cache.get,o=n.cache.set,i=s,s(a)},(...e)=>i(((...e)=>{let t,n,r=0,o="";for(;r<e.length;)(t=e[r++])&&(n=yl(t))&&(o&&(o+=" "),o+=n);return o})(...e))},vl=[],wl=e=>{const t=t=>t[e]||vl;return t.isThemeGetter=!0,t},xl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Sl=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_l=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,El=/\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$/,Cl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Il=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zl=e=>Sl.test(e),Ml=e=>!!e&&!Number.isNaN(Number(e)),Ol=e=>!!e&&Number.isInteger(Number(e)),Rl=e=>e.endsWith("%")&&Ml(e.slice(0,-1)),Nl=e=>_l.test(e),Al=()=>!0,Pl=e=>El.test(e)&&!Cl.test(e),Dl=()=>!1,$l=e=>Il.test(e),Ll=e=>Tl.test(e),jl=e=>!Wl(e)&&!Jl(e),Fl=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),Ul=e=>od(e,cd,Dl),Wl=e=>xl.test(e),Bl=e=>od(e,ld,Pl),Hl=e=>od(e,dd,Ml),Zl=e=>od(e,pd,Al),ql=e=>od(e,ud,Dl),Vl=e=>od(e,sd,Dl),Gl=e=>od(e,ad,Ll),Yl=e=>od(e,hd,$l),Jl=e=>kl.test(e),Xl=e=>id(e,ld),Kl=e=>id(e,ud),Ql=e=>id(e,sd),ed=e=>id(e,cd),td=e=>id(e,ad),nd=e=>id(e,hd,!0),rd=e=>id(e,pd,!0),od=(e,t,n)=>{const r=xl.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},id=(e,t,n=!1)=>{const r=kl.exec(e);return!!r&&(r[1]?t(r[1]):n)},sd=e=>"position"===e||"percentage"===e,ad=e=>"image"===e||"url"===e,cd=e=>"length"===e||"size"===e||"bg-size"===e,ld=e=>"length"===e,dd=e=>"number"===e,ud=e=>"family-name"===e,pd=e=>"number"===e||"weight"===e,hd=e=>"shadow"===e,fd=/*#__PURE__*/bl(()=>{const e=wl("color"),t=wl("font"),n=wl("text"),r=wl("font-weight"),o=wl("tracking"),i=wl("leading"),s=wl("breakpoint"),a=wl("container"),c=wl("spacing"),l=wl("radius"),d=wl("shadow"),u=wl("inset-shadow"),p=wl("text-shadow"),h=wl("drop-shadow"),f=wl("blur"),m=wl("perspective"),g=wl("aspect"),y=wl("ease"),b=wl("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Jl,Wl],w=()=>[Jl,Wl,c],x=()=>[zl,"full","auto",...w()],k=()=>[Ol,"none","subgrid",Jl,Wl],S=()=>["auto",{span:["full",Ol,Jl,Wl]},Ol,Jl,Wl],_=()=>[Ol,"auto",Jl,Wl],E=()=>["auto","min","max","fr",Jl,Wl],C=()=>["auto",...w()],I=()=>[zl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],T=()=>[zl,"screen","full","dvw","lvw","svw","min","max","fit",...w()],z=()=>[zl,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],M=()=>[e,Jl,Wl],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ql,Vl,{position:[Jl,Wl]}],R=()=>["auto","cover","contain",ed,Ul,{size:[Jl,Wl]}],N=()=>[Rl,Xl,Bl],A=()=>["","none","full",l,Jl,Wl],P=()=>["",Ml,Xl,Bl],D=()=>[Ml,Rl,Ql,Vl],$=()=>["","none",f,Jl,Wl],L=()=>["none",Ml,Jl,Wl],j=()=>["none",Ml,Jl,Wl],F=()=>[Ml,Jl,Wl],U=()=>[zl,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Nl],breakpoint:[Nl],color:[Al],container:[Nl],"drop-shadow":[Nl],ease:["in","out","in-out"],font:[jl],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Nl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Nl],shadow:[Nl],spacing:["px",Ml],text:[Nl],"text-shadow":[Nl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",zl,Wl,Jl,g]}],container:["container"],"container-type":[{"@container":["","normal","size",Jl,Wl]}],"container-named":[Fl],columns:[{columns:[Ml,Wl,Jl,a]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"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:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[Ol,"auto",Jl,Wl]}],basis:[{basis:[zl,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ml,zl,"auto","initial","none",Wl]}],grow:[{grow:["",Ml,Jl,Wl]}],shrink:[{shrink:["",Ml,Jl,Wl]}],order:[{order:[Ol,"first","last","none",Jl,Wl]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],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:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mbs:[{mbs:C()}],mbe:[{mbe:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...T()]}],"min-inline-size":[{"min-inline":["auto",...T()]}],"max-inline-size":[{"max-inline":["none",...T()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[a,"screen",...I()]}],"min-w":[{"min-w":[a,"screen","none",...I()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,Xl,Bl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,rd,Zl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Rl,Wl]}],"font-family":[{font:[Kl,ql,t]}],"font-features":[{"font-features":[Wl]}],"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:[o,Jl,Wl]}],"line-clamp":[{"line-clamp":[Ml,"none",Jl,Hl]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",Jl,Wl]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Jl,Wl]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Ml,"from-font","auto",Jl,Bl]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ml,"auto",Jl,Wl]}],"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:[Ol,Jl,Wl]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Jl,Wl]}],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",Jl,Wl]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ol,Jl,Wl],radial:["",Jl,Wl],conic:[Ol,Jl,Wl]},td,Gl]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:N()}],"gradient-via-pos":[{via:N()}],"gradient-to-pos":[{to:N()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-bs":[{"border-bs":P()}],"border-w-be":[{"border-be":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":P()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Ml,Jl,Wl]}],"outline-w":[{outline:["",Ml,Xl,Bl]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,nd,Yl]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",u,nd,Yl]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ml,Bl]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,nd,Yl]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ml,Jl,Wl]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"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":[Ml]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Jl,Wl]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Ml]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Jl,Wl]}],filter:[{filter:["","none",Jl,Wl]}],blur:[{blur:$()}],brightness:[{brightness:[Ml,Jl,Wl]}],contrast:[{contrast:[Ml,Jl,Wl]}],"drop-shadow":[{"drop-shadow":["","none",h,nd,Yl]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ml,Jl,Wl]}],"hue-rotate":[{"hue-rotate":[Ml,Jl,Wl]}],invert:[{invert:["",Ml,Jl,Wl]}],saturate:[{saturate:[Ml,Jl,Wl]}],sepia:[{sepia:["",Ml,Jl,Wl]}],"backdrop-filter":[{"backdrop-filter":["","none",Jl,Wl]}],"backdrop-blur":[{"backdrop-blur":$()}],"backdrop-brightness":[{"backdrop-brightness":[Ml,Jl,Wl]}],"backdrop-contrast":[{"backdrop-contrast":[Ml,Jl,Wl]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ml,Jl,Wl]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ml,Jl,Wl]}],"backdrop-invert":[{"backdrop-invert":["",Ml,Jl,Wl]}],"backdrop-opacity":[{"backdrop-opacity":[Ml,Jl,Wl]}],"backdrop-saturate":[{"backdrop-saturate":[Ml,Jl,Wl]}],"backdrop-sepia":[{"backdrop-sepia":["",Ml,Jl,Wl]}],"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",Jl,Wl]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ml,"initial",Jl,Wl]}],ease:[{ease:["linear","initial",y,Jl,Wl]}],delay:[{delay:[Ml,Jl,Wl]}],animate:[{animate:["none",b,Jl,Wl]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Jl,Wl]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:j()}],"scale-x":[{"scale-x":j()}],"scale-y":[{"scale-y":j()}],"scale-z":[{"scale-z":j()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Jl,Wl,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:U()}],"translate-x":[{"translate-x":U()}],"translate-y":[{"translate-y":U()}],"translate-z":[{"translate-z":U()}],"translate-none":["translate-none"],zoom:[{zoom:[Ol,Jl,Wl]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Jl,Wl]}],"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":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"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",Jl,Wl]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ml,Xl,Bl,Hl]}],stroke:[{stroke:["none",...M()]}],"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 md(...e){return fd(e.filter(Boolean).join(" "))}var gd={sm:"w-5 h-5",md:"w-8 h-8",lg:"w-12 h-12"};function yd(e){const{src:t,alt:n,elevation:r,fit:o="contain",size:i="md",rounded:s,className:a,style:c,ref:l,...d}=e,u="string"==typeof i,p=u?gd[i]:void 0,h=u?c:{width:i,height:i,...c};/* @__PURE__ */
3
+ return g("img",{...d,ref:l,alt:n,className:md("flex-shrink-0","contain"===o?"object-contain":"object-cover",p,!0===s||"theme"===s?Uc.theme:"full"===s?Uc.pill:s?Uc[s]:void 0,a),src:t,style:{...Zc(r),...h}})}function bd(){return"undefined"!=typeof window}function vd(e){return xd(e)?(e.nodeName||"").toLowerCase():"#document"}function wd(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function xd(e){return!!bd()&&(e instanceof Node||e instanceof wd(e).Node)}function kd(e){return!!bd()&&(e instanceof Element||e instanceof wd(e).Element)}function Sd(e){return!!bd()&&(e instanceof HTMLElement||e instanceof wd(e).HTMLElement)}function _d(e){return!(!bd()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof wd(e).ShadowRoot)}function Ed(e){return/^(html|body|#document)$/.test(vd(e))}function Cd(e){return wd(e).getComputedStyle(e)}function Id(e){if("html"===vd(e))return e;const t=e.assignedSlot||e.parentNode||_d(e)&&e.host||function(e){var t;return null==(t=(xd(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}(e);return _d(t)?t.host:t}var Td={...e},zd={};function Md(t,n){const r=e.useRef(zd);return r.current===zd&&(r.current=t(n)),r}var Od=Td.useInsertionEffect,Rd=Od&&Od!==Td.useLayoutEffect?Od:e=>e();function Nd(e){const t=Md(Ad).current;return t.next=e,Rd(t.effect),t.trampoline}function Ad(){const e={next:void 0,callback:Pd,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Pd(){}var Dd="undefined"!=typeof document?e.useLayoutEffect:()=>{};function $d(e,t){return e&&!t?e:!e&&t?t:e||t?{...e,...t}:void 0}var Ld={};function jd(e,t,n,r,o){if(!(n||r||o||e))return Fd(t);let i=Fd(e);return t&&(i=Ud(i,t)),n&&(i=Ud(i,n)),r&&(i=Ud(i,r)),o&&(i=Ud(i,o)),i}function Fd(e){return Bd(e)?{...Hd(e,Ld)}:function(e){const t={...e};for(const n in t){const e=t[n];Wd(n,e)&&(t[n]=qd(e))}return t}(e)}function Ud(e,t){return Bd(t)?Hd(t,e):function(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":e[n]=$d(e.style,r);break;case"className":e[n]=Gd(e.className,r);break;default:Wd(n,r)?e[n]=Zd(e[n],r):e[n]=r}}return e}(e,t)}function Wd(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return 111===n&&110===r&&o>=65&&o<=90&&("function"==typeof t||void 0===t)}function Bd(e){return"function"==typeof e}function Hd(e,t){return Bd(e)?e(t):e??Ld}function Zd(e,t){return t?e?(...n)=>{const r=n[0];if(Yd(r)){const o=r;Vd(o);const i=t(...n);return o.baseUIHandlerPrevented||e?.(...n),i}const o=t(...n);return e?.(...n),o}:qd(t):e}function qd(e){return e?(...t)=>{const n=t[0];return Yd(n)&&Vd(n),e(...t)}:e}function Vd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Gd(e,t){return t?e?t+" "+e:t:e}function Yd(e){return null!=e&&"object"==typeof e&&"nativeEvent"in e}var Jd,Xd,Kd=(Jd="https://base-ui.com/production-error",Xd="Base UI",function(e,...t){const n=new URL(Jd);return n.searchParams.set("code",e.toString()),t.forEach(e=>n.searchParams.append("args[]",e)),`${Xd} error #${e}; visit ${n} for the full message.`}),Qd=/*#__PURE__*/e.createContext(void 0);function eu(e){return e?.ownerDocument||document}function tu(e,t,{detail:n=0}={}){e.dispatchEvent(new(wd(e).PointerEvent)("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function nu(t={}){const{disabled:n=!1,focusableWhenDisabled:r,tabIndex:o=0,native:i=!0,composite:s}=t,a=e.useRef(null),c=function(t=!1){const n=e.useContext(Qd);if(void 0===n&&!t)throw new Error(Kd(16));return n}(!0),l=s??void 0!==c,{props:d}=function(t){const{focusableWhenDisabled:n,disabled:r,composite:o=!1,tabIndex:i=0,isNativeButton:s}=t,a=o&&!1!==n,c=o&&!1===n;return{props:e.useMemo(()=>{const e={onKeyDown(e){r&&n&&"Tab"!==e.key&&e.preventDefault()}};return o||(e.tabIndex=i,!s&&r&&(e.tabIndex=n?i:-1)),(s&&(n||a)||!s&&r)&&(e["aria-disabled"]=r),!s||n&&!c||(e.disabled=r),e},[o,r,n,a,c,s,i])}}({focusableWhenDisabled:r,disabled:n,composite:l,tabIndex:o,isNativeButton:i}),u=e.useCallback(()=>{const e=a.current;ru(e)&&l&&n&&void 0===d.disabled&&e.disabled&&(e.disabled=!1)},[n,d.disabled,l]);return Dd(u,[u]),{getButtonProps:e.useCallback((e={})=>{const{onClick:t,onMouseDown:r,onKeyUp:o,onKeyDown:s,onPointerDown:a,...c}=e;return jd({onClick(e){n?e.preventDefault():t?.(e)},onMouseDown(e){n||r?.(e)},onKeyDown(e){if(n)return;if(Vd(e),s?.(e),e.baseUIHandlerPrevented)return;const t=e.target===e.currentTarget,r=e.currentTarget,o=ru(r),a=!i&&(Sd(c=r)&&"A"===c.tagName&&Boolean(c.href));var c;const d=t&&(i?o:!a),u="Enter"===e.key,p=" "===e.key,h=r.getAttribute("role"),f=h?.startsWith("menuitem")||"option"===h||"gridcell"===h;if(t&&l&&p){if(e.defaultPrevented&&f)return;return e.preventDefault(),void(i&&!o||(e.preventBaseUIHandler(),tu(r,e)))}d&&!i&&(p||u)?e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),tu(r,e))):t&&a&&p&&e.preventDefault()},onKeyUp(e){n||(Vd(e),o?.(e),e.target===e.currentTarget&&i&&l&&ru(e.currentTarget)&&" "===e.key?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||l||e.defaultPrevented||" "!==e.key||(e.preventBaseUIHandler(),tu(e.currentTarget,e)))},onPointerDown(e){n?e.preventDefault():a?.(e)}},i?{type:"button"}:{role:"button"},d,c)},[n,d,l,i]),buttonRef:Nd(e=>{a.current=e,u()})}}function ru(e){return Sd(e)&&"BUTTON"===e.tagName}function ou(e,t,n,r){const o=Md(iu).current;return function(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}(o,e,t,n,r)&&su(o,[e,t,n,r]),o.callback}function iu(){return{callback:null,cleanup:null,refs:[]}}function su(e,t){e.refs=t,t.every(e=>null==e)?e.callback=null:e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),null!=n){const r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){const o=t[e];if(null!=o)switch(typeof o){case"function":{const t=o(n);"function"==typeof t&&(r[e]=t);break}case"object":o.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){const n=t[e];if(null!=n)switch(typeof n){case"function":{const t=r[e];"function"==typeof t?t():n(null);break}case"object":n.current=null}}}}}}var au=parseInt(e.version,10);function cu(e){return au>=e}function lu(t){if(!/*#__PURE__*/e.isValidElement(t))return null;const n=t,r=n.props;return(cu(19)?r?.ref:n.ref)??null}function du(){}var uu=Object.freeze([]),pu=Object.freeze({});function hu(t,n,o={}){const i=n.render,s=function(e,t={}){const{className:n,style:r,render:o}=e,{state:i=pu,ref:s,props:a,stateAttributesMapping:c,enabled:l=!0}=t,d=l?function(e,t){return"function"==typeof e?e(t):e}(n,i):void 0,u=l?function(e,t){return"function"==typeof e?e(t):e}(r,i):void 0,p=l?function(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const e=t[r](o);null!=e&&Object.assign(n,e);continue}!0===o?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}(i,c):pu,h=l&&a?function(e){return Array.isArray(e)?function(e){if(0===e.length)return Ld;if(1===e.length)return Fd(e[0]);let t=Fd(e[0]);for(let n=1;n<e.length;n+=1)t=Ud(t,e[n]);return t}(e):jd(void 0,e)}(a):void 0,f=l?$d(p,h)??{}:pu;"undefined"!=typeof document&&(l?Array.isArray(s)?f.ref=function(e){const t=Md(iu).current;return function(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}(t,e)&&su(t,e),t.callback}([f.ref,lu(o),...s]):f.ref=ou(f.ref,lu(o),s):ou(null,null));if(!l)return pu;void 0!==d&&(f.className=Gd(f.className,d));void 0!==u&&(f.style=$d(f.style,u));return f}(n,o);return!1===o.enabled?null:function(t,n,o,i){if(n){if("function"==typeof n)return n(o,i);const t=jd(o,n.props);t.ref=o.ref;let r=n;return r?.$$typeof===fu&&(r=e.Children.toArray(n)[0]),/*#__PURE__*/e.cloneElement(r,t)}if(t&&"string"==typeof t)return function(t,n){return"button"===t?/*#__PURE__*/r("button",{type:"button",...n,key:n.key}):"img"===t?/*#__PURE__*/r("img",{alt:"",...n,key:n.key}):/*#__PURE__*/e.createElement(t,n)}(t,o);throw new Error(Kd(8))}(t,i,s,o.state??pu)}var fu=Symbol.for("react.lazy");var mu=/*#__PURE__*/e.forwardRef(function(e,t){const{render:n,className:r,disabled:o=!1,focusableWhenDisabled:i=!1,nativeButton:s=!0,style:a,...c}=e,{getButtonProps:l,buttonRef:d}=nu({disabled:o,focusableWhenDisabled:i,native:s});return hu("button",e,{state:{disabled:o},ref:[t,d],props:[c,l]})}),gu={primary:"bg-primary text-primary-foreground border-transparent hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground border-transparent hover:bg-secondary/80",ghost:"bg-transparent text-foreground border-border hover:bg-muted",bare:"bg-transparent text-inherit border-transparent hover:bg-transparent p-0 min-h-0",chip:"bg-secondary-bg text-foreground border-transparent hover:bg-primary hover:text-primary-foreground hover:border-primary",tab:"bg-transparent text-foreground-muted border-transparent hover:text-foreground hover:bg-transparent p-0 min-h-0"},yu={sm:"px-2 py-1 text-xs min-h-7",md:"px-4 py-2 text-sm min-h-9"},bu={default:"rounded-lg",theme:Uc.theme,pill:Uc.pill};function vu({active:e=!1,className:t,disabled:n,elevation:r,full:o,shape:i="default",size:s="md",stacked:a=!1,type:c="button",variant:l="primary",style:d,ref:u,...p}){const h=!["bare","tab"].includes(l);/* @__PURE__ */
4
+ return g(mu,{...p,ref:u,className:md("inline-flex items-center justify-center gap-2 font-medium cursor-pointer transition-all focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",h&&"border",bu[i],gu[l],"bare"!==l&&"tab"!==l&&yu[s],a&&"flex-col gap-0.5","tab"===l&&"h-full min-w-0 flex-1",e&&"tab"===l&&"text-primary font-semibold",n&&"opacity-50 cursor-not-allowed pointer-events-none",o&&"w-full",t),"data-disabled":n?"true":"false","data-size":s,"data-variant":l,disabled:n,style:{...Zc(r),...d},type:c})}var wu={none:"0","2xs":"1",xs:"0.5",sm:"1.5",md:"2",lg:"3",xl:"4","2xl":"6"},xu=/* @__PURE__ */new Set(["padding","paddingX","paddingY","paddingTop","paddingBottom","gap","align","justify","grow","shrink","position","inset","overflow","overflowY","width","height","minWidth","border","rounded","animate","hidden","as","style"]);function ku(e){const t=[];if(void 0!==e.padding&&t.push(`p-${wu[e.padding]}`),void 0!==e.paddingX&&t.push(`px-${wu[e.paddingX]}`),void 0!==e.paddingY&&t.push(`py-${wu[e.paddingY]}`),void 0!==e.paddingTop&&t.push(`pt-${wu[e.paddingTop]}`),void 0!==e.paddingBottom&&t.push(`pb-${wu[e.paddingBottom]}`),void 0!==e.gap&&t.push(`gap-${wu[e.gap]}`),void 0!==e.align&&t.push(`items-${e.align}`),void 0!==e.justify&&t.push(`justify-${e.justify}`),!0===e.grow&&t.push("flex-1"),!1===e.shrink&&t.push("flex-shrink-0"),void 0!==e.position&&t.push(e.position),void 0!==e.inset&&t.push("0"===e.inset?"inset-0":`inset-${wu[e.inset]}`),void 0!==e.overflow&&t.push(`overflow-${e.overflow}`),void 0!==e.overflowY&&t.push(`overflow-y-${e.overflowY}`),void 0!==e.width&&t.push(`w-${e.width}`),void 0!==e.height&&t.push(`h-${e.height}`),"0"===e.minWidth&&t.push("min-w-0"),void 0!==e.border&&!1!==e.border)if(!0===e.border)t.push("border","border-border");else{const n={top:"t",bottom:"b",left:"l",right:"r"}[e.border];t.push(`border-${n}`,"border-border")}return void 0!==e.rounded&&!1!==e.rounded&&(!0===e.rounded?t.push(Uc.theme):"full"===e.rounded?t.push(Uc.pill):t.push(Uc[e.rounded])),void 0!==e.animate&&"none"!==e.animate&&t.push({spin:"animate-spin",ping:"animate-ping",pulse:"animate-pulse",fadeIn:"animate-fade-in"}[e.animate]),!0===e.hidden&&t.push("hidden"),t.join(" ")}var Su={default:"",card:"bg-card text-card-foreground"},_u={none:"",card:"px-3 py-2",toast:"py-2 pl-2 pr-3"},Eu=o(function(e,t){const{as:n="div",background:r="default",className:o,elevation:i,paddingPreset:s="none",radius:a,style:c,...l}=e,d=ku(e),u=function(e){const t={};for(const n in e)xu.has(n)||(t[n]=e[n]);return t}(l);/* @__PURE__ */
5
5
  return g(n,{...u,ref:t,className:md(Su[r],_u[s],a&&ku({rounded:a}),d,o),style:{...Zc(i),...c}})}),Cu=o(function(e,t){const{className:n,direction:r,...o}=e;/* @__PURE__ */
6
6
  return g(Eu,{...o,ref:t,className:md("flex","column"===r&&"flex-col",n)})}),Iu={checkCircle:{viewBox:"0 0 512 512",paths:[{d:"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z",fill:"currentColor"}]},circle:{viewBox:"0 0 512 512",paths:[{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z",fill:"currentColor"}]},exclamationCircle:{viewBox:"0 0 512 512",paths:[{d:"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z",fill:"currentColor"}]},arrowUp:{viewBox:"0 0 448 512",paths:[{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z",fill:"currentColor"}]},arrowDown:{viewBox:"0 0 448 512",paths:[{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z",fill:"currentColor"}]},chatBubble:{viewBox:"0 0 512 512",paths:[{d:"M87.48 380c1.2-4.38-1.43-10.47-3.94-14.86a42.63 42.63 0 0 0-2.54-3.8 199.81 199.81 0 0 1-33-110C47.64 139.09 140.72 48 255.82 48 356.2 48 440 117.54 459.57 209.85a199 199 0 0 1 4.43 41.64c0 112.41-89.49 204.93-204.59 204.93-18.31 0-43-4.6-56.47-8.37s-26.92-8.77-30.39-10.11a31.14 31.14 0 0 0-11.13-2.07 30.7 30.7 0 0 0-12.08 2.43L81.5 462.78a15.92 15.92 0 0 1-4.66 1.22 9.61 9.61 0 0 1-9.58-9.74 15.85 15.85 0 0 1 .6-3.29z",fill:"none",stroke:"currentColor",strokeWidth:32,strokeLinecap:"round"},{d:"M160 256 m-32 0 a32 32 0 1 1 64 0 a32 32 0 1 1 -64 0",fill:"currentColor"},{d:"M256 256 m-32 0 a32 32 0 1 1 64 0 a32 32 0 1 1 -64 0",fill:"currentColor"},{d:"M352 256 m-32 0 a32 32 0 1 1 64 0 a32 32 0 1 1 -64 0",fill:"currentColor"}]},stop:{viewBox:"0 0 512 512",paths:[{d:"M392 432H120a40 40 0 0 1-40-40V120a40 40 0 0 1 40-40h272a40 40 0 0 1 40 40v272a40 40 0 0 1-40 40z",fill:"currentColor"}]},mousePointerClick:{viewBox:"0 0 24 24",paths:[{d:"M14 4.1 12 6",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},{d:"m5.1 8-2.9-.8",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},{d:"m6 12-1.9 2",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},{d:"M7.2 2.2 8 5.1",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}]},ticktick:{viewBox:"0 0 24 24",paths:[{d:"M12 0C5.383 0 0 5.383 0 12s5.383 12 12 12 12-5.383 12-12h-2.7c0 5.128-4.172 9.3-9.3 9.3-5.128 0-9.3-4.172-9.3-9.3 0-5.128 4.172-9.3 9.3-9.3V0Zm7.4 2.583-7.505 9.371L8.388 9.08l-2.002 2.436 4.741 3.888a1.573 1.573 0 0 0 2.231-.233l8.504-10.617L19.4 2.583Z",fill:"currentColor"}]},home:{viewBox:"0 0 24 24",paths:[{d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}]},chat:{viewBox:"0 0 24 24",paths:[{d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}]},send:{viewBox:"0 0 24 24",paths:[{d:"M5 12h14m-7-7l7 7-7 7",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}]},closeSmall:{viewBox:"0 0 12 12",paths:[{d:"M9 3L3 9M3 3l6 6",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}]},close:{viewBox:"0 0 20 20",paths:[{d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}]},chevronDown:{viewBox:"0 0 24 24",paths:[{d:"M19 9l-7 7-7-7",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round"}]},screenShare:{viewBox:"0 0 24 24",paths:[{d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}]},alertCircle:{viewBox:"0 0 24 24",paths:[{d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}]}};function Tu({name:e,size:t=16,className:n,ref:r,...o}){const i=Iu[e];return i?/* @__PURE__ */g("svg",{...o,ref:r,"aria-hidden":"true",className:md("inline-block flex-shrink-0",n),fill:"none",height:t,viewBox:i.viewBox,width:t,xmlns:"http://www.w3.org/2000/svg",children:i.paths.map((e,t)=>/* @__PURE__ */g("path",{clipRule:e.clipRule,d:e.d,fill:e.fill??(e.stroke?"none":"currentColor"),fillRule:e.fillRule,stroke:e.stroke,strokeLinecap:e.strokeLinecap,strokeLinejoin:e.strokeLinejoin,strokeMiterlimit:e.strokeMiterlimit,strokeWidth:e.strokeWidth},t))}):null}var zu={primary:"bg-primary text-primary-foreground hover:bg-primary-hover",secondary:"bg-secondary-bg text-foreground hover:bg-secondary-hover",ghost:"bg-transparent text-foreground opacity-60 hover:opacity-100"},Mu={xs:"w-5 h-5 min-w-5",sm:"w-7 h-7 min-w-7"};function Ou({variant:e="ghost",size:t="sm",tone:n,label:r,disabled:o,className:i,children:s,style:a,ref:c,...l}){/* @__PURE__ */
7
7
  return g("button",{...l,ref:c,type:"button",disabled:o,"aria-label":r,className:md("inline-flex items-center justify-center flex-shrink-0 border-none cursor-pointer transition-all",Uc.circle,zu[e],n&&Wc[n],Mu[t],o&&"opacity-50 cursor-not-allowed pointer-events-none",i),style:a,children:s})}var Ru=o(function(e,t){/* @__PURE__ */
@@ -12,11 +12,11 @@ return g(Eu,{position:"fixed",animate:c?"none":"fadeIn",style:{zIndex:Gc,maxWidt
12
12
  /* @__PURE__ */y(Ru,{grow:!0,minWidth:"0",children:[/* @__PURE__ */g(Du,{as:"span",block:!0,inheritColor:!0,weight:"medium",style:{fontSize:"13px",color:u.titleColor,whiteSpace:o?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),n&&/* @__PURE__ */g(Du,{as:"span",block:!0,inheritColor:!0,style:{fontSize:"12px",color:u.bodyColor,opacity:.8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n})]}),o&&/* @__PURE__ */g(vu,{type:"button",variant:"ghost",shape:"pill",size:"sm",onClick:()=>{o(),d()},style:{color:u.titleColor,backgroundColor:u.actionBackground,border:u.border},"aria-label":"Retry",children:"Retry"}),
13
13
  /* @__PURE__ */g(Ou,{label:"Dismiss",onClick:e=>{e.stopPropagation(),d()},size:"xs",tone:"inherit",style:{color:u.closeColor,padding:"2px"},children:/* @__PURE__ */g(Tu,{name:"closeSmall",size:12})})]})})};function Lu(e){if(e.id.startsWith("screenshare-")){const t="Screenshare ended";return{...e,content:t,isSystemMessage:!0,timestamp:new Date(e.timestamp),parts:[{type:"text",content:t}]}}const t=[...e.parts],n=e.content.trim();return 0===t.length&&n&&t.push({type:"text",content:n}),{...e,timestamp:new Date(e.timestamp),parts:t}}function ju({videoStream:e,...t}){return{...t,timestamp:t.timestamp.toISOString()}}function Fu(e){return!e.isPlaceholder||("thinking"===e.placeholderState||"waiting-for-user"===e.placeholderState||e.parts.length>0)}var Uu=new class{restored=!1;restore(){const{chat_id:e,config:t,timestamp:n,messages:r,...o}=ds.getContext();return this.restored=!0,{...o,messages:r.map(Lu)}}persist(e){this.restored&&ds.updateContext({...e,messages:e.messages.filter(Fu).map(ju)})}};function Wu(e,t,n,r={}){return{id:`${e}-${Date.now()}`,content:n,sender:t,timestamp:/* @__PURE__ */new Date,parts:n?[{type:"text",content:n}]:[],...r}}var Bu=(e,t,n="user-message")=>Wu(n,"user",e.trim(),{mode:t}),Hu=e=>Wu("agent-message","agent",e.trim()),Zu=(e,t,n,r)=>Wu(r,n,e,{mode:t,isSystemMessage:!0});async function qu(e,t,n,r){if(!e.mtxId||!e.mtxKey)throw new Error("mtxId + mtxKey is required");const o=await us.getOrCreateChatId();!function(e,t,n){const r={question:t,mode:n,chat_id:ds.getChatId(),timestamp:/* @__PURE__ */(new Date).toISOString()};e.userId&&(r.user_id=e.userId),e.mtxId&&e.mtxKey&&(r.marketrix_id=e.mtxId,r.marketrix_key=e.mtxKey),os.activityLogCreate({type:"widget_question",metadata:r}).catch(e=>{})}(e,t,n);const i={type:`chat/${n}`,request_id:r,content:t},s=Nc.getInstance();s.isConnected()||await s.connect(o),await s.send(i)}var Vu={show:"Show",tell:"Tell",do:"Do"},Gu=e=>Vu[e],Yu=e=>(e??/* @__PURE__ */new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});function Ju(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}function Xu({messages:e,isTaskRunning:t,currentMode:n}){const r=e=>"agent"===e.sender&&!e.isSystemMessage&&!e.isScreenAccessRequest,o=e=>e.isPlaceholder&&void 0===e.mode||e.mode===n,i=[];!t||"show"!==n&&"do"!==n||i.push(e=>r(e)&&o(e)&&!!e.isPlaceholder,e=>r(e)&&o(e)),i.push(e=>r(e)&&!!e.isPlaceholder,r);for(const s of i){const t=Ju(e,s);if(t>=0)return{index:t,message:e[t]}}return null}var Ku=/* @__PURE__ */new Set(["click_element","type_text","select_dropdown_option","send_keys","upload_file"]);function Qu(e){return e?e.replace(/\(?cancelled by cleanup\)?/gi,"").replace(/\s+/g," ").trim():e}var ep=e=>"progress"===e.type&&"in_progress"===e.status;function tp(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}function np(e,t,n){if(t<0)return e;const r=[...e.parts];return r[t]={...r[t],...n},{...e,parts:r}}var rp=/* @__PURE__ */new Map([["navigate","Navigating"],["search","Searching"],["click_element","Clicking element"],["type_text","Typing text"],["scroll","Scrolling"],["scroll_to_text","Scrolling to text"],["send_keys","Pressing key"],["extract","Extracting content"],["get_dropdown_options","Reading dropdown options"],["select_dropdown_option","Selecting option"],["upload_file","Uploading file"],["go_back","Going back"],["wait","Waiting"],["close_tab","Closing tab"],["done","Done"],["get_html","Viewed your screen"],["get_screenshot","Taking screenshot"]]),op=/* @__PURE__ */new Set(["button","link","textbox","checkbox","radio","switch","tab","menuitem"]);function*ip(e){let t=e;for(;t;){yield t;const e=t.getRootNode();t=t.parentElement??(e instanceof ShadowRoot?e.host:null)}}function sp(e){if(!(e instanceof Element))return!1;try{if(!function(e){const t=e.tagName.toLowerCase();return"button"===t||"input"===t||"textarea"===t||"select"===t||"a"===t&&e.hasAttribute("href")||op.has(e.getAttribute("role")??"")||"true"===e.getAttribute("contenteditable")||e.hasAttribute("onclick")||parseInt(e.getAttribute("tabindex")??"-1",10)>=0}(e))return!1;if(!0===e.disabled)return!1;if("true"===e.getAttribute("aria-disabled"))return!1;for(const r of ip(e))if(r instanceof HTMLElement&&r.inert)return!1;const t=window.getComputedStyle(e);if("none"===t.display||"none"===t.pointerEvents)return!1;const n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return!1;for(const r of ip(e))if(r!==e){const e=window.getComputedStyle(r).overflow;if("hidden"===e||"clip"===e){const e=r.getBoundingClientRect();if(n.right<e.left||n.left>e.right||n.bottom<e.top||n.top>e.bottom)return!1}if(r===document.body)break}for(let r=e.getRootNode();r instanceof ShadowRoot;r=r.host.getRootNode()){const e=r.host.getBoundingClientRect();if(e.width<=0||e.height<=0)return!1}return!0}catch(t){return!1}}var ap=["type","role","aria-label","name","href"],cp=new class{index=/* @__PURE__ */new Map;elementToSequence=/* @__PURE__ */new WeakMap;generateSelector(e){if(e.id&&1===document.querySelectorAll(`#${CSS.escape(e.id)}`).length)return`#${CSS.escape(e.id)}`;const t=[];let n=e;for(;n&&n!==document.body&&n.parentElement;){let e=n.tagName.toLowerCase();if(n.id){e+=`#${CSS.escape(n.id)}`,t.unshift(e);break}{const t=n.parentElement;if(!t)break;const r=n.tagName,o=Array.from(t.children).filter(e=>e.tagName===r);if(o.length>1){e+=`:nth-of-type(${o.indexOf(n)+1})`}}t.unshift(e),n=n.parentElement}return t.join(" > ")}staleReason(e){return document.contains(e.element)?e.id&&e.element.id===e.id?null:ap.some((t,n)=>e.identity[n]&&e.element.getAttribute(t)!==e.identity[n])?"has changed":null:"no longer exists"}indexInteractableElements(){this.clearIndex();const e=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{if(e instanceof HTMLElement&&null===e.offsetParent&&"BODY"!==e.tagName){const t=window.getComputedStyle(e),n="fixed"===t.position||"sticky"===t.position;if("none"===t.display)return NodeFilter.FILTER_REJECT;if(!n){let t=e.parentElement,n=!1;for(;t&&t!==document.body;){const e=window.getComputedStyle(t);if("fixed"===e.position||"sticky"===e.position){n=!0;break}t=t.parentElement}if(!n)return NodeFilter.FILTER_REJECT}}return NodeFilter.FILTER_ACCEPT}});let t=e.nextNode(),n=0;for(;t;){const r=t instanceof HTMLElement?t:null;if(r){const e=r.matches('a[href], button, input, textarea, select, [role="button"]'),t=r.classList.contains("cursor-pointer")||r.classList.contains("clickable"),o="function"==typeof r.onclick;(e||t||o||sp(r))&&(this.index.set(n,{element:r,selector:this.generateSelector(r),id:r.id,identity:ap.map(e=>r.getAttribute(e))}),this.elementToSequence.set(r,n),n++)}t=e.nextNode()}}getSnapshotHtml(){this.indexInteractableElements();const e=document.documentElement.cloneNode(!0);for(const[n,{selector:r}]of this.index.entries())try{(e.querySelector("body")||e).querySelector(r)?.setAttribute("data-id",n.toString())}catch(t){}return e.outerHTML}getSequenceForElement(e){return this.elementToSequence.get(e)}clearIndex(){this.index.clear(),this.elementToSequence=/* @__PURE__ */new WeakMap}checkElementInteractable(e,t){if(!document.body.contains(e))return`ELEMENT_NOT_INTERACTABLE: Element ${t} is not in the DOM`;const n=window.getComputedStyle(e);if("none"===n.display)return`ELEMENT_NOT_INTERACTABLE: Element ${t} has display:none`;if("hidden"===n.visibility)return`ELEMENT_NOT_INTERACTABLE: Element ${t} has visibility:hidden`;if(0===parseFloat(n.opacity))return`ELEMENT_NOT_INTERACTABLE: Element ${t} has opacity:0`;const r=e.getBoundingClientRect();if(0===r.width||0===r.height)return`ELEMENT_NOT_INTERACTABLE: Element ${t} has zero dimensions`;if(r.bottom<0||r.top>window.innerHeight||r.right<0||r.left>window.innerWidth)return`ELEMENT_NOT_INTERACTABLE: Element ${t} is off-screen`;const o=r.left+r.width/2,i=r.top+r.height/2,s=document.elementFromPoint(o,i);if(s&&s!==e&&!e.contains(s)&&!(s.closest("#marketrix-show-highlight")||s.closest("#marketrix-show-popup")||s.closest("[data-marketrix-widget]"))){const e=s.tagName.toLowerCase();return`ELEMENT_OBSCURED: Element ${t} is covered by ${s.className?`${e}.${s.className.split(" ")[0]}`:e}. The obscuring element may be a modal or overlay that needs to be dismissed first.`}return null}getValidatedElement(e){const t=this.index.get(e);if(!t)return{element:null,error:`Element ${e} not found`};const n=this.staleReason(t);if(n)return{element:null,error:`DOM_CHANGED: Element at index ${e} ${n}. Call get_html to get updated indices.`};const r=this.checkElementInteractable(t.element,e);return r?{element:null,error:r}:{element:t.element}}},lp=null;function dp(){return lp?.active&&"live"===lp.getVideoTracks()[0]?.readyState?lp:(lp=null,null)}async function up(){const e=dp();if(e)return e;const t=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,preferCurrentTab:!0});if(!t||0===t.getVideoTracks().length)throw new Error("Screen sharing permission denied or no video track available");return lp=t,t.getVideoTracks()[0].addEventListener("ended",()=>{lp=null}),t}var pp=["scroll","resize","touchmove","wheel"],hp=320,fp=new class{currentPopup=null;currentHighlight=null;currentElement=null;currentOptions=null;currentPromise=null;resolvePromise=null;rejectPromise=null;clickHandler=null;scrollHandler=null;visibilityCheckInterval=null;async showToolAction(e){const{element:t,explanation:n,isClickAction:r=!1,browserToolName:o}=e;return this.currentOptions?.element===t&&this.currentOptions.explanation===n&&this.currentOptions.browserToolName===o&&this.currentPromise||(this.cleanup(),this.currentOptions=e,this.currentElement=t,t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),this.createHighlight(t),this.createPopup(n,r),this.setupPositionUpdates(),this.setupVisibilityMonitoring(),r&&this.setupClickHandler(),this.currentPromise=new Promise((e,t)=>{this.resolvePromise=e,this.rejectPromise=t}).finally(()=>{this.cleanup()})),this.currentPromise}cleanup(){if(this.takeSettlers().reject?.("Cancelled by cleanup"),this.clickHandler&&(document.removeEventListener("click",this.clickHandler,{capture:!0}),this.clickHandler=null),this.scrollHandler){for(const e of pp)window.removeEventListener(e,this.scrollHandler,{capture:!0});this.scrollHandler=null}this.visibilityCheckInterval&&(clearInterval(this.visibilityCheckInterval),this.visibilityCheckInterval=null),this.currentPopup?.remove(),this.currentHighlight?.remove(),document.getElementById("marketrix-show-popup")?.remove(),document.getElementById("marketrix-show-highlight")?.remove(),this.currentPopup=null,this.currentHighlight=null,this.currentElement=null,this.currentOptions=null,this.currentPromise=null}takeSettlers(){const e={resolve:this.resolvePromise,reject:this.rejectPromise};return this.resolvePromise=null,this.rejectPromise=null,e}createHighlight(e){const t=e.getBoundingClientRect(),n=document.createElement("div");n.id="marketrix-show-highlight",n.style.cssText=`\n position: fixed;\n top: ${t.top}px;\n left: ${t.left}px;\n width: ${t.width}px;\n height: ${t.height}px;\n border: 3px solid #3b82f6;\n border-radius: 4px;\n box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), 0 0 20px rgba(59, 130, 246, 0.4);\n z-index: 2147483645;\n pointer-events: none;\n transition: none;\n `,document.body.appendChild(n),this.currentHighlight=n}createPopup(e,t){const n=document.createElement("div");n.id="marketrix-show-popup",n.innerHTML=t?`<div style="font-weight: 500; color: #1f2937; font-size: 12px;">${this.escapeHtml(e)}</div>`:`<div style="margin-bottom: 12px; font-weight: 500; color: #1f2937; font-size: 12px;">${this.escapeHtml(e)}</div>\n <div style="display: flex; gap: 8px; justify-content: flex-end;">\n <button id="marketrix-show-continue" style="\n background: #3b82f6; color: white; border: none; border-radius: 6px;\n padding: 8px 16px; font-size: 12px; font-weight: 500; cursor: pointer;\n ">Continue</button>\n </div>`,n.style.cssText="position: fixed; width: 320px; background: white; border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); z-index: 2147483646; padding: 16px;",document.body.appendChild(n),this.currentPopup=n,t||this.setupContinueButton(n),this.updatePopupPosition()}setupPositionUpdates(){this.scrollHandler=()=>{if(!this.currentElement||!this.currentHighlight)return;const e=this.currentElement.getBoundingClientRect();Object.assign(this.currentHighlight.style,{top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,height:`${e.height}px`}),this.updatePopupPosition()};for(const e of pp)window.addEventListener(e,this.scrollHandler,{capture:!0,passive:!0})}updatePopupPosition(){if(!this.currentPopup||!this.currentElement)return;const e=this.currentElement.getBoundingClientRect(),t=120,n=10,r=e.left+e.width/2,o=e.top+e.height/2,i=[{left:e.right+20,top:o-60},{left:e.left-hp-20,top:o-60},{left:r-160,top:e.top-t-20},{left:r-160,top:e.bottom+20}];let s=i[0];for(const a of i)if(a.left>=n&&a.left+hp<=window.innerWidth-n&&a.top>=n&&a.top+t<=window.innerHeight-n){s=a;break}this.currentPopup.style.left=`${Math.max(n,Math.min(s.left,window.innerWidth-hp-n))}px`,this.currentPopup.style.top=`${Math.max(n,Math.min(s.top,window.innerHeight-t-n))}px`}setupClickHandler(){this.clickHandler=e=>{this.currentElement&&this.resolvePromise&&e.composedPath().includes(this.currentElement)&&(e.preventDefault(),e.stopPropagation(),this.takeSettlers().resolve?.(!0))},document.addEventListener("click",this.clickHandler,{capture:!0})}setupContinueButton(e){window.requestAnimationFrame(()=>{e.querySelector("#marketrix-show-continue")?.addEventListener("click",e=>{e.stopPropagation(),this.takeSettlers().resolve?.(!0)})})}setupVisibilityMonitoring(){this.visibilityCheckInterval=setInterval(()=>{if(!this.currentElement)return;const e=cp.getSequenceForElement(this.currentElement)??-1,t=cp.checkElementInteractable(this.currentElement,e);t&&this.failWithElementGone(t)},200)}failWithElementGone(e){this.takeSettlers().reject?.(/* @__PURE__ */new Error(`ELEMENT_GONE: ${e}`)),this.cleanup()}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}},mp=e=>({success:!0,data:{text:e}}),gp=e=>({success:!0,data:e}),yp=e=>({success:!1,data:{text:""},error:e}),bp=e=>({success:!1,data:{options:[]},error:e}),vp=new class{async executeTool(e,t,n="do",r=""){const o=t;try{if("show"===n&&Ku.has(e)){const t=o.index;if(void 0!==t){const{element:n,error:o}=cp.getValidatedElement(t);if(!n)return yp(o||`Element ${t} not found`);if(!(await fp.showToolAction({element:n,explanation:r||`Execute ${e}`,browserToolName:e,isClickAction:"click_element"===e})))return yp("User cancelled action")}}switch(e){case"navigate":return this.navigate(o);case"search":return this.search(o);case"click_element":return await this.clickElement(o);case"type_text":return this.typeText(o);case"scroll":return this.scroll(o);case"scroll_to_text":return this.scrollToText(o);case"extract":return this.extract(o);case"go_back":return this.goBack();case"wait":return await this.wait(o);case"select_dropdown_option":return this.selectDropdownOption(o);case"get_dropdown_options":return this.getDropdownOptions(o);case"send_keys":return this.sendKeys(o);case"upload_file":return this.uploadFile();case"close_tab":return this.closeTab();case"done":return this.done(o);case"get_html":return this.getHtml();case"get_screenshot":return await this.getScreenshot();default:return yp(`Unknown tool: ${e}`)}}catch(i){return fp.cleanup(),yp(i instanceof Error?i.message:String(i))}}navigate(e){return e.url?e.new_tab?(window.open(e.url,"_blank"),mp(`Opened ${e.url} in new tab`)):(window.location.href=e.url,mp(`Navigating to ${e.url}`)):yp("URL is required")}search(e){if(!e.query)return yp("Query is required");const t=e.engine||"duckduckgo",n=encodeURIComponent(e.query);let r=`https://duckduckgo.com/?q=${n}`;return"google"===t&&(r=`https://www.google.com/search?q=${n}`),"bing"===t&&(r=`https://www.bing.com/search?q=${n}`),window.location.href=r,mp(`Searching for "${e.query}" on ${t}`)}async clickElement(e){if(void 0===e.index)return yp("Index required");const{element:t,error:n}=cp.getValidatedElement(e.index);return t?(t.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(e=>setTimeout(e,100)),setTimeout(()=>{try{t.click()}catch(e){try{t.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}))}catch(n){}}},50),mp(`Clicked element ${e.index}`)):yp(n||`Element ${e.index} not found`)}typeText(e){if(void 0===e.index||void 0===e.text)return yp("Index and text required");const t=!1!==e.clear,{element:n,error:r}=cp.getValidatedElement(e.index);if(!n)return yp(r||`Element ${e.index} not found`);if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n.isContentEditable){const r=n;try{r.focus()}catch(o){}const i=t?e.text:r.value+e.text;let s=null;const a=(e,t)=>{try{return t()}catch(o){return s=o,!1}};if(!(a("Native setter",()=>{const e="TEXTAREA"===r.tagName.toUpperCase(),t=Object.getOwnPropertyDescriptor(e?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value");return!!t?.set&&(t.set.call(r,i),!0)})||a("Direct assignment",()=>(r.value=i,!0))||a("execCommand",()=>(r.focus(),t&&r.select(),document.execCommand("insertText",!1,e.text)))))return yp(`Failed to set value: ${s instanceof Error?s.message:String(s)}`);try{const t=new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:e.text});r.dispatchEvent(t),r.dispatchEvent(new Event("change",{bubbles:!0})),r.dispatchEvent(new Event("blur",{bubbles:!0}))}catch(o){}}else if("value"in n)try{n.value=e.text,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}catch(o){return yp(`Failed to set value on element: ${o instanceof Error?o.message:String(o)}`)}else try{n.textContent=e.text,n.dispatchEvent(new Event("input",{bubbles:!0}))}catch(o){return yp(`Failed to set textContent: ${o instanceof Error?o.message:String(o)}`)}return mp(`Typed text into element ${e.index}`)}scroll(e){const t=.8*window.innerHeight;switch(e.direction){case"down":window.scrollBy({top:t,behavior:"smooth"});break;case"up":window.scrollBy({top:-t,behavior:"smooth"});break;case"left":window.scrollBy({left:-t,behavior:"smooth"});break;case"right":window.scrollBy({left:t,behavior:"smooth"});break;default:return yp("Invalid direction")}return mp(`Scrolled ${e.direction}`)}scrollToText(e){if(!e.text)return yp("Text required");const t=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let n;for(;n=t.nextNode();)if(n.textContent?.includes(e.text)&&n.parentElement)return n.parentElement.scrollIntoView({behavior:"smooth",block:"center"}),mp(`Scrolled to "${e.text}"`);return yp(`Text "${e.text}" not found`)}extract(e){const t=!1!==e.extract_links,n={title:document.title,url:window.location.href,text:document.body.innerText.slice(0,1e4),links:t?Array.from(document.querySelectorAll("a[href]")).slice(0,100).map(e=>({text:e.textContent?.trim()||"",href:e.getAttribute("href")})):[]};return gp(n)}goBack(){return window.history.length>1?(window.history.back(),mp("Navigated back")):yp("No history")}async wait({seconds:e}){return void 0===e?yp("Seconds required"):(await new Promise(t=>setTimeout(t,1e3*e)),mp(`Waited ${e}s`))}selectDropdownOption(e){if(void 0===e.index||!e.option)return yp("Index/Option required");const{element:t,error:n}=cp.getValidatedElement(e.index);if(!t)return yp(n||`Select ${e.index} not found`);if(!(t instanceof HTMLSelectElement))return yp(`Element ${e.index} is not a select element`);const r=Array.from(t.options).find(t=>t.value===e.option||t.text===e.option);return r?(t.value=r.value,t.dispatchEvent(new Event("change",{bubbles:!0})),mp(`Selected ${e.option}`)):yp(`Option ${e.option} not found`)}getDropdownOptions(e){const t=e.index;if(void 0===t)return bp("Index required");const{element:n,error:r}=cp.getValidatedElement(t);if(!n)return bp(r||`Select ${t} not found`);if(!(n instanceof HTMLSelectElement))return bp(`Element ${t} is not a select element`);const o=Array.from(n.options).map(e=>({value:e.value,text:e.text}));return gp({options:o})}sendKeys(e){if(void 0===e.index||!e.keys)return yp("Index/Keys required");const{element:t,error:n}=cp.getValidatedElement(e.index);if(!t)return yp(n||`Element ${e.index} not found`);t.focus(),t.dispatchEvent(new KeyboardEvent("keydown",{key:e.keys,bubbles:!0,cancelable:!0})),t.dispatchEvent(new KeyboardEvent("keyup",{key:e.keys,bubbles:!0,cancelable:!0}));const r=this.simulateKeyAction(t,e.keys);return mp(r||`Sent keys ${e.keys}`)}simulateKeyAction(e,t){switch(t){case"Tab":case"Shift+Tab":{const n="Tab"===t?1:-1,r=Array.from(document.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent),o=r.indexOf(e),i=-1===o?void 0:r[o+n];return i?(i.focus(),`${t}: moved focus to ${i.tagName.toLowerCase()}${i.id?`#${i.id}`:""}`):`${t}: no ${n>0?"next":"previous"} focusable element`}case"Enter":if(e instanceof HTMLButtonElement||"button"===e.getAttribute("role"))return e.click(),"Enter: clicked button";if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=e.closest("form");if(t){const e=t.querySelector('button[type="submit"], input[type="submit"]');return e?(e.click(),"Enter: clicked form submit button"):(t.requestSubmit(),"Enter: submitted form")}}return e instanceof HTMLAnchorElement?(e.click(),"Enter: clicked link"):"Enter: dispatched event";case"Escape":return e.blur(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),"Escape: blurred element and dispatched to document";case" ":case"Space":return e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)?(e.click(),`Space: toggled ${e.type}`):e instanceof HTMLButtonElement||"button"===e.getAttribute("role")?(e.click(),"Space: clicked button"):"Space: dispatched event";case"ArrowDown":if(e instanceof HTMLSelectElement){const t=e.selectedIndex;return t<e.options.length-1?(e.selectedIndex=t+1,e.dispatchEvent(new Event("change",{bubbles:!0})),`ArrowDown: selected "${e.options[e.selectedIndex].text}"`):"ArrowDown: already at last option"}return"ArrowDown: dispatched event";case"ArrowUp":if(e instanceof HTMLSelectElement){const t=e.selectedIndex;return t>0?(e.selectedIndex=t-1,e.dispatchEvent(new Event("change",{bubbles:!0})),`ArrowUp: selected "${e.options[e.selectedIndex].text}"`):"ArrowUp: already at first option"}return"ArrowUp: dispatched event";case"Home":return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?(e.setSelectionRange(0,0),"Home: moved cursor to start"):"Home: dispatched event";case"End":if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=e.value.length;return e.setSelectionRange(t,t),"End: moved cursor to end"}return"End: dispatched event";case"Backspace":if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=e.value;if(!t||0===t.length)return"Backspace: input is empty, nothing to delete";let n,r,o=e.selectionStart??t.length,i=e.selectionEnd??t.length;if(0===o&&0===i&&(o=t.length,i=t.length),o===i&&o>0)n=t.slice(0,o-1)+t.slice(i),r=o-1;else{if(o===i)return"Backspace: cursor at start, nothing to delete";n=t.slice(0,o)+t.slice(i),r=o}return this.setValueAndCaret(e,n,r),`Backspace: deleted character, value is now "${n}"`}return"Backspace: dispatched event";case"Delete":if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=e.selectionStart||0,n=e.selectionEnd||0,r=e.value;let o;if(t===n&&t<r.length)o=r.slice(0,t)+r.slice(n+1);else{if(t===n)return"Delete: cursor at end, nothing to delete";o=r.slice(0,t)+r.slice(n)}return this.setValueAndCaret(e,o,t),`Delete: deleted character, value is now "${o}"`}return"Delete: dispatched event";default:return null}}setValueAndCaret(e,t,n){const r=Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;r?r.call(e,t):e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),e.setSelectionRange(n,n)}uploadFile(){return yp("File upload not supported via script")}closeTab(){return window.close(),mp("Attempted close")}done(e){if(void 0===e.success)return yp("success parameter is required");const t=e.message||(e.success?"Task completed":"Task failed");return mp(t)}getHtml(){try{const e=cp.getSnapshotHtml();return mp(e)}catch(e){return yp(String(e))}}async getScreenshot(){try{const e=await up(),t=document.createElement("video");t.srcObject=e,t.autoplay=!0,t.style.display="none",document.body.appendChild(t),await new Promise(e=>{t.onloadeddata=()=>e()});const n=document.createElement("canvas");n.width=t.videoWidth,n.height=t.videoHeight,n.getContext("2d")?.drawImage(t,0,0);const r=n.toDataURL("image/jpeg",.75);return t.remove(),mp(r)}catch(e){return yp(String(e))}}},wp=e=>({state:e,effects:[]});function xp(e,t,n,r,o,i,s){const a=Xu({messages:e,isTaskRunning:t,currentMode:n});if(!a)return e;let c=a.message;var l;if("failed"===i?c=function(e,t,n){const r=tp(e.parts,e=>"progress"===e.type&&e.browserToolName===t),o=r>=0?r:tp(e.parts,ep);if(o<0)return e;const i=Qu(e.parts[o].content);if(n.toLowerCase().includes("cancelled by cleanup"))return np(e,o,{status:"completed",content:i});const s=Qu(n);return np(e,o,{status:"failed",content:s?`${i} (${s})`:i})}(c,r,s||""):"done"!==r&&(c="in_progress"===i?function(e,t,n){const r=Qu(n),o=e.parts.findIndex(e=>ep(e)&&e.browserToolName===t);return o>=0?np(e,o,{content:r}):{...e,parts:[...e.parts,{type:"progress",content:r,status:"in_progress",browserToolName:t}]}}(c,r,o||(e=>rp.get(e)??e)(r)):np(l=c,tp(l.parts,ep),{status:"completed"})),t&&("show"===n||"do"===n)){const e="in_progress"===i&&"show"===n&&Ku.has(r);c={...c,placeholderState:e?"waiting-for-user":"thinking"}}const d=[...e];return d[a.index]=c,d}function kp(e,t,n){const r=Xu({messages:e.messages,isTaskRunning:e.task.isTaskRunning,currentMode:t}),o=[...e.messages];return r&&(o[r.index]=n(r.message)),{messages:o,task:{isTaskRunning:!1}}}var Sp={completed:"done",failed:"failed",stopped:"stopped"};function _p(e,t,n,r){const o=e.messages.map(e=>{if(e.id!==t)return e;const o=[...e.parts],i=o[o.length-1],s="text"===i?.type&&!0===i.streaming,a=r&&s?i.content+n:n,c={type:"text",content:a,...r&&{streaming:!0}};return s?o[o.length-1]=c:o.push(c),{...e,content:a,isPlaceholder:!1,placeholderState:void 0,parts:o}});return{...e,messages:o}}function Ep(e,t,n){const r=e.messages.map(e=>e.id!==t?e:{...e,content:n,isPlaceholder:!1,placeholderState:void 0,parts:[...e.parts,{type:"text",content:n}]});return{...e,messages:r}}var Cp=n(void 0),Ip=({children:e})=>{const[t,n]=p({isOpen:!1,activeView:"home",currentMode:"tell",isLoading:!1}),r=d(()=>({setActiveView:e=>n(t=>({...t,activeView:e})),toggleWidget:()=>n(e=>({...e,isOpen:!e.isOpen})),closeWidget:()=>n(e=>({...e,isOpen:!1})),setMode:e=>n(t=>({...t,currentMode:e})),setLoading:e=>n(t=>({...t,isLoading:e})),setError:e=>n(t=>({...t,error:e})),applyState:e=>n(t=>({...t,...e}))}),[]);/* @__PURE__ */
14
14
  return g(Cp.Provider,{value:{uiState:t,uiActions:r},children:e})},Tp=()=>{const e=s(Cp);if(!e)throw new Error("useUIStateContext must be used within UIStateProvider");return e},zp=n(void 0),Mp=({children:e,previewMode:t=!1})=>{const{uiState:n,uiActions:r}=Tp(),[o,s]=p(()=>({messages:[],task:{isTaskRunning:!1}})),c=u(o),l=u(n.currentMode);l.current=n.currentMode;const h=u(/* @__PURE__ */new Set),f=i(e=>{const t=c.current,n=e(t);n===t||n.messages===t.messages&&n.task===t.task||(c.current=n,s(n))},[]),m=i(e=>{f(t=>({...t,messages:[...t.messages,e]}))},[f]),y=i((e,t)=>{f(n=>({...n,messages:n.messages.map(n=>n.id===e?{...n,...t}:n)}))},[f]),b=i(e=>{f(t=>({...t,messages:t.messages.filter(t=>t.id!==e)}))},[f]),v=i(e=>{f(t=>({...t,messages:e}))},[f]),w=i(()=>{f(e=>({...e,messages:[]}))},[f]),x=i(e=>{f(t=>({...t,task:{isTaskRunning:e}}))},[f]),k=i(async(e,n,o)=>{const i=n??l.current;if(t)return o||m(Bu(e,i)),void m(Hu("This is a preview. In production, I'll respond to your messages here."));const s=ds.getConfig();if(!s||!s.mtxId&&!s.mtxKey&&!s.mtxApp)return void m(Hu("Configuration error: Missing API credentials. Please check your widget settings."));o||m(Bu(e,i));const a=`temp-${globalThis.crypto.randomUUID()}`;m({id:a,content:"",sender:"agent",timestamp:/* @__PURE__ */new Date,mode:i,isPlaceholder:!0,placeholderState:"thinking",parts:[]}),r.setLoading(!0);try{await qu(s,e,i,a)}catch(c){f(e=>Ep(e,a,"I'm sorry, I encountered an error processing your request. Please try again."))}finally{r.setLoading(!1)}},[t,m,f,r]);a(()=>{if(t)return;const e=Nc.getInstance(),n=async t=>{const{toolCallId:n,tool:r,args:o,mode:i,explanation:s}=t,a=await vp.executeTool(r,o,i,s),c=a.success?void 0:a.error??"Tool execution failed";f(e=>function(e,t,n,r,o,i){return{...e,messages:xp(e.messages,e.task.isTaskRunning,o,t,n,r,i)}}(e,r,s,c?"failed":"completed",l.current,c)),c||"done"!==r||f(e=>function(e,t){return kp(e,t,e=>({...e,taskStatus:"done"}))}(e,l.current)),e.send({type:"tool/response",tool_call_id:n,success:a.success,data:JSON.stringify(a.data),error:c}).catch(e=>{})},o={onMessage:async t=>{if("tool/call"===t.type){const n=t.tool_call_id;if(h.current.has(n))return;if(h.current.add(n),h.current.size>1e3&&(h.current=new Set([...h.current].slice(-500))),!rp.has(t.browser_tool))return void e.send({type:"tool/response",tool_call_id:n,success:!1,error:`Unknown tool: ${t.browser_tool}`}).catch(e=>{})}else"task/status"!==t.type||"completed"!==t.status&&"failed"!==t.status&&"stopped"!==t.status||h.current.clear();let o=[];f(e=>{const n=function(e,t,n){switch(t.type){case"tool/call":{const r=e.task.isTaskRunning?e.task:{isTaskRunning:!0},o=t.explanation||"";return{state:{messages:xp(e.messages,r.isTaskRunning,n,t.browser_tool,o,"in_progress"),task:r},effects:[{type:"executeTool",toolCallId:t.tool_call_id,tool:t.browser_tool,args:t.args,mode:t.mode||n||"do",explanation:o}]}}case"task/status":{if("running"===t.status)return wp(e);const r=t.message?{content:t.message}:{},o=t.status;return{state:kp(e,n,"has_question"===o?e=>({...e,placeholderState:"waiting-for-user",...r}):e=>({...e,taskStatus:Sp[o],...r})),effects:[]}}case"chat/delta":return{state:_p(e,t.request_id,t.text,!0),effects:[]};case"chat/response":return{state:_p(e,t.request_id,t.text,!1),effects:[{type:"setLoading",value:!1}]};case"chat/error":return{state:Ep(e,t.request_id,`Error: ${t.error}`),effects:[{type:"setLoading",value:!1}]};default:return wp(e)}}(e,t,l.current);return o=n.effects,n.state});for(const e of o)"setLoading"===e.type?r.setLoading(e.value):await n(e)},onError:e=>{r.setError(e.message)}};return e.addCallbacks(o),()=>{e.removeCallbacks(o)}},[t,f,r]);const S=i(async()=>{f(e=>function(e,t){return kp(e,t,e=>({...e,taskStatus:"stopped"}))}(e,l.current)),t||Nc.getInstance().send({type:"chat/stop"}).catch(e=>{r.setError("Could not stop the assistant — it may still be working.")})},[t,f,r]),_=d(()=>({addMessage:m,updateMessage:y,removeMessage:b,setMessages:v,clearMessages:w,messageDispatch:k}),[m,y,b,v,w,k]),E=d(()=>({setTaskState:x,stopTask:S}),[x,S]);/* @__PURE__ */
15
- return g(zp.Provider,{value:{messages:o.messages,chatActions:_,taskState:o.task,taskActions:E},children:e})},Op=()=>{const e=s(zp);if(!e)throw new Error("useChatContext must be used within ChatProvider");return e},Rp=n(null),Np=({previewMode:e})=>{const{uiState:t}=Tp(),{messages:n,taskState:r}=Op();return a(()=>{if(e)return;const{currentMode:o,isOpen:i}=t;Uu.persist({messages:n,...r,currentMode:o,isOpen:i})},[e,n,r,t]),null},Ap=({children:e,previewMode:t})=>{const{uiActions:n}=Tp(),{chatActions:r,taskActions:o}=Op();return a(()=>{if(t)return;let e=!1;return(async()=>{const t=await us.getOrCreateChatId();if(e)return;const{messages:i,isTaskRunning:s,...a}=Uu.restore();n.applyState(a),r.setMessages(i),o.setTaskState(s),Nc.getInstance().connect(t).catch(e=>{})})().catch(t=>{e||n.setError("Widget failed to initialise — please refresh the page.")}),()=>{e=!0}},[]),/* @__PURE__ */y(m,{children:[e,/* @__PURE__ */g(Np,{previewMode:t})]})},Pp=({children:e,previewMode:t=!1})=>/* @__PURE__ */g(Ip,{children:/* @__PURE__ */g(Mp,{previewMode:t,children:/* @__PURE__ */g(Ap,{previewMode:t,children:e})})});function Dp(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function $p(e){return function(e){const t=Dp(e);if(!t)return.5;const[n,r,o]=[t.r/255,t.g/255,t.b/255].map(e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return.2126*n+.7152*r+.0722*o}(e)>.5?"#000000":"#ffffff"}function Lp(e,t){if(e.startsWith("rgba")||e.startsWith("rgb")){const n=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n)return`rgba(${n[1]}, ${n[2]}, ${n[3]}, ${t})`}const n=Dp(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`:e}var jp={widget_background_color:"#ffffff",widget_text_color:"#1f2937",widget_border_color:"#e5e7eb",widget_accent_color:"#3b82f6",widget_secondary_color:"#6b7280",widget_border_radius:"20px",widget_animation_duration:"300ms",widget_fade_duration:"200ms"};function Fp(e={}){const t=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));return function(e){return{color:{background:e.widget_background_color,foreground:e.widget_text_color,foregroundMuted:Lp(e.widget_text_color,.6),foregroundFaint:Lp(e.widget_text_color,.4),border:e.widget_border_color,primary:e.widget_accent_color,primaryForeground:$p(e.widget_accent_color),primaryHover:Lp(e.widget_accent_color,.85),secondary:e.widget_secondary_color,secondaryForeground:"#ffffff",secondaryBg:Lp(e.widget_secondary_color,.2),secondaryHover:Lp(e.widget_secondary_color,.3)},radius:e.widget_border_radius,motion:{durationAnimation:e.widget_animation_duration,durationFade:e.widget_fade_duration}}}({...jp,...t})}var Up=n(null),Wp=()=>{const e=s(Up);if(!e)throw new Error("useWidgetConfig must be used within MarketrixWidget");return e},Bp=()=>{const{uiState:e,uiActions:t}=Tp(),{messages:n,chatActions:r,taskState:o,taskActions:s}=Op(),a=d(()=>({...e,...o,messages:n}),[e,n,o]),c=i(()=>{r.clearMessages(),s.setTaskState(!1),t.setError(void 0)},[r,s,t]);return{state:a,actions:d(()=>({...t,...s,...r,clearChatHistory:c}),[t,s,r,c])}},Hp=20,Zp={bottom_right:{classes:"bottom-5 right-5",vertical:"bottom",horizontal:"right"},bottom_left:{classes:"bottom-5 left-5",vertical:"bottom",horizontal:"left"},top_right:{classes:"top-5 right-5",vertical:"top",horizontal:"right"},top_left:{classes:"top-5 left-5",vertical:"top",horizontal:"left"}},qp=e=>Zp[e]??Zp.bottom_right,Vp=e=>{const{vertical:t,horizontal:n}=qp(e);return{[t]:"20px",[n]:"20px"}},Gp=(e,t,n,r,o)=>{const{vertical:i,horizontal:s}=qp(e);return{x:"left"===s?Hp:t-Hp-r,y:"top"===i?Hp:n-Hp-o}},Yp="cubic-bezier(0.16, 1, 0.3, 1)";function Jp({position:e,onDrag:n,isPreviewMode:r=!1,wrapperRef:o}){const[s,a]=p(!1),[c,d]=p({w:56,h:56}),[,h]=p(0),f=u(null),m=u(null),g=u(null),y=u(0),b=u([]),v=u(0),w=()=>{null!==g.current&&window.cancelAnimationFrame(g.current),g.current=null};t.useEffect(()=>w,[]),t.useEffect(()=>{if(r)return;const e=()=>h(e=>e+1);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const x=i(()=>{if(!o.current||"undefined"==typeof window)return;const e=o.current.getBoundingClientRect();d(t=>t.w===e.width&&t.h===e.height?t:{w:e.width,h:e.height})},[o]);l(()=>{x();const e="undefined"!=typeof window&&o.current?new ResizeObserver(x):null;return e&&o.current&&e.observe(o.current),()=>e?.disconnect()},[x,e,o]);const k="undefined"!=typeof window?window.innerWidth:0,S="undefined"!=typeof window?window.innerHeight:0,_=Gp(e,k,S,c.w,c.h),E=!r&&k>0&&S>0?{left:_.x,top:_.y}:void 0,C=(e,t=.999)=>e/1e3*t/(1-t),I=()=>{w(),o.current&&(o.current.style.transform="",o.current.style.willChange="",o.current.style.transition="")},T=i((e,t)=>{if(f.current)return;let r=!1;const i=()=>{r||(r=!0,f.current=null,t.style.transition="none",t.style.willChange="",n(e),a(!1),requestAnimationFrame(()=>{o.current&&(o.current.style.transition="")}))};f.current=i;const s=window.setTimeout(i,650);t.addEventListener("transitionend",function e(n){n.target===t&&"left"===n.propertyName&&(window.clearTimeout(s),t.removeEventListener("transitionend",e),i())})},[n,o]),z=i((t,r,i)=>{if(!o.current||!E)return I(),n(t),void a(!1);w();const s=o.current,l=Gp(e,k,S,c.w,c.h),d=Gp(t,k,S,c.w,c.h);s.style.transition="none",s.style.transform="none",s.style.willChange="left, top",s.style.left=`${l.x+r}px`,s.style.top=`${l.y+i}px`,requestAnimationFrame(()=>{s.style.transition=`left 600ms ${Yp}, top 600ms ${Yp}`,s.style.left=`${d.x}px`,s.style.top=`${d.y}px`}),T(t,s)},[T,n,E,e,k,S,c.w,c.h,o]),M=e=>{I(),m.current=null,a(!1),e.currentTarget.releasePointerCapture(e.pointerId)};return{isDragging:s,pixelPositionStyle:E,onPointerDown:e=>{m.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,dragging:!1,lastX:0,lastY:0},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{const t=m.current;if(t?.pointerId!==e.pointerId)return;const n=e.clientX-t.startX,r=e.clientY-t.startY;if(!t.dragging&&Math.hypot(n,r)>5&&(t.dragging=!0,a(!0),b.current=[],v.current=0,o.current&&(o.current.style.willChange="transform",o.current.style.transition="none")),!t.dragging)return;t.lastX=n,t.lastY=r;const i=Date.now();i-v.current>=10&&(v.current=i,b.current=[...b.current.slice(-5),{x:e.clientX,y:e.clientY,t:i}]),null===g.current&&(g.current=window.requestAnimationFrame(()=>{g.current=null;const e=m.current,t=o.current;t&&e&&(t.style.transform=`translate3d(${e.lastX}px, ${e.lastY}px, 0)`)}))},onPointerUp:t=>{const n=m.current;if(n?.pointerId===t.pointerId){if(n.dragging){const r=(()=>{const e=b.current;if(e.length<2)return{x:0,y:0};const t=e[e.length-1].t-e[0].t;return t<=0?{x:0,y:0}:{x:(e[e.length-1].x-e[0].x)/t*1e3,y:(e[e.length-1].y-e[0].y)/t*1e3}})(),i=C(r.x),s=C(r.y),a={dx:n.lastX+i,dy:n.lastY+s},c=o.current?.getBoundingClientRect(),l=c?((e,t,n,r,o,i)=>{const s=Gp(t,n,r,o,i),a=s.x+e.dx,c=s.y+e.dy;let l=t,d=1/0;for(const u of Object.keys(Zp)){const e=Gp(u,n,r,o,i),t=Math.hypot(a-e.x,c-e.y);t<d&&(d=t,l=u)}return l})(a,e,window.innerWidth,window.innerHeight,c.width,c.height):e;return z(l,n.lastX,n.lastY),y.current=Date.now()+600,m.current=null,void t.currentTarget.releasePointerCapture(t.pointerId)}M(t)}},onPointerCancel:e=>{m.current?.pointerId===e.pointerId&&M(e)},suppressUntilRef:y}}var Xp=({onDrag:e})=>{const{isPreviewMode:t=!1,widget_accent_color:n,widget_background_color:r,widget_border_radius:o,widget_position:i,widget_position_z_index:s}=Wp(),{state:a,actions:c}=Bp(),l=a.isOpen,d=a.isTaskRunning,p=!!a.error,h=!l&&(a.isLoading||d),f=!l&&d,m=p?"marketrix-widget-button-error-glow":"marketrix-widget-button-processing-glow",b=p?"marketrix-widget-button-error-activity-ring":"marketrix-widget-button-processing-activity-ring",v=Math.max(6,Math.min(22,Number.parseFloat(o)||12)),w=u(null),{isDragging:x,pixelPositionStyle:k,onPointerDown:S,onPointerMove:_,onPointerUp:E,onPointerCancel:C,suppressUntilRef:I}=Jp({position:i,onDrag:e,isPreviewMode:t,wrapperRef:w}),T=(e=>qp(e).classes)(i);/* @__PURE__ */
16
- return g(Eu,{ref:w,className:`${t?"absolute":"fixed"} ${k?"":T} ${x?"":"transition-transform duration-300 ease-in-out"}`,style:{zIndex:s,pointerEvents:l?"none":"auto",...t?Vp(i):{},...k},children:/* @__PURE__ */y(Eu,{className:`\n group relative w-14 h-14 overflow-visible transition-all duration-300 ease-in-out\n ${l?"scale-0 opacity-0 pointer-events-none":"scale-100 opacity-100 hover:scale-110"}\n `,children:[h&&/* @__PURE__ */g(Eu,{className:m,"aria-hidden":!0}),f&&!x&&/* @__PURE__ */g(vu,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),c.stopTask()},className:"absolute top-1/2 z-20 -translate-y-1/2 rounded-full border border-white/25 bg-gray-900 px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wide text-white shadow-lg opacity-0 transition-opacity duration-150 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:pointer-events-auto "+(i.includes("left")?"left-full ml-2":"right-full mr-2"),style:{border:"1px solid rgba(255,255,255,0.25)"},"aria-label":"Stop simulation",children:"Stop"}),
17
- /* @__PURE__ */g(vu,{type:"button",variant:"bare",onClick:()=>{Date.now()<I.current||c.toggleWidget()},onDragStart:e=>e.preventDefault(),onPointerDown:S,onPointerMove:_,onPointerUp:E,onPointerCancel:C,className:"relative z-10 w-14 h-14 min-w-14",style:{touchAction:"none",cursor:x?"grabbing":"grab",userSelect:"none",WebkitUserSelect:"none"},"aria-label":l?"Close":"Open","aria-live":"polite",children:/* @__PURE__ */g(Cu,{className:"w-full h-full items-center justify-center relative",children:/* @__PURE__ */y(Eu,{className:"\n relative w-12 h-12 overflow-hidden transition-[transform,opacity,background-color] duration-[167ms] ease-[cubic-bezier(0.33,0,0,1)]\n hover:scale-110 hover:duration-[250ms] active:scale-[0.85] active:duration-[134ms] active:ease-[cubic-bezier(0.45,0,0.2,1)]\n animate-launcher-entrance\n ",style:{borderRadius:o,backgroundColor:l?r:n,boxShadow:Fc.fab},children:[h&&/* @__PURE__ */g("svg",{className:b,viewBox:"0 0 54 54",fill:"none","aria-hidden":!0,children:/* @__PURE__ */g("rect",{x:"1.25",y:"1.25",width:"51.5",height:"51.5",rx:v+1,ry:v+1})}),
18
- /* @__PURE__ */g(Cu,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:l?"rotate(30deg) scale(0)":"rotate(0deg) scale(1)",opacity:l?0:1,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":l,children:/* @__PURE__ */g(yd,{src:jc,alt:"",className:"relative z-10 w-full h-full object-contain",draggable:!1,onDragStart:e=>e.preventDefault(),style:{borderRadius:o,border:"none",outline:"none",backgroundColor:"transparent",pointerEvents:"none",userSelect:"none"}})}),
19
- /* @__PURE__ */g(Cu,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:l?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:l?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!l,children:/* @__PURE__ */g(Tu,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]})})};function Kp(e){const t=e.getRootNode();return(t instanceof ShadowRoot?t.activeElement:document.activeElement)??null}function Qp(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent&&!e.hasAttribute("aria-hidden"))}function eh(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function th(e,t,n){return Math.min(Math.max(e,t),n)}var nh={"bottom-right":{growX:1,growY:1,cursor:"nwse-resize"},"bottom-left":{growX:-1,growY:1,cursor:"nesw-resize"},"top-right":{growX:1,growY:-1,cursor:"nesw-resize"},"top-left":{growX:-1,growY:-1,cursor:"nwse-resize"}};function rh(e,t,n,r){const o=`marketrix_widget_size_${n}`,s=u({width:360,height:450}),a=u(null),[c,l]=p(()=>function(e){try{const t=JSON.parse(as(e)??"null");return"number"!=typeof t?.width||"number"!=typeof t?.height?null:{width:th(t.width,280,600),height:th(t.height,320,Math.floor(.85*window.innerHeight))}}catch(t){return null}}(o)??{width:eh(e),height:eh(t)});s.current=c;const d=i(e=>t=>{if(t.preventDefault(),t.stopPropagation(),r)return;const n=t.clientX,i=t.clientY,c=s.current.width,d=s.current.height,{growX:u,growY:p,cursor:h}=nh[e];a.current&&(a.current.dataset.resizing="true");const f=e=>{const t={width:th(c+(e.clientX-n)*u,280,600),height:th(d+(e.clientY-i)*p,320,Math.floor(.85*window.innerHeight))};s.current=t,a.current&&(a.current.style.width=`${t.width}px`,a.current.style.height=`${t.height}px`)},m=()=>{if(document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect="",a.current&&delete a.current.dataset.resizing,l({...s.current}),!r){const{width:e,height:t}=s.current;cs(o,JSON.stringify({width:e,height:t}))}};document.body.style.cursor=h,document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",m)},[r,o]);return{widthPx:`${c.width}px`,heightPx:`${c.height}px`,onResizeStart:d,containerRef:a}}var oh=({title:e,subtitle:t,onClose:n,controls:r})=>/* @__PURE__ */y(Cu,{align:"center",justify:"between",paddingX:"lg",paddingY:"md",border:"bottom",shrink:!1,elevation:"section",children:[/* @__PURE__ */y(Cu,{align:"center",gap:"md",minWidth:"0",grow:!0,children:[/* @__PURE__ */g(yd,{src:jc,alt:"",size:"md",rounded:"theme",elevation:"card"}),/* @__PURE__ */y(Ru,{minWidth:"0",children:[/* @__PURE__ */g(Du,{size:"sm",weight:"semibold",truncate:!0,leading:"tight",children:e}),null!=t&&/* @__PURE__ */g(Du,{as:"p",size:"xs",variant:"muted",truncate:!0,children:t})]})]}),/* @__PURE__ */y(Cu,{align:"center",gap:"xs",shrink:!1,children:[r,/* @__PURE__ */g(Ou,{size:"sm",label:"Close",onClick:n,children:/* @__PURE__ */g(Tu,{name:"close",size:16})})]})]});function ih(e){const t=u(e);return t.current=e,t}function sh({onScreenSharingChange:e,onStartScreenShareRef:t,onStopScreenShareRef:n,onAddMessage:r,onUpdateMessage:o,onRemoveMessage:i,onSendMessage:s,pendingMessage:l,setPendingMessage:d}){const[u,h]=p(!1),[f,m]=p(null),[g,y]=p(null),[b,v]=p(!1),w=ih(u),x=ih(f),k=ih(e),S=e=>{e&&i?.(e),r(Zu("Stopped screenshare","show","user","stopped-sharing")),m(null)},_=ih(S);a(()=>{const e=()=>{const e=null!==dp(),t=w.current,n=x.current;e!==t&&(w.current=e,h(e),k.current?.(e)),t&&!e&&n&&_.current(n)};e();const t=setInterval(e,1e3);return()=>clearInterval(t)},[]);const E=()=>{v(!0)},C=()=>{if(!l)return;const e=l;d(null),s(e.content,e.mode,e.alreadyAdded)},I=e=>{g&&(o(g,{screenShareStatus:e}),y(null))},T=async()=>{try{const t=await up();h(!0),e?.(!0),I("allowed"),r(Zu("Started screenshare","show","user","started-screenshare"));const n=((e,t="show")=>Wu("screenshare","user","",{mode:t,videoStream:e}))(t,"show");m(n.id),r(n)}catch(t){h(!1),e?.(!1),I("denied")}C()},z=T,M=()=>{lp&&(lp.getTracks().forEach(e=>e.stop()),lp=null),h(!1),e?.(!1),S(f)};return c(t,()=>E),c(n,()=>M),{isScreenSharing:u,showScreenAccessDialog:b,handleScreenAccessDialogAllow:async()=>{v(!1),await T()},handleScreenAccessDialogDeny:()=>{v(!1)},handleScreenAccessAllow:z,handleScreenAccessDeny:()=>{I("denied"),C()},requestScreenAccess:e=>{if(g)return;const t=(e=>Wu("screen-access-request","agent","Can I take a look at your screen?",{mode:e,isScreenAccessRequest:!0}))(e);y(t.id),r(t)}}}function ah(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}function ch({value:e,onChange:t,onSubmit:n,modes:r=[],activeMode:o,onModeChange:s,disabled:c=!1,taskRunning:l=!1,onStop:d,ref:p}){const h=u(null);a(()=>{const e=h.current;if(!e)return;e.style.height="auto";const{scrollHeight:t}=e;e.style.height=`${Math.min(t,66)}px`,e.style.overflowY=t>66?"auto":"hidden"},[e]);const f=i(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),n())},[n]),m=Boolean(e.trim())&&!c;/* @__PURE__ */
15
+ return g(zp.Provider,{value:{messages:o.messages,chatActions:_,taskState:o.task,taskActions:E},children:e})},Op=()=>{const e=s(zp);if(!e)throw new Error("useChatContext must be used within ChatProvider");return e},Rp=n(null),Np=({previewMode:e})=>{const{uiState:t}=Tp(),{messages:n,taskState:r}=Op();return a(()=>{if(e)return;const{currentMode:o,isOpen:i}=t;Uu.persist({messages:n,...r,currentMode:o,isOpen:i})},[e,n,r,t]),null},Ap=({children:e,previewMode:t})=>{const{uiActions:n}=Tp(),{chatActions:r,taskActions:o}=Op();return a(()=>{if(t)return;let e=!1;return(async()=>{const t=await us.getOrCreateChatId();if(e)return;const{messages:i,isTaskRunning:s,...a}=Uu.restore();n.applyState(a),r.setMessages(i),o.setTaskState(s),Nc.getInstance().connect(t).catch(e=>{})})().catch(t=>{e||n.setError("Widget failed to initialise — please refresh the page.")}),()=>{e=!0}},[]),/* @__PURE__ */y(m,{children:[e,/* @__PURE__ */g(Np,{previewMode:t})]})},Pp=({children:e,previewMode:t=!1})=>/* @__PURE__ */g(Ip,{children:/* @__PURE__ */g(Mp,{previewMode:t,children:/* @__PURE__ */g(Ap,{previewMode:t,children:e})})});function Dp(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function $p(e){return function(e){const t=Dp(e);if(!t)return.5;const[n,r,o]=[t.r/255,t.g/255,t.b/255].map(e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return.2126*n+.7152*r+.0722*o}(e)>.5?"#000000":"#ffffff"}function Lp(e,t){if(e.startsWith("rgba")||e.startsWith("rgb")){const n=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n)return`rgba(${n[1]}, ${n[2]}, ${n[3]}, ${t})`}const n=Dp(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`:e}var jp={widget_background_color:"#ffffff",widget_text_color:"#1f2937",widget_border_color:"#e5e7eb",widget_accent_color:"#3b82f6",widget_secondary_color:"#6b7280"};function Fp(e={}){const t=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));return function(e){return{color:{background:e.widget_background_color,foreground:e.widget_text_color,foregroundMuted:Lp(e.widget_text_color,.6),foregroundFaint:Lp(e.widget_text_color,.4),border:e.widget_border_color,primary:e.widget_accent_color,primaryForeground:$p(e.widget_accent_color),primaryHover:Lp(e.widget_accent_color,.85),secondary:e.widget_secondary_color,secondaryForeground:"#ffffff",secondaryBg:Lp(e.widget_secondary_color,.2),secondaryHover:Lp(e.widget_secondary_color,.3)},radius:"12px",motion:{durationAnimation:"300ms",durationFade:"200ms"}}}({...jp,...t})}var Up=n(null),Wp=()=>{const e=s(Up);if(!e)throw new Error("useWidgetConfig must be used within MarketrixWidget");return e},Bp=()=>{const{uiState:e,uiActions:t}=Tp(),{messages:n,chatActions:r,taskState:o,taskActions:s}=Op(),a=d(()=>({...e,...o,messages:n}),[e,n,o]),c=i(()=>{r.clearMessages(),s.setTaskState(!1),t.setError(void 0)},[r,s,t]);return{state:a,actions:d(()=>({...t,...s,...r,clearChatHistory:c}),[t,s,r,c])}},Hp=20,Zp={bottom_right:{classes:"bottom-5 right-5",vertical:"bottom",horizontal:"right"},bottom_left:{classes:"bottom-5 left-5",vertical:"bottom",horizontal:"left"},top_right:{classes:"top-5 right-5",vertical:"top",horizontal:"right"},top_left:{classes:"top-5 left-5",vertical:"top",horizontal:"left"}},qp=e=>Zp[e]??Zp.bottom_right,Vp=e=>{const{vertical:t,horizontal:n}=qp(e);return{[t]:"20px",[n]:"20px"}},Gp=(e,t,n,r,o)=>{const{vertical:i,horizontal:s}=qp(e);return{x:"left"===s?Hp:t-Hp-r,y:"top"===i?Hp:n-Hp-o}},Yp="cubic-bezier(0.16, 1, 0.3, 1)";function Jp({position:e,onDrag:n,isPreviewMode:r=!1,wrapperRef:o}){const[s,a]=p(!1),[c,d]=p({w:56,h:56}),[,h]=p(0),f=u(null),m=u(null),g=u(null),y=u(0),b=u([]),v=u(0),w=()=>{null!==g.current&&window.cancelAnimationFrame(g.current),g.current=null};t.useEffect(()=>w,[]),t.useEffect(()=>{if(r)return;const e=()=>h(e=>e+1);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const x=i(()=>{if(!o.current||"undefined"==typeof window)return;const e=o.current.getBoundingClientRect();d(t=>t.w===e.width&&t.h===e.height?t:{w:e.width,h:e.height})},[o]);l(()=>{x();const e="undefined"!=typeof window&&o.current?new ResizeObserver(x):null;return e&&o.current&&e.observe(o.current),()=>e?.disconnect()},[x,e,o]);const k="undefined"!=typeof window?window.innerWidth:0,S="undefined"!=typeof window?window.innerHeight:0,_=Gp(e,k,S,c.w,c.h),E=!r&&k>0&&S>0?{left:_.x,top:_.y}:void 0,C=(e,t=.999)=>e/1e3*t/(1-t),I=()=>{w(),o.current&&(o.current.style.transform="",o.current.style.willChange="",o.current.style.transition="")},T=i((e,t)=>{if(f.current)return;let r=!1;const i=()=>{r||(r=!0,f.current=null,t.style.transition="none",t.style.willChange="",n(e),a(!1),requestAnimationFrame(()=>{o.current&&(o.current.style.transition="")}))};f.current=i;const s=window.setTimeout(i,650);t.addEventListener("transitionend",function e(n){n.target===t&&"left"===n.propertyName&&(window.clearTimeout(s),t.removeEventListener("transitionend",e),i())})},[n,o]),z=i((t,r,i)=>{if(!o.current||!E)return I(),n(t),void a(!1);w();const s=o.current,l=Gp(e,k,S,c.w,c.h),d=Gp(t,k,S,c.w,c.h);s.style.transition="none",s.style.transform="none",s.style.willChange="left, top",s.style.left=`${l.x+r}px`,s.style.top=`${l.y+i}px`,requestAnimationFrame(()=>{s.style.transition=`left 600ms ${Yp}, top 600ms ${Yp}`,s.style.left=`${d.x}px`,s.style.top=`${d.y}px`}),T(t,s)},[T,n,E,e,k,S,c.w,c.h,o]),M=e=>{I(),m.current=null,a(!1),e.currentTarget.releasePointerCapture(e.pointerId)};return{isDragging:s,pixelPositionStyle:E,onPointerDown:e=>{m.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,dragging:!1,lastX:0,lastY:0},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{const t=m.current;if(t?.pointerId!==e.pointerId)return;const n=e.clientX-t.startX,r=e.clientY-t.startY;if(!t.dragging&&Math.hypot(n,r)>5&&(t.dragging=!0,a(!0),b.current=[],v.current=0,o.current&&(o.current.style.willChange="transform",o.current.style.transition="none")),!t.dragging)return;t.lastX=n,t.lastY=r;const i=Date.now();i-v.current>=10&&(v.current=i,b.current=[...b.current.slice(-5),{x:e.clientX,y:e.clientY,t:i}]),null===g.current&&(g.current=window.requestAnimationFrame(()=>{g.current=null;const e=m.current,t=o.current;t&&e&&(t.style.transform=`translate3d(${e.lastX}px, ${e.lastY}px, 0)`)}))},onPointerUp:t=>{const n=m.current;if(n?.pointerId===t.pointerId){if(n.dragging){const r=(()=>{const e=b.current;if(e.length<2)return{x:0,y:0};const t=e[e.length-1].t-e[0].t;return t<=0?{x:0,y:0}:{x:(e[e.length-1].x-e[0].x)/t*1e3,y:(e[e.length-1].y-e[0].y)/t*1e3}})(),i=C(r.x),s=C(r.y),a={dx:n.lastX+i,dy:n.lastY+s},c=o.current?.getBoundingClientRect(),l=c?((e,t,n,r,o,i)=>{const s=Gp(t,n,r,o,i),a=s.x+e.dx,c=s.y+e.dy;let l=t,d=1/0;for(const u of Object.keys(Zp)){const e=Gp(u,n,r,o,i),t=Math.hypot(a-e.x,c-e.y);t<d&&(d=t,l=u)}return l})(a,e,window.innerWidth,window.innerHeight,c.width,c.height):e;return z(l,n.lastX,n.lastY),y.current=Date.now()+600,m.current=null,void t.currentTarget.releasePointerCapture(t.pointerId)}M(t)}},onPointerCancel:e=>{m.current?.pointerId===e.pointerId&&M(e)},suppressUntilRef:y}}var Xp=({onDrag:e})=>{const{isPreviewMode:t=!1,widget_accent_color:n,widget_background_color:r,widget_position:o,widget_position_z_index:i}=Wp(),{state:s,actions:a}=Bp(),c=s.isOpen,l=s.isTaskRunning,d=!!s.error,p=!c&&(s.isLoading||l),h=!c&&l,f=d?"marketrix-widget-button-error-glow":"marketrix-widget-button-processing-glow",m=d?"marketrix-widget-button-error-activity-ring":"marketrix-widget-button-processing-activity-ring",b=u(null),{isDragging:v,pixelPositionStyle:w,onPointerDown:x,onPointerMove:k,onPointerUp:S,onPointerCancel:_,suppressUntilRef:E}=Jp({position:o,onDrag:e,isPreviewMode:t,wrapperRef:b}),C=(e=>qp(e).classes)(o);/* @__PURE__ */
16
+ return g(Eu,{ref:b,className:`${t?"absolute":"fixed"} ${w?"":C} ${v?"":"transition-transform duration-300 ease-in-out"}`,style:{zIndex:i,pointerEvents:c?"none":"auto",...t?Vp(o):{},...w},children:/* @__PURE__ */y(Eu,{className:`\n group relative w-14 h-14 overflow-visible transition-all duration-300 ease-in-out\n ${c?"scale-0 opacity-0 pointer-events-none":"scale-100 opacity-100 hover:scale-110"}\n `,children:[p&&/* @__PURE__ */g(Eu,{className:f,"aria-hidden":!0}),h&&!v&&/* @__PURE__ */g(vu,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),a.stopTask()},className:"absolute top-1/2 z-20 -translate-y-1/2 rounded-full border border-white/25 bg-gray-900 px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wide text-white shadow-lg opacity-0 transition-opacity duration-150 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:pointer-events-auto "+(o.includes("left")?"left-full ml-2":"right-full mr-2"),style:{border:"1px solid rgba(255,255,255,0.25)"},"aria-label":"Stop simulation",children:"Stop"}),
17
+ /* @__PURE__ */g(vu,{type:"button",variant:"bare",onClick:()=>{Date.now()<E.current||a.toggleWidget()},onDragStart:e=>e.preventDefault(),onPointerDown:x,onPointerMove:k,onPointerUp:S,onPointerCancel:_,className:"relative z-10 w-14 h-14 min-w-14",style:{touchAction:"none",cursor:v?"grabbing":"grab",userSelect:"none",WebkitUserSelect:"none"},"aria-label":c?"Close":"Open","aria-live":"polite",children:/* @__PURE__ */g(Cu,{className:"w-full h-full items-center justify-center relative",children:/* @__PURE__ */y(Eu,{className:"\n relative w-12 h-12 overflow-hidden transition-[transform,opacity,background-color] duration-[167ms] ease-[cubic-bezier(0.33,0,0,1)]\n hover:scale-110 hover:duration-[250ms] active:scale-[0.85] active:duration-[134ms] active:ease-[cubic-bezier(0.45,0,0.2,1)]\n animate-launcher-entrance\n ",style:{borderRadius:"12px",backgroundColor:c?r:n,boxShadow:Fc.fab},children:[p&&/* @__PURE__ */g("svg",{className:m,viewBox:"0 0 54 54",fill:"none","aria-hidden":!0,children:/* @__PURE__ */g("rect",{x:"1.25",y:"1.25",width:"51.5",height:"51.5",rx:13,ry:13})}),
18
+ /* @__PURE__ */g(Cu,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:c?"rotate(30deg) scale(0)":"rotate(0deg) scale(1)",opacity:c?0:1,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":c,children:/* @__PURE__ */g(yd,{src:jc,alt:"",className:"relative z-10 w-full h-full object-contain",draggable:!1,onDragStart:e=>e.preventDefault(),style:{borderRadius:"12px",border:"none",outline:"none",backgroundColor:"transparent",pointerEvents:"none",userSelect:"none"}})}),
19
+ /* @__PURE__ */g(Cu,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:c?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:c?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!c,children:/* @__PURE__ */g(Tu,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]})})};function Kp(e){const t=e.getRootNode();return(t instanceof ShadowRoot?t.activeElement:document.activeElement)??null}function Qp(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent&&!e.hasAttribute("aria-hidden"))}function eh(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function th(e,t,n){return Math.min(Math.max(e,t),n)}var nh={"bottom-right":{growX:1,growY:1,cursor:"nwse-resize"},"bottom-left":{growX:-1,growY:1,cursor:"nesw-resize"},"top-right":{growX:1,growY:-1,cursor:"nesw-resize"},"top-left":{growX:-1,growY:-1,cursor:"nwse-resize"}};function rh(e,t,n,r){const o=`marketrix_widget_size_${n}`,s=u({width:360,height:450}),a=u(null),[c,l]=p(()=>function(e){try{const t=JSON.parse(as(e)??"null");return"number"!=typeof t?.width||"number"!=typeof t?.height?null:{width:th(t.width,280,600),height:th(t.height,320,Math.floor(.85*window.innerHeight))}}catch(t){return null}}(o)??{width:eh(e),height:eh(t)});s.current=c;const d=i(e=>t=>{if(t.preventDefault(),t.stopPropagation(),r)return;const n=t.clientX,i=t.clientY,c=s.current.width,d=s.current.height,{growX:u,growY:p,cursor:h}=nh[e];a.current&&(a.current.dataset.resizing="true");const f=e=>{const t={width:th(c+(e.clientX-n)*u,280,600),height:th(d+(e.clientY-i)*p,320,Math.floor(.85*window.innerHeight))};s.current=t,a.current&&(a.current.style.width=`${t.width}px`,a.current.style.height=`${t.height}px`)},m=()=>{if(document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect="",a.current&&delete a.current.dataset.resizing,l({...s.current}),!r){const{width:e,height:t}=s.current;cs(o,JSON.stringify({width:e,height:t}))}};document.body.style.cursor=h,document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",m)},[r,o]);return{widthPx:`${c.width}px`,heightPx:`${c.height}px`,onResizeStart:d,containerRef:a}}var oh=({title:e,subtitle:t,onClose:n,controls:r})=>/* @__PURE__ */y(Cu,{align:"center",justify:"between",paddingX:"lg",paddingY:"md",border:"bottom",shrink:!1,elevation:"section",children:[/* @__PURE__ */y(Cu,{align:"center",gap:"md",minWidth:"0",grow:!0,children:[/* @__PURE__ */g(yd,{src:jc,alt:"",size:"md",rounded:"theme",elevation:"card"}),/* @__PURE__ */y(Ru,{minWidth:"0",children:[/* @__PURE__ */g(Du,{size:"sm",weight:"semibold",truncate:!0,leading:"tight",children:e}),null!=t&&/* @__PURE__ */g(Du,{as:"p",size:"xs",variant:"muted",truncate:!0,children:t})]})]}),/* @__PURE__ */y(Cu,{align:"center",gap:"xs",shrink:!1,children:[r,/* @__PURE__ */g(Ou,{size:"sm",label:"Close",onClick:n,children:/* @__PURE__ */g(Tu,{name:"close",size:16})})]})]});function ih(e){const t=u(e);return t.current=e,t}function sh({onScreenSharingChange:e,onStartScreenShareRef:t,onStopScreenShareRef:n,onAddMessage:r,onUpdateMessage:o,onRemoveMessage:i,onSendMessage:s,pendingMessage:l,setPendingMessage:d}){const[u,h]=p(!1),[f,m]=p(null),[g,y]=p(null),[b,v]=p(!1),w=ih(u),x=ih(f),k=ih(e),S=e=>{e&&i?.(e),r(Zu("Stopped screenshare","show","user","stopped-sharing")),m(null)},_=ih(S);a(()=>{const e=()=>{const e=null!==dp(),t=w.current,n=x.current;e!==t&&(w.current=e,h(e),k.current?.(e)),t&&!e&&n&&_.current(n)};e();const t=setInterval(e,1e3);return()=>clearInterval(t)},[]);const E=()=>{v(!0)},C=()=>{if(!l)return;const e=l;d(null),s(e.content,e.mode,e.alreadyAdded)},I=e=>{g&&(o(g,{screenShareStatus:e}),y(null))},T=async()=>{try{const t=await up();h(!0),e?.(!0),I("allowed"),r(Zu("Started screenshare","show","user","started-screenshare"));const n=((e,t="show")=>Wu("screenshare","user","",{mode:t,videoStream:e}))(t,"show");m(n.id),r(n)}catch(t){h(!1),e?.(!1),I("denied")}C()},z=T,M=()=>{lp&&(lp.getTracks().forEach(e=>e.stop()),lp=null),h(!1),e?.(!1),S(f)};return c(t,()=>E),c(n,()=>M),{isScreenSharing:u,showScreenAccessDialog:b,handleScreenAccessDialogAllow:async()=>{v(!1),await T()},handleScreenAccessDialogDeny:()=>{v(!1)},handleScreenAccessAllow:z,handleScreenAccessDeny:()=>{I("denied"),C()},requestScreenAccess:e=>{if(g)return;const t=(e=>Wu("screen-access-request","agent","Can I take a look at your screen?",{mode:e,isScreenAccessRequest:!0}))(e);y(t.id),r(t)}}}function ah(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}function ch({value:e,onChange:t,onSubmit:n,modes:r=[],activeMode:o,onModeChange:s,disabled:c=!1,taskRunning:l=!1,onStop:d,ref:p}){const h=u(null);a(()=>{const e=h.current;if(!e)return;e.style.height="auto";const{scrollHeight:t}=e;e.style.height=`${Math.min(t,66)}px`,e.style.overflowY=t>66?"auto":"hidden"},[e]);const f=i(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),n())},[n]),m=Boolean(e.trim())&&!c;/* @__PURE__ */
20
20
  return y(Ru,{background:"card",rounded:"xl",border:!0,overflow:"hidden",className:"focus-within:border-foreground-faint transition-colors",children:[/* @__PURE__ */g("textarea",{ref:ah(h,p),value:e,onChange:e=>t(e.target.value),onKeyDown:f,placeholder:"Ask anything",disabled:c,rows:1,className:"block w-full min-h-0 resize-none rounded-none border-none bg-transparent px-3 text-sm text-foreground transition-colors placeholder:text-foreground-faint focus:ring-0 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",style:{lineHeight:"20px",paddingTop:"4px",paddingBottom:"2px",minHeight:"unset"}}),/* @__PURE__ */y(Cu,{align:"center",justify:"between",paddingX:"sm",paddingTop:"2xs",paddingBottom:"sm",children:[/* @__PURE__ */g(Cu,{align:"center",gap:"2xs",children:r.map(e=>{const t=o===e.id;/* @__PURE__ */
21
21
  return y("button",{type:"button",className:md("inline-flex cursor-pointer items-center gap-0.5 border-none px-2 py-0.5 text-[11px] font-medium transition-all duration-200",Uc.pill,t?"bg-primary text-primary-foreground shadow-sm":"bg-secondary-bg text-foreground-muted"),onClick:t=>{t.preventDefault(),t.stopPropagation(),s?.(e.id)},children:[/* @__PURE__ */g(Tu,{name:e.icon,size:12}),/* @__PURE__ */g(Du,{as:"span",inheritColor:!0,children:e.label})]},e.id)})}),/* @__PURE__ */g(Ou,{variant:l?"secondary":"primary",size:"sm",disabled:!l&&!m,label:l?"Stop simulation":"Send message",onClick:e=>{e.preventDefault(),e.stopPropagation(),l&&d?d():n()},children:/* @__PURE__ */g(Tu,l?{name:"stop",size:14}:{name:"send",size:16})})]})]})}var lh=/*#__PURE__*/e.createContext(void 0);function dh(t){const n=e.useContext(lh);if(!t&&void 0===n)throw new Error(Kd(27));return n}var uh=/*#__PURE__*/function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({}),ph={"data-starting-style":""},hh={"data-ending-style":""},fh={transitionStatus:e=>"starting"===e?ph:"ending"===e?hh:null},mh=(function(e){e.open="data-open",e.closed="data-closed",e[e.startingStyle=uh.startingStyle]="startingStyle",e[e.endingStyle=uh.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align"}({}),{"data-open":""}),gh={"data-closed":""},yh={"data-anchor-hidden":""},bh={open:e=>e?mh:gh,anchorHidden:e=>e?yh:null},vh={...bh,...fh},wh=/*#__PURE__*/e.forwardRef(function(e,t){const{render:n,className:r,style:o,forceRender:i=!1,...s}=e,a=dh(),c=a.useState("open"),l=a.useState("nested"),d=a.useState("mounted");return hu("div",e,{state:{open:c,transitionStatus:a.useState("transitionStatus")},ref:[a.context.backdropRef,t],stateAttributesMapping:vh,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},s],enabled:i||!l})});function xh(e,t,n,r){let o=!1,i=!1;const s=r??pu;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){i=!0},get isCanceled(){return o},get isPropagationAllowed(){return i},trigger:n,...s}}var kh=0;var Sh=Td.useId;function _h(t,n){if(void 0!==Sh){const e=Sh();return t??(n?`${n}-${e}`:e)}return function(t,n="mui"){const[r,o]=e.useState(t),i=t||r;return e.useEffect(()=>{null==r&&o(`${n}-${kh+=1}`)},[r,n]),i}(t,n)}function Eh(e){return _h(e,"base-ui")}var Ch=/*#__PURE__*/e.forwardRef(function(e,t){const{render:n,className:r,style:o,id:i,...s}=e,a=dh(),c=Eh(i);return a.useSyncedValueWithCleanup("descriptionElementId",c),hu("p",e,{ref:t,props:[{id:c},s]})});function Ih(t){e.useEffect(t,uu)}var Th=class e{static create(){return new e}currentId=0;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=0,t()},e)}isStarted(){return 0!==this.currentId}clear=()=>{0!==this.currentId&&(clearTimeout(this.currentId),this.currentId=0)};disposeEffect=()=>this.clear};function zh(){const e=Md(Th.create).current;return Ih(e.disposeEffect),e}var{userAgent:Mh,platform:Oh,maxTouchPoints:Rh}="undefined"==typeof navigator?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0},Nh=Mh.toLowerCase(),Ah=Oh.toLowerCase(),Ph=/^i(os$|p)/.test(Ah)||"macintel"===Ah&&Rh>1,Dh="android",$h=Ah===Dh||Nh.includes(Dh),Lh=!Ph&&Ah.startsWith("mac"),jh=(Ah.startsWith("win"),!$h&&/^(linux|chrome os)/.test(Ah),Lh||Ph),Fh="undefined"!=typeof CSS&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Uh=(!Fh&&Nh.includes("firefox"),!Fh&&Nh.includes("chrom"),jh),Wh=/jsdom|happydom/.test(Nh);var Bh="data-base-ui-focusable";function Hh(e){let t=e.activeElement;for(;null!=t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Zh(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&_d(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function qh(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Vh(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function Gh(e){return Sd(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function Yh(e){return!!e&&("combobox"===e.getAttribute("role")&&Gh(e))}function Jh(e){return e?e.hasAttribute("data-base-ui-focusable")?e:e.querySelector("[data-base-ui-focusable]")||e:null}function Xh(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Kh(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Qh(e){const t=Md(ef,e).current;return t.next=e,Dd(t.effect),t}function ef(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var tf=null;globalThis.requestAnimationFrame;var nf=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let r=0;r<t.length;r+=1)t[r]?.(e)};request(e){const t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){const t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}},rf=class e{static create(){return new e}static request(e){return nf.request(e)}static cancel(e){return nf.cancel(e)}currentId=tf;request(e){this.cancel(),this.currentId=nf.request(()=>{this.currentId=tf,e()})}cancel=()=>{this.currentId!==tf&&(nf.cancel(this.currentId),this.currentId=tf)};disposeEffect=()=>this.cancel};function of(){const e=Md(rf.create).current;return Ih(e.disposeEffect),e}var sf={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},af={...sf,position:"fixed",top:0,left:0},cf=/*#__PURE__*/e.forwardRef(function(t,n){const[r,o]=e.useState();Dd(()=>{Uh&&Fh&&o("button")},[]);/*#__PURE__*/
22
22
  return g("span",{...t,ref:n,style:af,"aria-hidden":!r||void 0,...{tabIndex:0,role:r},"data-base-ui-focus-guard":""})});function lf(e,t=(e?Cd(e):null)){return!(!(e&&e.isConnected&&t)||function(e){return"hidden"===e.visibility||"collapse"===e.visibility}(t))&&("function"==typeof e.checkVisibility?e.checkVisibility():"none"!==t.display&&"contents"!==t.display)}function df(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return _d(n)?n.host:null}function uf(e){for(const t of Array.from(e.children))if("summary"===vd(t))return t;return null}function pf(e,t){const n=uf(t);return!!n&&(e===n||Zh(n,e))}function hf(e){const t=e?vd(e):"";return null!=e&&e.matches('a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]')&&("summary"!==t||null!=e.parentElement&&"details"===vd(e.parentElement)&&uf(e.parentElement)===e)&&("details"!==t||null==uf(e))&&("input"!==t||"hidden"!==e.type)}function ff(e){if(!hf(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=df(t)){const n=t!==e,r="slot"===vd(t);if(t.hasAttribute("inert"))return!1;if(n&&"details"===vd(t)&&!t.open&&!pf(e,t)||t.hasAttribute("hidden")||!r&&!mf(t,n))return!1}return!0}function mf(e,t){const n=Cd(e);return t?"none"!==n.display:lf(e,n)}function gf(e){const t=e.tabIndex;if(t<0){const t=vd(e);if("details"===t||"audio"===t||"video"===t||Sd(e)&&e.isContentEditable)return 0}return t}function yf(e){if("input"!==vd(e))return null;const t=e;return"radio"===t.type&&""!==t.name?t:null}function bf(e){if(Sd(e)&&"slot"===vd(e)){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Sd(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function vf(e,t){bf(e).forEach(e=>{hf(e)&&t.push(e),vf(e,t)})}function wf(e,t,n){bf(e).forEach(e=>{Sd(e)&&e.matches(t)&&n.push(e),wf(e,t,n)})}function xf(e){return ff(e)&&gf(e)>=0}function kf(e){const t=[];return vf(e,t),t.filter(ff)}function Sf(e){const t=kf(e);return t.filter(e=>gf(e)>=0&&function(e,t){const n=yf(e);if(!n)return!0;const r=t.find(e=>{const t=yf(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{const t=yf(e);return t?.name===n.name&&t.form===n.form})===n}(e,t))}function _f(e,t){const n=Sf(e),r=n.length;if(0===r)return;const o=Hh(eu(e)),i=n.indexOf(o);return n[-1===i?1===t?0:r-1:i+t]}function Ef(e){return _f(eu(e).body,1)||e}function Cf(e){return _f(eu(e).body,-1)||e}function If(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Zh(n,r)}function Tf(e){const t=[];wf(e,"[data-tabindex]",t),t.forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}function zf(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...zf(e,t.id,n)])}function Mf(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){const t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Of(e){return`data-base-ui-${e}`}var Rf=0;function Nf(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;function i(){o&&!o()||e?.focus({preventScroll:n})}if(cancelAnimationFrame(Rf),r)return i(),du;const s=requestAnimationFrame(i);return Rf=s,()=>{Rf===s&&(cancelAnimationFrame(s),Rf=0)}}var Af={inert:/* @__PURE__ */new WeakMap,"aria-hidden":/* @__PURE__ */new WeakMap},Pf="data-base-ui-inert",Df={inert:/* @__PURE__ */new WeakSet,"aria-hidden":/* @__PURE__ */new WeakSet},$f=/* @__PURE__ */new WeakMap,Lf=0;function jf(e){return e?_d(e)?e.host:jf(e.parentNode):null}var Ff=(e,t)=>t.map(t=>{if(e.contains(t))return t;const n=jf(t);return e.contains(n)?n:null}).filter(e=>null!=e),Uf=e=>{const t=/* @__PURE__ */new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Wf=(e,t,n)=>{const r=[],o=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{"script"!==vd(e)&&(t.has(e)?o(e):r.push(e))})};return o(e),r};function Bf(e,t,n,r,{mark:o=!0}){let i=null;r?i="inert":n&&(i="aria-hidden");let s=null,a=null;const c=Ff(t,e),l=o?Wf(t,Uf(c),new Set(c)):[],d=[],u=[];if(i){const e=Af[i],n=function(e){return Df[e]}(i);a=n,s=e;const r=Ff(t,Array.from(t.querySelectorAll("[aria-live]"))),o=c.concat(r);Wf(t,Uf(o),new Set(o)).forEach(t=>{const r=t.getAttribute(i),o=null!==r&&"false"!==r,s=(e.get(t)||0)+1;e.set(t,s),d.push(t),1===s&&o&&n.add(t),o||t.setAttribute(i,"inert"===i?"":"true")})}return o&&l.forEach(e=>{const t=($f.get(e)||0)+1;$f.set(e,t),u.push(e),1===t&&e.setAttribute(Pf,"")}),Lf+=1,()=>{s&&d.forEach(e=>{const t=(s.get(e)||0)-1;s.set(e,t),t||(!a?.has(e)&&i&&e.removeAttribute(i),a?.delete(e))}),o&&u.forEach(e=>{const t=($f.get(e)||0)-1;$f.set(e,t),t||e.removeAttribute(Pf)}),(Lf-=1)||(Af.inert=/* @__PURE__ */new WeakMap,Af["aria-hidden"]=/* @__PURE__ */new WeakMap,Df.inert=/* @__PURE__ */new WeakSet,Df["aria-hidden"]=/* @__PURE__ */new WeakSet,$f=/* @__PURE__ */new WeakMap)}}function Hf(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t;return Bf(e,eu(e[0]).body,n,r,{mark:o})}var Zf={clipPath:"inset(50%)",position:"fixed",top:0,left:0},qf=/*#__PURE__*/e.createContext(null),Vf=()=>e.useContext(qf),Gf=Of("portal");var Yf=/*#__PURE__*/e.forwardRef(function(t,n){const{render:r,className:o,style:i,children:s,container:a,...c}=t,{node:l,nodeId:d,subtree:u}=function(t={}){const{ref:n,container:r,componentProps:o=pu,elementProps:i}=t,s=_h(),a=Vf()?.portalNode,[c,l]=e.useState(null),[d,u]=e.useState(null),p=Nd(e=>{null!==e&&u(e)}),h=e.useRef(null);Dd(()=>{if(null===r)return void(h.current&&(h.current=null,u(null),l(null)));const e=(r&&(xd(r)?r:r.current))??a??document.body;null!=e?h.current!==e&&(h.current=e,u(null),l(e)):h.current&&(h.current=null,u(null),l(null))},[r,a]);const f=hu("div",o,{ref:[n,p],props:[{id:s,[Gf]:""},i]}),m=c&&f?/*#__PURE__*/b.createPortal(f,c):null;return{node:d,nodeId:/*#__PURE__*/e.isValidElement(f)?f.props.id:void 0,subtree:m}}({container:a,ref:n,componentProps:t,elementProps:c}),p=e.useRef(null),h=e.useRef(null),f=e.useRef(null),m=e.useRef(null),[v,w]=e.useState(null),x=e.useRef(!1),k=v?.modal,S=v?.open,_=!!v&&!v.modal&&v.open&&!!l;e.useEffect(()=>{if(l&&!k)return Kh(Xh(l,"focusin",e,!0),Xh(l,"focusout",e,!0));function e(e){l&&e.relatedTarget&&If(e)&&("focusin"===e.type?x.current&&(Tf(l),x.current=!1):(!function(e){Sf(e).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}(l),x.current=!0))}},[l,k]),Dd(()=>{l&&!0===S&&x.current&&(Tf(l),x.current=!1)},[S,l]);const E=e.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:h,beforeInsideRef:f,afterInsideRef:m,portalNode:l,setFocusManagerState:w}),[l]);/*#__PURE__*/
@@ -27,10 +27,8 @@ return g("div",{ref:t,role:"presentation","data-base-ui-inert":"",...r,style:{po
27
27
  return y(lh.Provider,{value:S,children:[u&&/*#__PURE__*/g(wm,{handle:u,store:S}),T&&/*#__PURE__*/g(Bm,{store:S,parentContext:x?.context,isDrawer:f}),"function"==typeof r?r({payload:C}):r]})}function Vm(e){return qm("dialog",e)}var Gm=/*#__PURE__*/e.forwardRef(function(e,t){const{render:n,className:r,style:o,id:i,...s}=e,a=dh(),c=Eh(i);return a.useSyncedValueWithCleanup("titleElementId",c),hu("h2",e,{ref:t,props:[{id:c},s]})}),Ym=({open:e,onClose:t,title:n,description:r,onConfirm:o,confirmLabel:i="Confirm",cancelLabel:a="Cancel"})=>{const c=s(Rp)??document.body;/* @__PURE__ */
28
28
  return g(Vm,{open:e,onOpenChange:(e,n)=>{e||"none"===n.reason||t()},children:/* @__PURE__ */y(Pm,{container:c,children:[/* @__PURE__ */g(wh,{className:"fixed inset-0 z-(--layer-dialog) bg-black/20 animate-dialog-overlay-in"}),/* @__PURE__ */y(Rm,{className:"fixed top-1/2 left-1/2 z-[calc(var(--layer-dialog)+1)] flex max-h-[85vh] w-full max-w-sm -translate-x-1/2 -translate-y-1/2 flex-col overflow-auto rounded-lg bg-card p-4 animate-dialog-content-in",style:Zc("panel"),children:[
29
29
  /* @__PURE__ */g(Gm,{className:"mb-1 text-base font-semibold text-foreground",children:n}),null!=r&&/* @__PURE__ */g(Ch,{className:"mb-4 text-sm leading-relaxed text-muted-foreground",children:r}),
30
- /* @__PURE__ */y(Cu,{gap:"md",justify:"end",children:[/* @__PURE__ */g(vu,{type:"button",variant:"secondary",size:"sm",shape:"pill",onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},children:a}),/* @__PURE__ */g(vu,{type:"button",variant:"primary",size:"sm",shape:"pill",onClick:e=>{e.preventDefault(),e.stopPropagation(),o?.()},children:i})]})]})]})})},Jm={sm:"h-3.5 w-3.5 border-[1.5px]",md:"h-5 w-5 border-2",lg:"h-6 w-6 border-2"};function Xm({label:e,size:t="md",className:n,style:r,ref:o}){/* @__PURE__ */
31
- return y("div",{ref:o,className:md("inline-flex items-center gap-1.5",n),"data-size":t,role:"status",style:r,children:[
32
- /* @__PURE__ */g("div",{"aria-hidden":"true",className:md("animate-spin rounded-full border-current border-t-transparent flex-shrink-0",Jm[t])}),null!=e&&/* @__PURE__ */g("span",{children:e}),
33
- /* @__PURE__ */g("span",{className:"sr-only",children:"Loading"})]})}var Km=({isWaitingForUser:e})=>/* @__PURE__ */y(Cu,{align:"center",gap:"sm",paddingY:"xs",children:[/* @__PURE__ */g(Xm,{size:"sm"}),/* @__PURE__ */g(Du,{as:"span",size:"xs",weight:"normal",variant:"faint",children:e?"Waiting for you to complete the action":"Thinking"})]}),Qm=({message:e,isLastMessage:t})=>{const{isTaskRunning:n}=Bp().state,r="waiting-for-user"===e.placeholderState,o=n&&t&&("show"===e.mode||"do"===e.mode);return e.parts.length>0?/* @__PURE__ */y(Ru,{gap:"sm",children:[e.parts.map((e,t)=>{if("text"===e.type){const n=Qu(e.content);return n?/* @__PURE__ */g(Du,{as:"div",size:"sm",weight:"medium",style:{wordBreak:"break-word",whiteSpace:"pre-wrap",marginBottom:"4px"},children:n},`part-${t}`):null}return"progress"===e.type?/* @__PURE__ */g(Cu,{align:"start",gap:"md",children:/* @__PURE__ */g(Du,{as:"span",size:"xs",weight:"medium",style:{flex:1,whiteSpace:"pre-wrap"},children:e.content})},`part-${t}`):null}),(e.isPlaceholder&&!e.parts.some(e=>"text"===e.type)||o)&&/* @__PURE__ */g(Km,{isWaitingForUser:r})]}):e.isPlaceholder||n&&t&&("show"===e.mode||"do"===e.mode)?/* @__PURE__ */g(Km,{isWaitingForUser:r}):e.content?/* @__PURE__ */g(Du,{as:"div",size:"sm",weight:"medium",style:{wordBreak:"break-word",whiteSpace:"pre-wrap"},children:e.content}):/* @__PURE__ */g(Eu,{})},eg={done:{name:"checkCircle",opacity:1},failed:{name:"exclamationCircle",opacity:.75},stopped:{name:"circle",opacity:.5}},tg=({status:e})=>{const{name:t,opacity:n}=eg[e];/* @__PURE__ */
30
+ /* @__PURE__ */y(Cu,{gap:"md",justify:"end",children:[/* @__PURE__ */g(vu,{type:"button",variant:"secondary",size:"sm",shape:"pill",onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},children:a}),/* @__PURE__ */g(vu,{type:"button",variant:"primary",size:"sm",shape:"pill",onClick:e=>{e.preventDefault(),e.stopPropagation(),o?.()},children:i})]})]})]})})},Jm={sm:"h-3.5 w-3.5 border-[1.5px]",md:"h-5 w-5 border-2",lg:"h-6 w-6 border-2"};function Xm({size:e="md",style:t,ref:n}){/* @__PURE__ */
31
+ return y("div",{ref:n,className:"inline-flex items-center gap-1.5","data-size":e,role:"status",style:t,children:[/* @__PURE__ */g("div",{"aria-hidden":"true",className:md("animate-spin rounded-full border-current border-t-transparent flex-shrink-0",Jm[e])}),/* @__PURE__ */g("span",{className:"sr-only",children:"Loading"})]})}var Km=({isWaitingForUser:e})=>/* @__PURE__ */y(Cu,{align:"center",gap:"sm",paddingY:"xs",children:[/* @__PURE__ */g(Xm,{size:"sm"}),/* @__PURE__ */g(Du,{as:"span",size:"xs",weight:"normal",variant:"faint",children:e?"Waiting for you to complete the action":"Thinking"})]}),Qm=({message:e,isLastMessage:t})=>{const{isTaskRunning:n}=Bp().state,r="waiting-for-user"===e.placeholderState,o=n&&t&&("show"===e.mode||"do"===e.mode);return e.parts.length>0?/* @__PURE__ */y(Ru,{gap:"sm",children:[e.parts.map((e,t)=>{if("text"===e.type){const n=Qu(e.content);return n?/* @__PURE__ */g(Du,{as:"div",size:"sm",weight:"medium",style:{wordBreak:"break-word",whiteSpace:"pre-wrap",marginBottom:"4px"},children:n},`part-${t}`):null}return"progress"===e.type?/* @__PURE__ */g(Cu,{align:"start",gap:"md",children:/* @__PURE__ */g(Du,{as:"span",size:"xs",weight:"medium",style:{flex:1,whiteSpace:"pre-wrap"},children:e.content})},`part-${t}`):null}),(e.isPlaceholder&&!e.parts.some(e=>"text"===e.type)||o)&&/* @__PURE__ */g(Km,{isWaitingForUser:r})]}):e.isPlaceholder||n&&t&&("show"===e.mode||"do"===e.mode)?/* @__PURE__ */g(Km,{isWaitingForUser:r}):e.content?/* @__PURE__ */g(Du,{as:"div",size:"sm",weight:"medium",style:{wordBreak:"break-word",whiteSpace:"pre-wrap"},children:e.content}):/* @__PURE__ */g(Eu,{})},eg={done:{name:"checkCircle",opacity:1},failed:{name:"exclamationCircle",opacity:.75},stopped:{name:"circle",opacity:.5}},tg=({status:e})=>{const{name:t,opacity:n}=eg[e];/* @__PURE__ */
34
32
  return g(Tu,{name:t,size:14,style:{color:Lp(Wp().widget_accent_color,n),flexShrink:0}})},ng="8px 8px 0 0",rg=({label:e,children:t})=>/* @__PURE__ */g(Cu,{position:"absolute",inset:"0",align:"center",justify:"center",style:{backgroundColor:"#111827",borderRadius:ng,zIndex:10},children:/* @__PURE__ */y(Cu,{direction:"column",align:"center",gap:"md",style:{textAlign:"center",padding:"0 16px"},children:[t,/* @__PURE__ */g(Du,{as:"span",size:"xs",weight:"medium",style:{color:"rgba(255,255,255,0.7)"},children:e})]})}),og=({stream:e})=>{const t=u(null),n=u(null),[r,o]=p(!1),[i,s]=p(!1),c=()=>{n.current?.catch(()=>{}),n.current=null};return a(()=>{if(t.current&&e){const r=t.current;o(!1),s(!1),c(),r.srcObject=e;const i=()=>{o(!0)},a=()=>{s(!0),o(!1)};r.addEventListener("loadedmetadata",i),r.addEventListener("error",a);const l=r.play();return n.current=l,l.then(()=>{o(!0)}).catch(e=>{e instanceof Error&&"AbortError"!==e.name&&s(!0),n.current=null}),()=>{r.removeEventListener("loadedmetadata",i),r.removeEventListener("error",a)}}return()=>{c(),t.current&&(t.current.srcObject=null),o(!1),s(!1)}},[e]),e?/* @__PURE__ */y(Eu,{width:"full",overflow:"hidden",position:"relative",style:{marginBottom:"4px",borderRadius:ng,backgroundColor:"#000000",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06)"},children:[!r&&!i&&/* @__PURE__ */g(rg,{label:"Loading stream...",children:/* @__PURE__ */g(Xm,{size:"lg",style:{color:"white"}})}),i&&/* @__PURE__ */g(rg,{label:"Failed to load stream",children:/* @__PURE__ */g(Tu,{name:"alertCircle",size:32,style:{color:"#9ca3af"}})}),
35
33
  /* @__PURE__ */g("video",{ref:t,autoPlay:!0,muted:!0,playsInline:!0,style:{width:"100%",height:"auto",maxHeight:"192px",objectFit:"contain",borderRadius:ng,transition:"opacity 500ms",opacity:r?1:0,minHeight:"120px",background:"linear-gradient(135deg, #111827 0%, #374151 100%)"}}),r&&!i&&/* @__PURE__ */y(Cu,{position:"absolute",align:"center",gap:"sm",animate:"fadeIn",style:{top:"8px",right:"8px",padding:"4px 8px",borderRadius:"9999px",backgroundColor:"rgba(55,65,81,0.9)",backdropFilter:"blur(4px)",zIndex:20,boxShadow:"0 2px 8px rgba(31, 41, 55, 0.4)"},children:[/* @__PURE__ */y(Cu,{position:"relative",align:"center",justify:"center",children:[/* @__PURE__ */g(Eu,{position:"absolute",rounded:"full",animate:"ping",style:{width:"8px",height:"8px",backgroundColor:"white",opacity:.75}}),/* @__PURE__ */g(Eu,{position:"relative",rounded:"full",style:{width:"6px",height:"6px",backgroundColor:"white"}})]}),/* @__PURE__ */g(Du,{as:"span",size:"xs",weight:"semibold",style:{color:"white",textTransform:"uppercase",letterSpacing:"0.05em",fontSize:"10px"},children:"Live"})]}),
36
34
  /* @__PURE__ */g(Cu,{position:"absolute",inset:"0",align:"center",justify:"center",style:{borderRadius:ng,backgroundColor:"rgba(0,0,0,0)",zIndex:30,pointerEvents:"none"},children:/* @__PURE__ */g(Eu,{rounded:"lg",style:{padding:"4px 12px",backgroundColor:"rgba(0,0,0,0.7)",backdropFilter:"blur(4px)"},children:/* @__PURE__ */g(Du,{as:"div",size:"xs",weight:"medium",style:{color:"white"},children:"Screen Sharing Active"})})})]}):null},ig=({message:e,index:t,isLastMessage:n,onScreenAccessAllow:r,onScreenAccessDeny:o})=>{if(e.isSystemMessage)/* @__PURE__ */return g(Cu,{justify:"center",align:"center",children:/* @__PURE__ */g(Du,{as:"span",variant:"faint",weight:"normal",style:{fontSize:"10px"},children:e.content})},`message-${e.id}-${t}`);const i="user"===e.sender,s=i?"show"===e.mode||"do"===e.mode?"mousePointerClick":void 0:e.isScreenAccessRequest||"waiting-for-user"===e.placeholderState?"checkCircle":void 0;/* @__PURE__ */
@@ -50,11 +48,11 @@ return y(Ru,{height:"full",overflow:"hidden",id:"view-home",role:"tabpanel","ari
50
48
  return y(vu,{role:"tab","aria-selected":r,"aria-controls":`view-${n.id}`,id:`tab-${n.id}`,onClick:()=>t(n.id),active:r,stacked:!0,variant:"tab",children:[r&&/* @__PURE__ */g(Du,{as:"span",inheritColor:!0,style:{position:"absolute",top:0,left:"25%",right:"25%"},children:/* @__PURE__ */g("span",{className:"block h-0.5 w-full rounded-full bg-primary"})}),
51
49
  /* @__PURE__ */g(Du,{as:"span",inheritColor:!0,"aria-hidden":"true",children:/* @__PURE__ */g(Tu,{name:n.icon,size:20})}),
52
50
  /* @__PURE__ */g(Du,{as:"span",size:"xs",align:"center",inheritColor:!0,truncate:!0,block:!0,children:n.label})]},n.id)})}),vg=()=>{const e=Wp(),{state:t,actions:n}=Bp(),{isOpen:r,activeView:o}=t,s=e.isPreviewMode??!1,{widthPx:c,heightPx:l,onResizeStart:d,containerRef:h}=rh(e.widget_width,e.widget_height,Pc(e),s),f=u(null),[m,b]=p("forward"),v=u(o);a(()=>{v.current!==o&&(b("chat"===o?"forward":"back"),v.current=o)},[o]),function(e,t,n){const r=u(!1),o=u(null),s=i(()=>{const t=e.current;if(!t)return;const r=n?.focusTargetRef?.current;if(r)return void r.focus({preventScroll:!0});const o=Qp(t);o[0]&&o[0].focus({preventScroll:!0})},[e,n?.focusTargetRef]);a(()=>{if(!t)return r.current&&(o.current?.focus({preventScroll:!0}),o.current=null),void(r.current=!1);const i=e.current;if(!i)return;r.current||(o.current=Kp(i)),r.current=!0,s();const a=e=>{if("Escape"===e.key)return void n?.onEscape?.();if("Tab"!==e.key)return;const t=Qp(i);if(0===t.length)return;const r=Kp(i),o=r?t.indexOf(r):-1;-1!==o&&(e.shiftKey?0===o&&(e.preventDefault(),t[t.length-1].focus()):o===t.length-1&&(e.preventDefault(),t[0].focus()))};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[t,e,s,n?.onEscape])}(h,r,{onEscape:n.closeWidget,focusTargetRef:"chat"===o?f:void 0});const w=Vp(e.widget_position),[x,k]=p(!1),S=u(null),_=u(null);if(!r)return null;const E=e.widget_background_color.includes("gradient")?e.widget_background_color:`linear-gradient(135deg, ${e.widget_background_color} 0%, ${e.widget_background_color} 100%)`,{vertical:C,horizontal:I}=qp(e.widget_position),T="chat"===o&&!1!==e.use_screenshare?()=>{x?_.current?.():S.current?.()}:void 0;/* @__PURE__ */
53
- return y(Ru,{ref:h,position:s?"absolute":"fixed",rounded:"theme",border:!0,overflow:"hidden",style:{zIndex:e.widget_position_z_index,backgroundImage:E,transformOrigin:`${C} ${I}`,width:c,height:l,fontSize:e.widget_font_size,...w,pointerEvents:"auto",scrollbarWidth:"thin",animation:"messenger-entrance 300ms cubic-bezier(0, 1.2, 1, 1)",boxShadow:Fc.panel},children:[
51
+ return y(Ru,{ref:h,position:s?"absolute":"fixed",rounded:"theme",border:!0,overflow:"hidden",style:{zIndex:e.widget_position_z_index,backgroundImage:E,transformOrigin:`${C} ${I}`,width:c,height:l,fontSize:"14px",...w,pointerEvents:"auto",scrollbarWidth:"thin",animation:"messenger-entrance 300ms cubic-bezier(0, 1.2, 1, 1)",boxShadow:Fc.panel},children:[
54
52
  /* @__PURE__ */g(oh,{title:e.widget_header??"AI Agent",subtitle:e.widget_body??"How can I help?",onClose:n.closeWidget,controls:T&&/* @__PURE__ */y(Ou,{variant:"ghost",size:"sm",label:x?"Stop screen sharing":"Start screen sharing",onClick:T,children:[x&&/* @__PURE__ */y("span",{className:"absolute top-0.5 right-0.5 inline-flex h-1.5 w-1.5",children:[/* @__PURE__ */g("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-75"}),/* @__PURE__ */g("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-current"})]}),/* @__PURE__ */g(Tu,{name:"screenShare",size:16})]})}),
55
53
  /* @__PURE__ */g(Eu,{grow:!0,overflow:"hidden",style:{display:"flex",flexDirection:"column",minHeight:0},children:/* @__PURE__ */y(Eu,{"data-view-transition":!0,"data-direction":m,style:{width:"100%",height:"100%"},children:["home"===o&&/* @__PURE__ */g(hg,{onNavigateToChat:()=>{b("forward"),n.setActiveView("chat")},onChipClick:e=>{n.addMessage(Bu(e.text,e.type,"chip-message")),n.setMode(e.type),n.messageDispatch(e.text,e.type,!0)}}),"chat"===o&&/* @__PURE__ */g(dg,{onScreenSharingChange:k,onStartScreenShareRef:S,onStopScreenShareRef:_,messageInputRef:f})]},o)}),
56
54
  /* @__PURE__ */g(bg,{activeView:o,onChange:n.setActiveView}),!s&&/* @__PURE__ */g(gg,{onResizeStart:d})]})},wg=class extends t.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){}render(){return this.state.hasError?null:this.props.children}},xg=({config:e})=>{const[t,n]=p(!1),[r,o]=p(null),{state:i,actions:s}=Bp(),c=Nc.getInstance(),l=e.isPreviewMode??!1,d=Ki.safeParse(e).success;var u;u=i.isOpen,a(()=>{if(!u)return;if(!window.matchMedia("(max-width: 767px)").matches)return;const e=document.documentElement,t=document.body,n=e.style.overflow,r=t.style.overflow;return e.style.overflow="hidden",t.style.overflow="hidden",()=>{e.style.overflow=n,t.style.overflow=r}},[u]);const[h,f]=p(e.widget_position??"bottom_right"),m=`marketrix_widget_position_${Pc(e)}`;a(()=>{d&&ds.setConfig(e)},[e,d]),a(()=>{const t=l?null:as(m);(e=>"string"==typeof e&&e in Zp)(t)?f(t):f(e.widget_position??"bottom_right")},[l,m,e.widget_position]),a(()=>{if(i.isOpen||l||"default"!==e.widget_appearance||!e.widget_greeting_toast)return void n(!1);const t=setTimeout(()=>n(!0),2e3);return()=>clearTimeout(t)},[i.isOpen,l,e.widget_appearance,e.widget_greeting_toast]);if(!d)return null;const b=!e.widget_enabled||!1===e.show_widget||"hidden"===e.widget_appearance;if(!l&&b)return null;const v=Math.max(e.widget_position_z_index??0,qc),w={...e,widget_position:h,widget_position_z_index:v},x=i.isLoading||i.isTaskRunning,k={"--background":(S=Fp(e)).color.background,"--foreground":S.color.foreground,"--card":S.color.background,"--card-foreground":S.color.foreground,"--primary":S.color.primary,"--foreground-muted":S.color.foregroundMuted,"--foreground-faint":S.color.foregroundFaint,"--primary-foreground":S.color.primaryForeground,"--primary-hover":S.color.primaryHover,"--secondary":S.color.secondary,"--secondary-foreground":S.color.secondaryForeground,"--secondary-bg":S.color.secondaryBg,"--secondary-hover":S.color.secondaryHover,"--muted":S.color.border,"--muted-foreground":S.color.secondary,"--border":S.color.border,"--ring":S.color.primary,"--radius":S.radius,"--duration-animation":S.motion.durationAnimation,"--duration-fade":S.motion.durationFade};var S;/* @__PURE__ */
57
55
  return g(Up,{value:w,children:/* @__PURE__ */g(Eu,{ref:o,"data-marketrix-widget":!0,position:"relative",style:{...k,...l&&{width:"100%",height:"100%"}},children:/* @__PURE__ */y(Rp,{value:r,children:[x&&/* @__PURE__ */g(Eu,{"data-screen-edge-glow":!0,position:"fixed",inset:"0",style:{boxShadow:`inset 0 0 22px 2px ${Lp(w.widget_accent_color,.72)}, inset 0 0 46px 10px ${Lp(w.widget_accent_color,.28)}`,pointerEvents:"none",zIndex:Vc}}),
58
56
  /* @__PURE__ */g(wg,{children:/* @__PURE__ */g(vg,{})}),
59
- /* @__PURE__ */g(Xp,{onDrag:e=>{f(e),l||cs(m,e)}}),i.error&&/* @__PURE__ */g($u,{tone:"error",title:i.error,onDismiss:()=>s.setError(void 0),...c.canReconnect()&&{onRetry:()=>{s.setError(void 0),c.reconnectNow()}},position:"top"===qp(h).vertical?"bottom-center":"above-fab"}),t&&!i.error&&e.widget_greeting&&/* @__PURE__ */g($u,{tone:"info",title:e.widget_greeting,body:e.widget_body,onDismiss:()=>n(!1),position:"bottom-center"})]})})})};var kg={instance:null,config:null},Sg=null,_g=0,Eg=(e,t)=>{const n=e.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent='/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--shadow-2xs:0 1px #0000000d;--shadow-xs:0 1px 2px 0 #0000000d;--shadow-sm:var(--shadow-sm);--shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--shadow-lg:var(--shadow-lg);--shadow-xl:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab, var(--ring) 50%, transparent)}}body{background-color:var(--background);color:var(--foreground)}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-0\\.5{inset:calc(var(--spacing) * .5)}.inset-1{inset:var(--spacing)}.inset-1\\.5{inset:calc(var(--spacing) * 1.5)}.inset-2{inset:calc(var(--spacing) * 2)}.inset-3{inset:calc(var(--spacing) * 3)}.inset-4{inset:calc(var(--spacing) * 4)}.inset-6{inset:calc(var(--spacing) * 6)}.top-0\\.5{top:calc(var(--spacing) * .5)}.top-1\\/2{top:50%}.top-5{top:calc(var(--spacing) * 5)}.right-0\\.5{right:calc(var(--spacing) * .5)}.right-5{right:calc(var(--spacing) * 5)}.right-full{right:100%}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-1\\/2{left:50%}.left-5{left:calc(var(--spacing) * 5)}.left-full{left:100%}.z-\\(--layer-dialog\\){z-index:var(--layer-dialog)}.z-10{z-index:10}.z-20{z-index:20}.z-\\[calc\\(var\\(--layer-dialog\\)\\+1\\)\\]{z-index:calc(var(--layer-dialog) + 1)}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-32{margin:calc(var(--spacing) * 32)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-0\\.5{height:calc(var(--spacing) * .5)}.h-1\\.5{height:calc(var(--spacing) * 1.5)}.h-3\\.5{height:calc(var(--spacing) * 3.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[85vh\\]{max-height:85vh}.min-h-0{min-height:0}.min-h-7{min-height:calc(var(--spacing) * 7)}.min-h-9{min-height:calc(var(--spacing) * 9)}.w-1\\.5{width:calc(var(--spacing) * 1.5)}.w-3\\.5{width:calc(var(--spacing) * 3.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-auto{width:auto}.w-full{width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-7{min-width:calc(var(--spacing) * 7)}.min-w-14{min-width:calc(var(--spacing) * 14)}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-0{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-dialog-content-in{animation:dialog-content-in var(--duration-animation) ease-out}.animate-dialog-overlay-in{animation:dialog-overlay-in var(--duration-fade) ease-out}.animate-fade-in{animation:.5s ease-out fade-in}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.overflow-y-hidden{overflow-y:hidden}.rounded{border-radius:.25rem}.rounded-\\[var\\(--radius\\)\\]{border-radius:var(--radius)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\\[1\\.5px\\]{border-style:var(--tw-border-style);border-width:1.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-border{border-color:var(--border)}.border-current{border-color:currentColor}.border-transparent{border-color:#0000}.border-white\\/25{border-color:#ffffff40}@supports (color:color-mix(in lab, red, red)){.border-white\\/25{border-color:color-mix(in oklab, var(--color-white) 25%, transparent)}}.border-t-transparent{border-top-color:#0000}.bg-black\\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-card{background-color:var(--card)}.bg-current{background-color:currentColor}.bg-gray-900{background-color:var(--color-gray-900)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-secondary-bg{background-color:var(--secondary-bg)}.bg-transparent{background-color:#0000}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:0}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-0{padding-top:0}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0{padding-bottom:0}.pb-0\\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-2{padding-left:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-right{text-align:right}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-blue-500{color:var(--color-blue-500)}.text-card-foreground{color:var(--card-foreground)}.text-foreground{color:var(--foreground)}.text-foreground-faint{color:var(--foreground-faint)}.text-foreground-muted{color:var(--foreground-muted)}.text-inherit{color:inherit}.text-muted-foreground{color:var(--muted-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:var(--shadow-lg);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:var(--shadow-sm);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\,background-color\\]{transition-property:transform,opacity,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-\\[160ms\\]{--tw-duration:.16s;transition-duration:.16s}.duration-\\[167ms\\]{--tw-duration:.167s;transition-duration:.167s}.ease-\\[cubic-bezier\\(0\\.33\\,0\\,0\\,1\\)\\]{--tw-ease:cubic-bezier(.33,0,0,1);transition-timing-function:cubic-bezier(.33,0,0,1)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.group-focus-within\\:pointer-events-auto:is(:where(.group):focus-within *){pointer-events:auto}.group-focus-within\\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media (hover:hover){.group-hover\\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-foreground-faint::placeholder{color:var(--foreground-faint)}.focus-within\\:border-foreground-faint:focus-within{border-color:var(--foreground-faint)}@media (hover:hover){.hover\\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\\:border-primary:hover{border-color:var(--primary)}.hover\\:bg-muted:hover{background-color:var(--muted)}.hover\\:bg-primary:hover{background-color:var(--primary)}.hover\\:bg-primary-hover:hover{background-color:var(--primary-hover)}.hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.hover\\:bg-secondary-hover:hover{background-color:var(--secondary-hover)}.hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab, var(--secondary) 80%, transparent)}}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:text-foreground:hover{color:var(--foreground)}.hover\\:text-primary-foreground:hover{color:var(--primary-foreground)}.hover\\:opacity-100:hover{opacity:1}.hover\\:duration-\\[250ms\\]:hover{--tw-duration:.25s;transition-duration:.25s}}.focus\\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\\:outline-ring:focus-visible{outline-color:var(--ring)}.active\\:scale-\\[0\\.85\\]:active{scale:.85}.active\\:duration-\\[134ms\\]:active{--tw-duration:.134s;transition-duration:.134s}.active\\:ease-\\[cubic-bezier\\(0\\.45\\,0\\,0\\.2\\,1\\)\\]:active{--tw-ease:cubic-bezier(.45,0,.2,1);transition-timing-function:cubic-bezier(.45,0,.2,1)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}}:root,:host{--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--border:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--foreground-muted:#1f293799;--foreground-faint:#1f293766;--primary-hover:#3b82f6d9;--secondary-bg:#6b728033;--secondary-hover:#6b72804d;--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--radius:.625rem;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--spacing:.25rem;--duration-animation:.3s;--duration-fade:.2s;--layer-dialog:1100}@media (prefers-reduced-motion:reduce){[data-marketrix-widget]{--duration-animation:0s!important;--duration-fade:0s!important}}@keyframes dialog-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes dialog-content-in{0%{opacity:0;scale:.96}to{opacity:1;scale:1}}@keyframes fade-in{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}:host,[data-marketrix-widget]{font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-marketrix-widget],[data-marketrix-widget] *{pointer-events:auto;box-sizing:border-box;transition:color .2s ease-in-out,background-color .2s ease-in-out,border-color .2s ease-in-out,opacity .2s ease-in-out,box-shadow .2s ease-in-out,transform .2s ease-in-out}[data-marketrix-widget] button,[data-marketrix-widget] input,[data-marketrix-widget] textarea,[data-marketrix-widget] select{font:inherit}[data-resizing=true],[data-resizing=true] *{transition:none!important}@keyframes marketrix-screen-edge-pulse{0%,to{opacity:.55}50%{opacity:1}}[data-screen-edge-glow]{animation:1.6s ease-in-out infinite marketrix-screen-edge-pulse}.marketrix-widget-button-processing-glow,.marketrix-widget-button-error-glow{pointer-events:none;filter:blur(14px);will-change:transform, opacity;border-radius:50%;width:140%;height:140%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}@keyframes widget-activity-dash-travel{0%{stroke-dashoffset:0;opacity:.5}18%{stroke-dashoffset:-112px;opacity:1}35%{stroke-dashoffset:-160px;opacity:.65}60%{stroke-dashoffset:-160px;opacity:.45}82%{stroke-dashoffset:-272px;opacity:1}to{stroke-dashoffset:-320px;opacity:.6}}.marketrix-widget-button-processing-activity-ring,.marketrix-widget-button-error-activity-ring{pointer-events:none;z-index:0;position:absolute;inset:-3px;overflow:visible}.marketrix-widget-button-processing-activity-ring rect,.marketrix-widget-button-error-activity-ring rect{fill:none;stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:40 120;animation:1.9s cubic-bezier(.4,0,.2,1) infinite widget-activity-dash-travel}.marketrix-widget-button-processing-activity-ring rect{stroke:#31d06d;filter:drop-shadow(0 0 3px #31d06db3)}.marketrix-widget-button-error-activity-ring rect{stroke:#d0342c;filter:drop-shadow(0 0 3px #d0342cb3)}@keyframes widget-glow-green{0%,to{opacity:.72;background:radial-gradient(circle,#31d06d00 38%,#31d06d61 58%,#31d06d3d 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:1;background:radial-gradient(circle,#31d06d00 34%,#31d06d8c 56%,#31d06d54 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}.marketrix-widget-button-processing-glow{animation:2s ease-in-out infinite widget-glow-green}@keyframes widget-glow-red{0%,to{opacity:.65;background:radial-gradient(circle,#d0342c00 38%,#d0342c57 58%,#d0342c38 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:.95;background:radial-gradient(circle,#d0342c00 34%,#d0342c80 56%,#d0342c4d 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}.marketrix-widget-button-error-glow{animation:1.5s ease-in-out infinite widget-glow-red}@keyframes launcher-entrance{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.animate-launcher-entrance{animation:.25s ease-out forwards launcher-entrance}@keyframes messenger-entrance{0%{opacity:0;transform:scale(0)}40%{opacity:1}to{transform:scale(1)}}[data-view-transition][data-direction=forward]{animation:.3s both viewSlideForward}[data-view-transition][data-direction=back]{animation:.3s both viewSlideBack}@keyframes viewSlideForward{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes viewSlideBack{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}',n.appendChild(r);const o=document.createElement("div");return o.id=t,n.appendChild(o),{shadowRoot:n,mountEl:o}},Cg=e=>{const t="marketrix-widget-container-"+ ++_g,n=e??document.body;if(n.querySelector(`#${t}`))throw new Error(`Widget container with ID ${t} already exists`);const r=document.createElement("div");r.id=t,r.className="marketrix-widget-container",r.style.pointerEvents="auto",e&&Object.assign(r.style,{width:"100%",height:"100%",position:"relative",overflow:"visible"}),n.appendChild(r);const{shadowRoot:o,mountEl:i}=Eg(r,"marketrix-widget-root");return Object.assign(i.style,{pointerEvents:"auto",width:"100%",height:"100%",position:"relative"}),{container:r,shadowRoot:o,mountEl:i}},Ig=(e,n,r=!1)=>{const o=f(e);return o.render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g(Pp,{previewMode:r,children:/* @__PURE__ */g(xg,{config:n})})})),o},Tg=()=>null!==kg.instance,zg=()=>kg.config,Mg=(e,n="neutral")=>{if("undefined"==typeof window||"undefined"==typeof document)return;Og();const r=document.createElement("div");r.id="marketrix-widget-loader-container",r.className="marketrix-widget-loader-container",document.body.appendChild(r);const{mountEl:o}=Eg(r,"marketrix-widget-loader-root");(Sg=f(o)).render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g($u,{tone:n,title:e,onDismiss:Og})}))},Og=()=>{Sg?.unmount(),Sg=null,document.getElementById("marketrix-widget-loader-container")?.remove()},Rg=e=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(window.__mtx?.state)return;const t=document.querySelectorAll("script[mtx-id]"),n=t[t.length-1];if(!(n&&(r=n,r instanceof HTMLScriptElement)))return;var r;const o=n.getAttribute("mtx-id"),i=n.getAttribute("mtx-key"),s=n.getAttribute("mtx-api-host");if(!o||!i){if(Tg())return;return void Mg("Please configure mtx-id and mtx-key","error")}const a={mtxId:o,mtxKey:i};s&&(a.mtxApiHost=s),"false"===n.getAttribute("mtx-use-screenshare")&&(a.use_screenshare=!1),e(a).catch(e=>{})},Ng=null,Ag=0,Pg=null,Dg=null;function $g(e,t,n=!1){const{container:r,mountEl:o}=Cg(t);Pg=r,kg.instance=Ig(o,e,n),kg.config=e}async function Lg(e,t,n){let r;window.__mtx={state:"initializing"},e.mtxApiHost&&(e=>{if(!e?.trim())throw new Error("API URL is required for SDK configuration");e!==ns&&(ns=e,rs=ts(e))})(e.mtxApiHost),Mg("Loading widget settings...");try{r=await Lc(e)}catch(o){if(n!==Ag)return;return Mg(o instanceof Error?o.message:"Failed to initialize widget","error"),void(window.__mtx=void 0)}n===Ag&&(Og(),$g(r,t),window.__mtx={state:"active"},r.widget_recording&&r.mtxApp&&(async()=>{try{if(await Nc.getInstance().waitUntilRegistered(),n!==Ag)return;const e=await us.getOrCreateChatId();if(n!==Ag)return;const t=new Rc(e,r.mtxApp);Dg=t,await t.start(),n!==Ag&&(t.stop(),Dg===t&&(Dg=null))}catch(o){}})())}var jg=(e,t)=>{if(Ng)return Ng;if(window.__mtx?.state)return Promise.resolve();if(Tg())return Promise.resolve();const n=Lg(e,t,++Ag);return Ng=n,n.then(()=>{Ng===n&&(Ng=null)},()=>{Ng===n&&(Ng=null)}),n},Fg=()=>{Ag++,Nc.getInstance().disconnect(),Dg?.stop(),Dg=null;const e=kg.instance;e&&e.unmount(),kg.instance=null,kg.config=null,Pg&&(Pg.remove(),Pg=null),Ng=null,window.__mtx=void 0,Og()},Ug=async e=>{if(Tg()){const t=zg();if(!t)throw new Error("Widget not initialized");const n={...t,...e};Fg(),await jg(n)}},Wg=({settings:e,container:t,mtxId:n,mtxKey:r,mtxApiHost:o})=>{const i=u(null),s=u(null),c=u(null);return a(()=>{const a=t??i?.current?.parentElement??document.body;if(!(a&&(l=a,l instanceof HTMLElement)))return;var l;const{container:d,mountEl:u}=Cg(a);return c.current=d,s.current=Ig(u,{...Ac(e,{mtxId:n,mtxKey:r,mtxApiHost:o}),isPreviewMode:!0},!0),()=>{s.current&&(s.current.unmount(),s.current=null),c.current&&(c.current.remove(),c.current=null)}},[e,t,n,r,o]),t?null:/* @__PURE__ */g("div",{ref:i,style:{width:"100%",height:"100%",position:"relative"}})},Bg=async e=>{const t=e.container;if(void 0!==e.settings){Fg();const{settings:n,container:r,...o}=e;$g({...Ac(n,o),isPreviewMode:!0},t,!0)}else{if(void 0===e.mtxId||void 0===e.mtxKey)throw new Error("Invalid configuration: provide either settings (preview) or mtxId+mtxKey (production)");{const{container:n,...r}=e;await jg(r,t)}}};"undefined"!=typeof window&&setTimeout(()=>{try{Rg(jg)}catch(e){}},0);var Hg={MarketrixWidget:Wg,mountWidget:Bg,initWidget:jg,unmountWidget:Fg,updateMarketrixConfig:Ug,getCurrentConfig:zg};export{Wg as MarketrixWidget,Hg as default,zg as getCurrentConfig,jg as initWidget,Bg as mountWidget,Fg as unmountWidget,Ug as updateMarketrixConfig};
57
+ /* @__PURE__ */g(Xp,{onDrag:e=>{f(e),l||cs(m,e)}}),i.error&&/* @__PURE__ */g($u,{tone:"error",title:i.error,onDismiss:()=>s.setError(void 0),...c.canReconnect()&&{onRetry:()=>{s.setError(void 0),c.reconnectNow()}},position:"top"===qp(h).vertical?"bottom-center":"above-fab"}),t&&!i.error&&e.widget_greeting&&/* @__PURE__ */g($u,{tone:"info",title:e.widget_greeting,body:e.widget_body,onDismiss:()=>n(!1),position:"bottom-center"})]})})})};var kg={instance:null,config:null},Sg=null,_g=0,Eg=(e,t)=>{const n=e.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent='/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--shadow-2xs:0 1px #0000000d;--shadow-xs:0 1px 2px 0 #0000000d;--shadow-sm:var(--shadow-sm);--shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--shadow-lg:var(--shadow-lg);--shadow-xl:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab, var(--ring) 50%, transparent)}}body{background-color:var(--background);color:var(--foreground)}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-0\\.5{inset:calc(var(--spacing) * .5)}.inset-1{inset:var(--spacing)}.inset-1\\.5{inset:calc(var(--spacing) * 1.5)}.inset-2{inset:calc(var(--spacing) * 2)}.inset-3{inset:calc(var(--spacing) * 3)}.inset-4{inset:calc(var(--spacing) * 4)}.inset-6{inset:calc(var(--spacing) * 6)}.top-0\\.5{top:calc(var(--spacing) * .5)}.top-1\\/2{top:50%}.top-5{top:calc(var(--spacing) * 5)}.right-0\\.5{right:calc(var(--spacing) * .5)}.right-5{right:calc(var(--spacing) * 5)}.right-full{right:100%}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-1\\/2{left:50%}.left-5{left:calc(var(--spacing) * 5)}.left-full{left:100%}.z-\\(--layer-dialog\\){z-index:var(--layer-dialog)}.z-10{z-index:10}.z-20{z-index:20}.z-\\[calc\\(var\\(--layer-dialog\\)\\+1\\)\\]{z-index:calc(var(--layer-dialog) + 1)}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-32{margin:calc(var(--spacing) * 32)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-0\\.5{height:calc(var(--spacing) * .5)}.h-1\\.5{height:calc(var(--spacing) * 1.5)}.h-3\\.5{height:calc(var(--spacing) * 3.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[85vh\\]{max-height:85vh}.min-h-0{min-height:0}.min-h-7{min-height:calc(var(--spacing) * 7)}.min-h-9{min-height:calc(var(--spacing) * 9)}.w-1\\.5{width:calc(var(--spacing) * 1.5)}.w-3\\.5{width:calc(var(--spacing) * 3.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-auto{width:auto}.w-full{width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-7{min-width:calc(var(--spacing) * 7)}.min-w-14{min-width:calc(var(--spacing) * 14)}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-0{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-dialog-content-in{animation:dialog-content-in var(--duration-animation) ease-out}.animate-dialog-overlay-in{animation:dialog-overlay-in var(--duration-fade) ease-out}.animate-fade-in{animation:.5s ease-out fade-in}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.overflow-y-hidden{overflow-y:hidden}.rounded{border-radius:.25rem}.rounded-\\[var\\(--radius\\)\\]{border-radius:var(--radius)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\\[1\\.5px\\]{border-style:var(--tw-border-style);border-width:1.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-border{border-color:var(--border)}.border-current{border-color:currentColor}.border-transparent{border-color:#0000}.border-white\\/25{border-color:#ffffff40}@supports (color:color-mix(in lab, red, red)){.border-white\\/25{border-color:color-mix(in oklab, var(--color-white) 25%, transparent)}}.border-t-transparent{border-top-color:#0000}.bg-black\\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-card{background-color:var(--card)}.bg-current{background-color:currentColor}.bg-gray-900{background-color:var(--color-gray-900)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-secondary-bg{background-color:var(--secondary-bg)}.bg-transparent{background-color:#0000}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:0}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-0{padding-top:0}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0{padding-bottom:0}.pb-0\\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-2{padding-left:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-right{text-align:right}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-card-foreground{color:var(--card-foreground)}.text-foreground{color:var(--foreground)}.text-foreground-faint{color:var(--foreground-faint)}.text-foreground-muted{color:var(--foreground-muted)}.text-inherit{color:inherit}.text-muted-foreground{color:var(--muted-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:var(--shadow-lg);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:var(--shadow-sm);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\,background-color\\]{transition-property:transform,opacity,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-\\[160ms\\]{--tw-duration:.16s;transition-duration:.16s}.duration-\\[167ms\\]{--tw-duration:.167s;transition-duration:.167s}.ease-\\[cubic-bezier\\(0\\.33\\,0\\,0\\,1\\)\\]{--tw-ease:cubic-bezier(.33,0,0,1);transition-timing-function:cubic-bezier(.33,0,0,1)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.group-focus-within\\:pointer-events-auto:is(:where(.group):focus-within *){pointer-events:auto}.group-focus-within\\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media (hover:hover){.group-hover\\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-foreground-faint::placeholder{color:var(--foreground-faint)}.focus-within\\:border-foreground-faint:focus-within{border-color:var(--foreground-faint)}@media (hover:hover){.hover\\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\\:border-primary:hover{border-color:var(--primary)}.hover\\:bg-muted:hover{background-color:var(--muted)}.hover\\:bg-primary:hover{background-color:var(--primary)}.hover\\:bg-primary-hover:hover{background-color:var(--primary-hover)}.hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.hover\\:bg-secondary-hover:hover{background-color:var(--secondary-hover)}.hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab, var(--secondary) 80%, transparent)}}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:text-foreground:hover{color:var(--foreground)}.hover\\:text-primary-foreground:hover{color:var(--primary-foreground)}.hover\\:opacity-100:hover{opacity:1}.hover\\:duration-\\[250ms\\]:hover{--tw-duration:.25s;transition-duration:.25s}}.focus\\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\\:outline-ring:focus-visible{outline-color:var(--ring)}.active\\:scale-\\[0\\.85\\]:active{scale:.85}.active\\:duration-\\[134ms\\]:active{--tw-duration:.134s;transition-duration:.134s}.active\\:ease-\\[cubic-bezier\\(0\\.45\\,0\\,0\\.2\\,1\\)\\]:active{--tw-ease:cubic-bezier(.45,0,.2,1);transition-timing-function:cubic-bezier(.45,0,.2,1)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}}:root,:host{--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--border:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--foreground-muted:#1f293799;--foreground-faint:#1f293766;--primary-hover:#3b82f6d9;--secondary-bg:#6b728033;--secondary-hover:#6b72804d;--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--radius:.625rem;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--spacing:.25rem;--duration-animation:.3s;--duration-fade:.2s;--layer-dialog:1100}@media (prefers-reduced-motion:reduce){[data-marketrix-widget]{--duration-animation:0s!important;--duration-fade:0s!important}}@keyframes dialog-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes dialog-content-in{0%{opacity:0;scale:.96}to{opacity:1;scale:1}}@keyframes fade-in{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}:host,[data-marketrix-widget]{font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-marketrix-widget],[data-marketrix-widget] *{pointer-events:auto;box-sizing:border-box;transition:color .2s ease-in-out,background-color .2s ease-in-out,border-color .2s ease-in-out,opacity .2s ease-in-out,box-shadow .2s ease-in-out,transform .2s ease-in-out}[data-marketrix-widget] button,[data-marketrix-widget] input,[data-marketrix-widget] textarea,[data-marketrix-widget] select{font:inherit}[data-resizing=true],[data-resizing=true] *{transition:none!important}@keyframes marketrix-screen-edge-pulse{0%,to{opacity:.55}50%{opacity:1}}[data-screen-edge-glow]{animation:1.6s ease-in-out infinite marketrix-screen-edge-pulse}.marketrix-widget-button-processing-glow,.marketrix-widget-button-error-glow{pointer-events:none;filter:blur(14px);will-change:transform, opacity;border-radius:50%;width:140%;height:140%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}@keyframes widget-activity-dash-travel{0%{stroke-dashoffset:0;opacity:.5}18%{stroke-dashoffset:-112px;opacity:1}35%{stroke-dashoffset:-160px;opacity:.65}60%{stroke-dashoffset:-160px;opacity:.45}82%{stroke-dashoffset:-272px;opacity:1}to{stroke-dashoffset:-320px;opacity:.6}}.marketrix-widget-button-processing-activity-ring,.marketrix-widget-button-error-activity-ring{pointer-events:none;z-index:0;position:absolute;inset:-3px;overflow:visible}.marketrix-widget-button-processing-activity-ring rect,.marketrix-widget-button-error-activity-ring rect{fill:none;stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:40 120;animation:1.9s cubic-bezier(.4,0,.2,1) infinite widget-activity-dash-travel}.marketrix-widget-button-processing-activity-ring rect{stroke:#31d06d;filter:drop-shadow(0 0 3px #31d06db3)}.marketrix-widget-button-error-activity-ring rect{stroke:#d0342c;filter:drop-shadow(0 0 3px #d0342cb3)}@keyframes widget-glow-green{0%,to{opacity:.72;background:radial-gradient(circle,#31d06d00 38%,#31d06d61 58%,#31d06d3d 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:1;background:radial-gradient(circle,#31d06d00 34%,#31d06d8c 56%,#31d06d54 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}.marketrix-widget-button-processing-glow{animation:2s ease-in-out infinite widget-glow-green}@keyframes widget-glow-red{0%,to{opacity:.65;background:radial-gradient(circle,#d0342c00 38%,#d0342c57 58%,#d0342c38 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:.95;background:radial-gradient(circle,#d0342c00 34%,#d0342c80 56%,#d0342c4d 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}.marketrix-widget-button-error-glow{animation:1.5s ease-in-out infinite widget-glow-red}@keyframes launcher-entrance{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.animate-launcher-entrance{animation:.25s ease-out forwards launcher-entrance}@keyframes messenger-entrance{0%{opacity:0;transform:scale(0)}40%{opacity:1}to{transform:scale(1)}}[data-view-transition][data-direction=forward]{animation:.3s both viewSlideForward}[data-view-transition][data-direction=back]{animation:.3s both viewSlideBack}@keyframes viewSlideForward{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes viewSlideBack{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}',n.appendChild(r);const o=document.createElement("div");return o.id=t,n.appendChild(o),{shadowRoot:n,mountEl:o}},Cg=e=>{const t="marketrix-widget-container-"+ ++_g,n=e??document.body;if(n.querySelector(`#${t}`))throw new Error(`Widget container with ID ${t} already exists`);const r=document.createElement("div");r.id=t,r.className="marketrix-widget-container",r.style.pointerEvents="auto",e&&Object.assign(r.style,{width:"100%",height:"100%",position:"relative",overflow:"visible"}),n.appendChild(r);const{shadowRoot:o,mountEl:i}=Eg(r,"marketrix-widget-root");return Object.assign(i.style,{pointerEvents:"auto",width:"100%",height:"100%",position:"relative"}),{container:r,shadowRoot:o,mountEl:i}},Ig=(e,n,r=!1)=>{const o=f(e);return o.render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g(Pp,{previewMode:r,children:/* @__PURE__ */g(xg,{config:n})})})),o},Tg=()=>null!==kg.instance,zg=()=>kg.config,Mg=(e,n="neutral")=>{if("undefined"==typeof window||"undefined"==typeof document)return;Og();const r=document.createElement("div");r.id="marketrix-widget-loader-container",r.className="marketrix-widget-loader-container",document.body.appendChild(r);const{mountEl:o}=Eg(r,"marketrix-widget-loader-root");(Sg=f(o)).render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g($u,{tone:n,title:e,onDismiss:Og})}))},Og=()=>{Sg?.unmount(),Sg=null,document.getElementById("marketrix-widget-loader-container")?.remove()},Rg=e=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(window.__mtx?.state)return;const t=document.querySelectorAll("script[mtx-id]"),n=t[t.length-1];if(!(n&&(r=n,r instanceof HTMLScriptElement)))return;var r;const o=n.getAttribute("mtx-id"),i=n.getAttribute("mtx-key"),s=n.getAttribute("mtx-api-host");if(!o||!i){if(Tg())return;return void Mg("Please configure mtx-id and mtx-key","error")}const a={mtxId:o,mtxKey:i};s&&(a.mtxApiHost=s),"false"===n.getAttribute("mtx-use-screenshare")&&(a.use_screenshare=!1),e(a).catch(e=>{})},Ng=null,Ag=0,Pg=null,Dg=null;function $g(e,t,n=!1){const{container:r,mountEl:o}=Cg(t);Pg=r,kg.instance=Ig(o,e,n),kg.config=e}async function Lg(e,t,n){let r;window.__mtx={state:"initializing"},e.mtxApiHost&&(e=>{if(!e?.trim())throw new Error("API URL is required for SDK configuration");e!==ns&&(ns=e,rs=ts(e))})(e.mtxApiHost),Mg("Loading widget settings...");try{r=await Lc(e)}catch(o){if(n!==Ag)return;return Mg(o instanceof Error?o.message:"Failed to initialize widget","error"),void(window.__mtx=void 0)}n===Ag&&(Og(),$g(r,t),window.__mtx={state:"active"},r.widget_recording&&r.mtxApp&&(async()=>{try{if(await Nc.getInstance().waitUntilRegistered(),n!==Ag)return;const e=await us.getOrCreateChatId();if(n!==Ag)return;const t=new Rc(e,r.mtxApp);Dg=t,await t.start(),n!==Ag&&(t.stop(),Dg===t&&(Dg=null))}catch(o){}})())}var jg=(e,t)=>{if(Ng)return Ng;if(window.__mtx?.state)return Promise.resolve();if(Tg())return Promise.resolve();const n=Lg(e,t,++Ag);return Ng=n,n.then(()=>{Ng===n&&(Ng=null)},()=>{Ng===n&&(Ng=null)}),n},Fg=()=>{Ag++,Nc.getInstance().disconnect(),Dg?.stop(),Dg=null;const e=kg.instance;e&&e.unmount(),kg.instance=null,kg.config=null,Pg&&(Pg.remove(),Pg=null),Ng=null,window.__mtx=void 0,Og()},Ug=async e=>{if(Tg()){const t=zg();if(!t)throw new Error("Widget not initialized");const n={...t,...e};Fg(),await jg(n)}},Wg=({settings:e,container:t,mtxId:n,mtxKey:r,mtxApiHost:o})=>{const i=u(null),s=u(null),c=u(null);return a(()=>{const a=t??i?.current?.parentElement??document.body;if(!(a&&(l=a,l instanceof HTMLElement)))return;var l;const{container:d,mountEl:u}=Cg(a);return c.current=d,s.current=Ig(u,{...Ac(e,{mtxId:n,mtxKey:r,mtxApiHost:o}),isPreviewMode:!0},!0),()=>{s.current&&(s.current.unmount(),s.current=null),c.current&&(c.current.remove(),c.current=null)}},[e,t,n,r,o]),t?null:/* @__PURE__ */g("div",{ref:i,style:{width:"100%",height:"100%",position:"relative"}})},Bg=async e=>{const t=e.container;if(void 0!==e.settings){Fg();const{settings:n,container:r,...o}=e;$g({...Ac(n,o),isPreviewMode:!0},t,!0)}else{if(void 0===e.mtxId||void 0===e.mtxKey)throw new Error("Invalid configuration: provide either settings (preview) or mtxId+mtxKey (production)");{const{container:n,...r}=e;await jg(r,t)}}};"undefined"!=typeof window&&setTimeout(()=>{try{Rg(jg)}catch(e){}},0);var Hg={MarketrixWidget:Wg,mountWidget:Bg,initWidget:jg,unmountWidget:Fg,updateMarketrixConfig:Ug,getCurrentConfig:zg};export{Wg as MarketrixWidget,Hg as default,zg as getCurrentConfig,jg as initWidget,Bg as mountWidget,Fg as unmountWidget,Ug as updateMarketrixConfig};
60
58
  //# sourceMappingURL=widget.mjs.map